From ccb01d2dc65269517749c323a03e75843bb5407b Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Sat, 12 Oct 2002 21:19:28 +0000 Subject: [PATCH] * 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. --- ChangeLog | 13 +++++++++++++ THANKS | 2 ++ aclocal.in | 22 +++++++++++++--------- tests/Makefile.am | 1 + tests/Makefile.in | 1 + tests/aclocal2.test | 45 +++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 75 insertions(+), 9 deletions(-) create mode 100755 tests/aclocal2.test diff --git a/ChangeLog b/ChangeLog index 2cd15244..82aa56a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2002-10-12 Alexandre Duret-Lutz + + * 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 For Debian Bug#153697: diff --git a/THANKS b/THANKS index 897889b3..cfcf9aaf 100644 --- 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 diff --git a/aclocal.in b/aclocal.in index 5148422d..9de50f73 100644 --- a/aclocal.in +++ b/aclocal.in @@ -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]+))\\)"; @@ -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 diff --git a/tests/Makefile.am b/tests/Makefile.am index 0b460a53..760eedb4 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -6,6 +6,7 @@ TESTS = \ acinclude.test \ aclibobj.test \ aclocal.test \ +aclocal2.test \ aclocali.test \ aclocali1.test \ aclocalii.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 624ea0ff..058c4aaa 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -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 index 00000000..f2b38bba --- /dev/null +++ b/tests/aclocal2.test @@ -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 <acinclude.m4 <>configure.in <stderr +cat stderr +grep AM_LANG_PREPROC stderr && exit 1 +$FGREP 'AC_DEFUN([AM_LANG_PREPROC(Fortran 90)' aclocal.m4 -- 2.43.5