* automake.in (&handle_aclocal_m4): Rename as...
authorAkim Demaille <akim@epita.fr>
Mon, 9 Apr 2001 14:05:10 +0000 (14:05 +0000)
committerAkim Demaille <akim@epita.fr>
Mon, 9 Apr 2001 14:05:10 +0000 (14:05 +0000)
(&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
automake.in
configure.am
lib/am/configure.am

index 9b14344..744470c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2001-04-09  Akim Demaille  <akim@epita.fr>
 
+       * 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  <akim@epita.fr>
+
        * automake.in (&get_object_extension): Use ansi2knr.am.
        * clean-kr.am, kr-extra.am: Remove, merged into...
        * ansi2knr.am: this new file.
index 82e7967..fd73284 100755 (executable)
@@ -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');
 
index 348b1e4..19f6824 100644 (file)
@@ -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%
index 348b1e4..19f6824 100644 (file)
@@ -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%