[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 04/12] use a shell function for _AC_RUN_IFELSE
From: |
Paolo Bonzini |
Subject: |
[PATCH 04/12] use a shell function for _AC_RUN_IFELSE |
Date: |
Mon, 20 Oct 2008 15:35:43 +0200 |
2008-10-12 Paolo Bonzini <address@hidden>
* lib/autoconf/general.m4 (_AC_RUN_IFELSE): Use a shell function.
---
lib/autoconf/general.m4 | 31 ++++++++++++++++++-------------
1 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index 28c8e98..21606aa 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -2592,22 +2592,27 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[$2]], [[$3]])], [$4],
[$5])])
# We also remove conftest.o as if the compilation fails, some compilers
# don't remove it. We remove gmon.out and bb.out, which may be
# created during the run if the program is built with profiling support.
-m4_define([_AC_RUN_IFELSE],
-[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
-rm -f conftest$ac_exeext
-AS_IF([_AC_DO_VAR(ac_link) && _AC_DO_TOKENS(./conftest$ac_exeext)],
- [$2],
+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
-m4_ifvaln([$3],
- [( exit $ac_status )
-$3])dnl])[]dnl
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext
conftest.$ac_objext m4_ifval([$1],
- [conftest.$ac_ext])[]dnl
+ _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])
])# _AC_RUN_IFELSE
-
# AC_RUN_IFELSE(PROGRAM,
# [ACTION-IF-TRUE], [ACTION-IF-FALSE],
# [ACTION-IF-CROSS-COMPILING = RUNTIME-ERROR])
--
1.5.5