From c6448c8a27e164c32ad6a94679beb04afd0cecb7 Mon Sep 17 00:00:00 2001 From: John Gilmore Date: Sat, 18 Mar 1995 04:42:05 +0000 Subject: [PATCH] * acgeneral.m4: Report the update status of the cache better; show diffs if an unwriteable cache gets updated, for manually configuring the Mac config.cache. * configure: Update with this acgeneral.m4. [This change, or one very close to it, was submitted for autoconf 2.2.] git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5168 dc483132-0cff-0310-8789-dd5450dbe970 --- src/util/autoconf/acgeneral.m4 | 17 ++++++++++++----- src/util/autoconf/configure | 17 ++++++++++++----- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/util/autoconf/acgeneral.m4 b/src/util/autoconf/acgeneral.m4 index b7e6bc3fd..102b0bdd0 100644 --- a/src/util/autoconf/acgeneral.m4 +++ b/src/util/autoconf/acgeneral.m4 @@ -881,9 +881,7 @@ fi dnl AC_CACHE_SAVE() define(AC_CACHE_SAVE, -[if test -w $cache_file; then -echo "updating cache $cache_file" -cat > $cache_file <<\EOF +[cat > $cache_file.$$ <<\EOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs. It is not useful on other systems. @@ -906,11 +904,20 @@ dnl Allow a site initialization script to override cache values. # with their high bit set. (set) 2>&1 | tr '\201-\377' '\001-\177' | sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/: \${\1='\2'}/p" \ - >> $cache_file + >> $cache_file.$$ changequote([, ])dnl +if cmp -s $cache_file $cache_file.$$; then + true else -echo "not updating unwritable cache $cache_file" + if test -w $cache_file; then + echo "updating cache $cache_file" + cat $cache_file.$$ > $cache_file + else + echo "not updating unwritable cache $cache_file" + diff $cache_file $cache_file.$$ + fi fi +rm -f $cache_file.$$ ]) dnl The name of shell var CACHE-ID must contain `_cv_' in order to get saved. diff --git a/src/util/autoconf/configure b/src/util/autoconf/configure index 97345c99e..adff411cc 100644 --- a/src/util/autoconf/configure +++ b/src/util/autoconf/configure @@ -549,9 +549,7 @@ if test -f $srcdir/standards.texi; then fi trap '' 1 2 15 -if test -w $cache_file; then -echo "updating cache $cache_file" -cat > $cache_file <<\EOF +cat > $cache_file.$$ <<\EOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs. It is not useful on other systems. @@ -572,10 +570,19 @@ EOF # with their high bit set. (set) 2>&1 | tr '\201-\377' '\001-\177' | sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/: \${\1='\2'}/p" \ - >> $cache_file + >> $cache_file.$$ +if cmp -s $cache_file $cache_file.$$; then + true else -echo "not updating unwritable cache $cache_file" + if test -w $cache_file; then + echo "updating cache $cache_file" + cat $cache_file.$$ > $cache_file + else + echo "not updating unwritable cache $cache_file" + diff $cache_file $cache_file.$$ + fi fi +rm -f $cache_file.$$ trap 'rm -fr conftest* confdefs* core $ac_clean_files; exit 1' 1 2 15 -- 2.26.2