[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: comment handling in aclocal ... bug or feature ?
From: |
Alexandre Duret-Lutz |
Subject: |
Re: comment handling in aclocal ... bug or feature ? |
Date: |
Sun, 26 Mar 2006 09:51:33 +0200 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (gnu/linux) |
>>> "MF" == Mike Frysinger <address@hidden> writes:
MF> we hit a bunch of bugs in Gentoo because the dgs package installs a
MF> path_dps.m4 file with a ton of helpful comments explaining how to use it
...
MF> one such snippet looks like:
MF> dnl [2] Put follwoing codes in the acinclude.m4
MF> dnl include(path_dps.m4)
MF> dnl [3] Add path_dps.m4 to EXTRA_DIST in the Makefile.am at the
directory .
MF> the trouble is that aclocal finds the 'include(path_dps.m4)' file and then
MF> tries to include it resulting in something like:
MF> $ aclocal-1.9
MF> /usr/share/aclocal/path_dps.m4:172: file `path_dps.m4' does not exist
This is bogus in more than one way: `include' is not interpreted
by autoconf (has been disabled since version 1.3) so aclocal
shouldn't even scan for it.
I'm installing the following patch.
2006-03-25 Mike Frysinger <address@hidden> (tiny change)
Alexandre Duret-Lutz <address@hidden>
* aclocal.in ($m4_include_rx): Do not recognize `include', and
adjust scan_configure_dep and scan_file accordingly.
(scan_configure_dep): Do not search white lines.
(scan_file): Strip comments from current line after checking
for serial, so that aclocal does not trip on `m4_include' macros
in comments. Report from Mike Frysinger.
* tests/acloca21.test: New file.
* tests/Makefile.am (TESTS): Add it.
Index: THANKS
===================================================================
RCS file: /cvs/automake/automake/THANKS,v
retrieving revision 1.277
diff -u -r1.277 THANKS
--- THANKS 21 Mar 2006 19:09:21 -0000 1.277
+++ THANKS 26 Mar 2006 07:39:18 -0000
@@ -174,6 +174,7 @@
Michael Brantley address@hidden
Michel de Ruiter address@hidden
Mike Castle address@hidden
+Mike Frysinger address@hidden
Mike Nolta address@hidden
Miles Bader address@hidden
Miloslav Trmac address@hidden
Index: aclocal.in
===================================================================
RCS file: /cvs/automake/automake/aclocal.in,v
retrieving revision 1.136
diff -u -r1.136 aclocal.in
--- aclocal.in 21 Mar 2006 19:09:21 -0000 1.136
+++ aclocal.in 26 Mar 2006 07:39:18 -0000
@@ -134,10 +134,10 @@
# Matches an AC_REQUIRE line.
my $ac_require_rx = "AC_REQUIRE\\((?:\\[([^]]+)\\]|([^],)\n]+))\\)";
-# Matches an m4_include line
-my $m4_include_rx = "(?:m4_)?(s?)include\\((?:\\[([^]]+)\\]|([^],)\n]+))\\)";
+# Matches an m4_include line.
+my $m4_include_rx = "(m4_|m4_s|s)include\\((?:\\[([^]]+)\\]|([^],)\n]+))\\)";
-# Match a serial number
+# Match a serial number.
my $serial_line_rx = '^#\s*serial\s+(\S*)';
my $serial_number_rx = '^\d+(?:\.\d+)*$';
@@ -348,12 +348,14 @@
# Remove comments from current line.
s/\bdnl\b.*$//;
s/\#.*$//;
+ # Avoid running all the following regexes on white lines.
+ next if /^\s*$/;
while (/$m4_include_rx/go)
{
my $ifile = $2 || $3;
# Skip missing `sinclude'd files.
- next if $1 eq 's' && ! -f $ifile;
+ next if $1 ne 'm4_' && ! -f $ifile;
push @ilist, $ifile;
}
@@ -486,6 +488,11 @@
}
}
+ # Remove comments from current line.
+ # Do not do it earlier, because the serial line is a comment.
+ $line =~ s/\bdnl\b.*$//;
+ $line =~ s/\#.*$//;
+
while ($line =~ /$ac_defun_rx/go)
{
$defun_seen = 1;
@@ -528,7 +535,7 @@
{
my $ifile = $2 || $3;
# Skip missing `sinclude'd files.
- next if $1 eq 's' && ! -f $ifile;
+ next if $1 ne 'm4_' && ! -f $ifile;
push (@inc_files, $ifile);
$inc_lines{$ifile} = $.;
}
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.598
diff -u -r1.598 Makefile.am
--- tests/Makefile.am 21 Mar 2006 19:09:21 -0000 1.598
+++ tests/Makefile.am 26 Mar 2006 07:39:19 -0000
@@ -23,6 +23,7 @@
acloca18.test \
acloca19.test \
acloca20.test \
+acloca21.test \
acoutnoq.test \
acoutpt.test \
acoutpt2.test \
Index: tests/acloca21.test
===================================================================
RCS file: tests/acloca21.test
diff -N tests/acloca21.test
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/acloca21.test 26 Mar 2006 07:39:19 -0000
@@ -0,0 +1,36 @@
+#! /bin/sh
+# Copyright (C) 2006 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 Automake; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# Make sure aclocal ignores include() commands in comments.
+# Report from Mike Frysinger.
+# Also make sure aclocal does not think 'include' is
+# an Autoconf macro.
+
+. ./defs || exit 1
+
+set -e
+
+cat >>configure.in <<EOF
+dnl m4_include(__some_really_bogus_nonexistent_file__.m4)
+ # m4_include(__some_really_bogus_nonexistent_file__.m4)
+## m4_include(__some_really_bogus_nonexistent_file__.m4)
+echo 'include(foobar)' is OK
+EOF
+$ACLOCAL
--
Alexandre Duret-Lutz
Shared books are happy books. http://www.bookcrossing.com/friend/gadl