* aclocal.in (ac_defun_rx, ac_require_rx): If the macro name is
authorAlexandre Duret-Lutz <adl@gnu.org>
Sat, 12 Oct 2002 21:19:29 +0000 (21:19 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Sat, 12 Oct 2002 21:19:29 +0000 (21:19 +0000)
quoted, accept any character but `]'.  This makes it possible
to define macros such as `AC_LANG_PREPROC(Fortran 90)'.
(scan_m4_files): Quote $key in the regex.  Don't define $expr, it's
not used.
(add_file, scan_file): Adjust to the new definitions of $ac_defun_rx
and $ac_require_rx.
* tests/aclocal2.test: New file.
* tests/Makefile.am (TESTS): Add aclocal2.test.
Reported by Tamara L. Dahlgren and Tom Epperly.

ChangeLog
THANKS
aclocal.in
tests/Makefile.am
tests/Makefile.in
tests/aclocal2.test [new file with mode: 0755]

index 2cd1524..82aa56a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2002-10-12  Alexandre Duret-Lutz  <adl@gnu.org>
+
+       * aclocal.in (ac_defun_rx, ac_require_rx): If the macro name is
+       quoted, accept any character but `]'.  This makes it possible
+       to define macros such as `AC_LANG_PREPROC(Fortran 90)'.
+       (scan_m4_files): Quote $key in the regex.  Don't define $expr, it's
+       not used.
+       (add_file, scan_file): Adjust to the new definitions of $ac_defun_rx
+       and $ac_require_rx.
+       * tests/aclocal2.test: New file.
+       * tests/Makefile.am (TESTS): Add aclocal2.test.
+       Reported by Tamara L. Dahlgren and Tom Epperly.
+
 2002-10-11  Alexandre Duret-Lutz  <adl@gnu.org>
 
        For Debian Bug#153697:
diff --git a/THANKS b/THANKS
index 897889b..cfcf9aa 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -181,6 +181,7 @@ Shuhei Amakawa              sa264@cam.ac.uk
 Shigio Yamaguchi       shigio@tamacom.com
 Steve M. Robbins       steve@nyongwa.montreal.qc.ca
 Sven Verdoolaege       skimo@kotnet.org
+Tamara L. Dahlgren     dahlgren1@llnl.gov
 Tatu Ylonen            ylo@ssh.fi
 The Crimson Binome     steve@nyongwa.montreal.qc.ca
 Thien-Thi Nguyen       ttn@glug.org
@@ -190,6 +191,7 @@ Thomas Tanner               tanner@ffii.org
 Tim Goodwin            tjg@star.le.ac.uk
 Tim Mooney             mooney@dogbert.cc.ndsu.NoDak.edu
 Tim Van Holder         tim.van.holder@pandora.be
+Tom Epperly            tepperly@llnl.gov
 Ulrich Drepper         drepper@gnu.ai.mit.edu
 Vadim Zeitlin          Vadim.zeitlin@dptmaths.ens-cachan.fr
 Werner Koch            wk@isil.d.shuttle.de
index 5148422..9de50f7 100644 (file)
@@ -80,10 +80,16 @@ $output_file = 'aclocal.m4';
 $verbose = 0;
 
 # Matches a macro definition.
-$ac_defun_rx = "A[CU]_DEFUN\\(\\[?([^],)\n]+)\\]?";
+#   AC_DEFUN([macroname], ...)
+# or
+#   AC_DEFUN(macroname, ...)
+# When macroname is `['-quoted , we accept any character in the name,
+# except `]'.  Otherwise macroname stops on the first `]', `,', `)',
+# or `\n' encountered.
+$ac_defun_rx = "A[CU]_DEFUN\\((?:\\[([^]]+)\\]|([^],)\n]+))";
 
 # Matches an AC_REQUIRE line.
-$ac_require_rx = "AC_REQUIRE\\(\\[?([^])]*)\\]?\\)";
+$ac_require_rx = "AC_REQUIRE\\((?:\\[([^]]+)\\]|([^],)\n]+))\\)";
 
 \f
 
@@ -310,10 +316,8 @@ sub scan_m4_files (@)
     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.
-       (my $expr = $key) =~ s/(\W)/\\$1/g;
-       $search .= ('if (/\b' . $key . '\b/) { & add_macro (' . $key
-                   . '); $found = 1; }' . "\n");
+       $search .= ('if (/\b\Q' . $key . '\E(?!\w)/) { & add_macro ("' . $key
+                   . '"); $found = 1; }' . "\n");
     }
     $search .= "return \$found;\n};\n";
     eval $search;
@@ -363,7 +367,7 @@ sub add_file ($)
 
        if (/$ac_require_rx/g)
        {
-           push (@rlist, $1);
+           push (@rlist, $1 || $2);
        }
 
        # The search function is constructed dynamically by
@@ -401,9 +405,9 @@ sub scan_file ($)
 
        if (/$ac_defun_rx/)
        {
-           if (! defined $map{$1})
+           if (! defined $map{$1 || $2})
            {
-               $map{$1} = $file;
+               $map{$1 || $2} = $file;
            }
 
            # Note: we used to give an error here if we saw a
index 0b460a5..760eedb 100644 (file)
@@ -6,6 +6,7 @@ TESTS = \
 acinclude.test \
 aclibobj.test \
 aclocal.test \
+aclocal2.test \
 aclocali.test \
 aclocali1.test \
 aclocalii.test \
index 624ea0f..058c4aa 100644 (file)
@@ -98,6 +98,7 @@ TESTS = \
 acinclude.test \
 aclibobj.test \
 aclocal.test \
+aclocal2.test \
 aclocali.test \
 aclocali1.test \
 aclocalii.test \
diff --git a/tests/aclocal2.test b/tests/aclocal2.test
new file mode 100755 (executable)
index 0000000..f2b38bb
--- /dev/null
@@ -0,0 +1,45 @@
+#! /bin/sh
+# Copyright (C) 2002  Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with autoconf; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Make sure aclocal works with macro that have parentheses in their
+# name.  Report from Tamara L. Dahlgren and Tom Epperly.
+
+. ./defs || exit 1
+
+set -e
+
+mkdir m4
+cat >m4/f90.m4 <<EOF
+AC_DEFUN([AM_LANG_PREPROC(Fortran 90)], [...something...])
+EOF
+
+cat >acinclude.m4 <<EOF
+AC_DEFUN([AM_FUBAR],
+[AC_REQUIRE([AM_LANG_PREPROC(Fortran 90)])])
+EOF
+
+cat >>configure.in <<EOF
+AM_FUBAR
+EOF
+
+$ACLOCAL -I m4 2>stderr
+cat stderr
+grep AM_LANG_PREPROC stderr && exit 1
+$FGREP 'AC_DEFUN([AM_LANG_PREPROC(Fortran 90)' aclocal.m4