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 [ifelse(m4_PACKAGE_VERSION, [2.59], [
22 dnl AC_DEFUN a commonly used macro so this file is picked up.
23 m4_copy([AC_PREREQ], [_AC_PREREQ])
24 AC_DEFUN([AC_PREREQ], [frob])
25 m4_copy([_AC_PREREQ], [AC_PREREQ])
27 dnl Override the broken macro.
30 # This is a subroutine of AC_OUTPUT, but it does not go into
31 # config.status, rather, it is called after running config.status.
32 m4_define([_AC_OUTPUT_SUBDIRS],
35 # CONFIG_SUBDIRS section, as fixed in confsubdir.m4.
37 if test "$no_recursion" != yes; then
39 # Remove --cache-file and --srcdir arguments so they do not pile up.
40 ac_sub_configure_args=
42 eval "set x $ac_configure_args"
46 if test -n "$ac_prev"; then
51 -cache-file | --cache-file | --cache-fil | --cache-fi \
52 | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
54 -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
55 | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \
60 -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
62 -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
64 -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
66 -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
70 *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
72 ac_sub_configure_args="$ac_sub_configure_args '$ac_arg'" ;;
76 # Always prepend --prefix to ensure using the same prefix
77 # in subdir configurations.
78 ac_arg="--prefix=$prefix"
80 *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
82 ac_sub_configure_args="$ac_arg $ac_sub_configure_args"
85 for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue
87 # Do not complain, so a configure script can configure whichever
88 # parts of a large source tree are present.
89 test -d "$srcdir/$ac_dir" || continue
91 AC_MSG_NOTICE([configuring in $ac_dir])
92 AS_MKDIR_P(["$ac_dir"])
93 _AC_SRCPATHS(["$ac_dir"])
97 # Check for guested configure; otherwise get Cygnus style configure.
98 if test -f "$ac_srcdir/configure.gnu"; then
99 ac_sub_configure=$ac_srcdir/configure.gnu
100 elif test -f "$ac_srcdir/configure"; then
101 ac_sub_configure=$ac_srcdir/configure
102 elif test -f "$ac_srcdir/configure.in"; then
103 # This should be Cygnus configure.
104 ac_sub_configure=$ac_aux_dir/configure
106 AC_MSG_WARN([no configuration information is in $ac_dir])
110 # The recursion is here.
111 if test -n "$ac_sub_configure"; then
112 # Make the cache file name correct relative to the subdirectory.
114 [[\\/]]* | ?:[[\\/]]* ) ac_sub_cache_file=$cache_file ;;
116 ac_sub_cache_file=$ac_top_builddir$cache_file ;;
119 AC_MSG_NOTICE([running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir])
120 # The eval makes quoting arguments work.
121 eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \
122 --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" ||
123 AC_MSG_ERROR([$ac_sub_configure failed for $ac_dir])
129 ])# _AC_OUTPUT_SUBDIRS
131 # _AC_ARG_VAR_VALIDATE
132 # --------------------
133 # The code is the same as autoconf 2.59, but with a more lenient check
134 # on precious variables that has been added in autoconf 2.62.
135 m4_define([_AC_ARG_VAR_VALIDATE],
136 [# Check that the precious variables saved in the cache have kept the same
138 ac_cache_corrupted=false
139 for ac_var in `(set) 2>&1 |
140 sed -n 's/^ac_env_\([[a-zA-Z_0-9]]*\)_set=.*/\1/p'`; do
141 eval ac_old_set=\$ac_cv_env_${ac_var}_set
142 eval ac_new_set=\$ac_env_${ac_var}_set
143 eval ac_old_val="\$ac_cv_env_${ac_var}_value"
144 eval ac_new_val="\$ac_env_${ac_var}_value"
145 case $ac_old_set,$ac_new_set in
147 AS_MESSAGE([error: `$ac_var' was set to `$ac_old_val' in the previous run], 2)
148 ac_cache_corrupted=: ;;
150 AS_MESSAGE([error: `$ac_var' was not set in the previous run], 2)
151 ac_cache_corrupted=: ;;
154 if test "x$ac_old_val" != "x$ac_new_val"; then
155 # differences in whitespace do not lead to failure.
156 ac_old_val_w=`echo x $ac_old_val`
157 ac_new_val_w=`echo x $ac_new_val`
158 if test "$ac_old_val_w" != "$ac_new_val_w"; then
159 AS_MESSAGE([error: `$ac_var' has changed since the previous run:], 2)
162 AS_MESSAGE([warning: ignoring whitespace changes in `$ac_var' since the previous run:], 2)
163 eval $ac_var=\$ac_old_val
165 AS_MESSAGE([ former value: `$ac_old_val'], 2)
166 AS_MESSAGE([ current value: `$ac_new_val'], 2)
169 # Pass precious variables to config.status.
170 if test "$ac_new_set" = set; then
172 dnl If you change this globbing pattern, test it on an old shell --
173 dnl it's sensitive. Putting any kind of quote in it causes syntax errors.
174 [ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)]
175 ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
176 *) ac_arg=$ac_var=$ac_new_val ;;
178 case " $ac_configure_args " in
179 *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
180 *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
184 if $ac_cache_corrupted; then
185 AS_MESSAGE([error: changes in the environment can compromise the build], 2)
186 AS_ERROR([run `make distclean' and/or `rm $cache_file' and start over])
188 ])# _AC_ARG_VAR_VALIDATE