I'm going to apply it tomorrow.
Index: ChangeLog
from Akim Demaille <[EMAIL PROTECTED]>
* automake.in (&scan_aclocal_m4): Handle $relative_dir and special
variables.
Specify to the caller whether $regen_aclocal_m4.
(&handle_configure): Adjust.
Transform `REGEN-ACLOCAL-M4'.
* configure.am: Use it.
* tests/defs (me): New.
* tests/configdeps.test: New.
Index: automake.in
--- automake.in Sun, 01 Apr 2001 22:58:38 +0200 akim (am/f/39_automake.i 1.256 755)
+++ automake.in Tue, 10 Apr 2001 01:45:12 +0200 akim (am/f/39_automake.i 1.256 755)
@@ -3144,13 +3144,20 @@ sub handle_subdirs
}
-# @DEPENDENCIES
+# ($REGEN, @DEPENDENCIES)
# &scan_aclocal_m4
# ----------------
# If aclocal.m4 creation is automated, return the list of its dependencies.
sub scan_aclocal_m4
{
my $regen_aclocal = 0;
+
+ return (0, ())
+ unless $relative_dir eq '.';
+
+ &examine_variable ('CONFIG_STATUS_DEPENDENCIES');
+ &examine_variable ('CONFIGURE_DEPENDENCIES');
+
if (-f 'aclocal.m4')
{
&define_variable ("ACLOCAL_M4", '$(top_srcdir)/aclocal.m4');
@@ -3169,21 +3176,14 @@ sub scan_aclocal_m4
}
}
- my $acinclude = 0;
+ my @ac_deps = ();
+
if (-f 'acinclude.m4')
{
$regen_aclocal = 1;
- $acinclude = 1;
+ push @ac_deps, 'acinclude.m4';
}
- return ()
- unless $regen_aclocal;
-
- # Note that it might be possible that aclocal.m4 doesn't exist but
- # should be auto-generated. This case probably isn't very
- # important.
- my @ac_deps = ($acinclude ? ' acinclude.m4' : '');
-
if (&variable_defined ('ACLOCAL_M4_SOURCES'))
{
push (@ac_deps, '$(ACLOCAL_M4_SOURCES)');
@@ -3215,7 +3215,12 @@ sub scan_aclocal_m4
}
}
}
- return @ac_deps;
+
+ # Note that it might be possible that aclocal.m4 doesn't exist but
+ # should be auto-generated. This case probably isn't very
+ # important.
+
+ return ($regen_aclocal, @ac_deps);
}
# Rewrite a list of input files into a form suitable to put on a
@@ -3272,14 +3277,7 @@ sub handle_configure
my @rewritten = &rewrite_inputs_into_dependencies (1, @secondary_inputs);
- my @aclocal_m4_deps;
- if ($relative_dir eq '.')
- {
- @aclocal_m4_deps = &scan_aclocal_m4 ();
- &examine_variable ('CONFIG_STATUS_DEPENDENCIES');
- &examine_variable ('CONFIGURE_DEPENDENCIES');
- }
-
+ my ($regen_aclocal_m4, @aclocal_m4_deps) = scan_aclocal_m4 ();
$output_rules .=
&file_contents ('configure',
@@ -3302,6 +3300,8 @@ sub handle_configure
=> $cmdline_use_dependencies ? '' : ' --ignore-deps',
'MAKEFILE-AM-SOURCES'
=> "$input$colon_infile",
+ 'REGEN-ACLOCAL-M4'
+ => $regen_aclocal_m4,
'ACLOCAL_M4_DEPS'
=> join (' ', @aclocal_m4_deps)));
Index: configure.am
--- configure.am Sun, 11 Mar 2001 22:42:47 +0100 akim (am/h/32_configure. 1.8 644)
+++ configure.am Tue, 10 Apr 2001 01:24:57 +0200 akim (am/h/32_configure. 1.8 644)
@@ -61,6 +61,8 @@
## ------------ ##
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%
Index: tests/Makefile.am
--- tests/Makefile.am Sun, 01 Apr 2001 22:00:20 +0200 akim (am/f/4_Makefile.a 1.14 644)
+++ tests/Makefile.am Tue, 10 Apr 2001 01:42:29 +0200 akim (am/f/4_Makefile.a 1.14 644)
@@ -64,6 +64,7 @@
condman.test \
condman2.test \
conf2.test \
+confdeps.test \
confdist.test \
confh.test \
confh2.test \
Index: tests/defs
--- tests/defs Sun, 11 Mar 2001 09:55:48 +0100 akim (am/f/2_defs 1.7 644)
+++ tests/defs Tue, 10 Apr 2001 01:41:14 +0200 akim (am/f/2_defs 1.7 644)
@@ -8,6 +8,8 @@
exit 1
}
+me=`echo "$0" | sed -e 's,.*[\\/],,;s/\.test$//'`
+
# Always use an absolute srcdir. Otherwise symlinks made in subdirs
# of the test dir just won't work.
case "$srcdir" in
Index: tests/confdeps.test
--- tests/confdeps.test Tue, 10 Apr 2001 01:46:26 +0200 akim ()
+++ tests/confdeps.test Tue, 10 Apr 2001 01:39:56 +0200 akim (am/h/39_confdeps.t 644)
@@ -0,0 +1,21 @@
+#! /bin/sh
+
+# Make sure that config* files are properly regenerated.
+
+. $srcdir/defs || exit 1
+
+echo "FOO = foo" > Makefile.am
+set -e
+
+echo "$me: Not generated by aclocal..."
+echo "Hello, universe!" > aclocal.m4
+$AUTOMAKE
+grep '^\$(ACLOCAL_M4):' Makefile.in && exit 1
+
+
+echo "$me: Generated by aclocal..."
+$ACLOCAL
+$AUTOMAKE
+grep '^\$(ACLOCAL_M4):' Makefile.in
+
+exit 0