autoconf-patches
[Top][All Lists]
Advanced

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

[PATCH 03/12] use a shell function for _AC_LINK_IFELSE


From: Paolo Bonzini
Subject: [PATCH 03/12] use a shell function for _AC_LINK_IFELSE
Date: Mon, 20 Oct 2008 15:35:42 +0200

2008-10-12  Paolo Bonzini  <address@hidden>

        * lib/autoconf/general.m4 (_AC_LINK_IFELSE): Use a shell function.
---
 lib/autoconf/general.m4 |   33 +++++++++++++++++++++------------
 1 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index 1cdabf7..28c8e98 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -2521,25 +2521,34 @@ 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) && {
+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.])], [
+  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])
        }],
-      [$2],
+      [ac_retval=0],
       [_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_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
+])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])
 ])# _AC_LINK_IFELSE
 
 
-- 
1.5.5





reply via email to

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