+2010-08-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ Try to update config.cache atomically; respect symlinks.
+ * lib/autoconf/general.m4 (AC_CACHE_SAVE): Use `mv -f' to update
+ the cache file if it is a regular file and not a symlink. Move
+ first to temporary name in the target directory if not in the
+ current directory for atomicity across mount points.
+ * tests/base.at (AC_CACHE_CHECK): Try symlinked cache file.
+ * doc/autoconf.texi (Cache Files): Leftover temporary cache
+ files may be deleted by the user.
+ * NEWS: Update.
+
2010-08-27 Eric Blake <eblake@redhat.com>
m4sh: protect LINENO against stray macro
** The macro m4_define_default is now documented.
+** Symlinked config.cache files are supported; configure now tries to
+ update non-symlinked cache files atomically, so that concurrent configure
+ runs do not leave behind broken cache files. It is still unspecified
+ which subset or union of results is cached though.
+
* Major changes in Autoconf 2.67 (2010-07-21) [stable]
Released by Eric Blake, based on git versions 2.66.*.
however, if the system configuration (e.g., the installed libraries or
compilers) changes and the stale cache file is not deleted.
+If @command{configure} is interrupted at the right time when it updates
+a cache file outside of the build directory where the @command{configure}
+script is run, it may leave behind a temporary file named after the
+cache file with digits following it. You may safely delete such a file.
+
+
@node Cache Checkpointing
@subsection Cache Checkpointing
:end'] >>confcache
if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
if test -w "$cache_file"; then
- test "x$cache_file" != "x/dev/null" &&
+ if test "x$cache_file" != "x/dev/null"; then
AC_MSG_NOTICE([updating cache $cache_file])
- cat confcache >$cache_file
+ if test ! -f "$cache_file" || test -h "$cache_file"; then
+ cat confcache >"$cache_file"
+ else
+dnl Try to update the cache file atomically even on different mount points;
+dnl at the same time, avoid filename limitation issues in the common case.
+ case $cache_file in #(
+ */* | ?:*)
+ mv -f confcache "$cache_file"$$ &&
+ mv -f "$cache_file"$$ "$cache_file" ;; #(
+ *)
+ mv -f confcache "$cache_file" ;;
+ esac
+ fi
+ fi
else
AC_MSG_NOTICE([not updating unwritable cache $cache_file])
fi
AT_CHECK([grep cache stdout], [1])
AT_CHECK([LC_ALL=C ls -t config.cache a-stamp-file | sed 1q | grep config.cache], [1])
+# Using a symlinked cache file works.
+: > cache
+rm -f config.cache
+AS_LN_S([cache], [config.cache])
+AT_CHECK_CONFIGURE([-C])
+# Either the system does not support symlinks, or the symlinked-to file
+# should be updated.
+AT_CHECK([test -s cache || test ! -h config.cache])
+
# config.site can specify a site-wide cache, accumulating information.
# Also test that we don't run afoul of sourcing a file with leading -.
AT_DATA([-config.site],