summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <bonzini@gnu.org>2008-10-20 15:35:42 +0200
committerEric Blake <ebb9@byu.net>2008-10-22 11:29:18 -0600
commit30249d93c1b4255390286a4713a65eca7327c13e (patch)
treebdf8f844df81bab7aaa51b5c2782a3a3f7ff455c
parent5042ddd81f94e67d95813d5c68cbdbdbf2324e11 (diff)
downloadautoconf-30249d93c1b4255390286a4713a65eca7327c13e.tar.gz
Use a shell function for _AC_LINK_IFELSE.
* lib/autoconf/general.m4 (_AC_LINK_IFELSE_BODY): New macro. (_AC_LINK_IFELSE): Use a shell function. Signed-off-by: Eric Blake <ebb9@byu.net>
-rw-r--r--ChangeLog7
-rw-r--r--lib/autoconf/general.m454
2 files changed, 42 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index 9e79f1ca..bdc32445 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-10-22 Paolo Bonzini <bonzini@gnu.org>
+ and Eric Blake <ebb9@byu.net>
+
+ Use a shell function for _AC_LINK_IFELSE.
+ * lib/autoconf/general.m4 (_AC_LINK_IFELSE_BODY): New macro.
+ (_AC_LINK_IFELSE): Use a shell function.
+
2008-10-22 Eric Blake <ebb9@byu.net>
Fix autoconf logging commands.
diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index 919e4903..04866c26 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -2524,6 +2524,33 @@ AU_DEFUN([AC_TRY_COMPILE],
## --------------------- ##
+# _AC_LINK_IFELSE_BODY
+# --------------------
+# Shell function body for _AC_LINK_IFELSE.
+m4_define([_AC_LINK_IFELSE_BODY],
+[ AS_LINENO_PUSH([$[]1])
+ rm -f conftest.$ac_objext conftest$ac_exeext
+ AS_IF([_AC_DO_STDERR($ac_link) && {
+ test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ AS_TEST_X([conftest$ac_exeext])
+ }],
+ [ac_retval=0],
+ [_AC_MSG_LOG_CONFTEST
+ ac_retval=1])
+ # Delete also the IPA/IPO (Inter Procedural Analysis/Optimization)
+ # information created by the PGI compiler (conftest_ipa8_conftest.oo),
+ # as it would interfere with the next link command.
+ rm -rf conftest.dSYM
+ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext
+ AS_LINENO_POP
+ return $ac_retval
+])# _AC_LINK_IFELSE_BODY
+
+
# _AC_LINK_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
# -------------------------------------------------------------
# Try to link PROGRAM.
@@ -2535,25 +2562,14 @@ AU_DEFUN([AC_TRY_COMPILE],
# reported by Chris Johns in
# <http://lists.gnu.org/archive/html/autoconf/2007-03/msg00085.html>.
#
-m4_define([_AC_LINK_IFELSE],
-[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
-rm -f conftest.$ac_objext conftest$ac_exeext
-AS_IF([_AC_DO_STDERR($ac_link) && {
- test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- AS_TEST_X([conftest$ac_exeext])
- }],
- [$2],
- [_AC_MSG_LOG_CONFTEST
- $3])
-dnl Delete also the IPA/IPO (Inter Procedural Analysis/Optimization)
-dnl information created by the PGI compiler (conftest_ipa8_conftest.oo),
-dnl as it would interfere with the next link command.
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext m4_ifval([$1], [conftest.$ac_ext])[]dnl
+AC_DEFUN([_AC_LINK_IFELSE],
+[AC_REQUIRE_SHELL_FN([ac_func_]_AC_LANG_ABBREV[_try_link],
+ [AS_FUNCTION_DESCRIBE([ac_func_]_AC_LANG_ABBREV[_try_link], [LINENO],
+ [Try to link 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_link "$LINENO"], [$2], [$3])
+m4_ifvaln([$1], [rm -f conftest.$ac_ext])dnl
])# _AC_LINK_IFELSE