]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
autom4te: always update the output file, even if it hasn’t changed
authorZack Weinberg <zackw@panix.com>
Tue, 29 Dec 2020 20:33:33 +0000 (15:33 -0500)
committerZack Weinberg <zackw@panix.com>
Tue, 29 Dec 2020 20:33:33 +0000 (15:33 -0500)
Automake generates a Makefile rule for regenerating the configure
script, that relies on an invocation of ‘autoconf’ always bumping the
timestamp on the configure script, even if it hasn’t changed.
The patch to make autom4te update the output file atomically
(1725c947144d9bebfe7817c2c5f0d53d884b1297) broke this.

Fixes several failures in automake’s test suite.

 * bin/autom4te.in (handle_output): Always call update_file with force=1.
 * tests/tools.at (autoconf: timestamp changes): New test.

bin/autom4te.in
tests/tools.at

index 4c2b905c072f1bd0972a89dc5d1d0dc621fc6493..64653a44c175c782472411ce5e4ec7406d8f67ee 100644 (file)
@@ -609,7 +609,9 @@ sub handle_output ($$)
     }
 
   $out->close();
-  update_file ($scratchfile, $output, $force)
+  # Always update the file, even if it didn't change;
+  # Automake relies on this.
+  update_file ($scratchfile, $output, 1)
     if defined $scratchfile;
 
   # If no forbidden words, we're done.
index 49710202025caf68b51d96f9082591f3302ecc44..89b8b63bd5867d7d93834ecc854271e314d41fc0 100644 (file)
@@ -662,6 +662,52 @@ arbitrary $text
 AT_CLEANUP
 
 
+# autoconf: timestamp changes
+# ---------------------------
+# Automake needs autoconf to update the timestamp on the configure script
+# whenever configure.ac or aclocal.m4 changes, even if the contents of the
+# configure script have not changed.
+AT_SETUP([autoconf: timestamp changes])
+
+AT_DATA([aclocal.m4],
+[[AC_DEFUN([local_KILROY], [# kilroy was here
+])
+]])
+
+AT_DATA_AUTOCONF([configure.ac],
+[[AC_INIT
+AC_PROG_CC
+local_KILROY
+AC_OUTPUT
+]])
+
+AT_CHECK_AUTOCONF
+
+cp configure configure.1
+sleep 1
+printf '%s\n' 'AC_LIBSOURCES([foo.c])dn@&t@l' >> configure.ac
+
+# This step must not use --force.
+# We don't need to check shell syntax, because if all goes well,
+# the script will be unchanged from what it was in the first autoconf
+# pass, and that was already checked.
+AT_CHECK_M4([autoconf])
+AT_CHECK([cmp configure configure.1])
+AT_CHECK([test configure -nt configure.1])
+
+cp configure configure.2
+sleep 1
+printf '%s\n' \
+  'AC_DEFUN([unused_MACRO], [# bob was there too' \
+  '])' >> aclocal.m4
+
+# Same as above.
+AT_CHECK_M4([autoconf])
+AT_CHECK([cmp configure configure.2])
+AT_CHECK([test configure -nt configure.2])
+
+AT_CLEANUP
+
 
 ## --------- ##
 ## ifnames.  ##