+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
* 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
# _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.
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])
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
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
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
# 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
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}.
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
# 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;}
# 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=
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
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
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
# 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
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
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
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
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
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
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
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
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
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
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
# 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
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
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
# 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
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}.
: ${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
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;}
'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
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
-) 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;;
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;;
@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
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
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:
$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
@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
@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
# _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.
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])
## ---------------------------------------------------------------- ##]])
+## ------------ ##
+## 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. ##
## ---------------------------------------------- ##