]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* acgeneral.m4 (_AC_ARG_VAR_VALIDATE): Be sure to cache the
authorAkim Demaille <akim@epita.fr>
Sun, 17 Jun 2001 18:14:27 +0000 (18:14 +0000)
committerAkim Demaille <akim@epita.fr>
Sun, 17 Jun 2001 18:14:27 +0000 (18:14 +0000)
current values of the precious variables, not the previously
cached values.
Pass precious variables which are set to config.status.
* doc/autoconf.texi (Setting Output Variables): Document AC_ARG_VAR.
* tests/torture.at (AC_ARG_VAR): New.

ChangeLog
NEWS
acgeneral.m4
configure
doc/autoconf.texi
lib/autoconf/general.m4
tests/torture.at

index f82c3b6964c990c005e07b493057f2edff24420c..ce44a8b61ed1e5faeac527aadb368f773eb24032 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2001-06-17  Akim Demaille  <akim@epita.fr>
+
+       * acgeneral.m4 (_AC_ARG_VAR_VALIDATE): Be sure to cache the
+       current values of the precious variables, not the previously
+       cached values.
+       Pass precious variables which are set to config.status.
+       * doc/autoconf.texi (Setting Output Variables): Document AC_ARG_VAR.
+       * tests/torture.at (AC_ARG_VAR): New.
+
 2001-06-15  Paul Eggert  <eggert@twinsun.com>
 
        * doc/autoconf.texi: Move AC_FUNC_WAIT3 and
diff --git a/NEWS b/NEWS
index 8c3fd92c6d69f43dc731924398bb73cb60208c60..2a0b6d37dbccbfe4c8e4fe226419065544f01dfa 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,7 @@
 * Major changes in Autoconf 2.50a                       -*- outline -*-
+** Documentation
+- AC_ARG_VAR
+
 ** Default includes
 - Now include stdint.h.
 - sys/types.h and sys/stat.h are guarded.
 - HAVE_INTTYPES_H is defined only if not conflicting with previous
   headers.
 - build_, host_, and target_alias are AC_SUBST as in 2.13.
+- AC_ARG_VAR: The latest value of precious variables is saved, instead
+  of the first one.
+- AC_ARG_VAR properly propagates precious variables inherited from the
+  environment to ./config.status.
 
 ** Generic macros
 - AC_CHECK_HEADER and AC_CHECK_HEADERS support a fourth argument to
index 6e880e84302e62a63ad804da5af3b62b74cf7916..44e17c518d3ed18350e6e7f165b9546068aa2bcc 100644 (file)
@@ -1513,6 +1513,19 @@ ac_cv_env_$1_value=$$1])dnl
 
 # _AC_ARG_VAR_VALIDATE
 # --------------------
+# The precious variables are saved twice at the beginning of
+# configure.  E.g., PRECIOUS, is saved as `ac_env_PRECIOUS_SET' and
+# `ac_env_PRECIOUS_VALUE' on the one hand and `ac_cv_env_PRECIOUS_SET'
+# and `ac_cv_env_PRECIOUS_VALUE' on the other hand.
+#
+# Now the cache has just been load, so `ac_cv_env_' represents the
+# 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.
 m4_define([_AC_ARG_VAR_VALIDATE],
 [# Check that the precious variables saved in the cache have kept the same
 # value.
@@ -1539,6 +1552,23 @@ for ac_var in `(set) 2>&1 |
         ac_suggest_removing_cache=:
       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).
+  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 --
+dnl it's sensitive.  Putting any kind of quote in it causes syntax errors.
+[    *" "*|*"  "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)]
+      ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"`
+      ac_configure_args="$ac_configure_args '$ac_arg'"
+      ;;
+    *) ac_configure_args="$ac_configure_args $ac_var=$ac_new_val"
+       ;;
+    esac
+  fi
 done
 if $ac_suggest_removing_cache; then
   AC_MSG_WARN([changes in the environment can compromise the build])
index 5a83817c6ac1e76b6d853cc7efd65ce8c8fc92b0..f877296f5cc20a19c22ac194594d53c3720cc199 100755 (executable)
--- a/configure
+++ b/configure
@@ -850,11 +850,26 @@ echo "$as_me: WARNING:   current value: $ac_new_val" >&2;}
         ac_suggest_removing_cache=:
       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).
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *" "*|*"   "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+      ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"`
+      ac_configure_args="$ac_configure_args '$ac_arg'"
+      ;;
+    *) ac_configure_args="$ac_configure_args $ac_var=$ac_new_val"
+       ;;
+    esac
+  fi
 done
 if $ac_suggest_removing_cache; then
