automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

aclocal & multiple macro calls on the same line


From: Alexandre Duret-Lutz
Subject: aclocal & multiple macro calls on the same line
Date: 30 May 2001 11:53:31 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

The following macro

AC_DEFUN([adl_COMPUTE_STANDARD_RELATIVE_PATHS],
## These calls need to be on separate lines for aclocal to work!
[adl_COMPUTE_RELATIVE_PATHS(dnl
adl_STANDARD_RELATIVE_PATH_LIST)])

works around an aclocal limitation.  The problem is that if I use

[adl_COMPUTE_RELATIVE_PATHS(adl_STANDARD_RELATIVE_PATH_LIST)]

aclocal will include only one of the two macros definitions.

Index: ChangeLog
--- ChangeLog
+++ ChangeLog
@@ -1,1 +1,7 @@
+2001-05-30  Alexandre Duret-Lutz  <address@hidden>
+
+       * 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.
+

Index: aclocal.in
===================================================================
RCS file: /cvs/automake/automake/aclocal.in,v
retrieving revision 1.55
diff -u -r1.55 aclocal.in
--- aclocal.in 2001/03/07 18:37:06 1.55
+++ aclocal.in 2001/05/30 09:43:15
@@ -322,17 +322,17 @@
     # 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: address@hidden search is $search " if $@;
+    $search .= "return \$found;\n};\n";
+    eval $search;
+    die "internal error: address@hidden search is $search" if $@;
 }
 
 ################################################################

-- 
Alexandre Duret-Lutz





reply via email to

[Prev in Thread] Current Thread [Next in Thread]