]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Another AC_DEFINE speedup.
authorEric Blake <ebb9@byu.net>
Wed, 10 Oct 2007 20:29:22 +0000 (14:29 -0600)
committerEric Blake <ebb9@byu.net>
Wed, 10 Oct 2007 20:36:27 +0000 (14:36 -0600)
* 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>
ChangeLog
lib/autoconf/functions.m4
lib/autoconf/general.m4
lib/m4sugar/m4sh.m4

index 4e31b80276de26e4ec634274c0c4e7d6d49dbeea..ea4f4bd4619ec0c8e649faeffeae5c1184d08c81 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
index a992325945d4e789658237905855a3c372ac0d0f..95f7b7373a2e0b6ac7844977b2cd61e0bf6582f4 100644 (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
 ])
index 896362dfcac7d604933b842851b82d9e7c403242..384eb4203adc7274fde86e510012a25d5c351490 100644 (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
index 15a4ed151b7e0604e42b788e878ef9e79d5d4087..157b844d95a31f298b19841d9b2366b9a1ac0539 100644 (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])])