/[autoconf]/autoconf/bin/autom4te.in
ViewVC logotype

Diff of /autoconf/bin/autom4te.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.74 by akim, Wed Oct 23 07:37:38 2002 UTC revision 1.75 by akim, Fri Oct 25 11:52:38 2002 UTC
# Line 230  use File::Basename; Line 230  use File::Basename;
230  use Autom4te::XFile;  use Autom4te::XFile;
231  use strict;  use strict;
232    
233  # Configuration file.  # Data directory.
234  my $datadir = $ENV{'AC_MACRODIR'} || '@datadir@';  my $datadir = $ENV{'AC_MACRODIR'} || '@datadir@';
 my $autom4te_cfg = $ENV{'AUTOM4TE_CFG'} || "$datadir/autom4te.cfg";  
235    
236  # $LANGUAGE{LANGUAGE} -- Automatic options for LANGUAGE.  # $LANGUAGE{LANGUAGE} -- Automatic options for LANGUAGE.
237  my %language;  my %language;
# Line 247  my $melt = 0; Line 246  my $melt = 0;
246    
247  # Names of the cache directory, cache directory index, trace cache  # Names of the cache directory, cache directory index, trace cache
248  # prefix, and output cache prefix.  # prefix, and output cache prefix.
249  my $cache = "autom4te.cache";  my $cache;
250  my $icache = "$cache/requests";  my $icache;
251  my $tcache = "$cache/traces.";  my $tcache;
252  my $ocache = "$cache/output.";  my $ocache;
253    
254  # The macros to trace mapped to their format, as specified by the  # The macros to trace mapped to their format, as specified by the
255  # user.  # user.
# Line 368  Operation modes: Line 367  Operation modes:
367    -f, --force              don\'t rely on cached values    -f, --force              don\'t rely on cached values
368    -W, --warnings=CATEGORY  report the warnings falling in CATEGORY    -W, --warnings=CATEGORY  report the warnings falling in CATEGORY
369    -l, --language=LANG      specify the set of M4 macros to use    -l, --language=LANG      specify the set of M4 macros to use
370      -C, --cache=[DIRECTORY]  preserve results for future runs in DIRECTORY
371    -m, --mode=OCTAL         change the non trace output file mode (0666)    -m, --mode=OCTAL         change the non trace output file mode (0666)
372    -M, --melt               don\'t use M4 frozen files    -M, --melt               don\'t use M4 frozen files
373    
# Line 443  sub files_to_options (@) Line 443  sub files_to_options (@)
443  }  }
444    
445    
446  # load_configuration ()  # load_configuration ($FILE)
447  # ---------------------  # --------------------------
448  # Load the configuration file.  # Load the configuration $FILE.
449  sub load_configuration ()  sub load_configuration ($)
450  {  {
451      my ($file) = @_;
452    use Text::ParseWords;    use Text::ParseWords;
453    
454    my $cfg = new Autom4te::XFile ($autom4te_cfg);    my $cfg = new Autom4te::XFile ($file);
455    my $lang;    my $lang;
456    while ($_ = $cfg->getline)    while ($_ = $cfg->getline)
457      {      {
# Line 467  sub load_configuration () Line 468  sub load_configuration ()
468          }          }
469        elsif ($type eq 'end-language:')        elsif ($type eq 'end-language:')
470          {          {
471            error "$autom4te_cfg:$.: end-language mismatch: $lang"            error "$file:$.: end-language mismatch: $lang"
472              if $lang ne lc $words[0];              if $lang ne lc $words[0];
473          }          }
474        elsif ($type eq 'args:')        elsif ($type eq 'args:')
# Line 476  sub load_configuration () Line 477  sub load_configuration ()
477          }          }
478        else        else
479          {          {
480            error "$autom4te_cfg:$.: unknown directive: $type";            error "$file:$.: unknown directive: $type";
481          }          }
482      }      }
483  }  }
# Line 507  sub parse_args () Line 508  sub parse_args ()
508        }        }
509    } while @language;    } while @language;
510    
511      # --debug is useless: it is parsed below.
512      if (exists $ENV{'AUTOM4TE_DEBUG'})
513        {
514          print STDERR "$me: concrete arguments:\n";
515          foreach my $arg (@ARGV)
516            {
517              print STDERR "| $arg\n";
518            }
519        }
520    
521    # Process the arguments for real this time.    # Process the arguments for real this time.
522    my @trace;    my @trace;
523    my @prepend_include;    my @prepend_include;
# Line 520  sub parse_args () Line 531  sub parse_args ()
531    
532       # Library directories:       # Library directories:
533       "B|prepend-include=s" => \@prepend_include,       "B|prepend-include=s" => \@prepend_include,
534       "I|include=s" => \@include,       "I|include=s"         => \@include,
535    
536       # Tracing:       # Tracing:
537       # Using a hash for traces is seducing.  Unfortunately, upon `-t FOO',       # Using a hash for traces is seducing.  Unfortunately, upon `-t FOO',
# Line 531  sub parse_args () Line 542  sub parse_args ()
542       "p|preselect=s" => \@preselect,       "p|preselect=s" => \@preselect,
543    
544       # Freezing.       # Freezing.
545       "F|freeze"  => \$freeze,       "F|freeze" => \$freeze,
546    
547         # Caching.
548         "C|cache=s" => \$cache,
549      );      );
550    
551    error "too few arguments    error "too few arguments
# Line 548  Try `$me --help' for more information." Line 562  Try `$me --help' for more information."
562    $melt = 1    $melt = 1
563      if $freeze;      if $freeze;
564    
565      # Names of the cache directory, cache directory index, trace cache
566      # prefix, and output cache prefix.  If the cache is not to be
567      # preserved, default to a temporary directory (automatically removed
568      # on exit).
569      $cache = $tmp
570        unless $cache;
571      $icache = "$cache/requests";
572      $tcache = "$cache/traces.";
573      $ocache = "$cache/output.";
574    
575    # Normalize the includes: the first occurrence is enough, several is    # Normalize the includes: the first occurrence is enough, several is
576    # a pain since it introduces a useless difference in the path which    # a pain since it introduces a useless difference in the path which
577    # invalidates the cache.  And strip `.' which is implicit and always    # invalidates the cache.  And strip `.' which is implicit and always
# Line 1110  sub freeze ($) Line 1134  sub freeze ($)
1134  ## Main program.  ##  ## Main program.  ##
1135  ## -------------- ##  ## -------------- ##
1136    
1137  mktmpdir ('t4');  mktmpdir ('am4t');
1138  load_configuration;  load_configuration ($ENV{'AUTOM4TE_CFG'} || "$datadir/autom4te.cfg");
1139    load_configuration ("$ENV{'HOME'}/.autom4te.cfg")
1140      if -f "$ENV{'HOME'}/.autom4te.cfg";
1141    load_configuration (".autom4te.cfg")
1142      if -f ".autom4te.cfg";
1143  parse_args;  parse_args;
1144    
1145  # Freezing does not involve the cache.  # Freezing does not involve the cache.

Legend:
Removed from v.1.74  
changed lines
  Added in v.1.75

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26