/[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.85 by akim, Wed Aug 20 12:52:18 2003 UTC revision 1.86 by akim, Thu Aug 21 17:25:31 2003 UTC
# Line 236  sub load Line 236  sub load
236    
237  package Autom4te;  package Autom4te;
238    
239    use Autom4te::ChannelDefs;
240    use Autom4te::Channels;
241  use Autom4te::FileUtils;  use Autom4te::FileUtils;
242  use Autom4te::General;  use Autom4te::General;
243  use File::Basename;  use File::Basename;
# Line 273  my %trace; Line 275  my %trace;
275  # `m4_pattern_allow' to check the output.  # `m4_pattern_allow' to check the output.
276  #  #
277  # FIXME: What about `sinclude'?  # FIXME: What about `sinclude'?
278  my @preselect = ('include', 'm4_pattern_allow', 'm4_pattern_forbid');  my @preselect = ('include',
279                     'm4_pattern_allow', 'm4_pattern_forbid',
280  # List of warnings.                   'm4_warn');
 my @warning;  
281    
282  # M4 include path.  # M4 include path.
283  my @include;  my @include;
284    
 # 0 for EXIT_SUCCESS.  
 my $exit_status = 0;  
   
285  # Do we freeze?  # Do we freeze?
286  my $freeze = 0;  my $freeze = 0;
287    
# Line 356  my %m4_builtin_alternate_name; Line 354  my %m4_builtin_alternate_name;
354    
355  # $HELP  # $HELP
356  # -----  # -----
357  $help = << "EOF";  $help = "Usage: $0 [OPTION] ... [FILES]
 Usage: $0 [OPTION] ... [FILES]  
358    
359  Run GNU M4 on the FILES, avoiding useless runs.  Output the traces if tracing,  Run GNU M4 on the FILES, avoiding useless runs.  Output the traces if tracing,
360  the frozen file if freezing, otherwise the expansion of the FILES.  the frozen file if freezing, otherwise the expansion of the FILES.
# Line 391  Languages include: Line 388  Languages include:
388    \`M4sh\'       create M4sh shell scripts    \`M4sh\'       create M4sh shell scripts
389    \`M4sugar\'    create M4sugar output    \`M4sugar\'    create M4sugar output
390    
391  Warning categories include:  " . Autom4te::ChannelDefs::usage . "
   \`cross\'         cross compilation issues  
   \`obsolete\'      obsolete constructs  
   \`syntax\'        dubious syntactic constructs  
   \`all\'           all the warnings  
   \`no-CATEGORY\'   turn off the warnings on CATEGORY  
   \`none\'          turn off all the warnings  
   \`error\'         warnings are error  
392    
393  The environment variable \`WARNINGS\' is honored.  The environment variable \`WARNINGS\' is honored.
394    
# Line 414  Freezing: Line 404  Freezing:
404    -F, --freeze   produce an M4 frozen state file for FILES    -F, --freeze   produce an M4 frozen state file for FILES
405    
406  Report bugs to <bug-autoconf\@gnu.org>.  Report bugs to <bug-autoconf\@gnu.org>.
407  EOF  ";
408    
409  # $VERSION  # $VERSION
410  # --------  # --------
# Line 540  sub parse_args () Line 530  sub parse_args ()
530    # Process the arguments for real this time.    # Process the arguments for real this time.
531    my @trace;    my @trace;
532    my @prepend_include;    my @prepend_include;
533      parse_WARNINGS;
534    getopt    getopt
535      (      (
536       # Operation modes:       # Operation modes:
537       "o|output=s"   => \$output,       "o|output=s"   => \$output,
538       "W|warnings=s" => \@warning,       "W|warnings=s" => \&parse_warnings,
539       "m|mode=s"     => \$mode,       "m|mode=s"     => \$mode,
540       "M|melt"       => \$melt,       "M|melt"       => \$melt,
541    
# Line 656  sub handle_m4 ($@) Line 647  sub handle_m4 ($@)
647  {  {
648    my ($req, @macro) = @_;    my ($req, @macro) = @_;
649    
   # 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.  
   my $m4_warnings =  
     lc join (',', reverse (split (',', ($ENV{'WARNINGS'} || '')),  
                            map { split /,/ } @warning));  
   
650    # GNU m4 appends when using --error-output.    # GNU m4 appends when using --error-output.
651    unlink ($tcache . $req->id . "t");    unlink ($tcache . $req->id . "t");
652    
# Line 674  sub handle_m4 ($@) Line 658  sub handle_m4 ($@)
658    # when we are interrupted (that leaves corrupted files).    # when we are interrupted (that leaves corrupted files).
659    xsystem ("$m4"    xsystem ("$m4"
660             . join (' --include=', '', @include)             . join (' --include=', '', @include)
            . " --define=m4_warnings=$m4_warnings"  
661             . ' --debug=aflq'             . ' --debug=aflq'
662             . (!exists $ENV{'AUTOM4TE_NO_FATAL'} ? ' --fatal-warning' : '')             . (!exists $ENV{'AUTOM4TE_NO_FATAL'} ? ' --fatal-warning' : '')
663             . " --error-output=$tcache" . $req->id . "t"             . " --error-output=$tcache" . $req->id . "t"
# Line 805  sub handle_output ($$) Line 788  sub handle_output ($$)
788    # This is unsatisfying but...    # This is unsatisfying but...
789    my $prohibited = '\b(' . join ('|', keys %prohibited) . ')\b';    my $prohibited = '\b(' . join ('|', keys %prohibited) . ')\b';
790    my $file = new Autom4te::XFile ($ARGV[$#ARGV]);    my $file = new Autom4te::XFile ($ARGV[$#ARGV]);
791    $exit_status = 1;    $exit_code = 1;
792    
793    while ($_ = $file->getline)    while ($_ = $file->getline)
794      {      {
# Line 1207  verbose "$me: the trace request object i Line 1190  verbose "$me: the trace request object i
1190  handle_m4 ($req, keys %{$req->macro})  handle_m4 ($req, keys %{$req->macro})
1191    if $force || ! $req->valid;    if $force || ! $req->valid;
1192    
1193    # Issue the warnings each time autom4te was run.
1194    handle_traces ($req, "$tmp/warnings",
1195                   ('m4_warn' => "\$1::\$f:\$l::\$2\n\n"));
1196    for (split (/\n{2,}/, contents ("$tmp/warnings")))
1197    {
1198      my ($cat, $loc, $msg) = split '::';
1199      msg $cat, $loc, "warning: $msg";
1200    }
1201    
1202  # Now output...  # Now output...
1203  if (%trace)  if (%trace)
1204    {    {
# Line 1225  else Line 1217  else
1217        if mtime ($output) < mtime ($ocache . $req->id);        if mtime ($output) < mtime ($ocache . $req->id);
1218    }    }
1219    
1220  # If all went fine, the cache is valid.  # If we ran up to here, the cache is valid.
1221  $req->valid (1)  $req->valid (1);
   if $exit_status == 0;  
   
1222  Request->save ($icache_file);  Request->save ($icache_file);
1223    
1224  exit $exit_status;  exit $exit_code;
1225    
1226  ### Setup "GNU" style for perl-mode and cperl-mode.  ### Setup "GNU" style for perl-mode and cperl-mode.
1227  ## Local Variables:  ## Local Variables:

Legend:
Removed from v.1.85  
changed lines
  Added in v.1.86

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