[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 01/12] use a shell function for _AC_PREPROC_IFELSE
From: |
Paolo Bonzini |
Subject: |
[PATCH 01/12] use a shell function for _AC_PREPROC_IFELSE |
Date: |
Mon, 20 Oct 2008 15:35:43 +0200 |
So, this is the patch bomb for shell functions. :-)
I'm starting from four simple functions for _AC_*_IFELSE. Together,
they obtain most of the size reduction (10-15%) but slow down Autoconf
by ~5%.
2008-10-12 Paolo Bonzini <address@hidden>
* lib/autoconf/general.m4 (_AC_PREPROC_IFELSE): Use a shell function.
---
lib/autoconf/general.m4 | 22 +++++++++++++++-------
1 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index 0566dd1..406a197 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -2384,18 +2384,26 @@ AC_DEFUN([AC_RUN_LOG],
# This macro can be used during the selection of a preprocessor.
# eval is necessary to expand ac_cpp.
AC_DEFUN([_AC_PREPROC_IFELSE],
-[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
-AS_IF([_AC_DO_STDERR([$ac_cpp conftest.$ac_ext]) >/dev/null && {
+[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.])], [
+ AS_LINENO_PUSH([$[]1])
+ AS_IF([_AC_DO_STDERR([$ac_cpp conftest.$ac_ext]) >/dev/null && {
test -z
"$ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag$ac_[]_AC_LANG_ABBREV[]_werror_flag"
||
test ! -s conftest.err
}],
- [$2],
- [_AC_MSG_LOG_CONFTEST
- $3])
-rm -f conftest.err m4_ifval([$1], [conftest.$ac_ext])[]dnl
+ [ac_retval=0],
+ [_AC_MSG_LOG_CONFTEST
+ ac_retval=1])
+ rm -f conftest.err
+ AS_LINENO_POP
+ return $ac_retval
+])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])
])# _AC_PREPROC_IFELSE
-
# AC_PREPROC_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
# ---------------------------------------------------------------
# Try to preprocess PROGRAM. Requires that the preprocessor for the
--
1.5.5
- [PATCH 01/12] use a shell function for _AC_PREPROC_IFELSE,
Paolo Bonzini <=