autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fyi-ac-arg-var.patch


From: Akim Demaille
Subject: Re: fyi-ac-arg-var.patch
Date: 21 Jun 2001 13:00:22 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Academic Rigor)

>>>>> "Alexandre" == Alexandre Oliva <address@hidden> writes:

  Alexandre> How about, instead of renaming config.cache, restarting
  Alexandre> configure with a switch that causes it not to use
  Alexandre> config.cache at all (i.e., don't read it, don't write it).
  Alexandre> Or restarting it with a private config.cache, removed after
  Alexandre> configure is completed.
  
  >> Doesn't sound to me either for the expert.  You're killing her
  >> Makefile, her config.h, and possibly cause a full recompilation.

Alexandre> Huh?  It's not killing anything at all.  The user started
Alexandre> configure, these files are going to be generated.  The
Alexandre> difference is that they're going to be configured and
Alexandre> generated using the new environment.

That's what I meant.  But you are right, let's play it safe.  If
something has changed and configure is run again, then it's logical to
start from scratch.

>> That's why I picked up the `user expert' solution.

Alexandre> Which happens to have a lot of potential to break for
Alexandre> novices.

I do agree!

Alexandre> It seems to me that we should just bail out in case any of
Alexandre> the precious variables change, and be done with it.

I.e., the `novice' solution :)

>> How about keeping `user expert', but in addition to the warning at
>> the beginning of configure, putting one at the end, so end the user
>> cannot miss it.

Alexandre> The user can still miss it.  S/he may have run `./configure
Alexandre> && make' (or `configure; make', since s/he's a novice :-)

Doh!  She might even be a bit confused with && and go for

        ./configure & make

But there is nothing we can do for her :)

Alexandre> and then the warning may go unnoticed.  Or s/he may be
Alexandre> configuring/building binutils+GCC+gdb+newlib, with their
Alexandre> number of configure steps.

OK.

>> How about introducing --force?

Alexandre> What would --force do?  I don't think reusing the cache
Alexandre> when some environment variable changes is ever going to be
Alexandre> a good idea.  

Good with me.

Alexandre> I could agree with not reading the cache in, but writing it
Alexandre> out just the same.  After all, the cache is just a cache,
Alexandre> so the only thing you're going to lose by not reading it in
Alexandre> is build time, and, but if you use incorrect cached values,
Alexandre> you're going lose more than build time.

Yes, you are very right.  It's an optimization and nothing more.

Sold!

I'm applying this change, but I'm waiting for you to agree/disagree on
the `make distclean' part of the message to update the doc.

Index: ChangeLog
from  Akim Demaille  <address@hidden>
        * acgeneral.m4 (_AC_ARG_VAR_VALIDATE): Die instead of warning when
        precious variables have changed.

Index: acgeneral.m4
===================================================================
RCS file: /cvs/autoconf/acgeneral.m4,v
retrieving revision 1.736
diff -u -u -r1.736 acgeneral.m4
--- acgeneral.m4 2001/06/21 09:18:16 1.736
+++ acgeneral.m4 2001/06/21 10:54:28
@@ -1522,14 +1522,12 @@
 # content of the cached values, while `ac_env_' represents that of the
 # current values.
 #
