automake-patches
[Top][All Lists]
Advanced

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

Re: RFC: defining aclocal.m4/configure/config.status rebuild rules in al


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

>>> "Raja" == Raja R Harinath <address@hidden> writes:

[...]

 Raja> I needed the following patch to get it to work in an non-$srcdir
 Raja> build.

 Raja> Index: configure.am
 Raja> ===================================================================
 Raja> RCS file: /cvs/automake/automake/lib/am/configure.am,v
 Raja> retrieving revision 1.17
 Raja> diff -u -p -u -r1.17 configure.am
 Raja> --- configure.am        24 Apr 2003 18:39:32 -0000      1.17
 Raja> +++ configure.am        24 Apr 2003 19:33:55 -0000
 Raja> @@ -88,8 +88,8 @@ $(top_srcdir)/configure: %MAINTAINER-MOD
 Raja> ## where the user is expected to define $(ACLOCAL_AMFLAGS).
 Raja> if %?REGEN-ACLOCAL-M4%
 Raja> $(ACLOCAL_M4): %MAINTAINER-MODE% $(top_srcdir)/%CONFIGURE-AC% 
%ACLOCAL_M4_DEPS%
 Raja> -?TOPDIR_P?     $(ACLOCAL) $(ACLOCAL_AMFLAGS)
 Raja> -?!TOPDIR_P?    cd $(top_srcdir) && $(MAKE) $(AM_MAKEFLAGS) 
'$$(ACLOCAL_M4)'
 Raja> +?TOPDIR_P?     cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
 Raja> +?!TOPDIR_P?    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) 
'$$(ACLOCAL_M4)'
 Raja> endif %?REGEN-ACLOCAL-M4%

 Raja> GNU make 3.81a2 wasn't too happy with the '$$(ACLOCAL_M4)' though.

 Raja> make[1]: *** No rule to make target `$(ACLOCAL_M4)'.  Stop.

 Raja> I don't know if this is a feature or a bug :-) You may need to put in
 Raja> topdir/Makefile.in

 Raja> .PHONY: am--rebuild-aclocal
 Raja> am--rebuild-aclocal: $(ACLOCAL_M4)

Thanks for catching this.  I've been toying too and found out
that I was also wrong to claim that aclocal.m4 does not depend
on its included files: changing one of this files might require
more files to be included.

Below is a patch that should fix and test the issues you
reported as well as this last one.  Does that look ok?

2003-04-24  Alexandre Duret-Lutz  <address@hidden>

        * tests/aclocal6.test: New file.
        * tests/Makefile.am (TESTS): Add it.
        * lib/am/configure.am (am--rebuild-aclocal): New rule.
        ($(ACLOCAL_M4)): Depend upon %CONFIGURE_DEPS%.  Make
        am--rebuild-aclocal when not in the top-directory.  Fix jump
        directories for VPATH builds.
        Suggested by Raja R. Harinath.

Index: NEWS
===================================================================
RCS file: /cvs/automake/automake/NEWS,v
retrieving revision 1.212
diff -u -r1.212 NEWS
--- NEWS        24 Apr 2003 18:54:46 -0000      1.212
+++ NEWS        24 Apr 2003 20:28:26 -0000
@@ -116,8 +116,6 @@
   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:
Index: lib/am/configure.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/configure.am,v
retrieving revision 1.17
diff -u -r1.17 configure.am
--- lib/am/configure.am 24 Apr 2003 18:39:32 -0000      1.17
+++ lib/am/configure.am 24 Apr 2003 20:28:26 -0000
@@ -86,10 +86,22 @@
 
 ## aclocal.m4 must be built by the top-level Makefile, because this is
 ## where the user is expected to define $(ACLOCAL_AMFLAGS).
+##
+## Whenever a configure dependency changes we need to rebuild
+## aclocal.m4 too.  Changing configure.ac, or any file included by
+## aclocal.m4 might require adding more files to aclocal.m4.  Hence
+## the %CONFIGURE_DEPS% dependency.
 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)'
+if %?TOPDIR_P%
+$(ACLOCAL_M4): %MAINTAINER-MODE% $(top_srcdir)/%CONFIGURE-AC% 
%ACLOCAL_M4_DEPS% %CONFIGURE_DEPS%
+       cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+
+.PHONY: am--rebuild-aclocal
+am--rebuild-aclocal: $(ACLOCAL_M4)
+else !%?TOPDIR_P%
+$(ACLOCAL_M4): %MAINTAINER-MODE% $(top_srcdir)/%CONFIGURE-AC% 
%ACLOCAL_M4_DEPS% %CONFIGURE_DEPS%
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--rebuild-aclocal
+endif !%?TOPDIR_P%
 endif %?REGEN-ACLOCAL-M4%
 
 
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.488
diff -u -r1.488 Makefile.am
--- tests/Makefile.am   24 Apr 2003 18:48:06 -0000      1.488
+++ tests/Makefile.am   24 Apr 2003 20:28:26 -0000
@@ -9,6 +9,7 @@
 aclocal3.test \
 aclocal4.test \
 aclocal5.test \
+aclocal6.test \
 acoutnoq.test \
 acoutpt.test \
 acoutpt2.test \
Index: tests/aclocal6.test
===================================================================
RCS file: tests/aclocal6.test
diff -N tests/aclocal6.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/aclocal6.test 24 Apr 2003 20:28:26 -0000
@@ -0,0 +1,69 @@
+#! /bin/sh
+# Copyright (C) 2003  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.m4 is rebuilt whenever a configure
+# dependency changes.  Test for VPATH too.
+
+required='GNUmake'
+. ./defs || exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+SOME_DEFS
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+SUBDIRS = sub
+ACLOCAL_AMFLAGS = -I m4
+END
+
+mkdir sub
+: > sub/Makefile.am
+
+mkdir m4
+echo 'AC_DEFUN([SOME_DEFS], [])' > m4/somedefs.m4
+echo 'AC_DEFUN([MORE_DEFS], [AC_SUBST([GREPME])])' > m4/moredefs.m4
+
+$ACLOCAL -I m4
+$AUTOCONF
+$AUTOMAKE --copy --add-missing
+
+mkdir build
+cd build
+
+../configure
+$MAKE
+
+# Update an aclocal.m4 dependency, then make sure all Makefiles
+# are updated, even from a sub-directory.
+echo 'AC_DEFUN([SOME_DEFS], [MORE_DEFS])' > ../m4/somedefs.m4
+cd sub
+$MAKE
+cd ..
+grep GREPME Makefile
+grep GREPME sub/Makefile
+
+# Make sure configure dependencies are distributed.
+$MAKE distdir
+test -f aclocal6-1.0/m4/moredefs.m4
+test -f aclocal6-1.0/m4/somedefs.m4


-- 
Alexandre Duret-Lutz





reply via email to

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