automake-patches
[Top][All Lists]
Advanced

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

FYI: fix PR/319 (aclocal should scan configure.ac for AC_DEFUN)


From: Alexandre Duret-Lutz
Subject: FYI: fix PR/319 (aclocal should scan configure.ac for AC_DEFUN)
Date: Fri, 02 Jan 2004 16:55:09 +0100
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

I've just realized that PR/319 was now easy to fix.

I'm installing this on HEAD and branch-1-8.

2004-01-02  Alexandre Duret-Lutz  <address@hidden>

        Fix for PR automake/319:
        * aclocal.in (scan_m4_files): Scan configure.ac.
        (trace_used_macros, write_aclocal): Remove configure.ac from the
        list of files to include.
        * tests/Makefile.am (TESTS): Add acloca15.test.
        * tests/acloca15.test: New file.

Index: aclocal.in
===================================================================
RCS file: /cvs/automake/automake/aclocal.in,v
retrieving revision 1.98
diff -u -r1.98 aclocal.in
--- aclocal.in  2 Jan 2004 14:53:48 -0000       1.98
+++ aclocal.in  2 Jan 2004 15:47:44 -0000
@@ -127,12 +127,17 @@
 {
     local (@dirlist) = @_;
 
-    # First, scan acinclude.m4 if it exists.
+    # First, scan configure.ac.  It may contain macro definitions,
+    # or may include other files that define macros.
+    &scan_file ($configure_ac);
+
+    # Then, scan acinclude.m4 if it exists.
     if (-f 'acinclude.m4')
     {
        &scan_file ('acinclude.m4');
     }
 
+    # Finally, scan all files in our search path.
     local ($m4dir);
     foreach $m4dir (@dirlist)
     {
@@ -378,6 +383,8 @@
   my %files = map { $map{$_} => 1 } keys %macro_seen;
   $files{'acinclude.m4'} = 1 if -f 'acinclude.m4';
   %files = strip_redundant_includes %files;
+  # configure.ac is implicitly included.
+  delete $files{$configure_ac};
 
   my $traces = ($ENV{AUTOM4TE} || 'autom4te');
   $traces .= " --language Autoconf-without-aclocal-m4 ";
@@ -424,6 +431,7 @@
   my %files = map { $map{$_} => 1 } @macros;
   $files{'acinclude.m4'} = 1 if -f 'acinclude.m4';
   %files = strip_redundant_includes %files;
+  delete $files{$configure_ac};
 
   for $file (grep { exists $files{$_} } @file_order)
     {
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.540
diff -u -r1.540 Makefile.am
--- tests/Makefile.am   2 Jan 2004 14:53:48 -0000       1.540
+++ tests/Makefile.am   2 Jan 2004 15:47:44 -0000
@@ -17,6 +17,7 @@
 acloca12.test \
 acloca13.test \
 acloca14.test \
+acloca15.test \
 acoutnoq.test \
 acoutpt.test \
 acoutpt2.test \
Index: tests/acloca15.test
===================================================================
RCS file: tests/acloca15.test
diff -N tests/acloca15.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/acloca15.test 2 Jan 2004 15:47:44 -0000
@@ -0,0 +1,49 @@
+#! /bin/sh
+# Copyright (C) 2004  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., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Make sure aclocal scans configure.in for macro definitions.
+# PR/319.
+
+. ./defs || exit 1
+
+set -e
+
+# Start macros with AM_ because that causes aclocal to complain if it
+# cannot find them.
+
+cat >> configure.in << 'END'
+m4_include([somedef.m4])
+AC_DEFUN([AM_SOME_MACRO])
+AC_DEFUN([AM_SOME_OTHER_MACRO])
+AM_SOME_MACRO
+AM_SOME_OTHER_MACRO
+AM_MORE_MACRO
+END
+
+mkdir m4
+echo 'AC_DEFUN([AM_SOME_MACRO])' > m4/some.m4
+echo 'AC_DEFUN([AM_SOME_DEF])' > somedef.m4
+echo 'AC_DEFUN([AM_MORE_MACRO], [AC_REQUIRE([AM_SOME_DEF])])' > m4/more.m4
+
+$ACLOCAL -I m4
+$FGREP AM_SOME_MACRO aclocal.m4 && exit 1
+$FGREP AM_MORE_MACRO aclocal.m4 && exit 1
+$FGREP 'm4_include([m4/more.m4])' aclocal.m4
+test 1 = `grep m4_include aclocal.m4 | wc -l`

-- 
Alexandre Duret-Lutz





reply via email to

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