1 dnl Fix Autoconf-2.59 bugs: by overriding broken internal
2 dnl Autoconf macros with backports of the 2.60+ fix.
3 dnl - AC_CONFIG_SUBDIRS whitespace mangling,
4 dnl - more lenient precious variable checks
6 dnl This file should be a no-op for Autoconf versions != 2.59.
7 dnl It can be removed once the complete tree has moved to a
8 dnl newer Autoconf version.
10 dnl m4_PACKAGE_VERSION is an undocumented Autoconf macro.
11 dnl We use it because this fix is intended for 2.59 only.
12 dnl A feature test for the broken AC_CONFIG_SUBDIRS instead
13 dnl would be better but is tricky.
15 dnl Use ifdef/ifelse over m4_ifdef/m4_ifelse to be clean for 2.13.
16 dnl Redefine AC_CONFIG_SUBDIRS so aclocal pulls in this file
19 ifdef([m4_PACKAGE_VERSION],
20 [dnl AC_DEFUN a commonly used macro so this file is picked up.
21 m4_copy([AC_PREREQ], [_AC_PREREQ])
22 AC_DEFUN([AC_PREREQ], [frob])
23 m4_copy([_AC_PREREQ], [AC_PREREQ])
25 ifelse(m4_PACKAGE_VERSION, [2.59], [
29 # This is a subroutine of AC_OUTPUT, but it does not go into
30 # config.status, rather, it is called after running config.status.
31 m4_define([_AC_OUTPUT_SUBDIRS],
34 # CONFIG_SUBDIRS section, as fixed in confsubdir.m4.
36 if test "$no_recursion" != yes; then
38 # Remove --cache-file and --srcdir arguments so they do not pile up.
39 ac_sub_configure_args=
41 eval "set x $ac_configure_args"
45 if test -n "$ac_prev"; then
50 -cache-file | --cache-file | --cache-fil | --cache-fi \
51 | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
53 -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
54 | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \
59 -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
61 -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
63 -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
65 -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
69 *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
71 ac_sub_configure_args="$ac_sub_configure_args '$ac_arg'" ;;
75 # Always prepend --prefix to ensure using the same prefix
76 # in subdir configurations.
77 ac_arg="--prefix=$prefix"
79 *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
81 ac_sub_configure_args="$ac_arg $ac_sub_configure_args"
84 for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue
86 # Do not complain, so a configure script can configure whichever
87 # parts of a large source tree are present.
88 test -d "$srcdir/$ac_dir" || continue
90 AC_MSG_NOTICE([configuring in $ac_dir])
91 AS_MKDIR_P(["$ac_dir"])
92 _AC_SRCPATHS(["$ac_dir"])
96 # Check for guested configure; otherwise get Cygnus style configure.
97 if test -f "$ac_srcdir/configure.gnu"; then
98 ac_sub_configure=$ac_srcdir/configure.gnu
99 elif test -f "$ac_srcdir/configure"; then
100 ac_sub_configure=$ac_srcdir/configure
101 elif test -f "$ac_srcdir/configure.in"; then
102 # This should be Cygnus configure.
103 ac_sub_configure=$ac_aux_dir/configure
105 AC_MSG_WARN([no configuration information is in $ac_dir])
109 # The recursion is here.
110 if test -n "$ac_sub_configure"; then
111 # Make the cache file name correct relative to the subdirectory.
113 [[\\/]]* | ?:[[\\/]]* ) ac_sub_cache_file=$cache_file ;;
115 ac_sub_cache_file=$ac_top_builddir$cache_file ;;
118 AC_MSG_NOTICE([running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir])
119 # The eval makes quoting arguments work.
120 eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \
121 --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" ||
122 AC_MSG_ERROR([$ac_sub_configure failed for $ac_dir])
128 ])# _AC_OUTPUT_SUBDIRS
131 ifelse(m4_PACKAGE_VERSION, [2.62],, [
133 # _AC_ARG_VAR_VALIDATE
134 # --------------------
135 # The code is the same as autoconf 2.59, but with a more lenient check
136 # on precious variables that has been added in autoconf 2.62.
137 m4_define([_AC_ARG_VAR_VALIDATE],
138 [# Check that the precious variables saved in the cache have kept the same
140 ac_cache_corrupted=false
141 for ac_var in `(set) 2>&1 |
142 sed -n 's/^ac_env_\([[a-zA-Z_0-9]]*\)_set=.*/\1/p'`; do
143 eval ac_old_set=\$ac_cv_env_${ac_var}_set
144 eval ac_new_set=\$ac_env_${ac_var}_set
145 eval ac_old_val="\$ac_cv_env_${ac_var}_value"
146 eval ac_new_val="\$ac_env_${ac_var}_value"
147 case $ac_old_set,$ac_new_set in
149 AS_MESSAGE([error: `$ac_var' was set to `$ac_old_val' in the previous run], 2)
150 ac_cache_corrupted=: ;;
152 AS_MESSAGE([error: `$ac_var' was not set in the previous run], 2)
153 ac_cache_corrupted=: ;;
156 if test "x$ac_old_val" != "x$ac_new_val"; then
157 # differences in whitespace do not lead to failure.
158 ac_old_val_w=`echo x $ac_old_val`
159 ac_new_val_w=`echo x $ac_new_val`
160 if test "$ac_old_val_w" != "$ac_new_val_w"; then
161 AS_MESSAGE([error: `$ac_var' has changed since the previous run:], 2)
164 AS_MESSAGE([warning: ignoring whitespace changes in `$ac_var' since the previous run:], 2)
165 eval $ac_var=\$ac_old_val
167 AS_MESSAGE([ former value: `$ac_old_val'], 2)
168 AS_MESSAGE([ current value: `$ac_new_val'], 2)
171 # Pass precious variables to config.status.
172 if test "$ac_new_set" = set; then
174 dnl If you change this globbing pattern, test it on an old shell --
175 dnl it's sensitive. Putting any kind of quote in it causes syntax errors.
176 [ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)]
177 ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
178 *) ac_arg=$ac_var=$ac_new_val ;;
180 case " $ac_configure_args " in
181 *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
182 *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
186 if $ac_cache_corrupted; then
187 AS_MESSAGE([error: changes in the environment can compromise the build], 2)
188 AS_ERROR([run `make distclean' and/or `rm $cache_file' and start over])
190 ])# _AC_ARG_VAR_VALIDATE