diff options
author | Paolo Bonzini <bonzini@gnu.org> | 2016-11-03 20:08:28 -0500 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2016-12-21 08:32:45 -0600 |
commit | c54beb85aa855ce2c817d4f7738748841bf6ad30 (patch) | |
tree | 2f4938650c3ecf51bc9c0863af095b85f1729def /lib/autoconf/functions.m4 | |
parent | 0848232967ea70448d3767f22ff2f7d359e67580 (diff) | |
download | autoconf-c54beb85aa855ce2c817d4f7738748841bf6ad30.tar.gz |
autoconf: prefer an unrolled loop for trivial AC_CHECK_FUNCS
An unrolled loop avoids the cost of spawning sed in AS_TR_SH and
AS_TR_CPP. Prefer it if there is nothing in the second and third
argument of AC_CHECK_FUNCS and the first argument is a literal.
* lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Unroll loop if safe.
(_AC_CHECK_FUNCS): Move basic implementation here.
Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
Message-Id: <1477933688-4884-2-git-send-email-bonzini@gnu.org>
[eblake: perform AC_CHECK_FUNCS_ONCE changes separately, use
dnl to reduce generated blank lines]
Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'lib/autoconf/functions.m4')
-rw-r--r-- | lib/autoconf/functions.m4 | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4 index 76824a26..a227cd45 100644 --- a/lib/autoconf/functions.m4 +++ b/lib/autoconf/functions.m4 @@ -88,12 +88,17 @@ m4_define([_AH_CHECK_FUNC], # `break' to stop the search. AC_DEFUN([AC_CHECK_FUNCS], [m4_map_args_w([$1], [_AH_CHECK_FUNC(], [)])]dnl -[AS_FOR([AC_func], [ac_func], [$1], -[AC_CHECK_FUNC(AC_func, - [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_]AC_func)) $2], - [$3])dnl]) +[m4_if([$2$3]AS_LITERAL_IF([$1], [[yes]], [[no]]), [yes], + [m4_map_args_w([$1], [_$0(], [)])], + [AS_FOR([AC_func], [ac_func], [$1], [_$0(AC_func, [$2], [$3])])])dnl ])# AC_CHECK_FUNCS +m4_define([_AC_CHECK_FUNCS], +[AC_CHECK_FUNC([$1], + [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_]$1)) $2], + [$3])dnl +]) + # _AC_CHECK_FUNC_ONCE(FUNCTION) # ----------------------------- |