From b30b1e89e82c624ccc2d16013a7c11f04172d7eb Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Mon, 9 Apr 2001 14:05:08 +0000 Subject: [PATCH] * automake.in (&handle_aclocal_m4): Rename as... (&scan_aclocal_m4): this. Return the list of aclocal.m4 dependencies. (&handle_configure): Invoke it, and use it when loading... * configure.am: Template the rules to recreate aclocal.m4. --- ChangeLog | 8 +++++ automake.in | 85 ++++++++++++++++++++++++--------------------- configure.am | 17 +++++++-- lib/am/configure.am | 17 +++++++-- 4 files changed, 81 insertions(+), 46 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9b14344f..744470c1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2001-04-09 Akim Demaille + + * automake.in (&handle_aclocal_m4): Rename as... + (&scan_aclocal_m4): this. + Return the list of aclocal.m4 dependencies. + (&handle_configure): Invoke it, and use it when loading... + * configure.am: Template the rules to recreate aclocal.m4. + 2001-04-09 Akim Demaille * automake.in (&get_object_extension): Use ansi2knr.am. diff --git a/automake.in b/automake.in index 82e7967a..fd732844 100755 --- a/automake.in +++ b/automake.in @@ -3227,8 +3227,12 @@ sub handle_subdirs $output_rules .= &file_contents ('subdirs'); } -# Handle aclocal.m4. -sub handle_aclocal_m4 + +# @DEPENDENCIES +# &scan_aclocal_m4 +# ---------------- +# If aclocal.m4 creation is automated, return the list of its dependencies. +sub scan_aclocal_m4 { my $regen_aclocal = 0; if (-f 'aclocal.m4') @@ -3256,55 +3260,46 @@ sub handle_aclocal_m4 $acinclude = 1; } + 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. - if ($regen_aclocal) - { - my @ac_deps = (($seen_maint_mode ? "\@MAINTAINER_MODE_TRUE\@": "") , - $configure_ac, - ($acinclude ? ' acinclude.m4' : '')); + my @ac_deps = ($acinclude ? ' acinclude.m4' : ''); - if (&variable_defined ('ACLOCAL_M4_SOURCES')) - { - push (@ac_deps, "\$(ACLOCAL_M4_SOURCES)"); - } - elsif (&variable_defined ('ACLOCAL_AMFLAGS')) + 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 ('ACLOCAL_AMFLAGS', '')) { - # Scan all -I directories for m4 files. These are our - # dependencies. - my $examine_next = 0; - foreach my $amdir (&variable_value_as_list ('ACLOCAL_AMFLAGS', '')) + if ($examine_next) { - if ($examine_next) + $examine_next = 0; + if ($amdir !~ /^\// && -d $amdir) { - $examine_next = 0; - if ($amdir !~ /^\// && -d $amdir) + foreach my $ac_dep (&my_glob ($amdir . '/*.m4')) { - foreach my $ac_dep (&my_glob ($amdir . '/*.m4')) - { - $ac_dep =~ s/^\.\/+//; - push (@ac_deps, $ac_dep) - unless $ac_dep eq "aclocal.m4" - || $ac_dep eq "acinclude.m4"; - } + $ac_dep =~ s/^\.\/+//; + push (@ac_deps, $ac_dep) + unless $ac_dep eq "aclocal.m4" + || $ac_dep eq "acinclude.m4"; } } - elsif ($amdir eq '-I') - { - $examine_next = 1; - } + } + elsif ($amdir eq '-I') + { + $examine_next = 1; } } - - &pretty_print_rule ("\$(ACLOCAL_M4):", "\t\t", @ac_deps); - - $output_rules .= ("\t" - . 'cd $(srcdir) && $(ACLOCAL)' - . (&variable_defined ('ACLOCAL_AMFLAGS') - ? ' $(ACLOCAL_AMFLAGS)' : '') - . "\n"); } + return @ac_deps; } # Rewrite a list of input files into a form suitable to put on a @@ -3361,6 +3356,15 @@ 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'); + } + + $output_rules .= &file_contents ('configure', ('MAKEFILE' @@ -3381,11 +3385,12 @@ sub handle_configure 'USE-DEPS' => $cmdline_use_dependencies ? '' : ' --ignore-deps', 'MAKEFILE-AM-SOURCES' - => "$input$colon_infile")); + => "$input$colon_infile", + 'ACLOCAL_M4_DEPS' + => join (' ', @aclocal_m4_deps))); if ($relative_dir eq '.') { - &handle_aclocal_m4; &examine_variable ('CONFIG_STATUS_DEPENDENCIES'); &examine_variable ('CONFIGURE_DEPENDENCIES'); diff --git a/configure.am b/configure.am index 348b1e4d..19f68246 100644 --- a/configure.am +++ b/configure.am @@ -34,9 +34,9 @@ -## ----------------------- ## -## Bulding config.status. ## -## ----------------------- ## +## --------------- ## +## config.status. ## +## --------------- ## if %?TOPDIR_P% ## Explicitly look in srcdir for benefit of non-GNU makes. @@ -46,3 +46,14 @@ config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(srcdir)/configure: %MAINTAINER-MODE% $(srcdir)/%CONFIGURE-AC% $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) cd $(srcdir) && $(AUTOCONF) endif %?TOPDIR_P% + + + +## ------------ ## +## aclocal.m4. ## +## ------------ ## + +if %?TOPDIR_P% +$(ACLOCAL_M4): %MAINTAINER-MODE% %CONFIGURE-AC% %ACLOCAL_M4_DEPS% + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +endif %?TOPDIR_P% diff --git a/lib/am/configure.am b/lib/am/configure.am index 348b1e4d..19f68246 100644 --- a/lib/am/configure.am +++ b/lib/am/configure.am @@ -34,9 +34,9 @@ -## ----------------------- ## -## Bulding config.status. ## -## ----------------------- ## +## --------------- ## +## config.status. ## +## --------------- ## if %?TOPDIR_P% ## Explicitly look in srcdir for benefit of non-GNU makes. @@ -46,3 +46,14 @@ config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(srcdir)/configure: %MAINTAINER-MODE% $(srcdir)/%CONFIGURE-AC% $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) cd $(srcdir) && $(AUTOCONF) endif %?TOPDIR_P% + + + +## ------------ ## +## aclocal.m4. ## +## ------------ ## + +if %?TOPDIR_P% +$(ACLOCAL_M4): %MAINTAINER-MODE% %CONFIGURE-AC% %ACLOCAL_M4_DEPS% + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +endif %?TOPDIR_P% -- 2.43.5