]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* bin/autom4te.in (&parse_args): Implement `frozen files are
authorAkim Demaille <akim@epita.fr>
Tue, 5 Feb 2002 08:11:32 +0000 (08:11 +0000)
committerAkim Demaille <akim@epita.fr>
Tue, 5 Feb 2002 08:11:32 +0000 (08:11 +0000)
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.

ChangeLog
bin/autom4te.in
lib/autom4te.in
man/autom4te.1

index 92b59a24c1ae2079fb847a3d7d1ce9e3e25e72f5..c2eef4af8c4f5191748666f25dc89ed5c72c54eb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2002-02-05  Akim Demaille  <akim@epita.fr>
+
+       * 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.
+
 2002-01-31  Akim Demaille  <akim@epita.fr>
 
        * lib/autoconf/general.m4 (_AC_INIT_PACKAGE): Accept $4.
index 1b54b3497dd67cdcbe8841e13ce901997f82e24a..42a23ca864710abf7b504d1ce1a887ee96797c65 100644 (file)
@@ -6,7 +6,7 @@ eval 'exec @PERL@ -S $0 ${1+"$@"}'
     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 @@ $version =  <<"EOF";
 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 @@ Try `$me --help' for more information.\n"
        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 7c2cb3530b00fead0fd88be004ffb1aef517c973..076c17ab4be8db3bc3f97ec94c447927cbacfe72 100644 (file)
@@ -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-preselections
 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"
index fb847c49f8bb799094d392237bedc4f8445f9ba0..cd9c547e1ad683683ac14b44b759d19542681217 100644 (file)
@@ -1,5 +1,5 @@
 .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.25.
-.TH AUTOM4TE "1" "January 2002" "autom4te 2.52h" "User Commands"
+.TH AUTOM4TE "1" "February 2002" "autom4te 2.52h" "User Commands"
 .SH NAME
 autom4te \- Generate files and scripts thanks to M4
 .SH SYNOPSIS
@@ -8,7 +8,12 @@ autom4te \- Generate files and scripts thanks to M4
 .SH DESCRIPTION
 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'.
+.PP
+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.
+.PP
 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.
@@ -94,7 +99,7 @@ prepare to trace MACRO in a future run
 .SH AUTHOR
 Written by Akim Demaille.
 .PP
-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.
 .SH "REPORTING BUGS"