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.
** 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.
# 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)
m4_define([AH_TEMPLATE],
[AH_VERBATIM([$1],
m4_text_wrap([$2 */], [ ], [/* ])[
-#undef $1])])
+@%:@undef ]_m4_expand([$1]))])
# AH_TOP(TEXT)
# 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])
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
+
+
## ------------ ##