-  { echo "$as_me:855: WARNING: changes in the environment can compromise the build" >&5
+  { echo "$as_me:870: WARNING: changes in the environment can compromise the build" >&5
 echo "$as_me: WARNING: changes in the environment can compromise the build" >&2;}
-  { echo "$as_me:857: WARNING: consider removing $cache_file and starting over" >&5
+  { echo "$as_me:872: WARNING: consider removing $cache_file and starting over" >&5
 echo "$as_me: WARNING: consider removing $cache_file and starting over" >&2;}
 fi
 
@@ -873,10 +888,10 @@ esac
 echo "#! $SHELL" >conftest.sh
 echo  "exit 0"   >>conftest.sh
 chmod +x conftest.sh
-if { (echo "$as_me:876: PATH=\".;.\"; conftest.sh") >&5
+if { (echo "$as_me:891: PATH=\".;.\"; conftest.sh") >&5
   (PATH=".;."; conftest.sh) 2>&5
   ac_status=$?
-  echo "$as_me:879: \$? = $ac_status" >&5
+  echo "$as_me:894: \$? = $ac_status" >&5
   (exit $ac_status); }; then
   ac_path_separator=';'
 else
@@ -902,7 +917,7 @@ for ac_dir in config $srcdir/config; do
   fi
 done
 if test -z "$ac_aux_dir"; then
-  { { echo "$as_me:905: error: cannot find install-sh or install.sh in config $srcdir/config" >&5
+  { { echo "$as_me:920: error: cannot find install-sh or install.sh in config $srcdir/config" >&5
 echo "$as_me: error: cannot find install-sh or install.sh in config $srcdir/config" >&2;}
    { (exit 1); exit 1; }; }
 fi
@@ -922,7 +937,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
-echo "$as_me:925: checking for a BSD compatible install" >&5
+echo "$as_me:940: checking for a BSD compatible install" >&5
 echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6
 if test -z "$INSTALL"; then
 if test "${ac_cv_path_install+set}" = set; then
@@ -971,7 +986,7 @@ fi
     INSTALL=$ac_install_sh
   fi
 fi
-echo "$as_me:974: result: $INSTALL" >&5
+echo "$as_me:989: result: $INSTALL" >&5
 echo "${ECHO_T}$INSTALL" >&6
 
 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
@@ -982,7 +997,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
 
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
-echo "$as_me:985: checking whether build environment is sane" >&5
+echo "$as_me:1000: checking whether build environment is sane" >&5
 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6
 # Just in case
 sleep 1
@@ -1005,7 +1020,7 @@ if (
       # if, for instance, CONFIG_SHELL is bash and it inherits a
       # broken ls alias from the environment.  This has actually
       # happened.  Such a system could not be considered "sane".
-      { { echo "$as_me:1008: error: ls -t appears to fail.  Make sure there is not a broken
+      { { echo "$as_me:1023: error: ls -t appears to fail.  Make sure there is not a broken
 alias in your environment" >&5
 echo "$as_me: error: ls -t appears to fail.  Make sure there is not a broken
 alias in your environment" >&2;}
@@ -1018,14 +1033,14 @@ then
    # Ok.
    :
 else
-   { { echo "$as_me:1021: error: newly created file is older than distributed files!
+   { { echo "$as_me:1036: error: newly created file is older than distributed files!
 Check your system clock" >&5
 echo "$as_me: error: newly created file is older than distributed files!
 Check your system clock" >&2;}
    { (exit 1); exit 1; }; }
 fi
 rm -f conftest*
-echo "$as_me:1028: result: yes" >&5
+echo "$as_me:1043: result: yes" >&5
 echo "${ECHO_T}yes" >&6
 if test "$program_transform_name" = s,x,x,; then
   program_transform_name=
@@ -1054,11 +1069,11 @@ if eval "$MISSING --run true"; then
 else
   am_missing_run=
   am_backtick='`'
-  { echo "$as_me:1057: WARNING: ${am_backtick}missing' script is too old or missing" >&5
+  { echo "$as_me:1072: WARNING: ${am_backtick}missing' script is too old or missing" >&5
 echo "$as_me: WARNING: ${am_backtick}missing' script is too old or missing" >&2;}
 fi
 
-echo "$as_me:1061: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "$as_me:1076: checking whether ${MAKE-make} sets \${MAKE}" >&5
 echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6
 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'`
 if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
@@ -1078,11 +1093,11 @@ fi
 rm -f conftest.make
 fi
 if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
-  echo "$as_me:1081: result: yes" >&5
+  echo "$as_me:1096: result: yes" >&5
 echo "${ECHO_T}yes" >&6
   SET_MAKE=
 else
-  echo "$as_me:1085: result: no" >&5
+  echo "$as_me:1100: result: no" >&5
 echo "${ECHO_T}no" >&6
   SET_MAKE="MAKE=${MAKE-make}"
 fi
@@ -1092,7 +1107,7 @@ PACKAGE=autoconf
 VERSION=2.50a
 
 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
-  { { echo "$as_me:1095: error: source directory already configured; run \"make distclean\" there first" >&5
+  { { echo "$as_me:1110: error: source directory already configured; run \"make distclean\" there first" >&5
 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
    { (exit 1); exit 1; }; }
 fi
@@ -1122,7 +1137,7 @@ AUTOTEST_PATH=..
 
 # Extract the first word of "expr", so it can be a program name with args.
 set dummy expr; ac_word=$2
-echo "$as_me:1125: checking for $ac_word" >&5
+echo "$as_me:1140: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_path_EXPR+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1139,7 +1154,7 @@ for ac_dir in $ac_dummy; do
   test -z "$ac_dir" && ac_dir=.
   if $as_executable_p "$ac_dir/$ac_word"; then
    ac_cv_path_EXPR="$ac_dir/$ac_word"
-   echo "$as_me:1142: found $ac_dir/$ac_word" >&5
+   echo "$as_me:1157: found $ac_dir/$ac_word" >&5
    break
 fi
 done
@@ -1150,10 +1165,10 @@ fi
 EXPR=$ac_cv_path_EXPR
 
 if test -n "$EXPR"; then
-  echo "$as_me:1153: result: $EXPR" >&5
+  echo "$as_me:1168: result: $EXPR" >&5
 echo "${ECHO_T}$EXPR" >&6
 else
-  echo "$as_me:1156: result: no" >&5
+  echo "$as_me:1171: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -1165,7 +1180,7 @@ for ac_prog in gm4 gnum4 m4
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-echo "$as_me:1168: checking for $ac_word" >&5
+echo "$as_me:1183: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_path_M4+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1182,7 +1197,7 @@ for ac_dir in $ac_dummy; do
   test -z "$ac_dir" && ac_dir=.
   if $as_executable_p "$ac_dir/$ac_word"; then
    ac_cv_path_M4="$ac_dir/$ac_word"
-   echo "$as_me:1185: found $ac_dir/$ac_word" >&5
+   echo "$as_me:1200: found $ac_dir/$ac_word" >&5
    break
 fi
 done
@@ -1193,10 +1208,10 @@ fi
 M4=$ac_cv_path_M4
 
 if test -n "$M4"; then
-  echo "$as_me:1196: result: $M4" >&5
+  echo "$as_me:1211: result: $M4" >&5
 echo "${ECHO_T}$M4" >&6
 else
-  echo "$as_me:1199: result: no" >&5
+  echo "$as_me:1214: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -1204,7 +1219,7 @@ fi
 done
 test -n "$M4" || M4="m4"
 
-echo "$as_me:1207: checking whether m4 supports frozen files" >&5
+echo "$as_me:1222: checking whether m4 supports frozen files" >&5
 echo $ECHO_N "checking whether m4 supports frozen files... $ECHO_C" >&6
 if test "${ac_cv_prog_gnu_m4+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1216,10 +1231,10 @@ if test x"$M4" != x; then
   esac
 fi
 fi
-echo "$as_me:1219: result: $ac_cv_prog_gnu_m4" >&5
+echo "$as_me:1234: result: $ac_cv_prog_gnu_m4" >&5
 echo "${ECHO_T}$ac_cv_prog_gnu_m4" >&6
 if test x"$ac_cv_prog_gnu_m4" != xyes; then
-  { { echo "$as_me:1222: error: GNU m4 1.4 is required" >&5
+  { { echo "$as_me:1237: error: GNU m4 1.4 is required" >&5
 echo "$as_me: error: GNU m4 1.4 is required" >&2;}
    { (exit 1); exit 1; }; }
 fi
@@ -1231,7 +1246,7 @@ for ac_prog in mawk gawk nawk awk
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-echo "$as_me:1234: checking for $ac_word" >&5
+echo "$as_me:1249: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_AWK+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1246,7 +1261,7 @@ for ac_dir in $ac_dummy; do
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_AWK="$ac_prog"
-echo "$as_me:1249: found $ac_dir/$ac_word" >&5
+echo "$as_me:1264: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -1254,10 +1269,10 @@ fi
 fi
 AWK=$ac_cv_prog_AWK
 if test -n "$AWK"; then
-  echo "$as_me:1257: result: $AWK" >&5
+  echo "$as_me:1272: result: $AWK" >&5
 echo "${ECHO_T}$AWK" >&6
 else
-  echo "$as_me:1260: result: no" >&5
+  echo "$as_me:1275: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -1271,7 +1286,7 @@ HELP2MAN=${HELP2MAN-"${am_missing_run}help2man"}
 # We use a path for perl so the #! line in autoscan will work.
 # Extract the first word of "perl", so it can be a program name with args.
 set dummy perl; ac_word=$2
-echo "$as_me:1274: checking for $ac_word" >&5
+echo "$as_me:1289: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_path_PERL+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1288,7 +1303,7 @@ for ac_dir in $ac_dummy; do
   test -z "$ac_dir" && ac_dir=.
   if $as_executable_p "$ac_dir/$ac_word"; then
    ac_cv_path_PERL="$ac_dir/$ac_word"
-   echo "$as_me:1291: found $ac_dir/$ac_word" >&5
+   echo "$as_me:1306: found $ac_dir/$ac_word" >&5
    break
 fi
 done
@@ -1300,17 +1315,17 @@ fi
 PERL=$ac_cv_path_PERL
 
 if test -n "$PERL"; then
-  echo "$as_me:1303: result: $PERL" >&5
+  echo "$as_me:1318: result: $PERL" >&5
 echo "${ECHO_T}$PERL" >&6
 else
-  echo "$as_me:1306: result: no" >&5
+  echo "$as_me:1321: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
 if test "$PERL" != no; then
   PERLSCRIPTS="autoscan autoupdate"
 else
-  { echo "$as_me:1313: WARNING: autoscan and autoupdate will not be built since perl is not found" >&5
+  { echo "$as_me:1328: WARNING: autoscan and autoupdate will not be built since perl is not found" >&5
 echo "$as_me: WARNING: autoscan and autoupdate will not be built since perl is not found" >&2;}
 fi
 
@@ -1326,7 +1341,7 @@ fi
 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
-echo "$as_me:1329: checking for a BSD compatible install" >&5
+echo "$as_me:1344: checking for a BSD compatible install" >&5
 echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6
 if test -z "$INSTALL"; then
 if test "${ac_cv_path_install+set}" = set; then
@@ -1375,7 +1390,7 @@ fi
     INSTALL=$ac_install_sh
   fi
 fi
-echo "$as_me:1378: result: $INSTALL" >&5
+echo "$as_me:1393: result: $INSTALL" >&5
 echo "${ECHO_T}$INSTALL" >&6
 
 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
@@ -1499,7 +1514,7 @@ rm -f confdef2opt.sed
 : ${CONFIG_STATUS=./config.status}
 ac_clean_files_save=$ac_clean_files
 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ echo "$as_me:1502: creating $CONFIG_STATUS" >&5
+{ echo "$as_me:1517: creating $CONFIG_STATUS" >&5
 echo "$as_me: creating $CONFIG_STATUS" >&6;}
 cat >$CONFIG_STATUS <<_ACEOF
 #! $SHELL
@@ -1667,7 +1682,7 @@ cat >>$CONFIG_STATUS <<\EOF
     echo "$ac_cs_version"; exit 0 ;;
   --he | --h)
     # Conflict between --help and --header
-    { { echo "$as_me:1670: error: ambiguous option: $1
+    { { echo "$as_me:1685: error: ambiguous option: $1
 Try \`$0 --help' for more information." >&5
 echo "$as_me: error: ambiguous option: $1
 Try \`$0 --help' for more information." >&2;}
@@ -1695,12 +1710,12 @@ Try \`$0 --help' for more information." >&2;}
   'tests/atconfig' ) CONFIG_FILES="$CONFIG_FILES tests/atconfig" ;;
 
   # This is an error.
-  -*) { { echo "$as_me:1698: error: unrecognized option: $1
+  -*) { { echo "$as_me:1713: error: unrecognized option: $1
 Try \`$0 --help' for more information." >&5
 echo "$as_me: error: unrecognized option: $1
 Try \`$0 --help' for more information." >&2;}
    { (exit 1); exit 1; }; } ;;
-  *) { { echo "$as_me:1703: error: invalid argument: $1" >&5
+  *) { { echo "$as_me:1718: error: invalid argument: $1" >&5
 echo "$as_me: error: invalid argument: $1" >&2;}
    { (exit 1); exit 1; }; };;
   esac
@@ -1928,7 +1943,7 @@ done; }
   esac
 
   if test x"$ac_file" != x-; then
-    { echo "$as_me:1931: creating $ac_file" >&5
+    { echo "$as_me:1946: creating $ac_file" >&5
 echo "$as_me: creating $ac_file" >&6;}
     rm -f "$ac_file"
   fi
@@ -1946,7 +1961,7 @@ echo "$as_me: creating $ac_file" >&6;}
       -) echo $tmp/stdin ;;
       [\\/$]*)
          # Absolute (can't be DOS-style, as IFS=:)
-         test -f "$f" || { { echo "$as_me:1949: error: cannot find input file: $f" >&5
+         test -f "$f" || { { echo "$as_me:1964: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          echo $f;;
@@ -1959,7 +1974,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;}
            echo $srcdir/$f
          else
            # /dev/null tree
-           { { echo "$as_me:1962: error: cannot find input file: $f" >&5
+           { { echo "$as_me:1977: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          fi;;
index 84e8128e9312f2f415d791873fcf35cd13e74cce..8c6eec992debe3a57576df10bc4e0ac8de903a37 100644 (file)
@@ -1572,17 +1572,18 @@ it looks are correct for most cases.
 
 @defmac AC_CONFIG_AUX_DIR (@var{dir})
 @maindex CONFIG_AUX_DIR
-Use the @file{install-sh}, @file{config.sub}, @file{config.guess}, and
-Cygnus @code{configure} scripts that are in directory @var{dir}.  These
-are auxiliary files used in configuration.  @var{dir} can be either
-absolute or relative to @file{@var{srcdir}}.  The default is
+Use the auxiliary build tools (e.g., @file{install-sh},
+@file{config.sub}, @file{config.guess}, Cygnus @code{configure},
+Automake and Libtool scripts etc.) that are in directory @var{dir}.
+These are auxiliary files used in configuration.  @var{dir} can be
+either absolute or relative to @file{@var{srcdir}}.  The default is
 @file{@var{srcdir}} or @file{@var{srcdir}/..} or
 @file{@var{srcdir}/../..}, whichever is the first that contains
 @file{install-sh}.  The other files are not checked for, so that using
 @code{AC_PROG_INSTALL} does not automatically require distributing the
 other auxiliary files.  It checks for @file{install.sh} also, but that
-name is obsolete because some @code{make} programs have a rule that
-creates @file{install} from it if there is no @file{Makefile}.
+name is obsolete because some @command{make} have a rule that creates
+@file{install} from it if there is no @file{Makefile}.
 @end defmac
 
 
@@ -1681,7 +1682,7 @@ request is given to @file{config.status}; typically, each time the file
 Shell commands output @emph{unquoted} near the beginning of
 @file{config.status}, and executed each time @file{config.status} runs
 (regardless of the tag).  Because they are unquoted, for example,
-@samp{$var} will be output as the value of @var{var}.  @var{init-cmds}
+@samp{$var} will be output as the value of @code{var}.  @var{init-cmds}
 is typically used by @file{configure} to give @file{config.status} some
 variables it needs to run the @var{commands}.
 @end table
@@ -1815,7 +1816,9 @@ Autoconf macros set additional output variables, which are mentioned in
 the descriptions for those macros.  @xref{Output Variable Index}, for a
 complete list of output variables.  @xref{Installation Directory
 Variables}, for the list of the preset ones related to installation
-directories.  Below are listed the other preset ones.
+directories.  Below are listed the other preset ones.  They all are
+precious variables (@pxref{Setting Output Variables},
+@code{AC_ARG_VAR}).
 
 @c Just say no to ASCII sorting!  We're humans, not computers.
 @c These variables are listed as they would be in a dictionary:
@@ -2988,19 +2991,9 @@ AC_PATH_PROG(INETD, inetd, /usr/libexec/inetd,
   $PATH:/usr/libexec:/usr/sbin:/usr/etc:etc)
 @end example
 
-@defmac AC_CHECK_FILE (@var{file}, @ovar{action-if-found}, @ovar{action-if-not-found})
-@maindex CHECK_FILE
-Check whether file @var{file} exists on the native system.  If it is
-found, execute @var{action-if-found}, otherwise do
-@var{action-if-not-found}, if given.
-@end defmac
-
-@defmac AC_CHECK_FILES (@var{files}, @ovar{action-if-found}, @ovar{action-if-not-found})
-@maindex CHECK_FILES
-Executes @code{AC_CHECK_FILE} once for each file listed in @var{files}.
-Additionally, defines @samp{HAVE_@var{file}} (@pxref{Standard Symbols})
-for each file found.
-@end defmac
+You are strongly encouraged to declare the @var{variable} passed to
+@code{AC_CHECK_PROG} etc. as precious, @xref{Setting Output Variables},
+@code{AC_ARG_VAR}, for more details.
 
 @defmac AC_CHECK_PROG (@var{variable}, @var{prog-to-check-for}, @var{value-if-found}, @ovar{value-if-not-found}, @ovar{path},  @ovar{reject})
 @maindex CHECK_PROG
@@ -3073,6 +3066,28 @@ path of the program if it is found.
 @end defmac
 
 
+@c FIXME: Not the proper place for these guys.
+
+You might also need to check for the existence of files.  Before using
+these macros, ask yourself whether a run time test might not be a better
+solution.  Be aware that, like most Autoconf macros, they test a feature
+of the host machine, and therefore, they die when cross-compiling.
+
+@defmac AC_CHECK_FILE (@var{file}, @ovar{action-if-found}, @ovar{action-if-not-found})
+@maindex CHECK_FILE
+Check whether file @var{file} exists on the native system.  If it is
+found, execute @var{action-if-found}, otherwise do
+@var{action-if-not-found}, if given.
+@end defmac
+
+@defmac AC_CHECK_FILES (@var{files}, @ovar{action-if-found}, @ovar{action-if-not-found})
+@maindex CHECK_FILES
+Executes @code{AC_CHECK_FILE} once for each file listed in @var{files}.
+Additionally, defines @samp{HAVE_@var{file}} (@pxref{Standard Symbols})
+for each file found.
+@end defmac
+
+
 @node Libraries, Library Functions, Alternative Programs, Existing Tests
 @section Library Files
 @cindex Library, checking
@@ -5415,6 +5430,78 @@ and then a @file{Makefile.in} could contain:
 @end example
 @end defmac
 
+@cindex Previous Variable
+@cindex Variable, Precious
+Running @command{configure} in different environments can be extremely
+dangerous.  If for instance the user runs @samp{CC=bizarre-cc
+./configure}, then the cache, @file{config.h} and many other output
+files will depend upon @command{bizarre-cc} being the C compiler.  If
+for some reason the user runs @command{/configure} again, or if it is
+run via @samp{./config.status --recheck}, (@xref{Automatic Remaking},
+and @pxref{config.status Invocation}), then the configuration can be
+inconsistent, composed of results depending upon two different
+compilers.
+
+Such variables are named @dfn{precious variables}, and can be declared
+as such by @code{AC_ARG_VAR}.
+
+@defmac AC_ARG_VAR (@var{variable}, @var{description})
+@maindex ARG_VAR
+Declare @var{variable} is a precious variable, and include its
+@var{description} in the variable section of @samp{./configure --help}.
+
+Being precious means that
+@itemize @minus
+@item
+@var{variable} is @code{AC_SUBST}'d.
+
+@item
+@var{variable} is kept in the cache including if it was not specified on
+the @samp{./configure} command line.  Indeed, while @command{configure}
+can notice the definition of @code{CC} in @samp{./configure
+CC=bizarre-cc}, it is impossible to notice it in @samp{CC=bizarre-cc
+./configure}, which, unfortunately, is what most users do.
+
+@item
+@var{variable} is checked for consistency between two
+@command{configure} runs.  For instance:
+
+@example
+$ ./configure --silent --config-cache
+$ CC=cc ./configure --silent --config-cache
+configure: WARNING: `CC' was not set in the previous run
+configure: WARNING: changes in the environment can compromise
+configure: WARNING: the build. consider removing config.cache
+configure: WARNING: and starting over
+$ CC=gcc ./configure --config-cache --silent
+configure: WARNING: `CC' has changed since the previous run:
+configure: WARNING:   former value:  cc
+configure: WARNING:   current value: gcc
+configure: WARNING: changes in the environment can compromise
+configure: WARNING: the build. consider removing config.cache
+configure: WARNING: and starting over
+$ ./configure --silent --config-cache
+configure: WARNING: `CC' was set to `gcc' in the previous run
+configure: WARNING: changes in the environment can compromise
+configure: WARNING: the build. consider removing config.cache
+configure: WARNING: and starting over
+@end example
+
+@item
+@var{variable} is kept during automatic reconfiguration
+(@pxref{config.status Invocation}) as if it had been passed as a command
+line argument, including when no cache is used:
+
+@example
+$ CC=/usr/bin/cc ./configure undeclared_var=raboof --silent
+$ ./config.status --recheck
+running /bin/sh ./configure undeclared_var=raboof --silent \
+  CC=/usr/bin/cc  --no-create --no-recursion
+@end example
+@end itemize
+@end defmac
+
+
 @node Caching Results, Printing Messages, Setting Output Variables, Results
 @section Caching Results
 @cindex Cache
index 6e880e84302e62a63ad804da5af3b62b74cf7916..44e17c518d3ed18350e6e7f165b9546068aa2bcc 100644 (file)
@@ -1513,6 +1513,19 @@ ac_cv_env_$1_value=$$1])dnl
 
 # _AC_ARG_VAR_VALIDATE
 # --------------------
+# The precious variables are saved twice at the beginning of
+# configure.  E.g., PRECIOUS, is saved as `ac_env_PRECIOUS_SET' and
+# `ac_env_PRECIOUS_VALUE' on the one hand and `ac_cv_env_PRECIOUS_SET'
+# and `ac_cv_env_PRECIOUS_VALUE' on the other hand.
+#
+# Now the cache has just been load, so `ac_cv_env_' represents the
+# 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.
 m4_define([_AC_ARG_VAR_VALIDATE],
 [# Check that the precious variables saved in the cache have kept the same
 # value.
@@ -1539,6 +1552,23 @@ for ac_var in `(set) 2>&1 |
         ac_suggest_removing_cache=:
       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).
+  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 --
+dnl it's sensitive.  Putting any kind of quote in it causes syntax errors.
+[    *" "*|*"  "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)]
+      ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"`
+      ac_configure_args="$ac_configure_args '$ac_arg'"
+      ;;
+    *) ac_configure_args="$ac_configure_args $ac_var=$ac_new_val"
+       ;;
+    esac
+  fi
 done
 if $ac_suggest_removing_cache; then
   AC_MSG_WARN([changes in the environment can compromise the build])
index 8ca8a8581509222c7b4c7a59ffc9a34ef7532faa..f975c84b834b31cc1038bf46686909da8548a2a0 100644 (file)
@@ -10,6 +10,107 @@ AT_BANNER([[Testing config.status.
 ## ---------------------------------------------------------------- ##]])
 
 
+## ------------ ##
+## AC_ARG_VAR.  ##
+## ------------ ##
+
+# Check that AC_ARG_VAR caches the latest values, diagnoses
+# inconsistances, and arms config.status.
+
+AT_SETUP([AC_ARG_VAR])
+
+# We don't want to run this test if this shell doesn't support
+# `unset'.
+AT_CHECK([
+if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+  exit 0
+else
+  exit 77
+fi
+])
+
+AT_DATA([configure.ac],
+[[AC_INIT
+AC_ARG_VAR([precious], [this variable costs a lot])
+AC_OUTPUT(file)
+]])
+
+AT_DATA([file.in],
+[[`@precious@'
+]])
+
+AT_CHECK_AUTOCONF
+
+# Initially unset.
+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'.
+export precious=diamonds
+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], [], [`diamonds'
+])
+
+unset precious
+AT_CHECK([./config.status --recheck], [], [ignore])
+AT_CHECK([./config.status], [], [ignore])
+AT_CHECK([cat file], [], [`diamonds'
+])
+
+
+# Set to `apple of my eye'.
+export precious='apple of my eye'
+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], [], [`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], [], [`'
+])
+
+
+
+AT_CLEANUP
+
+
 ## ---------------------------------------------- ##
 ## AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS.  ##
 ## ---------------------------------------------- ##