/[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.67 by roth, Tue Jul 30 00:42:58 2002 UTC revision 1.68 by akim, Thu Aug 29 08:03:10 2002 UTC
# Line 278  my $freeze = 0; Line 278  my $freeze = 0;
278  # $M4.  # $M4.
279  my $m4 = $ENV{"M4"} || '@M4@';  my $m4 = $ENV{"M4"} || '@M4@';
280  # Some non-GNU m4's don't reject the --help option, so give them /dev/null.  # Some non-GNU m4's don't reject the --help option, so give them /dev/null.
281  die "$me: need GNU m4 1.4 or later: $m4\n"  error "need GNU m4 1.4 or later: $m4"
282    if system "$m4 --help </dev/null 2>&1 | grep reload-state >/dev/null";    if system "$m4 --help </dev/null 2>&1 | grep reload-state >/dev/null";
283    
284  # Set some high recursion limit as the default limit, 250, has already  # Set some high recursion limit as the default limit, 250, has already
# Line 443  sub load_configuration () Line 443  sub load_configuration ()
443          }          }
444        elsif ($type eq 'end-language:')        elsif ($type eq 'end-language:')
445          {          {
446            die "$me: $autom4te_cfg:$.: end-language mismatch: $lang\n"            error "$autom4te_cfg:$.: end-language mismatch: $lang"
447              if $lang ne lc $words[0];              if $lang ne lc $words[0];
448          }          }
449        elsif ($type eq 'args:')        elsif ($type eq 'args:')
# Line 452  sub load_configuration () Line 452  sub load_configuration ()
452          }          }
453        else        else
454          {          {
455            die "$me: $autom4te_cfg:$.: unknown directive: $type\n";            error "$autom4te_cfg:$.: unknown directive: $type";
456          }          }
457      }      }
458  }  }
# Line 477  sub parse_args () Line 477  sub parse_args ()
477    
478      foreach (@language)      foreach (@language)
479        {        {
480          die "$me: unknown language: $_\n"          error "unknown language: $_"
481            unless exists $language{lc $_};            unless exists $language{lc $_};
482          unshift @ARGV, @{$language{lc $_}};          unshift @ARGV, @{$language{lc $_}};
483        }        }
# Line 510  sub parse_args () Line 510  sub parse_args ()
510       "F|freeze"  => \$freeze,       "F|freeze"  => \$freeze,
511      );      );
512    
513    die "$me: too few arguments    error "too few arguments
514  Try `$me --help' for more information.\n"  Try `$me --help' for more information."
515      unless @ARGV;      unless @ARGV;
516    
517    # Freezing:    # Freezing:
# Line 519  Try `$me --help' for more information.\n Line 519  Try `$me --help' for more information.\n
519    # And it implies melting: there is risk not to update properly using    # And it implies melting: there is risk not to update properly using
520    # old frozen files, and worse yet: we could load a frozen file and    # old frozen files, and worse yet: we could load a frozen file and
521    # refreeze it!  A sort of caching :)    # refreeze it!  A sort of caching :)
522    die "$me: cannot freeze and trace\n"    error "cannot freeze and trace"
523      if $freeze && @trace;      if $freeze && @trace;
524    $melt = 1    $melt = 1
525      if $freeze;      if $freeze;
# Line 612  sub handle_m4 ($@) Line 612  sub handle_m4 ($@)
612    #    #
613    # We don't output directly to the cache files, to avoid problems    # We don't output directly to the cache files, to avoid problems
614    # when we are interrupted (that leaves corrupted files).    # when we are interrupted (that leaves corrupted files).
615    my $command = ("$m4"    xsystem ("$m4"
616                   . join (' --include=', '', @include)             . join (' --include=', '', @include)
617                   . " --define=m4_warnings=$m4_warnings"             . " --define=m4_warnings=$m4_warnings"
618                   . ' --debug=aflq'             . ' --debug=aflq'
619                   . " --error-output=$tcache" . $req->id . "t"             . " --error-output=$tcache" . $req->id . "t"
620                   . join (' --trace=',   '', sort @macro)             . join (' --trace=',   '', sort @macro)
621                   . " @ARGV"             . " @ARGV"
622                   . ' </dev/null'             . ' </dev/null'
623                   . " >$ocache" . $req->id . "t");             . " >$ocache" . $req->id . "t");
   verbose "running: $command";  
   system $command;  
   if ($?)  
     {  
       verbose "$m4: failed with exit status: " . ($? >> 8) . "\n";  
       exit $? >> 8;  
     }  
