]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Use a shell function for _AC_COMPILE_IFELSE.
authorPaolo Bonzini <bonzini@gnu.org>
Mon, 20 Oct 2008 13:35:24 +0000 (15:35 +0200)
committerEric Blake <ebb9@byu.net>
Wed, 22 Oct 2008 03:00:00 +0000 (21:00 -0600)
* lib/autoconf/general.m4 (_AC_COMPILE_IFELSE_BODY): New macro.
(_AC_COMPILE_IFELSE): Use a shell function.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
lib/autoconf/general.m4

index 0eae97fc651bca6cefde7ac3be0d4086af3b61d6..25ba3c0c431ee956a796fd4ebdd1361ee3f85f6f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-10-21  Paolo Bonzini  <bonzini@gnu.org>
+       and Eric Blake  <ebb9@byu.net>
+
+       Use a shell function for _AC_COMPILE_IFELSE.
+       * lib/autoconf/general.m4 (_AC_COMPILE_IFELSE_BODY): New macro.
+       (_AC_COMPILE_IFELSE): Use a shell function.
+
 2008-10-21  Eric Blake  <ebb9@byu.net>
 
        Use AS_VAR_APPEND.
index ed32e2419252078056209d052db97aafd8d174cb..22111a1b78999f9364fa6d3375d33616302f8deb 100644 (file)
@@ -2392,7 +2392,7 @@ m4_define([_AC_PREPROC_IFELSE_BODY],
   rm -f conftest.err
   AS_LINENO_POP
   return $ac_retval
-])
+])# _AC_PREPROC_IFELSE_BODY
 
 
 # _AC_PREPROC_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
@@ -2405,7 +2405,7 @@ AC_DEFUN([_AC_PREPROC_IFELSE],
 [AC_REQUIRE_SHELL_FN([ac_func_]_AC_LANG_ABBREV[_try_cpp],
   [AS_FUNCTION_DESCRIBE([ac_func_]_AC_LANG_ABBREV[_try_cpp], [LINENO],
     [Try to preprocess conftest.$ac_ext, and return whether this succeeded.])],
-    [$0_BODY])]dnl
+  [$0_BODY])]dnl
 [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])]dnl
 [AS_IF([ac_func_[]_AC_LANG_ABBREV[]_try_cpp "$LINENO"], [$2], [$3])
 m4_ifvaln([$1], [rm -f conftest.$ac_ext])dnl
@@ -2466,22 +2466,37 @@ AC_DEFUN([AC_EGREP_HEADER],
 ## Examining syntax.  ##
 ## ------------------ ##
 
+# _AC_COMPILE_IFELSE_BODY
+# -----------------------
+# Shell function body for _AC_COMPILE_IFELSE.
+m4_define([_AC_COMPILE_IFELSE_BODY],
+[  AS_LINENO_PUSH([$[]1])
+  rm -f conftest.$ac_objext
+  AS_IF([_AC_DO_STDERR($ac_compile) && {
+        test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext],
+      [ac_retval=0],
+      [_AC_MSG_LOG_CONFTEST
+       ac_retval=1])
+  rm -f core conftest.err conftest.$ac_objext
+  AS_LINENO_POP
+  return $ac_retval
+])# _AC_COMPILE_IFELSE_BODY
+
 
 # _AC_COMPILE_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
 # ----------------------------------------------------------------
 # Try to compile PROGRAM.
 # This macro can be used during the selection of a compiler.
-m4_define([_AC_COMPILE_IFELSE],
-[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
-rm -f conftest.$ac_objext
-AS_IF([_AC_DO_STDERR($ac_compile) && {
-        test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext],
-      [$2],
-      [_AC_MSG_LOG_CONFTEST
-       $3])
-rm -f core conftest.err conftest.$ac_objext m4_ifval([$1], [conftest.$ac_ext])[]dnl
+AC_DEFUN([_AC_COMPILE_IFELSE],
+[AC_REQUIRE_SHELL_FN([ac_func_]_AC_LANG_ABBREV[_try_compile],
+  [AS_FUNCTION_DESCRIBE([ac_func_]_AC_LANG_ABBREV[_try_compile], [LINENO],
+    [Try to compile conftest.$ac_ext, and return whether this succeeded.])],
+  [$0_BODY])]dnl
+[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])]dnl
+[AS_IF([ac_func_[]_AC_LANG_ABBREV[]_try_compile "$LINENO"], [$2], [$3])
+m4_ifvaln([$1], [rm -f conftest.$ac_ext])dnl
 ])# _AC_COMPILE_IFELSE