]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Warn, not fail on whitespace-only precious variable differences.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Wed, 26 Mar 2008 05:55:22 +0000 (06:55 +0100)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Wed, 26 Mar 2008 05:55:22 +0000 (06:55 +0100)
* lib/autoconf/general.m4 (_AC_ARG_VAR_VALIDATE): Output
precious variable differences less ambiguous with `ugly-quotes'.
If their settings differ only in whitespace, do not fail, but
reuse the old value.
* tests/torture.at (AT_CHECK_AC_ARG_VAR): Extend macro to allow
an optional status and expected-warning argument.  Fix m4
quotation for initial value.
(AC_ARG_VAR): Also test for whitespace-only differences, and
that the old value is retained in this case.
* doc/autoconf.texi (Setting Output Variables): Document this.
* NEWS: Update.
Report and initial patch by Paolo Bonzini.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
NEWS
doc/autoconf.texi
lib/autoconf/general.m4
tests/torture.at

index 7f82ee218ccfe13ba63d7495200eb1e831c5e3b1..73b686464169572b710ada2cc37fb10aa542756a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2008-03-26  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Warn, not fail on whitespace-only precious variable differences.
+       * lib/autoconf/general.m4 (_AC_ARG_VAR_VALIDATE): Output
+       precious variable differences less ambiguous with `ugly-quotes'.
+       If their settings differ only in whitespace, do not fail, but
+       reuse the old value.
+       * tests/torture.at (AT_CHECK_AC_ARG_VAR): Extend macro to allow
+       an optional status and expected-warning argument.  Fix m4
+       quotation for initial value.
+       (AC_ARG_VAR): Also test for whitespace-only differences, and
+       that the old value is retained in this case.
+       * doc/autoconf.texi (Setting Output Variables): Document this.
+       * NEWS: Update.
+       Report and initial patch by Paolo Bonzini.
+
 2008-03-26  Eric Blake  <ebb9@byu.net>
 
        Document busybox sed bug.
diff --git a/NEWS b/NEWS
index 79d72f1cf823a354f0b10aa6c04a861f828db827..3d24e690bdf2364b331c03a4b853ba4a1211bd89 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -76,6 +76,9 @@ GNU Autoconf NEWS - User visible changes.
 ** `configure --help=recursive' now works in read-only trees and from
    unconfigured build trees.
 
+** If precious variables differ only in whitespace, then the cache consistency
+   check warns instead of fails, and reuses the old value.
+
 ** AT_BANNER is now documented.
 
 ** AT_SETUP now handles macro expansions properly when calculating line
index b72d8757b03a630b29d56b295257d94c291bafdc..991a714da5c15cc45310352b3655e91db112b2cb 100644 (file)
@@ -8799,7 +8799,8 @@ configure: error: run `make distclean' and/or \
 
 @noindent
 and similarly if the variable is unset, or if its content is changed.
-
+If the content has white space changes only, then the error is degraded
+to a warning only, but the old value is reused.
 
 @item
 @var{variable} is kept during automatic reconfiguration
index 645108e05c80aac44d991184181414ceed5a4dbd..058e193adf2eda6c930ae0df73e383ceee3131c1 100644 (file)
@@ -1547,10 +1547,18 @@ for ac_var in $ac_precious_vars; do
     ,);;
     *)
       if test "x$ac_old_val" != "x$ac_new_val"; then
-       AS_MESSAGE([error: `$ac_var' has changed since the previous run:], 2)
-       AS_MESSAGE([  former value:  $ac_old_val], 2)
-       AS_MESSAGE([  current value: $ac_new_val], 2)
-       ac_cache_corrupted=:
+       # differences in whitespace do not lead to failure.
+       ac_old_val_w=`echo x $ac_old_val`
+       ac_new_val_w=`echo x $ac_new_val`
+       if test "$ac_old_val_w" != "$ac_new_val_w"; then
+         AS_MESSAGE([error: `$ac_var' has changed since the previous run:], 2)
+         ac_cache_corrupted=:
+       else
+         AS_MESSAGE([warning: ignoring whitespace changes in `$ac_var' since the previous run:], 2)
+         eval $ac_var=\$ac_old_val
+       fi
+       AS_MESSAGE([  former value:  `$ac_old_val'], 2)
+       AS_MESSAGE([  current value: `$ac_new_val'], 2)
       fi;;
   esac
   # Pass precious variables to config.status.
index 0d7509ee53d0ef8222475c9217279f4e44e30274..a9e9dc1804679791202d7aa1f18b0cc8b47ba8c4 100644 (file)
@@ -46,16 +46,18 @@ AT_CLEANUP
 ## AC_ARG_VAR.  ##
 ## ------------ ##
 
-# AT_CHECK_AC_ARG_VAR(FIRST-VALUE, SECOND-VALUE)
-# ----------------------------------------------
+# AT_CHECK_AC_ARG_VAR(FIRST-VALUE, SECOND-VALUE, [STATUS = 1])
+# ------------------------------------------------------------
 # Check that AC_ARG_VAR caches the latest values, diagnoses
-# inconsistencies, and arms config.status.
+# inconsistencies, and arms config.status.  Check that recheck
+# returns STATUS, save configure output in files 'stdout' and 'stderr'
+# for further inspection.
 m4_define([AT_CHECK_AC_ARG_VAR],
 [rm -f config.cache
 
 # Initial value.
 m4_ifval([$1],
-        [precious='m4_bpatsubst($1, [[']], ['\\''])'; export precious],
+        [precious='m4_bpatsubst([$1], [[']], ['\\''])'; export precious],
         [unset precious])
 AT_CHECK_CONFIGURE([--config-cache -q])
 AT_CHECK([cat file], [], [`$1'
@@ -75,7 +77,7 @@ AT_CHECK([cat file], [], [`$1'
 m4_ifval([$2],
         [precious='$2'; export precious],
         [unset precious])
-AT_CHECK_CONFIGURE([--config-cache], [1], [], [ignore])
+AT_CHECK_CONFIGURE([--config-cache], [m4_default([$3], [1])], [stdout], [stderr])
 
 ])# AT_CHECK_AC_ARG_VAR
 
@@ -121,6 +123,13 @@ AT_CHECK_AC_ARG_VAR([apple of my {eye}], [orange of my eye])
 AT_CHECK_AC_ARG_VAR(['p  r     ec"iou$], [orange of my eye])
 dnl restore font-lock: "
 
+# Warn (but do not fail) about a whitespace-only change
+AT_CHECK_AC_ARG_VAR([   apple  of       my eye  ], [apple of my eye],
+                   [0], ["has whitespace changes"])
+mv stdout configure-output
+AT_CHECK([grep "ignoring whitespace changes" stderr], [], [ignore])
+AT_CHECK([grep "precious:       apple" configure-output], [], [ignore])
+
 AT_CLEANUP