summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2016-11-03 20:03:06 -0500
committerEric Blake <eblake@redhat.com>2016-12-21 08:32:36 -0600
commit73770787510fc18ec3dde2ccf3281977ea6b750b (patch)
tree1a98e20af3048c7cb43500c8018931559819acb4
parent501ccbbfdb43561537f377a2ac66cf89f975b1b1 (diff)
downloadautoconf-73770787510fc18ec3dde2ccf3281977ea6b750b.tar.gz
AC_CHECK_FUNCS_ONCE: hoist CPP name computation to m4 time
Rather than perform a sed script on each element of the $ac_func_c_list to compute the corresponding CPP name, we can make the list store a series of pairs of function names and CPP names all computed at m4 time. The resulting configure script is slightly larger based on how many function names are checked once, but also performs slightly faster. There is still a sed call in AC_CHECK_FUNC for computing the cache variable name; that will be dealt with next. * lib/autoconf/functions.m4 (_AC_CHECK_FUNC_ONCE): Track the CPP name in the list... (_AC_FUNCS_EXPANSION): ...and rewrite the list walk to parse off pairs of arguments, for fewer sed calls. Signed-off-by: Eric Blake <eblake@redhat.com>
-rw-r--r--lib/autoconf/functions.m416
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4
index 7b98a066..b937b2cc 100644
--- a/lib/autoconf/functions.m4
+++ b/lib/autoconf/functions.m4
@@ -97,8 +97,9 @@ AC_DEFUN([AC_CHECK_FUNCS],
# Check for a single FUNCTION once.
m4_define([_AC_CHECK_FUNC_ONCE],
[_AH_CHECK_FUNC([$1])AC_DEFUN([_AC_Func_$1], [m4_divert_text([INIT_PREPARE],
- [AS_VAR_APPEND([ac_func_]]_AC_LANG_ABBREV[[_list], [" $1"])])
-_AC_FUNCS_EXPANSION(_AC_LANG_ABBREV)])AC_REQUIRE([_AC_Func_$1])])
+ [AS_VAR_APPEND([ac_func_]]_AC_LANG_ABBREV[[_list],
+ [" $1 ]AS_TR_CPP([HAVE_$1])["])])]dnl
+[_AC_FUNCS_EXPANSION(_AC_LANG_ABBREV)])AC_REQUIRE([_AC_Func_$1])])
# AC_CHECK_FUNCS_ONCE(FUNCTION...)
# --------------------------------
@@ -113,7 +114,16 @@ AC_DEFUN([AC_CHECK_FUNCS_ONCE],
# AC_CHECK_FUNCS_ONCE while that language was active.
m4_define([_AC_FUNCS_EXPANSION],
[m4_ifndef([$0($1)], [m4_define([$0($1)])m4_divert_text([DEFAULTS],
-[ac_func_$1_list=])AC_CHECK_FUNCS([$ac_func_$1_list])])])
+[ac_func_$1_list=])ac_func=
+for ac_item in $ac_func_$1_list
+do
+ if test $ac_func; then
+ AC_CHECK_FUNC([$ac_func], [AC_DEFINE_UNQUOTED([$ac_item])])
+ ac_func=
+ else
+ ac_func=$ac_item
+ fi
+done])])
# _AC_REPLACE_FUNC(FUNCTION)