]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* bin/autom4te.in (&load_configuration): Take the file as
authorAkim Demaille <akim@epita.fr>
Fri, 25 Oct 2002 11:52:37 +0000 (11:52 +0000)
committerAkim Demaille <akim@epita.fr>
Fri, 25 Oct 2002 11:52:37 +0000 (11:52 +0000)
argument.
(&parse_args): Handle -C, --cache.
($help): Adjust.
(MAIN): Load ~/.autom4te.cfg and ./.autom4te.cfg.
* lib/autom4te.in (Autoconf): Pass --cache=autom4te.cache.
* doc/autoconf.texi (Invoking autom4te): Document --cache.
Now a subsection of...
(Using autom4te): This new section.
(Customizing autom4te): New.
(autom4te.cache): Adjust.

ChangeLog
NEWS
bin/autom4te.in
bin/autoreconf.in
doc/autoconf.texi
lib/autom4te.in
man/autom4te.1

index 3122fd273d08a209998befae257ca44823464a31..229035295ad6aa12e657a85d871d293a7e06a424 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2002-10-25  Akim Demaille  <akim@epita.fr>
+
+       * bin/autom4te.in (&load_configuration): Take the file as
+       argument.
+       (&parse_args): Handle -C, --cache.
+       ($help): Adjust.
+       (MAIN): Load ~/.autom4te.cfg and ./.autom4te.cfg.
+       * lib/autom4te.in (Autoconf): Pass --cache=autom4te.cache.
+       * doc/autoconf.texi (Invoking autom4te): Document --cache.
+       Now a subsection of...
+       (Using autom4te): This new section.
+       (Customizing autom4te): New.
+       (autom4te.cache): Adjust.
+
 2002-10-25  Akim Demaille  <akim@epita.fr>
 
        * doc/autoconf.texi (Generic Headers): More information on how to
diff --git a/NEWS b/NEWS
index be6e54bd8181cb751823b7362263b9757ad327a3..4177273f2b2b989cc6e043fd46f29c389c645c6c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,11 @@
 * Major changes in Autoconf 2.54a                       -*- outline -*-
 \f
 
+Tip of the release:
+
+           Did you have your configure.ac checked by autoscan?
+          Did you try the warning options?
+
 ** Documentation
 
 - AC_CHECK_HEADER, AC_CHECK_HEADERS
 - Produces messages (when --verbose) to be understood by Emacs'
   compile mode.
 
