1dnl Fix Autoconf-2.59 bugs: by overriding broken internal 2dnl Autoconf macros with backports of the 2.60+ fix. 3dnl - AC_CONFIG_SUBDIRS whitespace mangling, 4dnl - more lenient precious variable checks 5dnl - better configure error message 6dnl - reliance on non-Posix m4wrap (M4 1.6 or newer implement FIFO) 7dnl 8dnl The override bits of this file should be a no-op for the newest 9dnl Autoconf version, which means they can be removed once the complete 10dnl tree has moved to a new enough Autoconf version. 11dnl 12dnl The _GCC_AUTOCONF_VERSION_TEST ensures that exactly the desired 13dnl Autoconf version is used. It should be kept for consistency. 14 15dnl Provide m4_copy_force and m4_rename_force for old Autoconf versions. 16 17m4_ifndef([m4_copy_force], 18[m4_define([m4_copy_force], 19[m4_ifdef([$2], [m4_undefine([$2])])m4_copy($@)])]) 20 21m4_ifndef([m4_rename_force], 22[m4_define([m4_rename_force], 23[m4_ifdef([$2], [m4_undefine([$2])])m4_rename($@)])]) 24 25dnl m4_PACKAGE_VERSION is an undocumented Autoconf macro. 26dnl We use it because this fix is intended for 2.59 only. 27dnl A feature test for the broken AC_CONFIG_SUBDIRS instead 28dnl would be better but is tricky. 29dnl 30dnl Use ifdef/ifelse over m4_ifdef/m4_ifelse to be clean for 2.13. 31dnl Redefine AC_CONFIG_SUBDIRS so aclocal pulls in this file 32dnl when needed. 33 34ifdef([m4_PACKAGE_VERSION], 35[dnl AC_DEFUN a commonly used macro so this file is picked up. 36m4_copy([AC_PREREQ], [_AC_PREREQ]) 37AC_DEFUN([AC_PREREQ], [frob]) 38m4_copy_force([_AC_PREREQ], [AC_PREREQ]) 39 40 41dnl Ensure exactly this Autoconf version is used 42m4_ifndef([_GCC_AUTOCONF_VERSION], 43 [m4_define([_GCC_AUTOCONF_VERSION], [2.64])]) 44 45dnl Test for the exact version when AC_INIT is expanded. 46dnl This allows to update the tree in steps (for testing) 47dnl by putting 48dnl m4_define([_GCC_AUTOCONF_VERSION], [X.Y]) 49dnl in configure.ac before AC_INIT, 50dnl without rewriting this file. 51dnl Or for updating the whole tree at once with the definition above. 52AC_DEFUN([_GCC_AUTOCONF_VERSION_CHECK], 53[m4_if(m4_defn([_GCC_AUTOCONF_VERSION]), 54 m4_defn([m4_PACKAGE_VERSION]), [], 55 [m4_fatal([Please use exactly Autoconf ]_GCC_AUTOCONF_VERSION[ instead of ]m4_defn([m4_PACKAGE_VERSION])[.])]) 56]) 57m4_define([AC_INIT], m4_defn([AC_INIT])[ 58_GCC_AUTOCONF_VERSION_CHECK 59]) 60 61 62dnl Turn AC_DISABLE_OPTION_CHECKING into a no-op if not defined. 63m4_ifndef([AC_DISABLE_OPTION_CHECKING], 64 [m4_define([AC_DISABLE_OPTION_CHECKING])]) 65 66 67dnl Fix 2.64 cross compile detection for AVR and RTEMS 68dnl by not trying to compile fopen. 69m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.64], 70 [m4_foreach([_GCC_LANG], [C, C++, Fortran, Fortran 77], 71 [m4_define([_AC_LANG_IO_PROGRAM(]_GCC_LANG[)], m4_defn([AC_LANG_PROGRAM(]_GCC_LANG[)]))])]) 72 73 74m4_version_prereq([2.60],, [ 75dnl We use $ac_pwd in some of the overrides below; ensure its definition 76m4_divert_push([PARSE_ARGS])dnl 77ac_pwd=`pwd` 78m4_divert_pop([PARSE_ARGS])dnl 79]) 80 81 82m4_version_prereq([2.60],, [ 83 84# _AC_OUTPUT_SUBDIRS 85# ------------------ 86# This is a subroutine of AC_OUTPUT, but it does not go into 87# config.status, rather, it is called after running config.status. 88m4_define([_AC_OUTPUT_SUBDIRS], 89[ 90# 91# CONFIG_SUBDIRS section, as fixed in confsubdir.m4. 92# 93if test "$no_recursion" != yes; then 94 95 # Remove --cache-file and --srcdir arguments so they do not pile up. 96 ac_sub_configure_args= 97 ac_prev= 98 eval "set x $ac_configure_args" 99 shift 100 for ac_arg 101 do 102 if test -n "$ac_prev"; then 103 ac_prev= 104 continue 105 fi 106 case $ac_arg in 107 -cache-file | --cache-file | --cache-fil | --cache-fi \ 108 | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) 109 ac_prev=cache_file ;; 110 -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ 111 | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ 112 | --c=*) 113 ;; 114 --config-cache | -C) 115 ;; 116 -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) 117 ac_prev=srcdir ;; 118 -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) 119 ;; 120 -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) 121 ac_prev=prefix ;; 122 -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) 123 ;; 124 *) 125 case $ac_arg in 126 *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; 127 esac 128 ac_sub_configure_args="$ac_sub_configure_args '$ac_arg'" ;; 129 esac 130 done 131 132 # Always prepend --prefix to ensure using the same prefix 133 # in subdir configurations. 134 ac_arg="--prefix=$prefix" 135 case $ac_arg in 136 *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; 137 esac 138 ac_sub_configure_args="$ac_arg $ac_sub_configure_args" 139 140 ac_popdir=`pwd` 141 for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue 142 143 # Do not complain, so a configure script can configure whichever 144 # parts of a large source tree are present. 145 test -d "$srcdir/$ac_dir" || continue 146 147 AC_MSG_NOTICE([configuring in $ac_dir]) 148 AS_MKDIR_P(["$ac_dir"]) 149 _AC_SRCPATHS(["$ac_dir"]) 150 151 cd "$ac_dir" 152 153 # Check for guested configure; otherwise get Cygnus style configure. 154 if test -f "$ac_srcdir/configure.gnu"; then 155 ac_sub_configure=$ac_srcdir/configure.gnu 156 elif test -f "$ac_srcdir/configure"; then 157 ac_sub_configure=$ac_srcdir/configure 158 elif test -f "$ac_srcdir/configure.in"; then 159 # This should be Cygnus configure. 160 ac_sub_configure=$ac_aux_dir/configure 161 else 162 AC_MSG_WARN([no configuration information is in $ac_dir]) 163 ac_sub_configure= 164 fi 165 166 # The recursion is here. 167 if test -n "$ac_sub_configure"; then 168 # Make the cache file name correct relative to the subdirectory. 169 case $cache_file in 170 [[\\/]]* | ?:[[\\/]]* ) ac_sub_cache_file=$cache_file ;; 171 *) # Relative path. 172 ac_sub_cache_file=$ac_top_builddir$cache_file ;; 173 esac 174 175 AC_MSG_NOTICE([running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir]) 176 # The eval makes quoting arguments work. 177 eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \ 178 --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" || 179 AC_MSG_ERROR([$ac_sub_configure failed for $ac_dir]) 180 fi 181 182 cd "$ac_popdir" 183 done 184fi 185])# _AC_OUTPUT_SUBDIRS 186]) 187 188m4_version_prereq([2.63],, [ 189 190# _AC_ARG_VAR_VALIDATE 191# -------------------- 192# The code is the same as autoconf 2.59, but with a more lenient check 193# on precious variables and an output of pwd that have been added in 194# autoconf 2.62. 195m4_define([_AC_ARG_VAR_VALIDATE], 196[m4_divert_text([INIT_PREPARE], 197[# Check that the precious variables saved in the cache have kept the same 198# value. 199ac_cache_corrupted=false 200for ac_var in `(set) 2>&1 | 201 sed -n 's/^ac_env_\([[a-zA-Z_0-9]]*\)_set=.*/\1/p'`; do 202 eval ac_old_set=\$ac_cv_env_${ac_var}_set 203 eval ac_new_set=\$ac_env_${ac_var}_set 204 eval ac_old_val="\$ac_cv_env_${ac_var}_value" 205 eval ac_new_val="\$ac_env_${ac_var}_value" 206 case $ac_old_set,$ac_new_set in 207 set,) 208 AS_MESSAGE([error: `$ac_var' was set to `$ac_old_val' in the previous run], 2) 209 ac_cache_corrupted=: ;; 210 ,set) 211 AS_MESSAGE([error: `$ac_var' was not set in the previous run], 2) 212 ac_cache_corrupted=: ;; 213 ,);; 214 *) 215 if test "x$ac_old_val" != "x$ac_new_val"; then 216 # differences in whitespace do not lead to failure. 217 ac_old_val_w=`echo x $ac_old_val` 218 ac_new_val_w=`echo x $ac_new_val` 219 if test "$ac_old_val_w" != "$ac_new_val_w"; then 220 AS_MESSAGE([error: `$ac_var' has changed since the previous run:], 2) 221 ac_cache_corrupted=: 222 else 223 AS_MESSAGE([warning: ignoring whitespace changes in `$ac_var' since the previous run:], 2) 224 eval $ac_var=\$ac_old_val 225 fi 226 AS_MESSAGE([ former value: `$ac_old_val'], 2) 227 AS_MESSAGE([ current value: `$ac_new_val'], 2) 228 fi;; 229 esac 230 # Pass precious variables to config.status. 231 if test "$ac_new_set" = set; then 232 case $ac_new_val in 233dnl If you change this globbing pattern, test it on an old shell -- 234dnl it's sensitive. Putting any kind of quote in it causes syntax errors. 235[ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)] 236 ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; 237 *) ac_arg=$ac_var=$ac_new_val ;; 238 esac 239 case " $ac_configure_args " in 240 *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. 241 *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; 242 esac 243 fi 244done 245if $ac_cache_corrupted; then 246 AS_MESSAGE([error: in `$ac_pwd':], 2) 247 AS_MESSAGE([error: changes in the environment can compromise the build], 2) 248 AS_ERROR([run `make distclean' and/or `rm $cache_file' and start over]) 249fi])dnl 250])# _AC_ARG_VAR_VALIDATE 251]) 252 253m4_version_prereq([2.63],, [ 254 255# AC_MSG_FAILURE(ERROR, [EXIT-STATUS = 1]) 256# ---------------------------------------- 257# This is the same code as in 2.59 and 2.61, except it also outputs pwd. 258m4_define([AC_MSG_FAILURE], 259[{ AS_MESSAGE([error: in `$ac_pwd':], 2) 260AC_MSG_ERROR([$1 261See `config.log' for more details.], [$2]); }]) 262]) 263]) 264 265m4_version_prereq([2.60],, [ 266dnl M4 1.6 and newer implement m4wrap using FIFO semantics, as required 267dnl by Posix; earlier versions used LIFO semantics. Unfortunately, 268dnl Autoconf versions before 2.60 require those LIFO semantics, so 269dnl make sure to give it to them. 270m4_define([m4_wrap], [m4_ifdef([_$0_text], 271 [m4_define([_$0_text], [$1]m4_defn([_$0_text]))], 272 [m4_define([_$0_text], [$1])m4_builtin([m4wrap], 273 [m4_default(m4_defn([_$0_text])m4_undefine([_$0_text]))])])]) 274]) 275