autoconf-patches
[Top][All Lists]
Advanced

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

Re: Making it possible to disable the cache


From: Akim Demaille
Subject: Re: Making it possible to disable the cache
Date: 25 Oct 2002 13:52:16 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Honest Recruiter)

This is the version committed.

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * 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.

Index: NEWS
===================================================================
RCS file: /cvsroot/autoconf/autoconf/NEWS,v
retrieving revision 1.272
diff -u -u -r1.272 NEWS
--- NEWS 25 Oct 2002 09:03:31 -0000 1.272
+++ NEWS 25 Oct 2002 11:51:26 -0000
@@ -1,6 +1,11 @@
 * Major changes in Autoconf 2.54a                       -*- outline -*-
 
 
+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
@@ -12,6 +17,15 @@
 
 - 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
 
Index: bin/autom4te.in
===================================================================
RCS file: /cvsroot/autoconf/autoconf/bin/autom4te.in,v
retrieving revision 1.74
diff -u -u -r1.74 autom4te.in
--- bin/autom4te.in 23 Oct 2002 07:37:38 -0000 1.74
+++ bin/autom4te.in 25 Oct 2002 11:51:27 -0000
@@ -230,9 +230,8 @@
 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 @@
 
 # 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 @@
   -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 @@
 }
 
 
-# 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 @@
        }
       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 @@
        }
       else
        {
-         error "$autom4te_cfg:$.: unknown directive: $type";
+         error "$file:$.: unknown directive: $type";
        }
     }
 }
@@ -507,6 +508,16 @@
       }
   } 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 @@
 
      # Library directories:
      "B|prepend-include=s" => address@hidden,
-     "I|include=s" => address@hidden,
+     "I|include=s"         => address@hidden,
 
      # Tracing:
      # Using a hash for traces is seducing.  Unfortunately, upon `-t FOO',
@@ -531,7 +542,10 @@
      "p|preselect=s" => address@hidden,
 
      # Freezing.
-     "F|freeze"  => \$freeze,
+     "F|freeze" => \$freeze,
+
+     # Caching.
+     "C|cache=s" => \$cache,
     );
 
   error "too few arguments
@@ -548,6 +562,16 @@
   $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 @@
 ## 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: bin/autoreconf.in
===================================================================
RCS file: /cvsroot/autoconf/autoconf/bin/autoreconf.in,v
retrieving revision 1.107
diff -u -u -r1.107 autoreconf.in
--- bin/autoreconf.in 16 Oct 2002 06:38:50 -0000 1.107
+++ bin/autoreconf.in 25 Oct 2002 11:51:27 -0000
@@ -338,9 +338,12 @@
      . 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: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.696
diff -u -u -r1.696 autoconf.texi
--- doc/autoconf.texi 25 Oct 2002 08:44:23 -0000 1.696
+++ doc/autoconf.texi 25 Oct 2002 11:51:38 -0000
@@ -311,7 +311,7 @@
 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 @@
 * 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 @@
 
 @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 @@
 unexpanded macros.  The @command{autoconf} program checks for this problem
 by doing @samp{grep AC_ configure}.
 
address@hidden Invoking autom4te
address@hidden 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}:
address@hidden ---------------------------------------- Using autom4te
+
address@hidden Using autom4te
address@hidden 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}:
 @address@hidden
 @c
 Yet another great name from Lars J. Aas.
@@ -7172,8 +7180,17 @@
 }.
 
 @command{autom4te} should basically considered as a replacement of
address@hidden itself.  In particular, its handling of command line
-arguments is modeled after M4's:
address@hidden itself.
+
address@hidden
+* Invoking autom4te::           A GNU M4 wrapper
+* Customizing autom4te::        Customizing the Autoconf package
address@hidden menu
+
address@hidden Invoking autom4te
address@hidden Invoking @command{autom4te}
+
+The command line arguments are modeled after M4's:
 
 @example
 autom4te @var{options} @var{files}
@@ -7375,9 +7392,16 @@
 @command{autom4te} considers it is trashed).
 
 @table @option
address@hidden address@hidden
address@hidden -C
address@hidden address@hidden
+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 @@
 m4sugar/m4sugar.m4f m4sugar/m4sh.m4f --mode 777 foo.m4}.  The definition
 of the languages is stored in @file{autom4te.cfg}.
 
address@hidden Customizing autom4te
address@hidden 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}"},
address@hidden: "@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}:
+
address@hidden
+## ------------------ ##
+## User Preferences.  ##
+## ------------------ ##
+
+begin-language: "Autoconf"
+args: --cache=''
+end-language: "Autoconf"
address@hidden verbatim
+
+The most typical
+use is probably to disable caches with Autoconf
+
 
 @node Programming in M4sugar
 @section Programming in M4sugar
@@ -14188,6 +14247,20 @@
 
 But it is and remains being simply a cache: you can safely remove it.
 
address@hidden 1
+
address@hidden
+Can I permanently get rid of it?
address@hidden 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
address@hidden
 
 
 @c ===================================================== History of Autoconf.
Index: lib/autom4te.in
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autom4te.in,v
retrieving revision 1.15
diff -u -u -r1.15 autom4te.in
--- lib/autom4te.in 8 Oct 2002 23:05:41 -0000 1.15
+++ lib/autom4te.in 25 Oct 2002 11:51:38 -0000
@@ -162,6 +162,7 @@
 
 begin-language: "Autoconf"
 args: --prepend-include @datadir@
+args: --cache=automate.cache
 args: autoconf/autoconf.m4f
 args: acsite.m4?
 args: aclocal.m4?
Index: man/autom4te.1
===================================================================
RCS file: /cvsroot/autoconf/autoconf/man/autom4te.1,v
retrieving revision 1.42
diff -u -u -r1.42 autom4te.1
--- man/autom4te.1 11 Oct 2002 09:49:31 -0000 1.42
+++ man/autom4te.1 25 Oct 2002 11:51:38 -0000
@@ -43,6 +43,9 @@
 \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




reply via email to

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