automake-patches
[Top][All Lists]
Advanced

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

RFC: defining aclocal.m4/configure/config.status rebuild rules in all di


From: Alexandre Duret-Lutz
Subject: RFC: defining aclocal.m4/configure/config.status rebuild rules in all directories
Date: Sun, 13 Apr 2003 17:01:50 +0200
User-agent: Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.2 (gnu/linux)

The following patch applies on top of Akim's revised patch
(which I haven't installed yet).

It fixes the subdir8.test as it was introduced by the
aforementioned patch.  However I've updated subdir8.test to
show that the rebuild rules still aren't perfect.

The problem I'm facing is that aclocal.m4's depedencies are
only known at the top-level.  Users can define ACLOCAL_AMFLAGS
in their top-level Makefile, and Automake uses this variable
to compute aclocal.m4's dependencies (for each `-I dir' argument, 
it takes dir/*.m4 as dependencies).

When creating Makefile.ins in subdirectories, Automake doesn't
have access to ACLOCAL_AMFLAGS, hence it will genereate an
incomplete rule with missing dependencies.  This is still a win
over previous practice (no rule at all), but is somewhat
unsatisfactory.  

I don't see any easy solution.  Requiring the user to manually
define ACLOCAL_AMFLAGS in each directory isn't practicable.
Using AC_SUBST([ACLOCAL_AMFLAGS], [-I m4]) to do so will break
autoreconf & gettextize (these tools grep the top-level Makefile.am
for ACLOCAL_AMFLAGS).

One solution might be to encode aclocal.m4's dependencies in
aclocal.m4 itself.  aclocal would do this, and automake would
just have to grep aclocal.m4 for such dependencies.  I'm not
really fond of this solution because it seems error prone, and
aclocal is bound to disappear anyway.

In fact, as soon as we get rid of aclocal, this issue will
disappear.  So perhaps we shouldn't bother.  After all, failing
to notice in subdirectories that aclocal.m4 needs to be rebuilt
doesn't sounds very important: we'll notice it at some point
when make is latter run from the top-level.

Index: ChangeLog
from  Alexandre Duret-Lutz  <address@hidden>

        * automake.in (scan_aclocal_m4): Work in all directories, not only
        the top-level.  Prepend $(top_srcdir) in front of each aclocal.m4
        dependency.
        * lib/am/configure.am (config.status, configure, $(ACLOCAL_M4)):
        Define rebuild rules in each directory.
        * tests/subdir8.test: Augment to execrise aclocal.m4's dependencies.

Index: NEWS
===================================================================
RCS file: /home/adl/CVSROOT/LOCAL/HEAD3-20030413-1504/NEWS,v
retrieving revision 1.1
diff -u -r1.1 NEWS
--- NEWS        13 Apr 2003 13:04:19 -0000      1.1
+++ NEWS        13 Apr 2003 14:24:39 -0000
@@ -64,6 +64,24 @@
   substituted from configure.ac.  This has been requested by people
   dealing with non-POSIX ar implementations.
 
+* Any file which is m4_included from configure.ac will appear as
+  a configure and Makefile.in dependency.
+
+* The rules for rebuilding Makefiles and Makefile.ins will now rebuild
+  all Makefiles and all Makefile.ins at once when one of configure's
+  dependencies has changed.  This is considerably faster than
+  previous implementations, where config.status and automake were run
+  separately in each directory (this still happens when you change
+  a Makefile.am locally, without touching configure.ac or friends).
+  Doing this also solves a longstanding issue: these rebuild rule
+  failed to work when adding new directories to the tree, forcing
+  you to run automake manually.
+
+* For similar reasons, the rules to rebuild configure, config.status, and
+  aclocal.m4 are now defined in all directories.  Note that if you
+  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.
 
 New in 1.7:
 * Autoconf 2.54 is required.
Index: automake.in
===================================================================
RCS file: /home/adl/CVSROOT/LOCAL/HEAD3-20030413-1504/automake.in,v
retrieving revision 1.1
diff -u -r1.1 automake.in
--- automake.in 13 Apr 2003 13:04:19 -0000      1.1
+++ automake.in 13 Apr 2003 13:36:19 -0000
@@ -4282,22 +4282,13 @@
 {
     my $regen_aclocal = 0;
 
-    if (-f 'aclocal.m4')
-    {
-       # When using aclocal.m4, define this variable even in subdirectories,
-       # because every Makefile.in depends on $(ACLOCAL_M4).
-       &define_variable ("ACLOCAL_M4", '$(top_srcdir)/aclocal.m4', INTERNAL);
-    }
-
-    return (0, ())
-      unless $relative_dir eq '.';
-
     &examine_variable ('CONFIG_STATUS_DEPENDENCIES');
     &examine_variable ('CONFIGURE_DEPENDENCIES');
 
     if (-f 'aclocal.m4')
     {
        &push_dist_common ('aclocal.m4');
+       &define_variable ("ACLOCAL_M4", '$(top_srcdir)/aclocal.m4', INTERNAL);
 
        my $aclocal = new Automake::XFile "< aclocal.m4";
        my $line = $aclocal->getline;
@@ -4331,7 +4322,7 @@
                    foreach my $ac_dep (&my_glob ($amdir . '/*.m4'))
                    {
                        $ac_dep =~ s/^\.\/+//;
-                       push (@ac_deps, $ac_dep)
+                       push (@ac_deps, '$(top_srcdir)/' . $ac_dep)
                          unless $ac_dep eq "aclocal.m4"
                            || $ac_dep eq "acinclude.m4";
                    }
Index: lib/am/configure.am
===================================================================
RCS file: /home/adl/CVSROOT/LOCAL/HEAD3-20030413-1504/lib/am/configure.am,v
retrieving revision 1.1
diff -u -r1.1 configure.am
--- lib/am/configure.am 13 Apr 2003 13:04:20 -0000      1.1
+++ lib/am/configure.am 13 Apr 2003 14:05:07 -0000
@@ -66,37 +66,31 @@
 ## --------------------------- ##
 
 if %?TOPDIR_P%
-## Explicitly look in srcdir for benefit of non-GNU makes.
-## Use `$(top_builddir)' for the benefit of Tru64 v5.1 make and also
-## NetBSD v1.5 make.  These `make's don't know that
-## `$(top_builddir)/config.status' and `config.status' are the same
-## file when top_builddir==`.'.
-$(top_builddir)/config.status: $(srcdir)/configure 
$(CONFIG_STATUS_DEPENDENCIES)
-       $(SHELL) ./config.status --recheck
-
 ## Always require configure.ac and configure at top level, even if they
 ## don't exist.  This is especially important for configure, since it
 ## won't be created until autoconf is run -- which might be after
 ## automake is run.
 DIST_COMMON += configure %CONFIGURE-AC%
-
-## Explicitly look in srcdir for benefit of non-GNU makes.
-$(srcdir)/configure: %MAINTAINER-MODE% $(srcdir)/%CONFIGURE-AC% $(ACLOCAL_M4) 
$(CONFIGURE_DEPENDENCIES) %CONFIGURE_DEPS%
-       cd $(srcdir) && $(AUTOCONF)
 endif %?TOPDIR_P%
 
+$(top_builddir)/config.status: $(top_srcdir)/configure 
$(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: %MAINTAINER-MODE% $(top_srcdir)/%CONFIGURE-AC% 
$(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) %CONFIGURE_DEPS%
+       cd $(top_srcdir) && $(AUTOCONF)
 
 
 ## ------------ ##
 ## aclocal.m4.  ##
 ## ------------ ##
 
-if %?TOPDIR_P%
-if  %?REGEN-ACLOCAL-M4%
-$(ACLOCAL_M4): %MAINTAINER-MODE% %CONFIGURE-AC% %ACLOCAL_M4_DEPS%
-       cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
-endif  %?REGEN-ACLOCAL-M4%
-endif %?TOPDIR_P%
+## aclocal.m4 must be built by the top-level Makefile, because this is
+## where the user is expected to define $(ACLOCAL_AMFLAGS).
+if %?REGEN-ACLOCAL-M4%
+$(ACLOCAL_M4): %MAINTAINER-MODE% $(top_srcdir)/%CONFIGURE-AC% %ACLOCAL_M4_DEPS%
+?TOPDIR_P?     $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+?!TOPDIR_P?    cd $(top_srcdir) && $(MAKE) $(AM_MAKEFLAGS) '$$(ACLOCAL_M4)'
+endif %?REGEN-ACLOCAL-M4%
 
 
 ## --------- ##
Index: tests/subdir8.test
===================================================================
RCS file: /home/adl/CVSROOT/LOCAL/HEAD3-20030413-1504/tests/subdir8.test,v
retrieving revision 1.1
diff -u -r1.1 subdir8.test
--- tests/subdir8.test  13 Apr 2003 13:04:31 -0000      1.1
+++ tests/subdir8.test  13 Apr 2003 13:45:04 -0000
@@ -36,10 +36,14 @@
 AM_PROG_CC_C_O
 AC_PROG_CC
 m4_include([confiles.m4])
+MORE_DEFS
 AC_OUTPUT
 END
 
-echo 'SUBDIRS = sub' > Makefile.am
+cat > Makefile.am <<EOF
+SUBDIRS = sub
+ACLOCAL_AMFLAGS = -I m4
+EOF
 
 mkdir sub
 
@@ -57,7 +61,10 @@
 }
 END
 
-$ACLOCAL
+mkdir m4
+echo 'AC_DEFUN([MORE_DEFS],[])' > m4/moredefs.m4
+
+$ACLOCAL -I m4
 $AUTOCONF
 $AUTOMAKE --copy --add-missing
 ./configure
@@ -89,3 +96,13 @@
 cd ..
 test -f maude/Makefile
 test -f sub/maude/Makefile
+
+# Make sure the rebuild rules for aclocal.m4 work from any directory.
+echo 'AC_DEFUN([MORE_DEFS],[AC_SUBST([GREPME])])' > m4/moredefs.m4
+cd sub
+$MAKE
+cd ..
+grep GREPME Makefile
+grep GREPME maude/Makefile
+grep GREPME sub/Makefile
+grep GREPME sub/maude/Makefile

-- 
Alexandre Duret-Lutz





reply via email to

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