From d2dd4ed1caafae99076fc549b2e7fbe706e42d4e Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Tue, 26 Aug 2008 09:07:01 -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 --- ChangeLog | 7 +++++++ bin/autom4te.in | 34 +++++++++++----------------------- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index 51812e2e9..e39b20221 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-08-26 Eric Blake + + 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 Adjust to recent m4 1.6 change to support m4_debugmode(d). diff --git a/bin/autom4te.in b/bin/autom4te.in index 685df41a3..055abcede 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 @@ -245,6 +224,8 @@ EOF # ------------------------ # Transform Autom4te conventions (e.g., using foo.m4f to designate a frozen # file) into a suitable command line for M4 (e.g., using --reload-state). +# parse_args guarantees that we will see at most one frozen file, and that +# if a frozen file is present, it is the first argument. sub files_to_options (@) { my (@file) = @_; @@ -255,6 +236,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 +403,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); -- 2.47.3