From: Eric Blake Date: Wed, 10 Oct 2007 20:29:22 +0000 (-0600) Subject: Another AC_DEFINE speedup. X-Git-Tag: v2.62~213^2~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=45b46a74678882b50d4ab0a8102cadd3b32b7fa4;p=thirdparty%2Fautoconf.git Another AC_DEFINE speedup. * lib/autoconf/general.m4 (AC_DEFINE_TRACE): Move parameter elision... (_AC_DEFINE_Q): ...here, and only do it once. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Avoid overquoting. * lib/m4sugar/m4sh.m4 (AS_LITERAL_IF): Fix m4_defn overquoting introduced 2007-10-05. Signed-off-by: Eric Blake --- diff --git a/ChangeLog b/ChangeLog index 4e31b802..ea4f4bd4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2007-10-10 Eric Blake + Another AC_DEFINE speedup. + * lib/autoconf/general.m4 (AC_DEFINE_TRACE): Move parameter + elision... + (_AC_DEFINE_Q): ...here, and only do it once. + * lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Avoid overquoting. + * lib/m4sugar/m4sh.m4 (AS_LITERAL_IF): Fix m4_defn overquoting + introduced 2007-10-05. + Whitespace cleanup. * lib/autoconf/general.m4: Use consistent indentation. * configure: Regenerate. diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4 index a9923259..95f7b737 100644 --- a/lib/autoconf/functions.m4 +++ b/lib/autoconf/functions.m4 @@ -1,6 +1,6 @@ # This file is part of Autoconf. -*- Autoconf -*- # Checking for functions. -# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software +# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software # Foundation, Inc. # # This program is free software: you can redistribute it and/or modify @@ -88,7 +88,7 @@ AC_DEFUN([AC_CHECK_FUNCS], for ac_func in $1 do AC_CHECK_FUNC($ac_func, - [AC_DEFINE_UNQUOTED([AS_TR_CPP([HAVE_$ac_func])]) $2], + [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$ac_func])) $2], [$3])dnl done ]) diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 896362df..384eb420 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -2015,14 +2015,9 @@ AS_IDENTIFIER_IF([$1], [], # AC_DEFINE_TRACE(CPP-SYMBOL) # --------------------------- # This macro is a wrapper around AC_DEFINE_TRACE_LITERAL which filters -# out non literal symbols. -# -# m4_index is roughly 5 to 8 times faster than m4_bpatsubst, so only -# use the regex when necessary. +# out non literal symbols. CPP-SYMBOL must not include any parameters. m4_define([AC_DEFINE_TRACE], -[AS_LITERAL_IF([$1], [AC_DEFINE_TRACE_LITERAL( - m4_if(m4_index([$1], [(]), [-1], [[$1]], - [m4_bpatsubst([[$1]], [(.*)])]))])]) +[AS_LITERAL_IF([$1], [AC_DEFINE_TRACE_LITERAL([$1])])]) # AC_DEFINE(VARIABLE, [VALUE], [DESCRIPTION]) @@ -2041,9 +2036,17 @@ m4_define([AC_DEFINE_UNQUOTED], [_AC_DEFINE_Q([], $@)]) # _AC_DEFINE_Q(QUOTE, VARIABLE, [VALUE], [DESCRIPTION]) # ----------------------------------------------------- +# Internal function that performs common elements of AC_DEFINE{,_UNQUOTED}. +# +# m4_index is roughly 5 to 8 times faster than m4_bpatsubst, so only +# use the regex when necessary. AC_name is defined with over-quotation, +# so that we can avoid m4_defn. m4_define([_AC_DEFINE_Q], -[AC_DEFINE_TRACE([$2])dnl -m4_ifval([$4], [AH_TEMPLATE(m4_bpatsubst([[$2]], [(.*)]), [$4])])dnl +[m4_pushdef([AC_name], m4_if(m4_index([$2], [(]), [-1], [[[$2]]], + [m4_bpatsubst([[[$2]]], [(.*)])]))dnl +AC_DEFINE_TRACE(AC_name)dnl +m4_ifval([$4], [AH_TEMPLATE(AC_name, [$4])])dnl +m4_popdef([AC_name])dnl cat >>confdefs.h <<$1_ACEOF [@%:@define] $2 m4_if($#, 2, 1, [$3]) _ACEOF diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4 index 15a4ed15..157b844d 100644 --- a/lib/m4sugar/m4sh.m4 +++ b/lib/m4sugar/m4sh.m4 @@ -1272,7 +1272,8 @@ m4_dquote(m4_dquote(m4_defn([m4_cr_symbols1])))[[))], [0], [$2], [$3])]) m4_define([AS_LITERAL_IF], [m4_cond([m4_eval(m4_index(m4_quote($1), [@S|@]) == -1)], [0], [$3], [m4_index(m4_translit(m4_quote($1), - [[]`,#]]m4_dquote(m4_defn([m4_cr_symbols2]))[, + [[]`,#]]]dnl +m4_dquote(m4_dquote(m4_defn([m4_cr_symbols2])))[[, [$$$]), [$])], [-1], [$2], [$3])])