]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Fix m4_location inside m4_wrap with m4 1.4.5.
authorEric Blake <ebb9@byu.net>
Tue, 9 Dec 2008 17:47:19 +0000 (10:47 -0700)
committerEric Blake <ebb9@byu.net>
Tue, 9 Dec 2008 17:47:19 +0000 (10:47 -0700)
* lib/m4sugar/m4sugar.m4 (m4_undefine): Redefine m4_location
inside wrapped text if older m4 is detected.
Reported by William Pursell.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
lib/m4sugar/m4sugar.m4

index 17eadc78043947bf930ba08c08b10e5b8542cf08..fb31bfdd45ae77563abca12513c1dc6f70a88474 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-12-09  Eric Blake  <ebb9@byu.net>
+
+       Fix m4_location inside m4_wrap with m4 1.4.5.
+       * lib/m4sugar/m4sugar.m4 (m4_undefine): Redefine m4_location
+       inside wrapped text if older m4 is detected.
+       Reported by William Pursell.
+
 2008-12-08  William Pursell  <bill.pursell@gmail.com>  (tiny change)
        and Eric Blake  <ebb9@byu.net>
 
index e3b712adcf3d57867bf5e9575cd00f721db437af..fe6af4fb5d22a9442597b2637b55df7ab06b5f57 100644 (file)
@@ -200,6 +200,7 @@ m4_copy([m4_undefine], [_m4_undefine])
 
 # m4_location
 # -----------
+# Output the current file, colon, and the current line number.
 m4_define([m4_location],
 [__file__:__line__])
 
@@ -3055,15 +3056,19 @@ m4_pattern_forbid([^dnl$])
 # is available for faster checks of dereferencing undefined macros.
 # But if it is missing, we assume we are being run by M4 1.4.x, that
 # $@ recursion is quadratic, and that we need foreach-based
-# replacement macros.  Use the raw builtin to avoid tripping up
-# include tracing.  Meanwhile, avoid m4_copy, since it temporarily
-# undefines m4_defn.
+# replacement macros.  Also, m4 prior to 1.4.8 loses track of location
+# during m4wrap text; __line__ should never be 0.
+#
+# Use the raw builtin to avoid tripping up include tracing.
+# Meanwhile, avoid m4_copy, since it temporarily undefines m4_defn.
 m4_ifdef([__m4_version__],
 [m4_debugmode([+d])
 m4_define([m4_defn], _m4_defn([_m4_defn]))
 m4_define([m4_popdef], _m4_defn([_m4_popdef]))
 m4_define([m4_undefine], _m4_defn([_m4_undefine]))],
-[m4_builtin([include], [m4sugar/foreach.m4])])
+[m4_builtin([include], [m4sugar/foreach.m4])
+m4_wrap_lifo([m4_if(__line__, [0], [m4_pushdef([m4_location],
+]]m4_dquote(m4_dquote(m4_dquote(__file__:__line__)))[[)])])])
 
 # Rewrite the first entry of the diversion stack.
 m4_divert([KILL])