-# So we check that `ac_env_' and `ac_cv_env_' are consistant.  But if
-# they aren't, be sure to update the `ac_cv_env_' values with the
-# `ac_env_' ones, otherwise, we would save again the old values in the
-# cache.
+# So we check that `ac_env_' and `ac_cv_env_' are consistant.  If
+# they aren't, die.
 m4_define([_AC_ARG_VAR_VALIDATE],
 [# Check that the precious variables saved in the cache have kept the same
 # value.
-ac_suggest_removing_cache=false
+ac_cache_corrupted=false
 for ac_var in `(set) 2>&1 |
                sed -n 's/^ac_env_\([[a-zA-Z_0-9]]*\)_set=.*/\1/p'`; do
   eval ac_old_set=\$ac_cv_env_${ac_var}_set
@@ -1538,25 +1536,22 @@
   eval ac_new_val="\$ac_env_${ac_var}_value"
   case $ac_old_set,$ac_new_set in
     set,)
-      AC_MSG_WARN([`$ac_var' was set to `$ac_old_val' in the previous run])
-      ac_suggest_removing_cache=: ;;
+      AS_MESSAGE([error: `$ac_var' was set to `$ac_old_val' in the previous 
run])
+      ac_cache_corrupted=: ;;
     ,set)
-      AC_MSG_WARN([`$ac_var' was not set in the previous run])
-      ac_suggest_removing_cache=: ;;
+      AS_MESSAGE([error: `$ac_var' was not set in the previous run])
+      ac_cache_corrupted=: ;;
     ,);;
     *)
       if test "x$ac_old_val" != "x$ac_new_val"; then
-        AC_MSG_WARN([`$ac_var' has changed since the previous run:])
-        AC_MSG_WARN([  former value:  $ac_old_val])
-        AC_MSG_WARN([  current value: $ac_new_val])
-        ac_suggest_removing_cache=:
+        AS_MESSAGE([error: `$ac_var' has changed since the previous run:])
+        AS_MESSAGE([  former value:  $ac_old_val])
+        AS_MESSAGE([  current value: $ac_new_val])
+        ac_cache_corrupted=:
       fi;;
   esac
-  # Synchronize cached values with current values.
-  eval ac_cv_env_${ac_var}_set=\${$ac_var+set}
-  eval ac_cv_env_${ac_var}_value=\$${ac_var}
   # Pass precious variables to config.status.  It doesn't matter if
-  # we pass it a second time (in addition to the command line arguments).
+  # we pass some twice (in addition to the command line arguments).
   if test "$ac_new_set" = set; then
     case $ac_new_val in
 dnl If you change this globbing pattern, test it on an old shell --
@@ -1572,7 +1567,7 @@
 done
 if $ac_cache_corrupted; then
   AS_MESSAGE([error: changes in the environment can compromise the build])
-  AS_ERROR([run `make distclean' and/or `rm $config_cache' and start over])
+  AS_ERROR([run `make distclean' and/or `rm $cache_file' and start over])
 fi
 ])# _AC_ARG_VAR_VALIDATE
 
Index: tests/torture.at
===================================================================
RCS file: /cvs/autoconf/tests/torture.at,v
retrieving revision 1.17
diff -u -u -r1.17 torture.at
--- tests/torture.at 2001/06/18 16:14:10 1.17
+++ tests/torture.at 2001/06/21 10:54:29
@@ -14,11 +14,14 @@
 ## AC_ARG_VAR.  ##
 ## ------------ ##
 
+# AT_CHECK_AC_ARG_VAR(TITLE, FIRST-VALUE, SECOND-VALUE)
+# -----------------------------------------------------
 # Check that AC_ARG_VAR caches the latest values, diagnoses
 # inconsistances, and arms config.status.
+m4_define([AT_CHECK_AC_ARG_VAR],
+[
+AT_SETUP([AC_ARG_VAR: $1])
 
-AT_SETUP([AC_ARG_VAR])
-
 # We don't want to run this test if this shell doesn't support
 # `unset'.
 AT_CHECK([
@@ -41,75 +44,36 @@
 
 AT_CHECK_AUTOCONF
 
-# Initially unset.
-unset precious
+# Initial value.
+m4_ifval([$2],
+         [precious='$2'; export precious],
+         [unset precious])
 AT_CHECK_CONFIGURE([--config-cache])
-AT_CHECK([cat file], [], [`'
-])
-
-unset precious
-AT_CHECK([./config.status --recheck], [], [ignore])
-AT_CHECK([./config.status], [], [ignore])
-AT_CHECK([cat file], [], [`'
-])
-
-
-# Set to `diamonds'.
-precious=diamonds; export precious
-AT_CHECK_CONFIGURE([--config-cache], [], [],
-[configure: WARNING: `precious' was not set in the previous run
-configure: WARNING: changes in the environment can compromise the build
-configure: WARNING: consider removing config.cache and starting over
+AT_CHECK([cat file], [], [`$2'
 ])
-AT_CHECK([cat file], [], [`diamonds'
-])
 
+# Testing --recheck.
 unset precious
 AT_CHECK([./config.status --recheck], [], [ignore])
 AT_CHECK([./config.status], [], [ignore])
-AT_CHECK([cat file], [], [`diamonds'
-])
-
-
-# Set to `apple of my eye'.
-precious='apple of my eye'; export precious
-AT_CHECK_CONFIGURE([--config-cache], [], [],
-[configure: WARNING: `precious' has changed since the previous run:
-configure: WARNING:   former value:  diamonds
-configure: WARNING:   current value: apple of my eye
-configure: WARNING: changes in the environment can compromise the build
-configure: WARNING: consider removing config.cache and starting over
+AT_CHECK([cat file], [], [`$2'
 ])
-AT_CHECK([cat file], [], [`apple of my eye'
-])
-
-unset precious
-AT_CHECK([./config.status --recheck], [], [ignore])
-AT_CHECK([./config.status], [], [ignore])
-AT_CHECK([cat file], [], [`apple of my eye'
-])
-
-
-# Don't set at all.
-unset precious
-AT_CHECK_CONFIGURE([--config-cache], [], [],
-[configure: WARNING: `precious' was set to `apple of my eye' in the previous 
run
-configure: WARNING: changes in the environment can compromise the build
-configure: WARNING: consider removing config.cache and starting over
-])
-AT_CHECK([cat file], [], [`'
-])
-
-unset precious
-AT_CHECK([./config.status --recheck], [], [ignore])
-AT_CHECK([./config.status], [], [ignore])
-AT_CHECK([cat file], [], [`'
-])
-
 
+# Second value.
+m4_ifval([$3],
+         [precious='$3'; export precious],
+         [unset precious])
+AT_CHECK_CONFIGURE([--config-cache], [1], [], [ignore])
 
 AT_CLEANUP
+])# AT_CHECK_AC_ARG_VAR
 
+AT_CHECK_AC_ARG_VAR([set a precious variable],
+                    [], [apple of my eye])
+AT_CHECK_AC_ARG_VAR([unset a precious variable],
+                    [apple of my eye], [])
+AT_CHECK_AC_ARG_VAR([change a precious variable],
+                    [apple of my eye], [orange of my eye])
 
 ## ---------------------------------------------- ##
 ## AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS.  ##



reply via email to

[Prev in Thread] Current Thread [Next in Thread]