X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=acinclude.m4;h=a254c2328346616a3a42ad5c800b947c70a3a38f;hb=03292c465464a1bb10b07ea5036ce64083984dd3;hp=611566900f178d8ffc7f153f479438977c894b6f;hpb=7c9e113b712e72fcb4ccc6075da7334cb3391059;p=openvswitch diff --git a/acinclude.m4 b/acinclude.m4 index 61156690..a254c232 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1,6 +1,6 @@ # -*- autoconf -*- -# Copyright (c) 2008, 2009 Nicira Networks. +# Copyright (c) 2008, 2009, 2010 Nicira Networks. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -144,6 +144,13 @@ AC_DEFUN([OVS_CHECK_LINUX26_COMPAT], [ [OVS_DEFINE([HAVE_CSUM_UNFOLD])]) OVS_GREP_IFELSE([$KSRC26/include/linux/skbuff.h], [skb_cow], [OVS_DEFINE([HAVE_SKB_COW])]) + # Check for the proto_data_valid member in struct sk_buff. The [^@] + # is necessary because some versions of this header remove the + # member but retain the kerneldoc comment that describes it (which + # starts with @). The brackets must be doubled because of m4 + # quoting rules. + OVS_GREP_IFELSE([$KSRC26/include/linux/skbuff.h], [[[^@]]proto_data_valid], + [OVS_DEFINE([HAVE_PROTO_DATA_VALID])]) OVS_CHECK_LOG2_H OVS_CHECK_VETH if cmp -s datapath/linux-2.6/kcompat.h.new \ @@ -184,6 +191,7 @@ AC_DEFUN([OVS_CHECK_STRTOK_R], char *token1, *token2; token1 = strtok_r(string, ":", &save_ptr); token2 = strtok_r(NULL, ":", &save_ptr); + freopen ("/dev/null", "w", stdout); printf ("%s %s\n", token1, token2); return 0; ]])], @@ -215,7 +223,7 @@ AC_DEFUN([OVS_CHECK_CC_OPTION], AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,)], [ovs_cv_name[]=yes], [ovs_cv_name[]=no]) CFLAGS="$ovs_save_CFLAGS"]) if test $ovs_cv_name = yes; then - m4_if([$2], [], [;], [$2]) + m4_if([$2], [], [:], [$2]) else m4_if([$3], [], [:], [$3]) fi @@ -223,8 +231,19 @@ AC_DEFUN([OVS_CHECK_CC_OPTION], dnl OVS_ENABLE_OPTION([OPTION]) dnl Check whether the given C compiler OPTION is accepted. -dnl If so, add it to CFLAGS. +dnl If so, add it to WARNING_FLAGS. dnl Example: OVS_ENABLE_OPTION([-Wdeclaration-after-statement]) AC_DEFUN([OVS_ENABLE_OPTION], - [OVS_CHECK_CC_OPTION([$1], [CFLAGS="$CFLAGS $1"])]) + [OVS_CHECK_CC_OPTION([$1], [WARNING_FLAGS="$WARNING_FLAGS $1"]) + AC_SUBST([WARNING_FLAGS])]) + +dnl OVS_CONDITIONAL_CC_OPTION([OPTION], [CONDITIONAL]) +dnl Check whether the given C compiler OPTION is accepted. +dnl If so, enable the given Automake CONDITIONAL. + +dnl Example: OVS_CONDITIONAL_CC_OPTION([-Wno-unused], [HAVE_WNO_UNUSED]) +AC_DEFUN([OVS_CONDITIONAL_CC_OPTION], + [OVS_CHECK_CC_OPTION( + [$1], [ovs_have_cc_option=yes], [ovs_have_cc_option=no]) + AM_CONDITIONAL([$2], [test $ovs_have_cc_option = yes])]) dnl ----------------------------------------------------------------------