624    
625    # Everything went ok: preserve the outputs.    # Everything went ok: preserve the outputs.
626    foreach my $file (map { $_ . $req->id } ($tcache, $ocache))    foreach my $file (map { $_ . $req->id } ($tcache, $ocache))
627      {      {
628        use File::Copy;        use File::Copy;
629        move ("${file}t", "$file")        move ("${file}t", "$file")
630          or die "$me: cannot not rename ${file}t as $file: $!\n";          or error "cannot not rename ${file}t as $file: $!";
631      }      }
632  }  }
633    
# Line 710  sub handle_output ($$) Line 703  sub handle_output ($$)
703      {      {
704        $out->open($output, O_CREAT | O_WRONLY | O_TRUNC, oct ($mode));        $out->open($output, O_CREAT | O_WRONLY | O_TRUNC, oct ($mode));
705      }      }
706    die "$me: cannot create $output: $!\n"    error "cannot create $output: $!"
707      unless $out;      unless $out;
708    my $in = new Autom4te::XFile ($ocache . $req->id);    my $in = new Autom4te::XFile ($ocache . $req->id);
709    
# Line 837  sub trace_format_to_m4 ($) Line 830  sub trace_format_to_m4 ($)
830          }          }
831        elsif (/^(\$.)/)        elsif (/^(\$.)/)
832          {          {
833            die "$me: invalid escape: $1\n";            error "invalid escape: $1";
834          }          }
835        else        else
836          {          {
# Line 1062  sub freeze ($) Line 1055  sub freeze ($)
1055    
1056    # When processing the file with diversion disabled, there must be no    # When processing the file with diversion disabled, there must be no
1057    # output but comments and empty lines.    # output but comments and empty lines.
1058    my $command = ("$m4"    my $result = xqx ("$m4"
1059                   . ' --fatal-warning'                      . ' --fatal-warning'
1060                   . join (' --include=', '', @include)                      . join (' --include=', '', @include)
1061                   . ' --define=divert'                      . ' --define=divert'
1062                   . " @ARGV"                      . " @ARGV"
1063                   . ' </dev/null');                      . ' </dev/null');
   verbose "running: $command";  
   my $result = `$command`;  
1064    $result =~ s/#.*\n//g;    $result =~ s/#.*\n//g;
1065    $result =~ s/^\n//mg;    $result =~ s/^\n//mg;
   if ($?)  
     {  
       verbose "$m4: failed with exit status: " . ($? >> 8) . "\n";  
       exit $? >> 8;  
     }  
1066    if ($result)    if ($result)
1067      {      {
1068        print STDERR "$me: freezing produced output:\n$result";        print STDERR "$me: freezing produced output:\n$result";
# Line 1085  sub freeze ($) Line 1071  sub freeze ($)
1071    
1072    # If freezing produces output, something went wrong: a bad `divert',    # If freezing produces output, something went wrong: a bad `divert',
1073    # or an improper paren etc.    # or an improper paren etc.
1074    $command = ("$m4"    xsystem ("$m4"
1075                . ' --fatal-warning'             . ' --fatal-warning'
1076                . join (' --include=', '', @include)             . join (' --include=', '', @include)
1077                . " --freeze-state=$output"             . " --freeze-state=$output"
1078                . " @ARGV"             . " @ARGV"
1079                . ' </dev/null');             . ' </dev/null');
   verbose "running: $command";  
   system $command;  
   if ($?)  
     {  
       verbose "$m4: failed with exit status: " . ($? >> 8) . "\n";  
       exit $? >> 8;  
     }  
1080  }  }
1081    
1082  ## -------------- ##  ## -------------- ##
# Line 1119  if ($freeze) Line 1098  if ($freeze)
1098  if (! -d "$cache")  if (! -d "$cache")
1099    {    {
1100      mkdir "$cache", 0755      mkdir "$cache", 0755
1101        or die "$me: cannot create $cache: $!\n";        or error "cannot create $cache: $!";
1102    }    }
1103    
1104  # Read the cache index if available and older than autom4te itself.  # Read the cache index if available and older than autom4te itself.

Legend:
Removed from v.1.67  
changed lines
  Added in v.1.68

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