From b92504fc837e4cb4a367ac39908398af34c5ca6b Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Fri, 2 Jan 2004 15:55:17 +0000 Subject: [PATCH] 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. --- ChangeLog | 9 ++++++++- aclocal.in | 10 ++++++++- tests/Makefile.am | 1 + tests/Makefile.in | 1 + tests/acloca15.test | 49 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 68 insertions(+), 2 deletions(-) create mode 100755 tests/acloca15.test diff --git a/ChangeLog b/ChangeLog index 2df55d9df..2d11700ed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2004-01-02 Alexandre Duret-Lutz + 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. + * aclocal.in (%file_includes): New variable. (scan_configure_dep): Compile $m4_include_rx and $ac_require_rx once. (scan_file): Scan for included files, and process these files @@ -9,7 +16,7 @@ (strip_redundant_includes): New function. (trace_used_macros): Call it. (write_aclocal): Likewise. Also check the mtime of included files. - * tests/Makfile.am (TESTS): Add acloca14.test. + * tests/Makefile.am (TESTS): Add acloca14.test. * tests/acloca14.test: New file. Report from Phil Edwards. diff --git a/aclocal.in b/aclocal.in index c5541ab3d..68dd58c86 100644 --- a/aclocal.in +++ b/aclocal.in @@ -127,12 +127,17 @@ sub scan_m4_files (@) { 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 @@ sub trace_used_macros () 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 @@ sub write_aclocal ($@) 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) { diff --git a/tests/Makefile.am b/tests/Makefile.am index 0be4b2dc6..d82c33b4f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -17,6 +17,7 @@ acloca11.test \ acloca12.test \ acloca13.test \ acloca14.test \ +acloca15.test \ acoutnoq.test \ acoutpt.test \ acoutpt2.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 5292f6d98..fcab5fcdb 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -131,6 +131,7 @@ acloca11.test \ acloca12.test \ acloca13.test \ acloca14.test \ +acloca15.test \ acoutnoq.test \ acoutpt.test \ acoutpt2.test \ diff --git a/tests/acloca15.test b/tests/acloca15.test new file mode 100755 index 000000000..3a4c8bcb6 --- /dev/null +++ b/tests/acloca15.test @@ -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` -- 2.47.2