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 <ebb9@byu.net>
This commit is contained in:
Eric Blake 2007-10-10 14:29:22 -06:00
parent b2bde204cf
commit 45b46a7467
4 changed files with 24 additions and 12 deletions

View File

@ -1,5 +1,13 @@
2007-10-10 Eric Blake <ebb9@byu.net>
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.

View File

@ -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
])

View File

@ -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

View File

@ -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])])