+** Obsolete options
+  Support for the obsoleted options -m, --macrodir, -l, --localdir is
+  dropped in favor of the safer --include/--prepend-include scheme.
+
+** Customization
+
+- ~/.autom4te.cfg makes it possible to disable the caching mechanism
+  (autom4te.cache).  See `Customizing autom4te' in the documentation.
+
 ** Macros
 
 - New macros
index 8bb70d966c49ccfc8b12d85c76b80111fd273be7..18b2cc0c34319f8922345e54f7c67ad9bff43007 100644 (file)
@@ -230,9 +230,8 @@ use File::Basename;
 use Autom4te::XFile;
 use strict;
 
-# Configuration file.
+# Data directory.
 my $datadir = $ENV{'AC_MACRODIR'} || '@datadir@';
-my $autom4te_cfg = $ENV{'AUTOM4TE_CFG'} || "$datadir/autom4te.cfg";
 
 # $LANGUAGE{LANGUAGE} -- Automatic options for LANGUAGE.
 my %language;
@@ -247,10 +246,10 @@ my $melt = 0;
 
 # Names of the cache directory, cache directory index, trace cache
 # prefix, and output cache prefix.
-my $cache = "autom4te.cache";
-my $icache = "$cache/requests";
-my $tcache = "$cache/traces.";
-my $ocache = "$cache/output.";
+my $cache;
+my $icache;
+my $tcache;
+my $ocache;
 
 # The macros to trace mapped to their format, as specified by the
 # user.
@@ -368,6 +367,7 @@ Operation modes:
   -f, --force              don\'t rely on cached values
   -W, --warnings=CATEGORY  report the warnings falling in CATEGORY
   -l, --language=LANG      specify the set of M4 macros to use
+  -C, --cache=[DIRECTORY]  preserve results for future runs in DIRECTORY
   -m, --mode=OCTAL         change the non trace output file mode (0666)
   -M, --melt               don\'t use M4 frozen files
 
@@ -443,14 +443,15 @@ sub files_to_options (@)
 }
 
 
-# load_configuration ()
-# ---------------------
-# Load the configuration file.
-sub load_configuration ()
+# load_configuration ($FILE)
+# --------------------------
+# Load the configuration $FILE.
+sub load_configuration ($)
 {
+  my ($file) = @_;
   use Text::ParseWords;
 
-  my $cfg = new Autom4te::XFile ($autom4te_cfg);
+  my $cfg = new Autom4te::XFile ($file);
   my $lang;
   while ($_ = $cfg->getline)
     {
@@ -467,7 +468,7 @@ sub load_configuration ()
        }
       elsif ($type eq 'end-language:')
        {
-         error "$autom4te_cfg:$.: end-language mismatch: $lang"
+         error "$file:$.: end-language mismatch: $lang"
            if $lang ne lc $words[0];
        }
       elsif ($type eq 'args:')
@@ -476,7 +477,7 @@ sub load_configuration ()
        }
       else
        {
-         error "$autom4te_cfg:$.: unknown directive: $type";
+         error "$file:$.: unknown directive: $type";
        }
     }
 }
@@ -507,6 +508,16 @@ sub parse_args ()
       }
   } while @language;
 
+  # --debug is useless: it is parsed below.
+  if (exists $ENV{'AUTOM4TE_DEBUG'})
+    {
+      print STDERR "$me: concrete arguments:\n";
+      foreach my $arg (@ARGV)
+       {
+         print STDERR "| $arg\n";
+       }
+    }
+
   # Process the arguments for real this time.
   my @trace;
   my @prepend_include;
@@ -520,7 +531,7 @@ sub parse_args ()
 
      # Library directories:
      "B|prepend-include=s" => \@prepend_include,
-     "I|include=s" => \@include,
+     "I|include=s"         => \@include,
 
      # Tracing:
      # Using a hash for traces is seducing.  Unfortunately, upon `-t FOO',
@@ -531,7 +542,10 @@ sub parse_args ()
      "p|preselect=s" => \@preselect,
 
      # Freezing.
-     "F|freeze"  => \$freeze,
+     "F|freeze" => \$freeze,
+
+     # Caching.
+     "C|cache=s" => \$cache,
     );
 
   error "too few arguments
@@ -548,6 +562,16 @@ Try `$me --help' for more information."
   $melt = 1
     if $freeze;
 
+  # Names of the cache directory, cache directory index, trace cache
+  # prefix, and output cache prefix.  If the cache is not to be
+  # preserved, default to a temporary directory (automatically removed
+  # on exit).
+  $cache = $tmp
+    unless $cache;
+  $icache = "$cache/requests";
+  $tcache = "$cache/traces.";
+  $ocache = "$cache/output.";
+
   # Normalize the includes: the first occurrence is enough, several is
   # a pain since it introduces a useless difference in the path which
   # invalidates the cache.  And strip `.' which is implicit and always
@@ -1110,8 +1134,12 @@ sub freeze ($)
 ## Main program.  ##
 ## -------------- ##
 
-mktmpdir ('t4');
-load_configuration;
+mktmpdir ('am4t');
+load_configuration ($ENV{'AUTOM4TE_CFG'} || "$datadir/autom4te.cfg");
+load_configuration ("$ENV{'HOME'}/.autom4te.cfg")
+  if -f "$ENV{'HOME'}/.autom4te.cfg";
+load_configuration (".autom4te.cfg")
+  if -f ".autom4te.cfg";
 parse_args;
 
 # Freezing does not involve the cache.
