419 |
## ---------- ## |
## ---------- ## |
420 |
|
|
421 |
|
|
422 |
|
# $OPTION |
423 |
|
# files_to_options (@FILE) |
424 |
|
# ------------------------ |
425 |
|
# Transform Autom4te conventions (e.g., using foo.m4f to designate a frozen |
426 |
|
# file) into a suitable command line for M4 (e.g., using --reload-state). |
427 |
|
sub files_to_options (@) |
428 |
|
{ |
429 |
|
my (@file) = @_; |
430 |
|
my @res; |
431 |
|
foreach my $file (@file) |
432 |
|
{ |
433 |
|
if ($file =~ /\.m4f$/) |
434 |
|
{ |
435 |
|
push @res, "--reload-state=$file"; |
436 |
|
} |
437 |
|
else |
438 |
|
{ |
439 |
|
push @res, $file; |
440 |
|
} |
441 |
|
} |
442 |
|
return join ' ', @res; |
443 |
|
} |
444 |
|
|
445 |
|
|
446 |
# load_configuration () |
# load_configuration () |
447 |
# --------------------- |
# --------------------- |
448 |
# Load the configuration file. |
# Load the configuration file. |
586 |
my $file = find_file ("$_?", @include); |
my $file = find_file ("$_?", @include); |
587 |
if (!$melt && $file) |
if (!$melt && $file) |
588 |
{ |
{ |
589 |
@argv = ("--reload-state=$file"); |
@argv = ($file); |
590 |
} |
} |
591 |
else |
else |
592 |
{ |
{ |
634 |
. ' --debug=aflq' |
. ' --debug=aflq' |
635 |
. " --error-output=$tcache" . $req->id . "t" |
. " --error-output=$tcache" . $req->id . "t" |
636 |
. join (' --trace=', '', sort @macro) |
. join (' --trace=', '', sort @macro) |
637 |
. " @ARGV" |
. " " . files_to_options (@ARGV) |
638 |
. ' </dev/null' |
. ' </dev/null' |
639 |
. " >$ocache" . $req->id . "t"); |
. " >$ocache" . $req->id . "t"); |
640 |
|
|
1052 |
('include' => '$1', |
('include' => '$1', |
1053 |
'm4_include' => '$1')); |
'm4_include' => '$1')); |
1054 |
my $deps = new Autom4te::XFile ("$tmp/dependencies"); |
my $deps = new Autom4te::XFile ("$tmp/dependencies"); |
1055 |
push @dep, map { chomp; find_file ($_, @include) } $deps->getlines; |
while ($_ = $deps->getline) |
1056 |
|
{ |
1057 |
|
chomp; |
1058 |
|
my $file = find_file ("$_?", @include); |
1059 |
|
# If a file which used to be included is no longer there, then |
1060 |
|
# don't say it's missing (it might no longer be included). But |
1061 |
|
# of course, that cause the output to be outdated (as if the |
1062 |
|
# time stamp of that missing file was newer). |
1063 |
|
return 0 |
1064 |
|
if ! $file; |
1065 |
|
push @dep, $file; |
1066 |
|
} |
1067 |
|
|
1068 |
# If $FILE is younger than one of its dependencies, it is outdated. |
# If $FILE is younger than one of its dependencies, it is outdated. |
1069 |
return up_to_date_p ($file, @dep); |
return up_to_date_p ($file, @dep); |
1086 |
. ' --fatal-warning' |
. ' --fatal-warning' |
1087 |
. join (' --include=', '', @include) |
. join (' --include=', '', @include) |
1088 |
. ' --define=divert' |
. ' --define=divert' |
1089 |
. " @ARGV" |
. " " . files_to_options (@ARGV) |
1090 |
. ' </dev/null'); |
. ' </dev/null'); |
1091 |
$result =~ s/#.*\n//g; |
$result =~ s/#.*\n//g; |
1092 |
$result =~ s/^\n//mg; |
$result =~ s/^\n//mg; |
1093 |
if ($result) |
|
1094 |
{ |
error "freezing produced output:\n$result" |
1095 |
print STDERR "$me: freezing produced output:\n$result"; |
if $result; |
|
exit 1; |
|
|
} |
|
1096 |
|
|
1097 |
# If freezing produces output, something went wrong: a bad `divert', |
# If freezing produces output, something went wrong: a bad `divert', |
1098 |
# or an improper paren etc. |
# or an improper paren etc. |
1100 |
. ' --fatal-warning' |
. ' --fatal-warning' |
1101 |
. join (' --include=', '', @include) |
. join (' --include=', '', @include) |
1102 |
. " --freeze-state=$output" |
. " --freeze-state=$output" |
1103 |
. " @ARGV" |
. " " . files_to_options (@ARGV) |
1104 |
. ' </dev/null'); |
. ' </dev/null'); |
1105 |
} |
} |
1106 |
|
|
1137 |
'path' => \@include, |
'path' => \@include, |
1138 |
'macro' => [keys %trace, @preselect]); |
'macro' => [keys %trace, @preselect]); |
1139 |
|
|
1140 |
# If $REQ's cache files are not up to date, declare it invalid. |
# If $REQ's cache files are not up to date, or simply if the user |
1141 |
|
# discarded them (-f), declare it invalid. |
1142 |
$req->valid (0) |
$req->valid (0) |
1143 |
if ! up_to_date ($req); |
if $force || ! up_to_date ($req); |
1144 |
|
|
1145 |
# We now know whether we can trust the Request object. Say it. |
# We now know whether we can trust the Request object. Say it. |
1146 |
if ($verbose) |
verbose "$me: the trace request object is:\n" . $req->marshall; |
|
{ |
|
|
print STDERR "$me: the trace request object is:\n"; |
|
|
print STDERR $req->marshall; |
|
|
} |
|
1147 |
|
|
1148 |
# We need to run M4 if (i) the users wants it (--force), (ii) $REQ is |
# We need to run M4 if (i) the users wants it (--force), (ii) $REQ is |
1149 |
# invalid. |
# invalid. |