From: Paolo Bonzini Date: Fri, 4 Nov 2016 01:08:28 +0000 (-0500) Subject: autoconf: prefer an unrolled loop for trivial AC_CHECK_FUNCS X-Git-Tag: v2.69b~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c54beb85aa855ce2c817d4f7738748841bf6ad30;p=thirdparty%2Fautoconf.git 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 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 --- 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) # -----------------------------