[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RFC: let aclocal output m4_includes for local m4 files
From: |
Alexandre Duret-Lutz |
Subject: |
RFC: let aclocal output m4_includes for local m4 files |
Date: |
Fri, 18 Apr 2003 00:33:59 +0200 |
User-agent: |
Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.2 (gnu/linux) |
[Hi Pavel! I'm CC:ing you because you introduced
ACLOCAL_M4_SOURCES, and this patch marks that variable
as obsolete. Let me know if you disagree.]
>>> "adl" == Alexandre Duret-Lutz <address@hidden> writes:
[...subdirectories do not know the dependencies of aclocal.m4...]
adl> It just occured to me there is a nifty way to fix this. When
adl> aclocal is about to copy a local file (where local means part of
adl> the project), it can just replace it with
adl> m4_include([the_local_file]). Then, there is no reason to
adl> rebuild aclocal.m4 when these files changes: only configure needs
adl> to be rebuilt, but as we keep track of m4_included file that sort
adl> of things already works.
adl> Doing this would
adl> (1) simplify Automake: we no longer have to care about aclocal.m4's
adl> dependencies anymore, i.e., no need to parse ACLOCAL_AMFLAGS
adl> and to glob *.m4 files in included directories (incidentally
adl> this will fix our good old PR/11).
adl> (2) get closer to Akim's plan for getting rid of aclocal and replacing
adl> it with a bunch of m4_includes.
adl> (3) lessen the size of aclocal.m4 (not a big deal, but it's
adl> somewhat satisfactory to have only one copy of each macro
adl> in the package).
Here is a tentative patch for the above.
It looks too easy to be correct :)
It applies on top of the two sibling patches I posted in the
last days (and that I still have not applied, because I'm
waiting from Akim comments, and Akim is on vacation):
http://article.gmane.org/gmane.comp.sysutils.automake.patches/899
http://article.gmane.org/gmane.comp.sysutils.automake.patches/922
Automake's own aclocal.m4 has been reduced to
| # generated automatically by aclocal 1.7a -*- Autoconf -*-
|
| # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
| # Free Software Foundation, Inc.
| # This file is free software; the Free Software Foundation
| # gives unlimited permission to copy and/or distribute it,
| # with or without modifications, as long as this notice is preserved.
|
| # This program is distributed in the hope that it will be useful,
| # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
| # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
| # PARTICULAR PURPOSE.
|
| m4_include([m4/init.m4])
| m4_include([m4/amversion.m4])
| m4_include([m4/options.m4])
| m4_include([m4/sanity.m4])
| m4_include([m4/missing.m4])
| m4_include([m4/auxdir.m4])
| m4_include([m4/install-sh.m4])
| m4_include([m4/strip.m4])
| m4_include([m4/lead-dot.m4])
| m4_include([m4/depend.m4])
| m4_include([m4/depout.m4])
| m4_include([m4/make.m4])
| m4_include([m4/cond.m4])
| m4_include([m4/runlog.m4])
which I find quite neat. (Of course in a real project these
Automake files would not be m4_included since they aren't
local, but you get the idea.)
2003-04-18 Alexandre Duret-Lutz <address@hidden>
* automake.in (scan_aclocal_m4): Do not parse ACLOCAL_AMFLAGS
and glob for m4_files (We've got all local m4 files while
tracing m4_include's). Diagnose ACLOCAL_M4_SOURCES as obsolete.
Distribute aclocal.m4 only at the top-level.
(my_glob): Remove. This fixes PR automake/11.
(handle_dist): Strip leading `./' from directories.
* aclocal.in (add_file): Output 'm4_include([file.m4])' instead
of copying local files.
(write_aclocal, parse_arguments): Bump copyright date.
* configure.in: De not build m4/amversion.m4 from here ...
* m4/Makefile.am ($(srcdir)/amversion.m4): ... do this here.
(nodist_m4data_DATA): Use $(srcdir)/amversion.m4 instead
of amversion.m4.
* tests/Makefile.am (XFAIL_TESTS): Remove aclocal5.test.
(TESTS): Remove aclocal2.test. Do not test aclocal.test twice.
* tests/aclocal2.test: Delete (pointless).
* tests/aclocal5.test: Make sure configure's dependencies are
distributed.
* tests/acinclude.test: Adjust to search for m4_include.
Index: NEWS
===================================================================
RCS file: /home/adl/CVSROOT/LOCAL/HEAD3-20030413-1504/NEWS,v
retrieving revision 1.2
diff -u -r1.2 NEWS
--- NEWS 17 Apr 2003 19:35:49 -0000 1.2
+++ NEWS 17 Apr 2003 20:55:34 -0000
@@ -65,7 +65,8 @@
dealing with non-POSIX ar implementations.
* Any file which is m4_included from configure.ac will appear as
- a configure and Makefile.in dependency.
+ a configure and Makefile.in dependency, and will be automatically
+ distributed.
* The rules for rebuilding Makefiles and Makefile.ins will now rebuild
all Makefiles and all Makefile.ins at once when one of configure's
@@ -82,6 +83,23 @@
were using the CONFIG_STATUS_DEPENDENCIES and CONFIGURE_DEPENDENCIES
(undocumented) variables, you will have to define them in all directories.
This is easily done using an AC_SUBST.
+
+* aclocal will now use `m4_include' instead of copying local m4 files
+ into aclocal.m4. (Local m4 files are those you ship with your
+ project, other files will be copied as usual.)
+
+ Because m4_included files are automatically distributed, it means
+ for most projects there is no point in EXTRA_DISTing the list
+ of m4 files which used. (You can probably get rid of m4/Makefile.am
+ if you had one.)
+
+ Some users where using the undocumented ACLOCAL_M4_SOURCES variable
+ to override the aclocal.m4 dependencies computed (inaccurately) by
+ older versions of Automake; this variable should be considered obsolete
+ and will be flagged as such when running `automake -Wobsolete'.
+ Note that local m4 files are no longer dependencies of aclocal.m4
+ (since it only includes them) but they are dependencies of configure.
+
New in 1.7:
* Autoconf 2.54 is required.
Index: aclocal.in
===================================================================
RCS file: /home/adl/CVSROOT/LOCAL/HEAD3-20030413-1504/aclocal.in,v
retrieving revision 1.1
diff -u -r1.1 aclocal.in
--- aclocal.in 13 Apr 2003 13:04:19 -0000 1.1
+++ aclocal.in 17 Apr 2003 21:59:35 -0000
@@ -7,7 +7,7 @@
# aclocal - create aclocal.m4 by scanning configure.ac
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
@@ -161,7 +161,7 @@
elsif ($arglist[0] eq '--version')
{
print "aclocal (GNU $PACKAGE) $VERSION\n\n";
- print "Copyright (C) 2002 Free Software Foundation, Inc.\n";
+ print "Copyright (C) 2003 Free Software Foundation, Inc.\n";
print "This is free software; see the source for copying
conditions. There is NO\n";
print "warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.\n\n";
print "Written by Tom Tromey <address@hidden>\n";
@@ -357,7 +357,19 @@
return if ($file_seen{$file});
$file_seen{$file} = 1;
- $output .= $file_contents{$file} . "\n";
+ # If the file to add looks like path outside the project,
+ # copy it to the output.
+ # The regex catches filenames starting with things like
+ # / \ c:\ ../ ./../ etc.
+ if ($file =~ m,^(?:(?:\w:)?[\\/]|(?:\.[\\/]+)*\.\.[\\/]),)
+ {
+ $output .= $file_contents{$file} . "\n";
+ }
+ else
+ {
+ # Otherwise, simply include the file.
+ $output .= "m4_include([$file])\n";
+ }
my (@rlist);
foreach (split ("\n", $file_contents{$file}))
{
@@ -443,7 +455,7 @@
print $out
"# generated automatically by aclocal $VERSION -*- Autoconf -*-
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
Index: automake.in
===================================================================
RCS file: /home/adl/CVSROOT/LOCAL/HEAD3-20030413-1504/automake.in,v
retrieving revision 1.2
diff -u -r1.2 automake.in
--- automake.in 17 Apr 2003 19:35:49 -0000 1.2
+++ automake.in 17 Apr 2003 22:15:07 -0000
@@ -4157,6 +4157,8 @@
next if /address@hidden@$/;
s/\$\(top_srcdir\)/$topsrcdir/;
s/\$\(srcdir\)/./;
+ # Strip any leading `./'.
+ s,^(:?\./+)*,,;
next unless s,/+[^/]+$,,;
$dist_dirs{$_} = 1
unless $_ eq '.';
@@ -4287,7 +4289,8 @@
if (-f 'aclocal.m4')
{
- &push_dist_common ('aclocal.m4');
+ &push_dist_common ('aclocal.m4')
+ if $relative_dir eq '.';
&define_variable ("ACLOCAL_M4", '$(top_srcdir)/aclocal.m4', INTERNAL);
my $aclocal = new Automake::XFile "< aclocal.m4";
@@ -4306,33 +4309,9 @@
if (variable_defined ('ACLOCAL_M4_SOURCES'))
{
push (@ac_deps, '$(ACLOCAL_M4_SOURCES)');
- }
- elsif (variable_defined ('ACLOCAL_AMFLAGS'))
- {
- # Scan all -I directories for m4 files. These are our
- # dependencies.
- my $examine_next = 0;
- foreach my $amdir (&variable_value_as_list_recursive
('ACLOCAL_AMFLAGS', TRUE))
- {
- if ($examine_next)
- {
- $examine_next = 0;
- if ($amdir !~ /^\// && -d $amdir)
- {
- foreach my $ac_dep (&my_glob ($amdir . '/*.m4'))
- {
- $ac_dep =~ s/^\.\/+//;
- push (@ac_deps, '$(top_srcdir)/' . $ac_dep)
- unless $ac_dep eq "aclocal.m4"
- || $ac_dep eq "acinclude.m4";
- }
- }
- }
- elsif ($amdir eq '-I')
- {
- $examine_next = 1;
- }
- }
+ msg_var ('obsolete', 'ACLOCAL_M4_SOURCES',
+ "`ACLOCAL_M4_SOURCES' is obsolete.\n"
+ . "It should be safe to simply remove it.");
}
# Note that it might be possible that aclocal.m4 doesn't exist but
@@ -8661,16 +8640,6 @@
}
}
-
-################################################################
-
-# Glob something. Do this to avoid indentation screwups everywhere we
-# want to glob. Gross!
-sub my_glob
-{
- my ($pat) = @_;
- return <${pat}>;
-}
################################################################
Index: bootstrap
===================================================================
RCS file: /home/adl/CVSROOT/LOCAL/HEAD3-20030413-1504/bootstrap,v
retrieving revision 1.1
diff -u -r1.1 bootstrap
--- bootstrap 13 Apr 2003 13:04:19 -0000 1.1
+++ bootstrap 17 Apr 2003 21:15:49 -0000
@@ -99,16 +99,13 @@
-e "address@hidden@%$BOOTSTRAP_SHELL%g" \
aclocal.in >aclocal.tmp
-# Create temporary replacement for amversion.m4
-sed -e "address@hidden@%$PERL%g" \
- -e "address@hidden@%$VERSION%g" \
+# Overwrite amversion.m4
+sed -e "address@hidden@%$VERSION%g" \
-e "address@hidden@%$APIVERSION%g" \
- -e "address@hidden@%$PACKAGE%g" \
- -e "address@hidden@%$datadir%g" \
- m4/amversion.in >aclocal-$APIVERSION/amversion-tmp.m4
+ m4/amversion.in >m4/amversion.m4
# Run aclocal
-$PERL ./aclocal.tmp -I aclocal-$APIVERSION -I m4
+$PERL ./aclocal.tmp -I m4
# Create temporary replacement for automake
sed -e "address@hidden@%$PERL%g" \
Index: configure.in
===================================================================
RCS file: /home/adl/CVSROOT/LOCAL/HEAD3-20030413-1504/configure.in,v
retrieving revision 1.1
diff -u -r1.1 configure.in
--- configure.in 13 Apr 2003 13:04:19 -0000 1.1
+++ configure.in 17 Apr 2003 21:36:06 -0000
@@ -113,7 +113,6 @@
lib/Makefile
lib/am/Makefile
m4/Makefile
- m4/amversion.m4:m4/amversion.in
tests/Makefile
tests/defs
])
Index: m4/Makefile.am
===================================================================
RCS file: /home/adl/CVSROOT/LOCAL/HEAD3-20030413-1504/m4/Makefile.am,v
retrieving revision 1.1
diff -u -r1.1 Makefile.am
--- m4/Makefile.am 13 Apr 2003 13:04:20 -0000 1.1
+++ m4/Makefile.am 17 Apr 2003 21:39:33 -0000
@@ -53,6 +53,19 @@
sanity.m4 \
strip.m4
-nodist_m4data_DATA = amversion.m4
+# Use `$(srcdir)' for the benefit of non-GNU makes.
+# Many implementations do not know that `./foo' is the same target as `foo'.
+nodist_m4data_DATA = $(srcdir)/amversion.m4
DISTCLEANFILES = amversion.m4
EXTRA_DIST = dirlist
+
+# We build amversion.m4 here, instead of from config.status,
+# because config.status is rerun each time one of configure's
+# dependencies change and amversion.m4 happens to be a configure
+# dependency. configure and amversion.m4 would be rebuilt in
+# loop otherwise.
+$(srcdir)/amversion.m4: $(srcdir)/amversion.in
+ sed -e 's,address@hidden@],$(VERSION),g' \
+ -e 's,address@hidden@],$(APIVERSION),g' \
+ $(srcdir)/amversion.in > address@hidden
+ mv -f address@hidden $@
Index: tests/Makefile.am
===================================================================
RCS file: /home/adl/CVSROOT/LOCAL/HEAD3-20030413-1504/tests/Makefile.am,v
retrieving revision 1.2
diff -u -r1.2 Makefile.am
--- tests/Makefile.am 17 Apr 2003 19:35:50 -0000 1.2
+++ tests/Makefile.am 17 Apr 2003 21:03:20 -0000
@@ -1,14 +1,11 @@
## Process this file with automake to create Makefile.in
-XFAIL_TESTS = aclocal5.test auxdir2.test cond17.test
+XFAIL_TESTS = auxdir2.test cond17.test
TESTS = \
acinclude.test \
aclibobj.test \
aclocal.test \
-aclocal2.test \
-aclocal.test \
-aclocal2.test \
aclocal3.test \
aclocal4.test \
aclocal5.test \
Index: tests/acinclude.test
===================================================================
RCS file: /home/adl/CVSROOT/LOCAL/HEAD3-20030413-1504/tests/acinclude.test,v
retrieving revision 1.1
diff -u -r1.1 acinclude.test
--- tests/acinclude.test 13 Apr 2003 13:04:21 -0000 1.1
+++ tests/acinclude.test 17 Apr 2003 20:58:25 -0000
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 1996, 2002 Free Software Foundation, Inc.
+# Copyright (C) 1996, 2002, 2003 Free Software Foundation, Inc.
#
# This file is part of GNU Automake.
#
@@ -23,8 +23,8 @@
. ./defs || exit 1
-echo moo > acinclude.m4
+set -e
+: > acinclude.m4
-$ACLOCAL || exit 1
-
-grep moo aclocal.m4
+$ACLOCAL
+grep 'm4_include.*acinclude\.m4' aclocal.m4
Index: tests/aclocal2.test
===================================================================
RCS file: tests/aclocal2.test
diff -N tests/aclocal2.test
--- tests/aclocal2.test 13 Apr 2003 13:04:21 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,41 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2000, 2002 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 autoconf; 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 that ACLOCAL_AMFLAGS doesn't cause circular dependencies.
-. ./defs || exit 1
-
-echo AM_QUUX >> configure.in
-
-cat > quux.m4 << 'END'
-AC_DEFUN([AM_QUUX], [
-])
-END
-
-cat > Makefile.am << 'END'
-ACLOCAL_AMFLAGS = -I .
-END
-
-# We have to run aclocal first to make sure that aclocal.m4 exists.
-# Otherwise automake won't guess that we want to auto-generate it.
-$ACLOCAL -I . || exit 1
-
-$AUTOMAKE || exit 1
-
-grep "\$(ACLOCAL_M4): *configure.in *quux.m4" Makefile.in || exit 1
Index: tests/aclocal5.test
===================================================================
RCS file: /home/adl/CVSROOT/LOCAL/HEAD3-20030413-1504/tests/aclocal5.test,v
retrieving revision 1.2
diff -u -r1.2 aclocal5.test
--- tests/aclocal5.test 17 Apr 2003 19:49:06 -0000 1.2
+++ tests/aclocal5.test 17 Apr 2003 20:35:22 -0000
@@ -59,3 +59,7 @@
cd ..
grep GREPME Makefile
grep GREPME sub/Makefile
+
+# Make sure configure dependencies are distributed.
+$MAKE distdir
+test -f aclocal5-1.0/m4/moredefs.m4
--
Alexandre Duret-Lutz
Re: RFC: defining aclocal.m4/configure/config.status rebuild rules in all directories, Alexandre Duret-Lutz, 2003/04/24
Re: RFC: defining aclocal.m4/configure/config.status rebuild rules in all directories, Raja R Harinath, 2003/04/24