autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: using older m4 (was: [PATCH] Fix treatment of --enable-assert in AC_


From: Eric Blake
Subject: Re: using older m4 (was: [PATCH] Fix treatment of --enable-assert in AC_HEADER_ASSERT)
Date: Tue, 9 Dec 2008 18:44:19 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Eric Blake <ebb9 <at> byu.net> writes:

> What version of m4 are you using?
> 
> > -script.4s:2: error: m4_init: unbalanced m4_divert_push:
> > +:0: error: m4_init: unbalanced m4_divert_push:

Probably not m4 1.4.5 (which printed NONE for the filename, instead of an empty 
string), and not 1.4.8 or newer, so I'm guessing either 1.4.6 or 1.4.7.

At any rate, I'm committing this - I was able to reproduce the failure with m4 
1.4.5, and verified that this fixes the failure.


From: Eric Blake <address@hidden>
Date: Tue, 9 Dec 2008 10:47:19 -0700
Subject: [PATCH] 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.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog              |    7 +++++++
 lib/m4sugar/m4sugar.m4 |   13 +++++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 17eadc7..fb31bfd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-12-09  Eric Blake  <address@hidden>
+
+       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  <address@hidden>  (tiny change)
        and Eric Blake  <address@hidden>
 
diff --git a/lib/m4sugar/m4sugar.m4 b/lib/m4sugar/m4sugar.m4
index e3b712a..fe6af4f 100644
--- a/lib/m4sugar/m4sugar.m4
+++ b/lib/m4sugar/m4sugar.m4
@@ -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])
-- 
1.6.0.4







reply via email to

[Prev in Thread] Current Thread [Next in Thread]