X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=acinclude.m4;h=abbc57e61c83e0bce84b77a7fcd3345edd30d7df;hb=f0c689263a0424c83663b8466a64a051a012c757;hp=490936e1de2a0556706511d4cf5af6541ef99386;hpb=8f3a29be917cad5bcb389ab510d918ae21fea0c5;p=openvswitch diff --git a/acinclude.m4 b/acinclude.m4 index 490936e1..abbc57e6 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. @@ -42,7 +42,14 @@ AC_DEFUN([OVS_CHECK_LINUX26], [ AC_MSG_CHECKING([for Linux 2.6 source directory]) KSRC26=$KBUILD26 if test ! -e $KSRC26/include/linux/kernel.h; then - KSRC26=`(cd $KBUILD26 && pwd -P) | sed 's,-[[^-]]*$,-common,'` + case `echo "$KBUILD26" | sed 's,/*$,,'` in # ( + */build) + KSRC26=`echo "$KBUILD26" | sed 's,/build/*$,/source,'` + ;; # ( + *) + KSRC26=`(cd $KBUILD26 && pwd -P) | sed 's,-[[^-]]*$,-common,'` + ;; + esac if test ! -e $KSRC26/include/linux/kernel.h; then AC_MSG_ERROR([cannot find source directory]) fi @@ -63,8 +70,9 @@ AC_DEFUN([OVS_CHECK_LINUX26], [ AC_ERROR([Linux kernel in build tree $KBUILD26 (source tree $KSRC26) is not version 2.6]) fi fi - if ! test -e "$KBUILD26"/include/linux/version.h || \ - ! test -e "$KBUILD26"/include/linux/autoconf.h; then + if test ! -e "$KBUILD26"/include/linux/version.h || \ + (test ! -e "$KBUILD26"/include/linux/autoconf.h && \ + test ! -e "$KBUILD26"/include/generated/autoconf.h); then AC_MSG_ERROR([Linux kernel source in $KBUILD26 is not configured]) fi OVS_CHECK_LINUX26_COMPAT @@ -208,6 +216,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; ]])], @@ -252,4 +261,14 @@ dnl Example: OVS_ENABLE_OPTION([-Wdeclaration-after-statement]) AC_DEFUN([OVS_ENABLE_OPTION], [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 ----------------------------------------------------------------------