autoconf-patches
[Top][All Lists]
Advanced

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

Re: __m4_version__ and frozen files


From: Eric Blake
Subject: Re: __m4_version__ and frozen files
Date: Tue, 26 Aug 2008 07:24:32 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080708 Thunderbird/2.0.0.16 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Eric Blake on 8/26/2008 6:47 AM:
> I'm looking at autom4te.in; right now it calls xsystem (which aborts if m4
> fails, even if the failure is status 63).  I see two possible options.
> One is to enhance xsystem to take an optional parameter of the fallback
> command to execute if the first command fails with version mismatch (and
> here, it would be a matter of always computing the command-line for --melt
> as the fallback command); this only helps if m4 1.6 uses V2 frozen files
> so that m4 1.4.x exits with status 63.  The other option is to look at the
> @m4_builtin map, and if __m4_version__ is not present, add an explicit
> option -U__m4_version__ to the list handed to xsystem, which will nuke
> whatever value __m4_version__ had within the frozen file (and m4 1.4.x
> will have the benefit of using linear algorithms).  That sounds simpler to
> implement, but it only helps if m4 1.6 uses V1 frozen files.

My perl is not as strong as my m4; does this patch look sane?

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAki0BBAACgkQ84KuGfSFAYDvwQCfRYuCIywf+Snts8qkndS9x8UX
Es0AmgJtsY2TxZwlKQrt/WbJuIowpRMD
=RlGb
-----END PGP SIGNATURE-----
>From c22005d60eb1cdf69de6741ea38ea754e1f08577 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Tue, 26 Aug 2008 07:21:10 -0600
Subject: [PATCH] Don't let frozen __m4_version__ break downgrade to m4 1.4.x.

* bin/autom4te.in: Adjust comments, now that we rely on 1.4.5+.
(files_to_options): Avoid inheriting __m4_version__ from frozen
file if current M4 does not support it.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog       |    7 +++++++
 bin/autom4te.in |   32 +++++++++-----------------------
 2 files changed, 16 insertions(+), 23 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 51812e2..e39b202 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-08-26  Eric Blake  <address@hidden>
+
+       Don't let frozen __m4_version__ break downgrade to m4 1.4.x.
+       * bin/autom4te.in: Adjust comments, now that we rely on 1.4.5+.
+       (files_to_options): Avoid inheriting __m4_version__ from frozen
+       file if current M4 does not support it.
+
 2008-08-25  Eric Blake  <address@hidden>
 
        Adjust to recent m4 1.6 change to support m4_debugmode(d).
diff --git a/bin/autom4te.in b/bin/autom4te.in
index 685df41..d923d16 100644
--- a/bin/autom4te.in
+++ b/bin/autom4te.in
@@ -111,29 +111,8 @@ map { s/:.*//;s/\W// } @m4_builtin;
 # Some macros don't follow this scheme: be sure to properly map to their
 # alternate name too.
 #
-# This is because GNU M4 1.4's tracing of builtins is buggy.  When run on
-# this input:
-#
-# | divert(-1)
-# | changequote([, ])
-# | define([m4_eval], defn([eval]))
-# | eval(1)
-# | m4_eval(2)
-# | undefine([eval])
-# | m4_eval(3)
-#
-# it behaves this way:
-#
-# | % m4 input.m4 -da -t eval
-# | m4trace: -1- eval(1)
-# | m4trace: -1- m4_eval(2)
-# | m4trace: -1- m4_eval(3)
-# | %
-#
-# Conversely:
-#
-# | % m4 input.m4 -da -t m4_eval
-# | %
+# FIXME: Trace status of renamed builtins was fixed in M4 1.4.5, which
+# we now depend on; do we still need to do this mapping?
 #
 # So we will merge them, i.e., tracing `BUILTIN' or tracing
 # `m4_BUILTIN' will be the same: tracing both, but honoring the
@@ -255,6 +234,12 @@ sub files_to_options (@)
       if ($file =~ /\.m4f$/)
        {
          $arg = "--reload-state=$arg";
+         # If the user downgraded M4 from 1.6 to 1.4.x after freezing
+         # the file, then we ensure the frozen __m4_version__ will
+         # not cause m4_init to make the wrong decision about the
+         # current M4 version.
+         $arg .= " --undefine=__m4_version__"
+           unless grep {/__m4_version__/} @m4_builtin;
        }
       push @res, $arg;
     }
@@ -416,6 +401,7 @@ Try `$me --help' for more information."
     }
 
   # Work around the M4 builtins tracing problem for @PRESELECT.
+  # FIXME: Is this still needed, now that we rely on M4 1.4.5?
   push (@preselect,
        map { $m4_builtin_alternate_name{$_} }
        grep { exists $m4_builtin_alternate_name{$_} } @preselect);
-- 
1.6.0


reply via email to

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