123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074 |
- eval 'case $# in 0) exec /usr/bin/env perl -S "$0";; *) exec /usr/bin/env perl -S "$0" "$@";; esac'
- if 0;
- BEGIN
- {
- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '/opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/linux-devkit/sysroots/x86_64-arago-linux/usr/share/autoconf';
- unshift @INC, $pkgdatadir;
-
-
-
-
- $ENV{'SHELL'} = '/bin/sh' if ($^O eq 'dos');
- }
- use Autom4te::C4che;
- use Autom4te::ChannelDefs;
- use Autom4te::Channels;
- use Autom4te::FileUtils;
- use Autom4te::General;
- use Autom4te::XFile;
- use File::Basename;
- use strict;
- my $pkgdatadir = $ENV{'AC_MACRODIR'} || '/opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/linux-devkit/sysroots/x86_64-arago-linux/usr/share/autoconf';
- my %language;
- my $output = '-';
- my $mode = "0666";
- my $melt = 0;
- my $cache;
- my $icache;
- my $tcache;
- my $ocache;
- my $icache_file;
- my $flock_implemented = 'yes';
- my %trace;
- my @preselect = ('include',
- 'm4_pattern_allow', 'm4_pattern_forbid',
- '_m4_warn');
- my @include;
- my $freeze = 0;
- my $m4 = $ENV{"M4"} || 'm4';
- fatal "need GNU m4 1.4 or later: $m4"
- if system "$m4 --help </dev/null 2>&1 | grep reload-state >/dev/null";
- $m4 .= ' --nesting-limit=1024'
- if " $m4 " !~ / (--nesting-limit(=[0-9]+)?|-L[0-9]*) /;
- my @m4_builtin = `echo dumpdef | $m4 2>&1 >/dev/null`;
- map { s/:.*//;s/\W// } @m4_builtin;
- my %m4_builtin_alternate_name;
- @m4_builtin_alternate_name{"$_", "m4_$_"} = ("m4_$_", "$_")
- foreach (grep { !/m4wrap|m4exit|dnl|ifelse|__.*__/ } @m4_builtin);
- @m4_builtin_alternate_name{"ifelse", "m4_if"} = ("m4_if", "ifelse");
- @m4_builtin_alternate_name{"m4exit", "m4_exit"} = ("m4_exit", "m4exit");
- @m4_builtin_alternate_name{"m4wrap", "m4_wrap"} = ("m4_wrap", "m4wrap");
- $help = "Usage: $0 [OPTION]... [FILES]
- Run GNU M4 on the FILES, avoiding useless runs. Output the traces if tracing,
- the frozen file if freezing, otherwise the expansion of the FILES.
- If some of the FILES are named \`FILE.m4f\' they are considered to be M4
- frozen files of all the previous files (which are therefore not loaded).
- If \`FILE.m4f\' is not found, then \`FILE.m4\' will be used, together with
- all the previous files.
- Some files may be optional, i.e., will only be processed if found in the
- include path, but then must end in \`.m4?\'; the question mark is not part of
- the actual file name.
- Operation modes:
- -h, --help print this help, then exit
- -V, --version print version number, then exit
- -v, --verbose verbosely report processing
- -d, --debug don\'t remove temporary files
- -o, --output=FILE save output in FILE (defaults to \`-\', stdout)
- -f, --force don\'t rely on cached values
- -W, --warnings=CATEGORY report the warnings falling in CATEGORY
- -l, --language=LANG specify the set of M4 macros to use
- -C, --cache=DIRECTORY preserve results for future runs in DIRECTORY
- --no-cache disable the cache
- -m, --mode=OCTAL change the non trace output file mode (0666)
- -M, --melt don\'t use M4 frozen files
- Languages include:
- \`Autoconf\' create Autoconf configure scripts
- \`Autotest\' create Autotest test suites
- \`M4sh\' create M4sh shell scripts
- \`M4sugar\' create M4sugar output
- " . Autom4te::ChannelDefs::usage . "
- The environment variables \`M4\' and \`WARNINGS\' are honored.
- Library directories:
- -B, --prepend-include=DIR prepend directory DIR to search path
- -I, --include=DIR append directory DIR to search path
- Tracing:
- -t, --trace=MACRO[:FORMAT] report the MACRO invocations
- -p, --preselect=MACRO prepare to trace MACRO in a future run
- Freezing:
- -F, --freeze produce an M4 frozen state file for FILES
- FORMAT defaults to \`\$f:\$l:\$n:\$%\', and can use the following escapes:
- \$\$ literal \$
- \$f file where macro was called
- \$l line where macro was called
- \$d nesting depth of macro call
- \$n name of the macro
- \$NUM argument NUM, unquoted and with newlines
- \$SEP\@ all arguments, with newlines, quoted, and separated by SEP
- \$SEP* all arguments, with newlines, unquoted, and separated by SEP
- \$SEP% all arguments, without newlines, unquoted, and separated by SEP
- SEP can be empty for the default (comma for \@ and *, colon for %),
- a single character for that character, or {STRING} to use a string.
- Report bugs to <bug-autoconf\@gnu.org>.
- GNU Autoconf home page: <http://www.gnu.org/software/autoconf/>.
- General help using GNU software: <http://www.gnu.org/gethelp/>.
- ";
- $version = <<"EOF";
- autom4te (GNU Autoconf) 2.69
- Copyright (C) 2012 Free Software Foundation, Inc.
- License GPLv3+/Autoconf: GNU GPL version 3 or later
- <http://gnu.org/licenses/gpl.html>, <http://gnu.org/licenses/exceptions.html>
- This is free software: you are free to change and redistribute it.
- There is NO WARRANTY, to the extent permitted by law.
- Written by Akim Demaille.
- EOF
- ## ---------- ##
- ## Routines. ##
- ## ---------- ##
- # $OPTION
- # files_to_options (@FILE)
- # ------------------------
- # Transform Autom4te conventions (e.g., using foo.m4f to designate a frozen
- # file) into a suitable command line for M4 (e.g., using --reload-state).
- # parse_args guarantees that we will see at most one frozen file, and that
- # if a frozen file is present, it is the first argument.
- sub files_to_options (@)
- {
- my (@file) = @_;
- my @res;
- foreach my $file (@file)
- {
- my $arg = shell_quote ($file);
- if ($file =~ /\.m4f$/)
- {
- $arg = "--reload-state=$arg";
-
-
-
-
- $arg .= " --undefine=__m4_version__"
- unless grep {/__m4_version__/} @m4_builtin;
- }
- push @res, $arg;
- }
- return join ' ', @res;
- }
- sub load_configuration ($)
- {
- my ($file) = @_;
- use Text::ParseWords;
- my $cfg = new Autom4te::XFile ("< " . open_quote ($file));
- my $lang;
- while ($_ = $cfg->getline)
- {
- chomp;
-
- next
- if /^\s*(\
- my @words = shellwords ($_);
- my $type = shift @words;
- if ($type eq 'begin-language:')
- {
- fatal "$file:$.: end-language missing for: $lang"
- if defined $lang;
- $lang = lc $words[0];
- }
- elsif ($type eq 'end-language:')
- {
- error "$file:$.: end-language mismatch: $lang"
- if $lang ne lc $words[0];
- $lang = undef;
- }
- elsif ($type eq 'args:')
- {
- fatal "$file:$.: no current language"
- unless defined $lang;
- push @{$language{$lang}}, @words;
- }
- else
- {
- error "$file:$.: unknown directive: $type";
- }
- }
- }
- sub parse_args ()
- {
-
-
-
-
-
- my @language;
- do {
- @language = ();
- use Getopt::Long;
- Getopt::Long::Configure ("pass_through", "permute");
- GetOptions ("l|language=s" => \@language);
- foreach (@language)
- {
- error "unknown language: $_"
- unless exists $language{lc $_};
- unshift @ARGV, @{$language{lc $_}};
- }
- } while @language;
-
- if (exists $ENV{'AUTOM4TE_DEBUG'})
- {
- print STDERR "$me: concrete arguments:\n";
- foreach my $arg (@ARGV)
- {
- print STDERR "| $arg\n";
- }
- }
-
- my @trace;
- my @prepend_include;
- parse_WARNINGS;
- getopt
- (
-
- "o|output=s" => \$output,
- "W|warnings=s" => \&parse_warnings,
- "m|mode=s" => \$mode,
- "M|melt" => \$melt,
-
- "B|prepend-include=s" => \@prepend_include,
- "I|include=s" => \@include,
-
-
-
-
-
- "t|trace=s" => \@trace,
- "p|preselect=s" => \@preselect,
-
- "F|freeze" => \$freeze,
-
- "C|cache=s" => \$cache,
- "no-cache" => sub { $cache = undef; },
- );
- fatal "too few arguments
- Try `$me --help' for more information."
- unless @ARGV;
-
-
-
-
-
- fatal "cannot freeze and trace"
- if $freeze && @trace;
- $melt = 1
- if $freeze;
-
-
-
-
- $cache = $tmp
- unless $cache;
- $icache = "$cache/requests";
- $tcache = "$cache/traces.";
- $ocache = "$cache/output.";
-
-
-
-
- @include = grep { !/^\.$/ } uniq (reverse(@prepend_include), @include);
-
-
-
- foreach (@trace)
- {
- /^([^:]+)(?::(.*))?$/ms;
- $trace{$1} = defined $2 ? $2 : '$f:$l:$n:$%';
- $trace{$m4_builtin_alternate_name{$1}} = $trace{$1}
- if exists $m4_builtin_alternate_name{$1};
- }
-
-
- push (@preselect,
- map { $m4_builtin_alternate_name{$_} }
- grep { exists $m4_builtin_alternate_name{$_} } @preselect);
-
-
-
-
-
-
-
- my @argv;
- foreach (@ARGV)
- {
- if ($_ eq '-')
- {
- push @argv, $_;
- }
- elsif (/\.m4f$/)
- {
-
- my $file = find_file ("$_?", @include);
- if (!$melt && $file)
- {
- @argv = ($file);
- }
- else
- {
- s/\.m4f$/.m4/;
- push @argv, find_file ($_, @include);
- }
- }
- else
- {
- my $file = find_file ($_, @include);
- push @argv, $file
- if $file;
- }
- }
- @ARGV = @argv;
- }
- sub handle_m4 ($@)
- {
- my ($req, @macro) = @_;
-
- unlink ($tcache . $req->id . "t");
-
-
-
-
- xsystem ("$m4 --gnu"
- . join (' --include=', '', map { shell_quote ($_) } @include)
- . ' --debug=aflq'
- . (!exists $ENV{'AUTOM4TE_NO_FATAL'} ? ' --fatal-warning' : '')
- . " --debugfile=" . shell_quote ("$tcache" . $req->id . "t")
- . join (' --trace=', '', map { shell_quote ($_) } sort @macro)
- . " " . files_to_options (@ARGV)
- . " > " . shell_quote ("$ocache" . $req->id . "t"));
-
- foreach my $file (map { $_ . $req->id } ($tcache, $ocache))
- {
- use File::Copy;
- move ("${file}t", "$file")
- or fatal "cannot rename ${file}t as $file: $!";
- }
- }
- my $first_warn_forbidden = 1;
- sub warn_forbidden ($$%)
- {
- my ($where, $word, %forbidden) = @_;
- my $message;
- for my $re (sort keys %forbidden)
- {
- if ($word =~ $re)
- {
- $message = $forbidden{$re};
- last;
- }
- }
- $message ||= "possibly undefined macro: $word";
- warn "$where: error: $message\n";
- if ($first_warn_forbidden)
- {
- warn <<EOF;
- If this token and others are legitimate, please use m4_pattern_allow.
- See the Autoconf documentation.
- EOF
- $first_warn_forbidden = 0;
- }
- }
- sub handle_output ($$)
- {
- my ($req, $output) = @_;
- verb "creating $output";
-
- handle_traces ($req, "$tmp/patterns",
- ('m4_pattern_forbid' => 'forbid:$1:$2',
- 'm4_pattern_allow' => 'allow:$1'));
- my @patterns = new Autom4te::XFile ("< " . open_quote ("$tmp/patterns"))->getlines;
- chomp @patterns;
- my %forbidden =
- map { /^forbid:([^:]+):.+$/ => /^forbid:[^:]+:(.+)$/ } @patterns;
- my $forbidden = join ('|', map { /^forbid:([^:]+)/ } @patterns) || "^\$";
- my $allowed = join ('|', map { /^allow:([^:]+)/ } @patterns) || "^\$";
- verb "forbidden tokens: $forbidden";
- verb "forbidden token : $_ => $forbidden{$_}"
- foreach (sort keys %forbidden);
- verb "allowed tokens: $allowed";
-
-
-
-
- my $out = new Autom4te::XFile;
- if ($output eq '-')
- {
- $out->open (">$output");
- }
- else
- {
- $out->open($output, O_CREAT | O_WRONLY | O_TRUNC, oct ($mode));
- }
- fatal "cannot create $output: $!"
- unless $out;
- my $in = new Autom4te::XFile ("< " . open_quote ($ocache . $req->id));
- my %prohibited;
- my $res;
- while ($_ = $in->getline)
- {
- s/\s+$//;
- s/__oline__/$./g;
- s/\@<:\@/[/g;
- s/\@:>\@/]/g;
- s/\@\{:\@/(/g;
- s/\@:\}\@/)/g;
- s/\@S\|\@/\$/g;
- s/\@%:\@/#/g;
- $res = $_;
-
-
- s/\
- unless /^\
- foreach (split (/\W+/))
- {
- $prohibited{$_} = $.
- if !/^$/ && /$forbidden/o && !/$allowed/o && ! exists $prohibited{$_};
- }
-
- $res =~ s/\@&t\@//g;
- print $out "$res\n";
- }
- $out->close();
-
- return
- if ! %prohibited;
-
-
- $exit_code = 1;
- if ($ARGV[$#ARGV] ne '-')
- {
- my $prohibited = '\b(' . join ('|', keys %prohibited) . ')\b';
- my $file = new Autom4te::XFile ("< " . open_quote ($ARGV[$#ARGV]));
- while ($_ = $file->getline)
- {
-
-
- s/\
- unless /^\
-
- while (/$prohibited/)
- {
- my $word = $1;
- warn_forbidden ("$ARGV[$#ARGV]:$.", $word, %forbidden);
- delete $prohibited{$word};
-
- return
- if ! %prohibited;
- $prohibited = '\b(' . join ('|', keys %prohibited) . ')\b';
- }
- }
- }
- warn_forbidden ("$output:$prohibited{$_}", $_, %forbidden)
- foreach (sort { $prohibited{$a} <=> $prohibited{$b} } keys %prohibited);
- }
- sub trace_format_to_m4 ($)
- {
- my ($format) = @_;
- my $underscore = $_;
- my %escape = (
- 'f' => '$1',
-
- 'l' => '$2',
-
- 'd' => '$3',
-
- 'n' => '$4',
-
- '$' => '$');
- my $res = '';
- $_ = $format;
- while ($_)
- {
-
- if (s/^\$(\d+)//)
- {
- $res .= "\$" . ($1 + 4);
- }
-
- elsif (s/^\$([fldn\$])//)
- {
- $res .= $escape{$1};
- }
-
- elsif (s/^\$\{([^}]*)\}([@*%])//
- || s/^\$(.?)([@*%])//)
- {
-
- if ($2 eq '@')
- {
- $res .= ']at_at([' . ($1 ? $1 : ',') . '], $@)[';
- }
-
- elsif ($2 eq '*')
- {
- $res .= ']at_star([' . ($1 ? $1 : ',') . '], $@)[';
- }
-
- elsif ($2 eq '%')
- {
- $res .= ']at_percent([' . ($1 ? $1 : ':') . '], $@)[';
- }
- }
- elsif (/^(\$.)/)
- {
- error "invalid escape: $1";
- }
- else
- {
- s/^([^\$]+)//;
- $res .= $1;
- }
- }
- $_ = $underscore;
- return '[[' . $res . ']]';
- }
- sub handle_traces ($$%)
- {
- my ($req, $output, %trace) = @_;
- verb "formatting traces for `$output': " . join (', ', sort keys %trace);
-
- my $trace_m4 = new Autom4te::XFile ("> " . open_quote ("$tmp/traces.m4"));
- $_ = <<'EOF';
- divert(-1)
- changequote([, ])
-
-
-
-
-
-
-
-
- define([_at_at],
- [at_ifelse([$#], [1], [],
- [$#], [2], [[[$2]]],
- [[[$2]][$1]$0([$1], at_shift(at_shift($@)))])])
- define([_at_percent],
- [at_ifelse([$#], [1], [],
- [$#], [2], [at_flatten([$2])],
- [at_flatten([$2])[$1]$0([$1], at_shift(at_shift($@)))])])
- define([_at_star],
- [at_ifelse([$#], [1], [],
- [$#], [2], [[$2]],
- [[$2][$1]$0([$1], at_shift(at_shift($@)))])])
-
-
-
- define([at_flatten],
- [at_patsubst(at_patsubst([[[$1]]], [\\\n]), [[\n\t ]+], [ ])])
- define([at_args], [at_shift(at_shift(at_shift(at_shift(at_shift($@)))))])
- define([at_at], [_$0([$1], at_args($@))])
- define([at_percent], [_$0([$1], at_args($@))])
- define([at_star], [_$0([$1], at_args($@))])
- EOF
- s/^ //mg;s/\\t/\t/mg;s/\\n/\n/mg;
- print $trace_m4 $_;
-
-
-
-
-
-
-
-
- print $trace_m4 "# Copy the builtins.\n";
- map { print $trace_m4 "define([at_$_], defn([$_]))\n" } @m4_builtin;
- print $trace_m4 "\n";
- print $trace_m4 "# Disable them.\n";
- map { print $trace_m4 "at_undefine([$_])\n" } @m4_builtin;
- print $trace_m4 "\n";
-
- print $trace_m4
- "## -------------------------------------- ##\n",
- "## By default neutralize all the traces. ##\n",
- "## -------------------------------------- ##\n",
- "\n";
- print $trace_m4 "at_define([AT_$_], [at_dnl])\n"
- foreach (sort keys %{$req->macro});
- print $trace_m4 "\n";
-
- print $trace_m4
- "## ------------------------- ##\n",
- "## Trace processing macros. ##\n",
- "## ------------------------- ##\n",
- "\n";
- foreach (sort keys %trace)
- {
-
- (my $comment = "Trace $_:$trace{$_}") =~ s/^/\# /;
- print $trace_m4 "$comment\n";
- print $trace_m4 "at_define([AT_$_],\n";
- print $trace_m4 trace_format_to_m4 ($trace{$_}) . ")\n\n";
- }
- print $trace_m4 "\n";
-
- print $trace_m4 "at_divert(0)at_dnl\n";
-
-
-
-
-
-
-
-
-
-
-
- my $traces = new Autom4te::XFile ("< " . open_quote ($tcache . $req->id));
- while ($_ = $traces->getline)
- {
-
-
-
- s{^m4trace:(.+):(\d+): -(\d+)- ([^(]+)\((.*)$}
- {AT_$4([$1], [$2], [$3], [$4], $5};
-
- s{^m4trace:(.+):(\d+): -(\d+)- ([^)]*)\n$}
- {AT_$4([$1], [$2], [$3], [$4])\n};
- print $trace_m4 "$_";
- }
- $trace_m4->close;
- my $in = new Autom4te::XFile ("$m4 " . shell_quote ("$tmp/traces.m4") . " |");
- my $out = new Autom4te::XFile ("> " . open_quote ($output));
-
-
-
- while ($_ = $in->getline)
- {
-
- s/\@<:\@/[/g;
- s/\@:>\@/]/g;
- s/\@\{:\@/(/g;
- s/\@:\}\@/)/g;
- s/\@S\|\@/\$/g;
- s/\@%:\@/#/g;
- s/\@&t\@//g;
- print $out $_;
- }
- }
- sub up_to_date ($)
- {
- my ($req) = @_;
- return 0
- if ! $req->valid;
- my $tfile = $tcache . $req->id;
- my $ofile = $ocache . $req->id;
-
-
-
- return 0
- if ! -f $tfile || ! -f $ofile;
-
-
- my $tmtime = mtime ($tfile);
- my $omtime = mtime ($ofile);
- my ($file, $mtime) = ($tmtime < $omtime
- ? ($ofile, $omtime) : ($tfile, $tmtime));
-
- my @dep = @ARGV;
-
- if (grep { $_ eq '-' } @dep)
- { return 0 }
-
-
- handle_traces ($req, "$tmp/dependencies",
- ('include' => '$1',
- 'm4_include' => '$1'));
- my $deps = new Autom4te::XFile ("< " . open_quote ("$tmp/dependencies"));
- while ($_ = $deps->getline)
- {
- chomp;
- my $file = find_file ("$_?", @include);
-
-
-
-
- return 0
- if ! $file;
- push @dep, $file;
- }
-
- return up_to_date_p ($file, @dep);
- }
- sub freeze ($)
- {
- my ($output) = @_;
-
-
- my $result = xqx ("$m4"
- . ' --fatal-warning'
- . join (' --include=', '', map { shell_quote ($_) } @include)
- . ' --define=divert'
- . " " . files_to_options (@ARGV)
- . ' </dev/null');
- $result =~ s/#.*\n//g;
- $result =~ s/^\n//mg;
- fatal "freezing produced output:\n$result"
- if $result;
-
-
- xsystem ("$m4"
- . ' --fatal-warning'
- . join (' --include=', '', map { shell_quote ($_) } @include)
- . " --freeze-state=" . shell_quote ($output)
- . " " . files_to_options (@ARGV)
- . ' </dev/null');
- }
- mktmpdir ('am4t');
- load_configuration ($ENV{'AUTOM4TE_CFG'} || "$pkgdatadir/autom4te.cfg");
- load_configuration ("$ENV{'HOME'}/.autom4te.cfg")
- if exists $ENV{'HOME'} && -f "$ENV{'HOME'}/.autom4te.cfg";
- load_configuration (".autom4te.cfg")
- if -f ".autom4te.cfg";
- parse_args;
- if ($freeze)
- {
- freeze ($output);
- exit $exit_code;
- }
- if (! -d "$cache")
- {
- mkdir "$cache", 0755
- or -d "$cache"
- or fatal "cannot create $cache: $!";
- }
- $icache_file = new Autom4te::XFile $icache, O_RDWR|O_CREAT;
- $icache_file->lock (LOCK_EX)
- if ($flock_implemented eq "yes");
- Autom4te::C4che->load ($icache_file)
- if -f $icache && mtime ($icache) > mtime ($0);
- my $req = Autom4te::C4che->request ('input' => \@ARGV,
- 'path' => \@include,
- 'macro' => [keys %trace, @preselect]);
- $req->valid (0)
- if $force || ! up_to_date ($req);
- verb "the trace request object is:\n" . $req->marshall;
- handle_m4 ($req, keys %{$req->macro})
- if $force || ! $req->valid;
- my $separator = "\n" . ('-' x 25) . " END OF WARNING " . ('-' x 25) . "\n\n";
- handle_traces ($req, "$tmp/warnings",
- ('_m4_warn' => "\$1::\$f:\$l::\$2::\$3$separator"));
- for (split (/\n*$separator\n*/o, contents ("$tmp/warnings")))
- {
-
-
-
-
-
-
-
-
- my ($cat, $loc, $msg, $stacktrace) = split ('::', $_, 4);
- msg $cat, $loc, "warning: $msg",
- partial => ($stacktrace =~ /top level$/) + 0;
- for (split /\n/, $stacktrace)
- {
- my ($loc, $trace) = split (': ', $_, 2);
- msg $cat, $loc, $trace, partial => ($trace !~ /top level$/) + 0;
- }
- }
- if (%trace)
- {
-
-
-
-
-
- handle_traces ($req, $output, %trace);
- }
- else
- {
-
-
- handle_output ($req, $output)
- if $force || mtime ($output) < mtime ($ocache . $req->id);
- }
- $req->valid (1);
- Autom4te::C4che->save ($icache_file);
- exit $exit_code;
|