index 6bb33e38455515a5d08a7c628345767290055e46..bd305f74b839170926a2e62bb67518e271ff267a 100644 (file)
@@ -338,9 +338,12 @@ sub autoreconf ($)
      . join (' --trace=', '',
             # If you change this list, update the
             # `Autoreconf-preselections' section of autom4te.in.
-            'AC_INIT', 'AM_GNU_GETTEXT', 'AC_PROG_LIBTOOL',
             'AC_CONFIG_HEADERS',
-            'AC_CONFIG_SUBDIRS:AC_CONFIG_SUBDIRS:\$1')
+            'AC_CONFIG_SUBDIRS:AC_CONFIG_SUBDIRS:\$1',
+            'AC_INIT',
+            'AC_PROG_LIBTOOL',
+            'AM_GNU_GETTEXT',
+           )
      . ' |');
   while ($_ = $traces->getline)
     {
index 3345608a8baf665b500aa2dc7b17bbd76c1e4331..6cdc1ace80b7b7ab63990af8df72f6dcadcb2649 100644 (file)
@@ -311,7 +311,7 @@ Caching Results
 Programming in M4
 
 * M4 Quotation::                Protecting macros from unwanted expansion
-* Invoking autom4te::           The Autoconf executables backbone
+* Using autom4te::              The Autoconf executables backbone
 * Programming in M4sugar::      Convenient pure M4 macros
 * Programming in M4sh::         Common shell Constructs
 
@@ -324,6 +324,11 @@ M4 Quotation
 * Quadrigraphs::                Another way to escape special characters
 * Quotation Rule Of Thumb::     One parenthesis, one quote
 
+Using @command{autom4te}
+
+* Invoking autom4te::           A GNU M4 wrapper
+* Customizing autom4te::        Customizing the Autoconf package
+
 Programming in M4sugar
 
 * Redefined M4 Macros::         M4 builtins changed in M4sugar
@@ -6656,7 +6661,7 @@ and their interface might change in the future.  As a matter of fact,
 
 @menu
 * M4 Quotation::                Protecting macros from unwanted expansion
-* Invoking autom4te::           The Autoconf executables backbone
+* Using autom4te::              The Autoconf executables backbone
 * Programming in M4sugar::      Convenient pure M4 macros
 * Programming in M4sh::         Common shell Constructs
 @end menu
@@ -7159,12 +7164,15 @@ this happens, the resulting @command{configure} script will contain
 unexpanded macros.  The @command{autoconf} program checks for this problem
 by doing @samp{grep AC_ configure}.
 
-@node Invoking autom4te
-@section Invoking @command{autom4te}
 
-The Autoconf suite, including M4sugar, M4sh, and Autotest, in addition to
-Autoconf per se, heavily rely on M4.  All these different uses revealed
-common needs factored into a layer over @command{m4}:
+@c ---------------------------------------- Using autom4te
+
+@node Using autom4te
+@section Using @command{autom4te}
+
+The Autoconf suite, including M4sugar, M4sh, and Autotest, in addition
+to Autoconf per se, heavily rely on M4.  All these different uses
+revealed common needs factored into a layer over @command{m4}:
 @command{autom4te}@footnote{
 @c
 Yet another great name from Lars J. Aas.
@@ -7172,8 +7180,17 @@ Yet another great name from Lars J. Aas.
 }.
 
 @command{autom4te} should basically considered as a replacement of
-@command{m4} itself.  In particular, its handling of command line
-arguments is modeled after M4's:
+@command{m4} itself.
+
+@menu
+* Invoking autom4te::           A GNU M4 wrapper
+* Customizing autom4te::        Customizing the Autoconf package
+@end menu
+
+@node Invoking autom4te
+@subsection Invoking @command{autom4te}
+
+The command line arguments are modeled after M4's:
 
 @example
 autom4te @var{options} @var{files}
@@ -7375,9 +7392,16 @@ be removed} at any moment (especially if for some reason
 @command{autom4te} considers it is trashed).
 
 @table @option
