]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Let autoheader see through m4 macros in AC_DEFINE.
authorEric Blake <ebb9@byu.net>
Sat, 25 Jul 2009 12:00:38 +0000 (06:00 -0600)
committerEric Blake <ebb9@byu.net>
Sat, 25 Jul 2009 12:00:38 +0000 (06:00 -0600)
* lib/autoconf/general.m4 (AC_DEFINE_TRACE): Expand macro before
tracing its name.
* lib/autoconf/autoheader.m4 (AH_VERBATIM, AH_TEMPLATE): Likewise,
for using the macro in a template file.
* tests/tools.at (autoheader and macros): New test.
* NEWS: Mention this.
Reported by Bruno Haible.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
NEWS
lib/autoconf/autoheader.m4
lib/autoconf/general.m4
tests/tools.at

index 0b9908034a9ccaba23b7bf72ac3a5c075059866b..5daef4db6eb32dc74e13b3093c318b89b33bc90a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2009-07-25  Eric Blake  <ebb9@byu.net>
 
+       Let autoheader see through m4 macros in AC_DEFINE.
+       * lib/autoconf/general.m4 (AC_DEFINE_TRACE): Expand macro before
+       tracing its name.
+       * lib/autoconf/autoheader.m4 (AH_VERBATIM, AH_TEMPLATE): Likewise,
+       for using the macro in a template file.
+       * tests/tools.at (autoheader and macros): New test.
+       * NEWS: Mention this.
+       Reported by Bruno Haible.
+
        Improve NEWS wording.
        * NEWS: Use more accurate statement.
        Suggestedy by Ralf Wildenhues.
diff --git a/NEWS b/NEWS
index d3662cd037f8a543ddc34f88525e2f6a705feb5d..3830fc0bbfcd1061a88be4b56d6d51e9fcac9878 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,9 @@ GNU Autoconf NEWS - User visible changes.
 ** The following documented autoconf macros are new:
    AC_ERLANG_SUBST_ERTS_VER
 
+** The autoheader tool now understands m4 macro arguments passed to
+   AC_DEFINE and AC_DEFINE_UNQUOTED.
+
 ** Ensure AT_CHECK can support commands that include a # given with
    proper m4 quoting.  For shell comments, this is a new feature; for
    non-shell comments, this fixes a regression introduced in 2.63b.
index 8e109cca2562e660c5bab23c53faa090c5a63998..99723f235174ed448320d0b97c5d60d60b96bf1c 100644 (file)
@@ -68,7 +68,7 @@ m4_define([AH_OUTPUT], [])
 # Quote for Perl '' strings, which are those used by Autoheader.
 m4_define([AH_VERBATIM],
 [AS_LITERAL_IF([$1],
-              [AH_OUTPUT([$1], AS_ESCAPE([[$2]], [\']))])])
+              [AH_OUTPUT(_m4_expand([$1]), AS_ESCAPE([[$2]], [\']))])])
 
 
 # AH_TEMPLATE(KEY, DESCRIPTION)
@@ -78,7 +78,7 @@ m4_define([AH_VERBATIM],
 m4_define([AH_TEMPLATE],
 [AH_VERBATIM([$1],
             m4_text_wrap([$2 */], [   ], [/* ])[
-#undef $1])])
+@%:@undef ]_m4_expand([$1]))])
 
 
 # AH_TOP(TEXT)
index e3b69d024af7a302265dfc9b221dafc67aa14e89..f030c26ba0d9c0cf70db2583e945a822017defef 100644 (file)
@@ -2075,7 +2075,7 @@ AS_IDENTIFIER_IF([$1], [],
 # This macro is a wrapper around AC_DEFINE_TRACE_LITERAL which filters
 # out non literal symbols.  CPP-SYMBOL must not include any parameters.
 m4_define([AC_DEFINE_TRACE],
-[AS_LITERAL_IF([$1], [AC_DEFINE_TRACE_LITERAL([$1])])])
+[AS_LITERAL_IF([$1], [AC_DEFINE_TRACE_LITERAL(_m4_expand([$1]))])])
 
 
 # AC_DEFINE(VARIABLE, [VALUE], [DESCRIPTION])
index 529eb93deb5ddd107536d6c5d7ef04db4a5719a0..e54ed6995e195738f8572c569ea53c84f356b5a2 100644 (file)
@@ -717,6 +717,42 @@ The Dog in a h@t.
 AT_CLEANUP
 
 
+# autoheader should see through m4 macros, just like autoconf
+# http://lists.gnu.org/archive/html/bug-autoconf/2009-06/msg00000.html
+AT_SETUP([autoheader and macros])
+
+AT_DATA([configure.ac],
+[[AC_INIT
+AC_CONFIG_HEADER([config.h])
+m4_define([PETER], [SIMSALABIM])
+m4_define([PAUL], [OPENSESAME])
+AC_DEFINE([PETER], [10], [Peter's public info])
+AC_DEFINE_UNQUOTED([PAUL], [`expr 4 + 6`], [Paul's public info])
+AC_OUTPUT
+]])
+
+AT_CHECK_AUTOCONF
+AT_CHECK_AUTOHEADER
+AT_CHECK([grep -c SIMSALABIM configure config.h.in], [0],
+[[configure:1
+config.h.in:1
+]])
+AT_CHECK([grep -c OPENSESAME configure config.h.in], [0],
+[[configure:1
+config.h.in:1
+]])
+AT_CHECK([grep -c PETER configure config.h.in], [1],
+[[configure:0
+config.h.in:0
+]])
+AT_CHECK([grep -c PAUL configure config.h.in], [1],
+[[configure:0
+config.h.in:0
+]])
+
+AT_CLEANUP
+
+
 
 
 ## ------------ ##