autoconf-patches
[Top][All Lists]
Advanced

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

01-fyi-generalize-frozen.patch


From: Akim Demaille
Subject: 01-fyi-generalize-frozen.patch
Date: Tue, 05 Feb 2002 09:09:31 +0100

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * bin/autom4te.in (&parse_args): Implement `frozen files are
        optional are the sum of the previous files on the command line'.
        Also, pass `--reload-state=' on them, so...
        (handle_m4): don't.
        * lib/autom4te.in (Autotest, Autoconf): Rely on M4sh.
        (M4sh): Rely on M4sugar.
        (Autotest, M4sh, M4sugar): Use frozen files.

Index: bin/autom4te.in
--- bin/autom4te.in Wed, 30 Jan 2002 21:23:41 +0100 akim
+++ bin/autom4te.in Wed, 30 Jan 2002 22:22:52 +0100 akim
@@ -6,7 +6,7 @@
     if 0;

 # autom4te - Wrapper around M4 libraries.
-# Copyright 2001 Free Software Foundation, Inc.
+# Copyright 2001, 2002 Free Software Foundation, Inc.

 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -346,7 +346,12 @@ Usage: $0 [OPTION] ... [FILES]

 Run GNU M4 on the FILES, avoiding useless runs.  If tracing, the output
 consists of the traces only, otherwise output the expansion of the FILES.
-The first of the FILES may be an M4 frozen file, but then must end in \`.m4f\'.
+
+If some of the FILES are named \`FILE.m4f\' they are considered to be M4
+frozen files of all the previous files (which are therefore not loaded).
+If \`FILE.m4f\' is not found, then \`FILE.m4\' will be used, together with
+all the previous files.
+
 Some files may be optional, i.e., will only be processed if found in the
 include path, but then must end in \`.m4?\';  the question mark is not part of
 the actual file name.
@@ -396,7 +401,7 @@ Tracing:
 autom4te (@PACKAGE_NAME@) @VERSION@
 Written by Akim Demaille.

-Copyright 2001 Free Software Foundation, Inc.
+Copyright 2001, 2002 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 EOF
@@ -471,8 +476,6 @@ sub parse_args ()
       }
   } while @language;

-  debug "arguments: @ARGV\n";
-
   # Process the arguments for real this time.
   my @trace;
   getopt
@@ -521,18 +524,38 @@ sub parse_args ()
        map { $m4_builtin_alternate_name{$_} }
        grep { exists $m4_builtin_alternate_name{$_} } @preselect);

-  # Only the first file can be frozen, but M4 doesn't complain if this
-  # constraint is not honored.
-  die "$me: the first file only can be frozen\n"
-    if grep { /\.m4f/ } @ARGV[1 .. $#ARGV];
-
-  $ARGV[0] =~ s/\.m4f$/.m4/
-    if $melt;
-
+  # If we find frozen files, then all the files before it are
+  # discarded: the frozen file is supposed to include them all.
+  #
   # We don't want to depend upon m4's --include to find the top level
-  # files.  Try to get a canonical name, as it's part of the key for
-  # caching.  And some files are optional.
-  @ARGV = grep { defined $_ } map { find_file ($_, @include) } @ARGV;
+  # files, so we use `find_file' here.  Try to get a canonical name,
+  # as it's part of the key for caching.  And some files are optional
+  # (also handled by `find_file').
+  my @argv;
+  foreach (@ARGV)
+    {
+      if (/\.m4f$/)
+       {
+         # Frozen files are optional => pass a `?' to `find_file'.
+         my $file = find_file ("$_?", @include);
+         if (!$melt && $file)
+           {
+             @argv = ("--reload-state=$file");
+           }
+         else
+           {
+             s/\.m4f$/.m4/;
+             push @argv, find_file ($_, @include);
+           }
+       }
+      else
+       {
+         my $file = find_file ($_, @include);
+         push @argv, $file
+           if $file;
+       }
+    }
+  @ARGV = @argv;
 }


@@ -543,15 +566,6 @@ sub handle_m4 ($@)
 {
   my ($req, @macro) = @_;

-  my $files;
-  foreach (@ARGV)
-    {
-      $files .= ' ';
-      $files .= '--reload-state='
-       if /\.m4f$/;
-      $files .= "$_";
-    }
-
   # The warnings are the concatenation of 1. application's defaults,
   # 2. $WARNINGS, $3 command line options, in that order.
   # Set them in the order expected by the M4 macros: the converse.
@@ -574,7 +588,7 @@ sub handle_m4 ($@)
                 . ' --debug=aflq'
                 . " --error-output=$tcache" . $req->id
                 . join (' --trace=',   '', sort @macro)
-                . $files
+                . " @ARGV"
                 . ' </dev/null'
                 . " >$ocache" . $req->id);
   verbose "running: $command";
Index: lib/autom4te.in
--- lib/autom4te.in Wed, 14 Nov 2001 20:54:00 +0100 akim
+++ lib/autom4te.in Wed, 30 Jan 2002 22:23:07 +0100 akim
@@ -1,6 +1,6 @@
 # Definition of macro sets.                              -*- Makefile -*-
 #
-# Copyright 2001 Free Software Foundation, Inc.
+# Copyright 2001, 2002 Free Software Foundation, Inc.
 #
 # This file is part of GNU Autoconf.
 #
@@ -138,6 +138,7 @@ args: --language Autoheader-preselection
 args: --language Automake-preselections
 args: --language Autoreconf-preselections
 args: --language Autoscan-preselections
+args: --language M4sh
 end-language: "Autoconf"


@@ -148,10 +149,11 @@ end-language: "Autoconf"
 begin-language: "Autotest"
 # patterns: *.at
 args: --include @datadir@
-args: autotest/autotest.m4
+args: autotest/autotest.m4f
 args: package.m4?
 args: --mode 777
 args: --warning syntax
+args: --language M4sh
 end-language: "Autotest"


@@ -162,9 +164,10 @@ end-language: "Autotest"
 begin-language: "M4sh"
 # patterns: *.as
 args: --include @datadir@
-args: m4sugar/m4sh.m4
+args: m4sugar/m4sh.m4f
 args: --mode 777
 args: --warning syntax
+args: --language M4sugar
 end-language: "M4sh"


@@ -175,6 +178,6 @@ end-language: "M4sh"
 begin-language: "M4sugar"
 # patterns: *.msh
 args: --include @datadir@
-args: m4sugar/m4sugar.m4
+args: m4sugar/m4sugar.m4f
 args: --warning syntax
 end-language: "M4sugar"



reply via email to

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