autoconf/output-headers-prepare.diff

63 lines
2.0 KiB
Diff

commit c87512b5ae11de7a98ccc8c3e42d5df6f5039fe0
Author: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Date: Tue Jun 17 08:42:14 2008 +0200
Fix '#undef variable /* comment */' transform in config headers.
* lib/autoconf/status.m4 (_AC_OUTPUT_HEADERS_PREPARE): For
undefined preprocessor macros that are followed by a comment
in the header template, do not create nested comments in the
output.
* tests/torture.at (@%:@define header templates): Extend test.
* NEWS: Update.
Report by Karsten Hopp <karsten@redhat.com>.
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4
index 50be77b..d5ed323 100644
--- a/lib/autoconf/status.m4
+++ b/lib/autoconf/status.m4
@@ -832,9 +832,9 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
}
split(mac1, mac2, "(") #)
macro = mac2[1]
+ prefix = substr(line, 1, index(line, defundef) - 1)
if (D_is_set[macro]) {
# Preserve the white space surrounding the "#".
- prefix = substr(line, 1, index(line, defundef) - 1)
print prefix "define", macro P[macro] D[macro]
next
} else {
@@ -842,7 +842,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# in the case of _POSIX_SOURCE, which is predefined and required
# on some systems where configure will not decide to define it.
if (defundef == "undef") {
- print "/*", line, "*/"
+ print "/*", prefix defundef, macro, "*/"
next
}
}
diff --git a/tests/torture.at b/tests/torture.at
index c37daba..92f8d5b 100644
--- a/tests/torture.at
+++ b/tests/torture.at
@@ -497,6 +497,8 @@ AT_DATA([config.hin],
#define str(define) \
#define
#define stringify(arg) str(arg)
+#undef aaa /* with comments */
+#undef not_substed /* with comments */
]])
AT_CHECK_AUTOCONF
@@ -527,6 +529,8 @@ ARG1
#define str(define) \
#define
#define stringify(arg) str(arg)
+#define aaa AAA
+/* #undef not_substed */
]])
AT_CHECK([cat config.h], 0, expout)