[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
53-fyi-autoscan-makefile-tokens.patch
From: |
Akim Demaille |
Subject: |
53-fyi-autoscan-makefile-tokens.patch |
Date: |
Mon, 26 Nov 2001 11:49:49 +0100 |
Index: ChangeLog
from Akim Demaille <address@hidden>
* bin/autoscan.in (&scan_c_file, &scan_sh_file, &scan_makefile):
Remove $filepath, useless.
(&scan_makefile): Don't remove the $(FOO), ${FOO} and @FOO@
variables, they are really part of the tokens.
Split the input line on spaces and then look for tokens.
Now autoscan ceases to ask for AC_PROG_LEX for the package Bison
because of `lex$U.$(OBJEXT)'.
(&scan_files): Use "@list" instead of join.
* doc/Makefile.am (CLEANFILES): Add *.fns.
Index: bin/autoscan.in
--- bin/autoscan.in Sat, 24 Nov 2001 22:36:44 +0100 akim
+++ bin/autoscan.in Sun, 25 Nov 2001 10:45:33 +0100 akim
@@ -207,8 +207,7 @@ sub used ($$;$)
sub scan_c_file ($)
{
my ($filename) = @_;
- my $filepath = $File::Find::name;
- push (@cfiles, $filepath);
+ push @cfiles, $File::Find::name;
# Nonzero if in a multiline comment.
my $in_comment = 0;
@@ -279,33 +278,36 @@ sub scan_c_file ($)
sub scan_makefile ($)
{
my ($filename) = @_;
- my $filepath = $File::Find::name;
- push (@makefiles, $filepath);
+ push @makefiles, $File::Find::name;
my $file = new Autom4te::XFile "<$filename";
while ($_ = $file->getline)
{
- # Strip out comments and variable references.
+ # Strip out comments.
s/#.*//;
- s/\$\([^\)]*\)//g;
- s/\${[^\}]*}//g;
- s/@address@hidden@//g;
# Variable assignments.
while (s/\b([a-zA-Z_]\w*)\s*=/ /)
{
used ('makevars', $1);
}
- # Libraries.
- while (s/\B-l([a-zA-Z_]\w*)\b/ /)
- {
- used ('libraries', $1);
- }
- # Tokens in the code.
- while (s/(?<![-\w.])([a-zA-Z_][\w+.-]+)/ /)
+ # Be sure to catch a whole word. For instance `lex$U.$(OBJEXT)'
+ # is a single token. Otherwise we might believe `lex' is needed.
+ foreach my $word (split (/\s+/))
{
- used ('programs', $1);
+ # Libraries.
+ if ($word =~ /^-l([a-zA-Z_]\w*)$/)
+ {
+ used ('libraries', $1);
+ }
+ # Tokens in the code.
+ # We allow some additional characters, e.g., `+', since
+ # autoscan/programs includes `c++'.
+ if ($word =~ /^[a-zA-Z_][\w+]*$/)
+ {
+ used ('programs', $word);
+ }
}
}
@@ -318,8 +320,7 @@ sub scan_makefile ($)
sub scan_sh_file ($)
{
my ($filename) = @_;
- my $filepath = $File::Find::name;
- push (@shfiles, $filepath);
+ push @shfiles, $File::Find::name;
my $file = new Autom4te::XFile "<$filename";
@@ -390,9 +391,9 @@ sub scan_files ()
if ($verbose)
{
- print "cfiles:", join(" ", @cfiles), "\n";
- print "makefiles:", join(" ", @makefiles), "\n";
- print "shfiles:", join(" ", @shfiles), "\n";
+ print "cfiles: @cfiles\n";
+ print "makefiles: @makefiles\n";
+ print "shfiles: @shfiles\n";
foreach my $kind (@kinds)
{
@@ -595,7 +596,8 @@ sub check_configure_ac ($)
{
check_configure_ac ($configure_ac);
}
-
+# This close is really needed. For some reason, probably best named
+# a bug, it seems that the dtor of $LOG is not called automatically
+# at END. It results in a truncated file.
$log->close;
-
exit 0;
Index: doc/Makefile.am
--- doc/Makefile.am Fri, 24 Aug 2001 08:01:11 +0200 akim
+++ doc/Makefile.am Sun, 25 Nov 2001 10:31:12 +0100 akim
@@ -29,7 +29,8 @@
# Files from texi2dvi that should be removed, but which Automake does
# not know.
CLEANFILES = autoconf.acs autoconf.cvs autoconf.mss autoconf.prs \
- autoconf.ats autoconf.evs autoconf.ovs autoconf.tmp \
+ autoconf.ats autoconf.evs autoconf.fns autoconf.ovs \
+ autoconf.tmp \
autoconf*.html standards*.html \
autoconf*.pdf standards*.pdf
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- 53-fyi-autoscan-makefile-tokens.patch,
Akim Demaille <=