2001-06-14 Tom Tromey <tromey@redhat.com>
authorTom Tromey <tromey@redhat.com>
Fri, 15 Jun 2001 00:41:29 +0000 (00:41 +0000)
committerTom Tromey <tromey@redhat.com>
Fri, 15 Jun 2001 00:41:29 +0000 (00:41 +0000)
* aclocal.in (scan_m4_files): Removed unused variable.

2001-06-14  Alexandre Duret-Lutz  <duret_g@epita.fr>

* aclocal.in (scan_m4_files): Tweak the building of &search so
that multiple macro names can be found on the same line.  Ensure
we match whole macro name, not only substrings.

ChangeLog
aclocal.in

index b56a7f0..4101907 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2001-06-14  Tom Tromey  <tromey@redhat.com>
+
+       * aclocal.in (scan_m4_files): Removed unused variable.
+
+2001-06-14  Alexandre Duret-Lutz  <duret_g@epita.fr>
+
+       * aclocal.in (scan_m4_files): Tweak the building of &search so
+       that multiple macro names can be found on the same line.  Ensure
+       we match whole macro name, not only substrings.
+
 2001-06-12  Tom Tromey  <tromey@redhat.com>
 
        * automake.texi (ANSI): Minor clarification.
index 5d3f785..7879806 100644 (file)
@@ -304,7 +304,7 @@ sub scan_m4_files
     {
        opendir (DIR, $m4dir)
            || die "aclocal: couldn't open directory `$m4dir': $!\n";
-       local ($file, $fullfile, $expr);
+       local ($file, $fullfile);
        foreach $file (sort grep (! /^\./, readdir (DIR)))
        {
            # Only examine .m4 files.
@@ -322,17 +322,17 @@ sub scan_m4_files
     # Construct a new function that does the searching.  We use a
     # function (instead of just evalling $search in the loop) so that
     # "die" is correctly and easily propagated if run.
-    local ($search, $expr, $key) = '';
-    foreach $key (reverse sort keys %map)
+    my $search = "sub search {\nmy \$found = 0;\n";
+    foreach my $key (reverse sort keys %map)
     {
        # EXPR is a regexp matching the name of the macro.
-       ($expr = $key) =~ s/(\W)/\\$1/g;
-       $search .= ("if (/" . $expr . "/) { & add_macro (" . $key
-                   . "); return 1; }\n");
+       (my $expr = $key) =~ s/(\W)/\\$1/g;
+       $search .= ('if (/\b' . $key . '\b/) { & add_macro (' . $key
+                   . '); $found = 1; }' . "\n");
     }
-    $search .= "return 0;\n";
-    eval 'sub search { ' . $search . '};';
-    die "internal error: $@\n search is $search " if $@;
+    $search .= "return \$found;\n};\n";
+    eval $search;
+    die "internal error: $@\n search is $search" if $@;
 }
 
 ################################################################