]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - config/override.m4
2008-04-18 Paolo Bonzini <bonzini@gnu.org>
[thirdparty/binutils-gdb.git] / config / override.m4
CommitLineData
266df637
PB
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
6dnl This file should be a no-op for Autoconf versions != 2.59.
7dnl It can be removed once the complete tree has moved to a
8dnl newer Autoconf version.
9
10dnl m4_PACKAGE_VERSION is an undocumented Autoconf macro.
11dnl We use it because this fix is intended for 2.59 only.
12dnl A feature test for the broken AC_CONFIG_SUBDIRS instead
13dnl would be better but is tricky.
14dnl
15dnl Use ifdef/ifelse over m4_ifdef/m4_ifelse to be clean for 2.13.
16dnl Redefine AC_CONFIG_SUBDIRS so aclocal pulls in this file
17dnl when needed.
18
19ifdef([m4_PACKAGE_VERSION],
20[ifelse(m4_PACKAGE_VERSION, [2.59], [
21
22dnl AC_DEFUN a commonly used macro so this file is picked up.
23m4_copy([AC_PREREQ], [_AC_PREREQ])
24AC_DEFUN([AC_PREREQ], [frob])
25m4_copy([_AC_PREREQ], [AC_PREREQ])
26
27dnl Override the broken macro.
28# _AC_OUTPUT_SUBDIRS
29# ------------------
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.
32m4_define([_AC_OUTPUT_SUBDIRS],
33[
34#
35# CONFIG_SUBDIRS section, as fixed in confsubdir.m4.
36#
37if test "$no_recursion" != yes; then
38
39 # Remove --cache-file and --srcdir arguments so they do not pile up.
40 ac_sub_configure_args=
41 ac_prev=
42 eval "set x $ac_configure_args"
43 shift
44 for ac_arg
45 do
46 if test -n "$ac_prev"; then
47 ac_prev=
48 continue
49 fi
50 case $ac_arg in
51 -cache-file | --cache-file | --cache-fil | --cache-fi \
52 | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
53 ac_prev=cache_file ;;
54 -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
55 | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \
56 | --c=*)
57 ;;
58 --config-cache | -C)
59 ;;
60 -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
61 ac_prev=srcdir ;;
62 -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
63 ;;
64 -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
65 ac_prev=prefix ;;
66 -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
67 ;;
68 *)
69 case $ac_arg in
70 *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
71 esac
72 ac_sub_configure_args="$ac_sub_configure_args '$ac_arg'" ;;
73 esac
74 done
75
76 # Always prepend --prefix to ensure using the same prefix
77 # in subdir configurations.
78 ac_arg="--prefix=$prefix"
79 case $ac_arg in
80 *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
81 esac
82 ac_sub_configure_args="$ac_arg $ac_sub_configure_args"
83
84 ac_popdir=`pwd`
85 for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue
86
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
90
91 AC_MSG_NOTICE([configuring in $ac_dir])
92 AS_MKDIR_P(["$ac_dir"])
93 _AC_SRCPATHS(["$ac_dir"])
94
95 cd "$ac_dir"
96
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
105 else
106 AC_MSG_WARN([no configuration information is in $ac_dir])
107 ac_sub_configure=
108 fi
109
110 # The recursion is here.
111 if test -n "$ac_sub_configure"; then
112 # Make the cache file name correct relative to the subdirectory.
113 case $cache_file in
114 [[\\/]]* | ?:[[\\/]]* ) ac_sub_cache_file=$cache_file ;;
115 *) # Relative path.
116 ac_sub_cache_file=$ac_top_builddir$cache_file ;;
117 esac
118
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])
124 fi
125
126 cd "$ac_popdir"
127 done
128fi
129])# _AC_OUTPUT_SUBDIRS
130
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.
135m4_define([_AC_ARG_VAR_VALIDATE],
136[# Check that the precious variables saved in the cache have kept the same
137# value.
138ac_cache_corrupted=false
139for 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
146 set,)
147 AS_MESSAGE([error: `$ac_var' was set to `$ac_old_val' in the previous run], 2)
148 ac_cache_corrupted=: ;;
149 ,set)
150 AS_MESSAGE([error: `$ac_var' was not set in the previous run], 2)
151 ac_cache_corrupted=: ;;
152 ,);;
153 *)
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)
160 ac_cache_corrupted=:
161 else
162 AS_MESSAGE([warning: ignoring whitespace changes in `$ac_var' since the previous run:], 2)
163 eval $ac_var=\$ac_old_val
164 fi
165 AS_MESSAGE([ former value: `$ac_old_val'], 2)
166 AS_MESSAGE([ current value: `$ac_new_val'], 2)
167 fi;;
168 esac
169 # Pass precious variables to config.status.
170 if test "$ac_new_set" = set; then
171 case $ac_new_val in
172dnl If you change this globbing pattern, test it on an old shell --
173dnl 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 ;;
177 esac
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'" ;;
181 esac
182 fi
183done
184if $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])
187fi
188])# _AC_ARG_VAR_VALIDATE
189])])