automake
[Top][All Lists]
Advanced

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

Re: comment handling in aclocal ... bug or feature ?


From: Mike Frysinger
Subject: Re: comment handling in aclocal ... bug or feature ?
Date: Sat, 18 Mar 2006 01:37:06 -0500
User-agent: KMail/1.9.1

On Thursday 16 March 2006 19:04, Mike Frysinger wrote:
> 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 :)

ok, previous patch was a little too aggressive ... it'd keep '#' comments from 
being output to the file file which in turn breaks things nicely.  patch 
attached chops comments just before they get checked but after they get 
queued for output.

this is my first time hacking on automake code so please bear with me ;)
-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/\#.*$//;
@@ -436,6 +438,11 @@ sub scan_file ($$$)
       next if /^##/;
 
       $contents .= $_;
+
+      # Remove comments from current line.
+      s/\bdnl\b.*$//;
+      s/\#.*$//;
+
       my $line = $_;
 
       if ($line =~ /$serial_line_rx/go)
--- tests/commen11.test
+++ tests/commen11.test
@@ -0,0 +1,33 @@
+#! /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 > configure.ac
+echo 'dnl include(__some_really_bogus_nonexistent_file__.m4)' >> configure.ac
+echo '  # include(__some_really_bogus_nonexistent_file__.m4)' >> configure.ac
+echo '##  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]