X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=acinclude.m4;h=a254c2328346616a3a42ad5c800b947c70a3a38f;hb=66aeba23bd8effd71e0a3cf9c0cab75f3d75f6f1;hp=767414e604d1d4102ec604acdb38c1e14e39ba36;hpb=83f6c0502c67ea117c73d3bbb91f9b9e0e81bf87;p=openvswitch diff --git a/acinclude.m4 b/acinclude.m4 index 767414e6..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; ]])], @@ -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 ----------------------------------------------------------------------