configure: Fix check for GNU make $(if) extension.
authorBen Pfaff <blp@nicira.com>
Wed, 25 Jul 2012 17:28:38 +0000 (10:28 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 25 Jul 2012 19:39:41 +0000 (12:39 -0700)
As it turns out, the argument to AC_CONFIG_COMMANDS_PRE gets copied into
config.status whether or not it gets run by the shell at "configure" time,
defeating my attempt to support non-GNU make here.

Reported-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
acinclude.m4

index b5876a880325d7af7a9a9962088f0c66ea81c4e0..8bd4544b5d27431255dc07c5aebf973994a71bde 100644 (file)
@@ -405,7 +405,7 @@ dnl OVS_MAKE_HAS_IF([if-true], [if-false])
 dnl
 dnl Checks whether make has the GNU make $(if condition,then,else) extension.
 dnl Runs 'if-true' if so, 'if-false' otherwise.
-AC_DEFUN([OVS_MAKE_HAS_IF],
+AC_DEFUN([OVS_CHECK_MAKE_IF],
   [AC_CACHE_CHECK(
      [whether ${MAKE-make} has GNU make \$(if) extension],
      [ovs_cv_gnu_make_if],
@@ -425,8 +425,7 @@ EOF
         ovs_cv_gnu_make_if=yes
       else
         ovs_cv_gnu_make_if=no
-      fi])
-   AS_IF([test $ovs_cv_gnu_make_if = yes], [$1], [$2])])
+      fi])])
 
 dnl OVS_CHECK_SPARSE_TARGET
 dnl
@@ -450,8 +449,10 @@ AC_DEFUN([OVS_CHECK_SPARSE_TARGET],
 dnl OVS_ENABLE_SPARSE
 AC_DEFUN([OVS_ENABLE_SPARSE],
   [AC_REQUIRE([OVS_CHECK_SPARSE_TARGET])
-   OVS_MAKE_HAS_IF(
-     [AC_CONFIG_COMMANDS_PRE(
-        [: ${SPARSE=sparse}
-         AC_SUBST([SPARSE])
-         CC='$(if $(C),REAL_CC="'"$CC"'" CHECK="$(SPARSE) -I $(top_srcdir)/include/sparse $(SPARSEFLAGS)" cgcc $(CGCCFLAGS),'"$CC"')'])])])
+   AC_REQUIRE([OVS_CHECK_MAKE_IF])
+   : ${SPARSE=sparse}
+   AC_SUBST([SPARSE])
+   AC_CONFIG_COMMANDS_PRE(
+     [if test $ovs_cv_gnu_make_if = yes; then
+        CC='$(if $(C),REAL_CC="'"$CC"'" CHECK="$(SPARSE) -I $(top_srcdir)/include/sparse $(SPARSEFLAGS)" cgcc $(CGCCFLAGS),'"$CC"')'
+      fi])])