automake
[Top][All Lists]
Advanced

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

comment handling in aclocal ... bug or feature ?


From: Mike Frysinger
Subject: comment handling in aclocal ... bug or feature ?
Date: Thu, 16 Mar 2006 19:04:29 -0500
User-agent: KMail/1.9.1

we hit a bunch of bugs in Gentoo because the dgs package installs a 
path_dps.m4 file with a ton of helpful comments explaining how to use it ... 
one such snippet looks like:

dnl   [2] Put follwoing codes in the acinclude.m4
dnl       include(path_dps.m4)
dnl   [3] Add path_dps.m4 to EXTRA_DIST in the Makefile.am at the directory .

the trouble is that aclocal finds the 'include(path_dps.m4)' file and then 
tries to include it resulting in something like:
$ aclocal-1.9
/usr/share/aclocal/path_dps.m4:172: file `path_dps.m4' does not exist

ive attached a patch which updates the comment handling in a few places under 
the assumption that the behavior i'm seeing is a bug :)
-mike
2006-03-16  Mike Frysinger  <address@hidden>

        * aclocal.in (scan_configure_dep): Ignore ## lines.
        (scan_file): Remove dnl and # comments.
        * tests/commen11.test: New file.
        * tests/Makefile.am (TESTS): Add commen11.test.

--- aclocal.in
+++ aclocal.in
@@ -345,6 +345,8 @@ sub scan_configure_dep ($)
   foreach (split ("\n", $contents))
     {
       ++$line;
+      # Ignore `##' lines.
+      next if /^##/;
       # Remove comments from current line.
       s/\bdnl\b.*$//;
       s/\#.*$//;
@@ -434,6 +436,9 @@ sub scan_file ($$$)
     {
       # Ignore `##' lines.
       next if /^##/;
+      # Remove comments from current line.
+      s/\bdnl\b.*$//;
+      s/\#.*$//;
 
       $contents .= $_;
       my $line = $_;
--- tests/commen11.test
+++ tests/commen11.test
@@ -0,0 +1,30 @@
+#! /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 include() commands in comments are ignored by aclocal.
+# Report from Mike Frysinger.
+
+. ./defs || exit 1
+
+set -e
+
+echo 'dnl include(__some_really_bogus_nonexistent_file__.m4)' > configure.ac
+
+$ACLOCAL
--- tests/Makefile.am
+++ tests/Makefile.am
@@ -102,6 +102,7 @@ comment7.test \
 comment8.test \
 comment9.test \
 commen10.test \
+commen11.test \
 compile.test \
 compile_f90_c_cxx.test \
 compile_f_c_cxx.test \

reply via email to

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