]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* bin/autoreconf.in (autoreconf): Don't let aclocal.m4 be older
authorAkim Demaille <akim@epita.fr>
Thu, 25 Apr 2002 10:28:01 +0000 (10:28 +0000)
committerAkim Demaille <akim@epita.fr>
Thu, 25 Apr 2002 10:28:01 +0000 (10:28 +0000)
than some of the input files, hence, on the second run of aclocal,
if some of its input are younger, make them older.
Suggested by Paul Eggert.

ChangeLog
bin/autoreconf.in

index 0aacf508747282fdc830285da057068703dd5b96..4e71cc2f10865adbdaf805c81b2c99967475cc4a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2002-04-25  Akim Demaille  <akim@epita.fr>
+
+       * bin/autoreconf.in (autoreconf): Don't let aclocal.m4 be older
+       than some of the input files, hence, on the second run of aclocal,
+       if some of its input are younger, make them older.
+       Suggested by Paul Eggert.
+
 2002-04-25  Akim Demaille  <akim@epita.fr>
 
        * doc/autoconf.texi (Limitations of Usual Tools): sed and `!'.
index 6c5e1624ec4d3d965a0fca690f1dae472b10bf48..9f990e8db81ca00485eb204d35981339b1acef86 100644 (file)
@@ -442,8 +442,46 @@ sub autoreconf ($)
        {
          xsystem ("$aclocal $aclocal_flags --output=aclocal.m4t");
          # aclocal may produce no output.
-         update_file ('aclocal.m4t', 'aclocal.m4')
-           if -f 'aclocal.m4t';
+         if (-f 'aclocal.m4t')
+           {
+             update_file ('aclocal.m4t', 'aclocal.m4');
+             # Make sure that the local m4 files are older than
+             # aclocal.m4.
+             #
+             # Why is not always the case?  Because we already run
+             # aclocal a first (before tracing), which, for instance,
+             # can find Gettext's macros in .../share/aclocal, so we
+             # may have had the right aclocal.m4 already.  Then
+             # gettextize is run, and installs locally these M4
+             # files.  Then autoreconf, via update_file, sees it is
+             # the _same_ aclocal.m4, and doesn't change its
+             # timestamp.  But later, Automake's Makefile expresses
+             # that aclocal.m4 depends on these local files, which
+             # are younger, so it triggers aclocal again.
+             #
+             # To make sure aclocal.m4 is younger, we change the
+             # modification times of the local M4 files to be
+             # slightly older than it.
+             #
+             # First, where are the local files?
+             my $aclocal_local_dir = '.';
+             if ($aclocal_flags =~ /-I\s+(\S+)/)
+               {
+                 $aclocal_local_dir = $1;
+               }
+             # All the local files younger than aclocal.m4 are to be
+             # grown older than it.
+             my $aclocal_m4_mtime = mtime ('aclocal.m4');
+             for my $file (glob ("$aclocal_local_dir/*.m4"), 'acinclude.m4')
+               {
+                 if (mtime ($file) >= $aclocal_m4_mtime)
+                   {
+                     debug "making $file younger than aclocal.m4";
+                     utime $aclocal_m4_mtime - 1, $aclocal_m4_mtime - 1,
+                       $file;
+                   }
+               }
+           }
        }
     }