>>> "Tom" == Tom Epperly <[EMAIL PROTECTED]> writes:
Tom> Tamara L Dahlgren wrote: >> In trying to integrate F90/F95 macros into our acinclude.m4 file, I've >> encountered problems with aclocal's parsing. In particular aclocal does >> not parse the F90 or F95 preprocessor or compiler macros (i.e., >> AC_LANG_PREPROC(Fortran 90), AC_LANG_COMPILER(Fortran 90), >> AC_LANG_PREPROC(Fortran 95), AC_LANG_COMPILER(Fortran 95)). Tom> The F90/F95 macros we're putting in acinclude.m4 are based on Tom> autoconf's rules for Fortran 77. Here are the excerpts from Tom> acinclude.m4 that seem to cause problems when using aclocal. Thanks for the report. I'm installing the following patch on HEAD and branch-1-7 (so it will be in Automake 1.7.1). Please let me know if you try this change and find it's not enough. 2002-10-12 Alexandre Duret-Lutz <[EMAIL PROTECTED]> * 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. Index: THANKS =================================================================== RCS file: /cvs/automake/automake/THANKS,v retrieving revision 1.191 diff -u -r1.191 THANKS --- THANKS 10 Oct 2002 17:37:37 -0000 1.191 +++ THANKS 12 Oct 2002 21:13:31 -0000 @@ -181,6 +181,7 @@ Shigio Yamaguchi [EMAIL PROTECTED] Steve M. Robbins [EMAIL PROTECTED] Sven Verdoolaege [EMAIL PROTECTED] +Tamara L. Dahlgren [EMAIL PROTECTED] Tatu Ylonen [EMAIL PROTECTED] The Crimson Binome [EMAIL PROTECTED] Thien-Thi Nguyen [EMAIL PROTECTED] @@ -190,6 +191,7 @@ Tim Goodwin [EMAIL PROTECTED] Tim Mooney [EMAIL PROTECTED] Tim Van Holder [EMAIL PROTECTED] +Tom Epperly [EMAIL PROTECTED] Ulrich Drepper [EMAIL PROTECTED] Vadim Zeitlin [EMAIL PROTECTED] Werner Koch [EMAIL PROTECTED] Index: aclocal.in =================================================================== RCS file: /cvs/automake/automake/aclocal.in,v retrieving revision 1.76 diff -u -r1.76 aclocal.in --- aclocal.in 15 Sep 2002 20:34:14 -0000 1.76 +++ aclocal.in 12 Oct 2002 21:13:32 -0000 @@ -80,10 +80,16 @@ $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 @@ 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 @@ if (/$ac_require_rx/g) { - push (@rlist, $1); + push (@rlist, $1 || $2); } # The search function is constructed dynamically by @@ -401,9 +405,9 @@ 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: tests/Makefile.am =================================================================== RCS file: /cvs/automake/automake/tests/Makefile.am,v retrieving revision 1.449 diff -u -r1.449 Makefile.am --- tests/Makefile.am 10 Oct 2002 18:22:07 -0000 1.449 +++ tests/Makefile.am 12 Oct 2002 21:13:32 -0000 @@ -6,6 +6,7 @@ acinclude.test \ aclibobj.test \ aclocal.test \ +aclocal2.test \ aclocali.test \ aclocali1.test \ aclocalii.test \ Index: tests/Makefile.in =================================================================== RCS file: /cvs/automake/automake/tests/Makefile.in,v retrieving revision 1.584 diff -u -r1.584 Makefile.in --- tests/Makefile.in 10 Oct 2002 18:22:07 -0000 1.584 +++ tests/Makefile.in 12 Oct 2002 21:13:34 -0000 @@ -98,6 +98,7 @@ acinclude.test \ aclibobj.test \ aclocal.test \ +aclocal2.test \ aclocali.test \ aclocali1.test \ aclocalii.test \ Index: tests/aclocal2.test =================================================================== RCS file: tests/aclocal2.test diff -N tests/aclocal2.test --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/aclocal2.test 12 Oct 2002 21:13:34 -0000 @@ -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 -- Alexandre Duret-Lutz