X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=acinclude.m4;h=a254c2328346616a3a42ad5c800b947c70a3a38f;hb=608efb41cefb76e371d44489950b797aca6f8e98;hp=e938e6f303da2bd88a366a7794b61af042c4a192;hpb=6a33828dbcc9a4f67bd730061b931c77caad2990;p=openvswitch diff --git a/acinclude.m4 b/acinclude.m4 index e938e6f3..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. @@ -191,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; ]])], @@ -222,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 @@ -230,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 ----------------------------------------------------------------------