389 |
The environment variable \`WARNINGS\' is honored. |
The environment variable \`WARNINGS\' is honored. |
390 |
|
|
391 |
Library directories: |
Library directories: |
392 |
-I, --include=DIR look for FILES in DIR (cumulative) |
-B, --prepend-include=DIR prepend directory DIR to search path |
393 |
|
-I, --include=DIR append directory DIR to search path |
394 |
|
|
395 |
Tracing: |
Tracing: |
396 |
-t, --trace=MACRO report the MACRO invocations |
-t, --trace=MACRO report the MACRO invocations |
485 |
|
|
486 |
# Process the arguments for real this time. |
# Process the arguments for real this time. |
487 |
my @trace; |
my @trace; |
488 |
|
my @prepend_include; |
489 |
|
my $include_envvar; |
490 |
|
my @site_macro_subdirs; |
491 |
getopt |
getopt |
492 |
( |
( |
493 |
# Operation modes: |
# Operation modes: |
497 |
"M|melt" => \$melt, |
"M|melt" => \$melt, |
498 |
|
|
499 |
# Library directories: |
# Library directories: |
500 |
|
"B|prepend-include=s" => \@prepend_include, |
501 |
"I|include=s" => \@include, |
"I|include=s" => \@include, |
502 |
|
"include-envvar=s" => \$include_envvar, |
503 |
|
"site-macro-subdir=s" => \@site_macro_subdirs, |
504 |
|
|
505 |
# Tracing: |
# Tracing: |
506 |
# Using a hash for traces is seducing. Unfortunately, upon `-t FOO', |
# Using a hash for traces is seducing. Unfortunately, upon `-t FOO', |
528 |
$melt = 1 |
$melt = 1 |
529 |
if $freeze; |
if $freeze; |
530 |
|
|
531 |
|
# Add directories from the appropriate env var to the include path. |
532 |
|
@include = (@include, split(/:/, $ENV{$include_envvar})) |
533 |
|
if defined($include_envvar) && exists($ENV{$include_envvar}); |
534 |
|
|
535 |
|
# Also add the site macro directory, if applicable. |
536 |
|
map { @include = (@include, "@SITE_MACRO_DIR@/$_"); } @site_macro_subdirs |
537 |
|
if ('@SITE_MACRO_DIR@' ne 'no') && @site_macro_subdirs; |
538 |
|
|
539 |
# Normalize the includes: the first occurrence is enough, several is |
# Normalize the includes: the first occurrence is enough, several is |
540 |
# a pain since it introduces a useless difference in the path which |
# a pain since it introduces a useless difference in the path which |
541 |
# invalidates the cache. And strip `.' which is implicit and always |
# invalidates the cache. And strip `.' which is implicit and always |
542 |
# first. |
# first. |
543 |
@include = grep { !/^\.$/ } uniq (@include); |
@include = grep { !/^\.$/ } uniq (reverse(@prepend_include), @include); |
544 |
|
|
545 |
# Convert @trace to %trace, and work around the M4 builtins tracing |
# Convert @trace to %trace, and work around the M4 builtins tracing |
546 |
# problem. |
# problem. |
614 |
# |
# |
615 |
# Neutralize its stdin, so that GNU M4 1.5 doesn't neutralize SIGINT. |
# Neutralize its stdin, so that GNU M4 1.5 doesn't neutralize SIGINT. |
616 |
# |
# |
|
# Be extremely cautious to reverse the includes when talking to M4: |
|
|
# it doesn't speak the same --include as we do. |
|
|
# |
|
617 |
# We don't output directly to the cache files, to avoid problems |
# We don't output directly to the cache files, to avoid problems |
618 |
# when we are interrupted (that leaves corrupted files). |
# when we are interrupted (that leaves corrupted files). |
619 |
my $command = ("$m4" |
my $command = ("$m4" |
620 |
. join (' --include=', '', reverse @include) |
. join (' --include=', '', @include) |
621 |
. " --define=m4_warnings=$m4_warnings" |
. " --define=m4_warnings=$m4_warnings" |
622 |
. ' --debug=aflq' |
. ' --debug=aflq' |
623 |
. " --error-output=$tcache" . $req->id . "t" |
. " --error-output=$tcache" . $req->id . "t" |
1068 |
# output but comments and empty lines. |
# output but comments and empty lines. |
1069 |
my $command = ("$m4" |
my $command = ("$m4" |
1070 |
. ' --fatal-warning' |
. ' --fatal-warning' |
1071 |
. join (' --include=', '', reverse @include) |
. join (' --include=', '', @include) |
1072 |
. ' --define=divert' |
. ' --define=divert' |
1073 |
. " @ARGV" |
. " @ARGV" |
1074 |
. ' </dev/null'); |
. ' </dev/null'); |
1091 |
# or an improper paren etc. |
# or an improper paren etc. |
1092 |
$command = ("$m4" |
$command = ("$m4" |
1093 |
. ' --fatal-warning' |
. ' --fatal-warning' |
1094 |
. join (' --include=', '', reverse @include) |
. join (' --include=', '', @include) |
1095 |
. " --freeze-state=$output" |
. " --freeze-state=$output" |
1096 |
. " @ARGV" |
. " @ARGV" |
1097 |
. ' </dev/null'); |
. ' </dev/null'); |