+@item --cache=[@var{directory}]
+@itemx -C
+@itemx -C@var{directory}
+Specify the name of the directory where the result should be cached.
+Passing an empty value disables caching.  Be sure to pass a relative
+path name, as for the time being, global caches are not supported.
+
 @item --force
 @itemx -f
-Do not consider the cache (but update it anyway).
+If a cache is used, consider it obsolete (but update it anyway).
 @end table
 
 @sp 1
@@ -7498,6 +7522,41 @@ foo.m4}, i.e., @samp{autom4te --prepend-include /usr/local/share/autoconf
 m4sugar/m4sugar.m4f m4sugar/m4sh.m4f --mode 777 foo.m4}.  The definition
 of the languages is stored in @file{autom4te.cfg}.
 
+@node Customizing autom4te
+@subsection Customizing @command{autom4te}
+
+One can customize @command{autom4te} via @file{~/.autom4te.cfg} (i.e.,
+as found in the user home directory), and @file{./.autom4te.cfg} (i.e.,
+as found in the directory from which @command{autom4te} is run).  The
+order is first reading @file{autom4te.cfg}, then @file{~/.autom4te.cfg},
+then @file{./.autom4te.cfg}, and finally the command line arguments.
+
+In these text files, comments are introduced with @code{#}, and empty
+lines are ignored.  Customization is performed on a per-language basis,
+wrapped in between a @samp{begin-language: "@var{language}"},
+@samp{end-language: "@var{language}"} pair.
+
+Customizing a language stands for appending options (@pxref{Invoking
+autom4te}) to the current definition of the language.  Options, and more
+generally arguments, are introduced by @samp{args: @var{arguments}}.
+You may use the traditional shell syntax to quote the @var{arguments}.
+
+As an example, to disable Autoconf caches (@file{autom4te.cache})
+globally, include the following lines in @file{~/.autom4te.cfg}:
+
+@verbatim
+## ------------------ ##
+## User Preferences.  ##
+## ------------------ ##
+
+begin-language: "Autoconf"
+args: --cache=''
+end-language: "Autoconf"
+@end verbatim
+
+The most typical
+use is probably to disable caches with Autoconf
+
 
 @node Programming in M4sugar
 @section Programming in M4sugar
@@ -14188,6 +14247,20 @@ and is increasing with the size of @file{configure.ac}.
 
 But it is and remains being simply a cache: you can safely remove it.
 
+@sp 1
+
+@display
+Can I permanently get rid of it?
+@end display
+
+The creation of this cache can be disabled from @file{~/.autom4te.cfg},
+see @ref{Customizing autom4te}, for more details.  You should be aware
+that disabling the cache slows down the Autoconf test suite by 40%.  The
+more GNU Build System components are used, the more the cache is useful;
+for instance running @samp{autoreconf -f} on the Coreutils is twice
+slower without the cache @emph{although @option{--force} implies that
+the cache is not fully exploited}, and eight times slower than without
+@option{--force}.
 
 
 @c ===================================================== History of Autoconf.
index db7f3642722aaf4654e691ac6c22a14d0a004fef..fb5c2557b84506b4ecc70ca9a6db746316d3a9d3 100644 (file)
@@ -162,6 +162,7 @@ end-language: "Autoscan-preselections"
 
 begin-language: "Autoconf"
 args: --prepend-include @datadir@
+args: --cache=automate.cache
 args: autoconf/autoconf.m4f
 args: acsite.m4?
 args: aclocal.m4?
index d90727409e4439e3c3b65e5301347e012d51c829..fb1d0e14c2d77b2aca76f5b0c052f51b1256660f 100644 (file)
@@ -43,6 +43,9 @@ report the warnings falling in CATEGORY
 \fB\-l\fR, \fB\-\-language\fR=\fILANG\fR
 specify the set of M4 macros to use
 .TP
+\fB\-C\fR, \fB\-\-cache\fR=\fI[DIRECTORY]\fR
+preserve results for future runs in DIRECTORY
+.TP
 \fB\-m\fR, \fB\-\-mode\fR=\fIOCTAL\fR
 change the non trace output file mode (0666)
 .TP