[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 05/12] use a shell function for AC_CHECK_FUNC
From: |
Paolo Bonzini |
Subject: |
[PATCH 05/12] use a shell function for AC_CHECK_FUNC |
Date: |
Mon, 20 Oct 2008 15:35:17 +0200 |
Here we go with the most used AC_CHECK_* functions. These further
reduce by another 10%. Autoconf becomes faster by 20-30% too,
because several complex macros are expanded only once as part of
the shell function.
2008-10-12 Paolo Bonzini <address@hidden>
* lib/autoconf/general.m4 (AC_CHECK_FUNC): Use a shell function.
---
lib/autoconf/functions.m4 | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4
index c325f30..cb5d900 100644
--- a/lib/autoconf/functions.m4
+++ b/lib/autoconf/functions.m4
@@ -65,11 +65,20 @@
# AC_CHECK_FUNC(FUNCTION, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
# -----------------------------------------------------------------
AC_DEFUN([AC_CHECK_FUNC],
-[AS_VAR_PUSHDEF([ac_var], [ac_cv_func_$1])dnl
-AC_CACHE_CHECK([for $1], [ac_var],
-[AC_LINK_IFELSE([AC_LANG_FUNC_LINK_TRY([$1])],
- [AS_VAR_SET([ac_var], [yes])],
- [AS_VAR_SET([ac_var], [no])])])
+[AC_REQUIRE_SHELL_FN([ac_func_]_AC_LANG_ABBREV[_check_func],
+ [AS_FUNCTION_DESCRIBE([ac_func_]_AC_LANG_ABBREV[_check_func], [LINENO FUNC],
+ [Tests whether FUNC exists, setting a cache variable accordingly])], [
+ AS_LINENO_PUSH([$[]1])
+ AS_VAR_PUSHDEF([ac_var], [ac_cv_func_$[]2])dnl
+ AC_CACHE_CHECK([for $[]2], [ac_var],
+ [AC_LINK_IFELSE([AC_LANG_FUNC_LINK_TRY([$][2])],
+ [AS_VAR_SET([ac_var], [yes])],
+ [AS_VAR_SET([ac_var], [no])])])
+ AS_VAR_POPDEF([ac_var])dnl
+ AS_LINENO_POP
+])dnl
+ac_func_[]_AC_LANG_ABBREV[]_check_func "$LINENO" "$1"
+AS_VAR_PUSHDEF([ac_var], [ac_cv_func_$1])dnl
AS_VAR_IF([ac_var], [yes], [$2], [$3])dnl
AS_VAR_POPDEF([ac_var])dnl
])# AC_CHECK_FUNC
--
1.5.5
- [PATCH 05/12] use a shell function for AC_CHECK_FUNC,
Paolo Bonzini <=