autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 04/12] use a shell function for _AC_RUN_IFELSE


From: Eric Blake
Subject: Re: [PATCH 04/12] use a shell function for _AC_RUN_IFELSE
Date: Thu, 23 Oct 2008 06:37:22 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.17) Gecko/20080914 Thunderbird/2.0.0.17 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Paolo Bonzini on 10/23/2008 6:06 AM:
>> I'll wait another day before applying this, unless I get earlier agreement 
>> that 
>> this semantic change is okay (intended or not).
> 
> Go ahead and apply it so that the AC_*_IFELSE macro are done.  I'll
> restore the intended semantics with a follow-up patch as soon as possible.

Sure.  I pushed your patch 4 plus this squashed on top:

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkkAcAIACgkQ84KuGfSFAYCkrgCeMHRUkKxLhCta7zcOFAZUXsoK
G48AoNQG4ZNiqN/YNfg9e240DmomEhMu
=LtS5
-----END PGP SIGNATURE-----
diff --git a/ChangeLog b/ChangeLog
index 2f8cb50..71dc355 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-10-23  Paolo Bonzini  <address@hidden>
+       and Eric Blake  <address@hidden>
+
+       Use a shell function for _AC_RUN_IFELSE.
+        * lib/autoconf/general.m4 (_AC_RUN_IFELSE_BODY): New macro.
+       (_AC_RUN_IFELSE): Use a shell function.
+       (_AC_RUN_LOG): Avoid subshell for logging.
+
 2008-10-23  Eric Blake  <address@hidden>
 
        Formatting tweak: balance () with m4sh case statements.
diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index 5e28697..21959df 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -2230,7 +2230,7 @@ AU_ALIAS([AC_VERBOSE], [AC_MSG_RESULT])
 # ----------------------------------
 # Eval COMMAND, save the exit status in ac_status, and log it.
 AC_DEFUN([_AC_RUN_LOG],
-[{ ($2) >&AS_MESSAGE_LOG_FD
+[{ { $2; } >&AS_MESSAGE_LOG_FD
   ($1) 2>&AS_MESSAGE_LOG_FD
   ac_status=$?
   _AS_ECHO_LOG([\$? = $ac_status])
@@ -2606,6 +2606,23 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[$2]], [[$3]])], [$4], 
[$5])])
 ## ------------------------------- ##
 
 
+# _AC_RUN_IFELSE_BODY
+# -------------------
+# Shell function body for _AC_RUN_IFELSE.
+m4_define([_AC_RUN_IFELSE_BODY],
+[  AS_LINENO_PUSH([$[]1])
+  AS_IF([_AC_DO_VAR(ac_link) && _AC_DO_TOKENS(./conftest$ac_exeext)],
+      [ac_retval=0],
+      [AS_ECHO(["$as_me: program exited with status $ac_status"]) 
>&AS_MESSAGE_LOG_FD
+       _AC_MSG_LOG_CONFTEST
+       ac_retval=$ac_status])
+  rm -rf conftest.dSYM
+  rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext 
conftest.$ac_objext conftest$ac_exeext
+  AS_LINENO_POP
+  return $ac_retval
+])# _AC_RUN_IFELSE_BODY
+
+
 # _AC_RUN_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
 # ------------------------------------------------------------
 # Compile, link, and run.
@@ -2617,21 +2634,11 @@ AC_DEFUN([_AC_RUN_IFELSE],
 [AC_REQUIRE_SHELL_FN([ac_func_]_AC_LANG_ABBREV[_try_run],
   [AS_FUNCTION_DESCRIBE([ac_func_]_AC_LANG_ABBREV[_try_run], [LINENO],
     [Try to link conftest.$ac_ext, and return whether this succeeded.
-     Assumes that executables *can* be run.])], [
-  AS_LINENO_PUSH([$[]1])
-  AS_IF([_AC_DO_VAR(ac_link) && _AC_DO_TOKENS(./conftest$ac_exeext)],
-      [ac_retval=0],
-      [AS_ECHO(["$as_me: program exited with status $ac_status"]) 
>&AS_MESSAGE_LOG_FD
-       _AC_MSG_LOG_CONFTEST
-       ac_retval=$ac_status])
-  rm -rf conftest.dSYM
-  rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext 
conftest.$ac_objext conftest$ac_exeext
-  AS_LINENO_POP
-  return $ac_retval
-])dnl
-m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
-AS_IF([ac_func_[]_AC_LANG_ABBREV[]_try_run "$LINENO"], [$2], [$3])
-m4_ifvaln([$1], [rm -f conftest.$ac_ext])
+     Assumes that executables *can* be run.])],
+  [$0_BODY])]dnl
+[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])]dnl
+[AS_IF([ac_func_[]_AC_LANG_ABBREV[]_try_run "$LINENO"], [$2], [$3])
+m4_ifvaln([$1], [rm -f conftest.$ac_ext])dnl
 ])# _AC_RUN_IFELSE
 
 # AC_RUN_IFELSE(PROGRAM,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]