]> git.ipfire.org Git - thirdparty/gcc.git/blame - configure.ac
This patch works around a parsing problem with g++ 4.3.
[thirdparty/gcc.git] / configure.ac
CommitLineData
beeaf216 1# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
daecebc8 2# 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
8927b7c0 3# Free Software Foundation, Inc.
6599da04
JM
4#
5# This file is free software; you can redistribute it and/or modify it
6# under the terms of the GNU General Public License as published by
309c24a9 7# the Free Software Foundation; either version 3 of the License, or
6599da04
JM
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful, but
11# WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13# General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
309c24a9
JJ
16# along with this program; see the file COPYING3. If not see
17# <http://www.gnu.org/licenses/>.
6599da04
JM
18
19##############################################################################
671aa708
NN
20### WARNING: this file contains embedded tabs. Do not run untabify on this file.
21
7142fb32
PB
22m4_include(config/acx.m4)
23m4_include(config/override.m4)
38d24731 24m4_include(config/proginstall.m4)
7413962d 25m4_include(config/elf.m4)
592c90ff
KG
26m4_include([libtool.m4])
27m4_include([ltoptions.m4])
28m4_include([ltsugar.m4])
29m4_include([ltversion.m4])
30m4_include([lt~obsolete.m4])
33ad93b9 31m4_include([config/isl.m4])
d32ef397 32m4_include([config/cloog.m4])
ad6717df 33
671aa708 34AC_INIT(move-if-change)
df58e648 35AC_PREREQ(2.64)
0115d4a3 36AC_DISABLE_OPTION_CHECKING
1c710c3c 37
ad33ff57
RW
38progname=$0
39# if PWD already has a value, it is probably wrong.
40if test -n "$PWD" ; then PWD=`${PWDCMD-pwd}`; fi
41
42# Export original configure arguments for use by sub-configures.
43# Quote arguments with shell meta charatcers.
44TOPLEVEL_CONFIGURE_ARGUMENTS=
45set -- "$progname" "$@"
46for ac_arg
47do
48 case "$ac_arg" in
49 *" "*|*" "*|*[[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\']]*)
50 ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"`
51 # if the argument is of the form -foo=baz, quote the baz part only
52 ac_arg=`echo "'$ac_arg'" | sed "s/^'\([[-a-zA-Z0-9]]*=\)/\\1'/"` ;;
53 *) ;;
54 esac
55 # Add the quoted argument to the list.
56 TOPLEVEL_CONFIGURE_ARGUMENTS="$TOPLEVEL_CONFIGURE_ARGUMENTS $ac_arg"
57done
58if test "$silent" = yes; then
59 TOPLEVEL_CONFIGURE_ARGUMENTS="$TOPLEVEL_CONFIGURE_ARGUMENTS --silent"
60fi
61# Remove the initial space we just introduced and, as these will be
62# expanded by make, quote '$'.
63TOPLEVEL_CONFIGURE_ARGUMENTS=`echo "x$TOPLEVEL_CONFIGURE_ARGUMENTS" | sed -e 's/^x *//' -e 's,\\$,$$,g'`
64AC_SUBST(TOPLEVEL_CONFIGURE_ARGUMENTS)
65
1c710c3c
DJ
66# Find the build, host, and target systems.
67ACX_NONCANONICAL_BUILD
68ACX_NONCANONICAL_HOST
69ACX_NONCANONICAL_TARGET
70
71dnl Autoconf 2.5x and later will set a default program prefix if
72dnl --target was used, even if it was the same as --host. Disable
73dnl that behavior. This must be done before AC_CANONICAL_SYSTEM
74dnl to take effect.
75test "$host_noncanonical" = "$target_noncanonical" &&
76 test "$program_prefix$program_suffix$program_transform_name" = \
77 NONENONEs,x,x, &&
78 program_transform_name=s,y,y,
79
671aa708
NN
80AC_CANONICAL_SYSTEM
81AC_ARG_PROGRAM
82
1c710c3c 83m4_pattern_allow([^AS_FOR_TARGET$])dnl
0999159b 84m4_pattern_allow([^AS_FOR_BUILD$])dnl
1c710c3c 85
775956d0
NN
86# Get 'install' or 'install-sh' and its variants.
87AC_PROG_INSTALL
ad6717df 88ACX_PROG_LN
148907ea 89AC_PROG_LN_S
87264276
PB
90AC_PROG_SED
91AC_PROG_AWK
775956d0 92
fc45f3fe
DJ
93srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
94
95# We pass INSTALL explicitly to sub-makes. Make sure that it is not
96# a relative path.
97if test "$INSTALL" = "${srcdir}/install-sh -c"; then
98 INSTALL="${srcpwd}/install-sh -c"
99fi
100
671aa708
NN
101# Set srcdir to "." if that's what it is.
102# This is important for multilib support.
103pwd=`${PWDCMD-pwd}`
671aa708
NN
104if test "${pwd}" = "${srcpwd}" ; then
105 srcdir=.
106fi
107
108topsrcdir=$srcpwd
6599da04 109
4977bab6 110extra_host_args=
afabd8e6 111
6599da04
JM
112### To add a new directory to the tree, first choose whether it is a target
113### or a host dependent tool. Then put it into the appropriate list
4977bab6
ZW
114### (library or tools, host or target), doing a dependency sort.
115
116# Subdirs will be configured in the order listed in build_configdirs,
117# configdirs, or target_configdirs; see the serialization section below.
118
119# Dependency sorting is only needed when *configuration* must be done in
120# a particular order. In all cases a dependency should be specified in
121# the Makefile, whether or not it's implicitly specified here.
6599da04 122
4977bab6
ZW
123# Double entries in build_configdirs, configdirs, or target_configdirs may
124# cause circular dependencies and break everything horribly.
6599da04 125
23f6b2f9
PB
126# these library is used by various programs built for the build
127# environment
128#
129build_libs="build-libiberty"
130
131# these tools are built for the build environment
85bfb75e 132build_tools="build-texinfo build-flex build-bison build-m4 build-fixincludes"
23f6b2f9 133
6599da04
JM
134# these libraries are used by various programs built for the host environment
135#
33ad93b9 136host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libcpp libdecnumber gmp mpfr mpc isl cloog libelf libiconv"
6599da04 137
6599da04
JM
138# these tools are built for the host environment
139# Note, the powerpc-eabi build depends on sim occurring before gdb in order to
140# know that we are building the simulator.
4977bab6
ZW
141# binutils, gas and ld appear in that order because it makes sense to run
142# "make check" in that particular order.
38e3d868 143# If --enable-gold is used, "gold" may replace "ld".
85bfb75e 144host_tools="texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gprof etc expect dejagnu m4 utils guile fastjar gnattools"
5d4a5ee6 145
7743113b
AG
146# libgcj represents the runtime libraries only used by gcj.
147libgcj="target-libffi \
7743113b 148 target-zlib \
7743113b
AG
149 target-libjava"
150
6599da04
JM
151# these libraries are built for the target environment, and are built after
152# the host libraries and the host tools (which may be a cross compiler)
8499116a 153# Note that libiberty is not a target library.
291f172e 154target_libraries="target-libgcc \
5d4a5ee6
JL
155 target-libgloss \
156 target-newlib \
6d3b5aea 157 target-libgomp \
48310492 158 target-libatomic \
0a35513e 159 target-libitm \
cb543528 160 target-libstdc++-v3 \
6de9cd9a 161 target-libmudflap \
77008252 162 target-libssp \
1ec601bf 163 target-libquadmath \
6de9cd9a 164 target-libgfortran \
7cd0cf9c 165 target-boehm-gc \
77d187bc 166 ${libgcj} \
d9cdb878 167 target-libobjc \
632e2a07
ILT
168 target-libada \
169 target-libgo"
6599da04 170
4dbda6f0
NN
171# these tools are built using the target libraries, and are intended to
172# run only in the target environment
6599da04 173#
4dbda6f0 174# note: any program that *uses* libraries that are in the "target_libraries"
1bcce263 175# list belongs in this list.
6599da04 176#
85bfb75e 177target_tools="target-rda"
6599da04
JM
178
179################################################################################
180
6599da04
JM
181## All tools belong in one of the four categories, and are assigned above
182## We assign ${configdirs} this way to remove all embedded newlines. This
183## is important because configure will choke if they ever get through.
184## ${configdirs} is directories we build using the host tools.
185## ${target_configdirs} is directories we build using the target tools.
6599da04 186configdirs=`echo ${host_libs} ${host_tools}`
4dbda6f0 187target_configdirs=`echo ${target_libraries} ${target_tools}`
71b5d516 188build_configdirs=`echo ${build_libs} ${build_tools}`
8b87bb96 189
ac9e6043 190m4_divert_text([PARSE_ARGS],
87841584
AM
191[case $srcdir in
192 *" "*)
193m4_pushdef([AS_MESSAGE_LOG_FD], [])dnl
194 AC_MSG_ERROR([path to source, $srcdir, contains spaces])
195m4_popdef([AS_MESSAGE_LOG_FD])dnl
196 ;;
197esac
198ac_subdirs_all=`cd $srcdir && echo */configure | sed 's,/configure,,g'`
ac9e6043
RW
199])
200
6599da04
JM
201################################################################################
202
6599da04
JM
203srcname="gnu development package"
204
205# This gets set non-empty for some net releases of packages.
206appdirs=""
207
e1848dde
NN
208# Define is_cross_compiler to save on calls to 'test'.
209is_cross_compiler=
210if test x"${host}" = x"${target}" ; then
211 is_cross_compiler=no
212else
213 is_cross_compiler=yes
214fi
215
b4acb5ef 216# Find the build and target subdir names.
8b87bb96 217GCC_TOPLEV_SUBDIRS
0db770bd
RW
218# Be sure to cover against remnants of an in-tree build.
219if test $srcdir != . && test -d $srcdir/host-${host_noncanonical}; then
220 AC_MSG_ERROR([building out of tree but $srcdir contains host-${host_noncanonical}.
221Use a pristine source tree when building in a separate tree])
222fi
f653f0ab 223
55380b08
NN
224# Skipdirs are removed silently.
225skipdirs=
226# Noconfigdirs are removed loudly.
227noconfigdirs=""
6599da04 228
55380b08
NN
229use_gnu_ld=
230# Make sure we don't let GNU ld be added if we didn't want it.
231if test x$with_gnu_ld = xno ; then
232 use_gnu_ld=no
5afab7ad 233 noconfigdirs="$noconfigdirs ld gold"
6599da04
JM
234fi
235
55380b08
NN
236use_gnu_as=
237# Make sure we don't let GNU as be added if we didn't want it.
238if test x$with_gnu_as = xno ; then
239 use_gnu_as=no
240 noconfigdirs="$noconfigdirs gas"
6599da04
JM
241fi
242
d7f09764
DN
243use_included_zlib=
244# Make sure we don't let ZLIB be added if we didn't want it.
245if test x$with_system_zlib = xyes ; then
246 use_included_zlib=no
247 noconfigdirs="$noconfigdirs zlib"
248fi
249
55380b08
NN
250# some tools are so dependent upon X11 that if we're not building with X,
251# it's not even worth trying to configure, much less build, that tool.
6599da04 252
55380b08
NN
253case ${with_x} in
254 yes | "") ;; # the default value for this tree is that X11 is available
423ce3eb 255 no)
b4f96efe 256 skipdirs="${skipdirs} tk itcl libgui"
423ce3eb
NN
257 # We won't be able to build gdbtk without X.
258 enable_gdbtk=no
259 ;;
55380b08
NN
260 *) echo "*** bad value \"${with_x}\" for -with-x flag; ignored" 1>&2 ;;
261esac
6599da04 262
1bcce263 263# Some are only suitable for cross toolchains.
95ddd785
NN
264# Remove these if host=target.
265cross_only="target-libgloss target-newlib target-opcodes"
6599da04 266
55380b08
NN
267case $is_cross_compiler in
268 no) skipdirs="${skipdirs} ${cross_only}" ;;
55380b08 269esac
6599da04 270
0c639b89
DD
271# If both --with-headers and --with-libs are specified, default to
272# --without-newlib.
9082a750
MR
273if test x"${with_headers}" != x && test x"${with_headers}" != xno \
274 && test x"${with_libs}" != x && test x"${with_libs}" != xno ; then
0c639b89
DD
275 if test x"${with_newlib}" = x ; then
276 with_newlib=no
277 fi
278fi
279
280# Recognize --with-newlib/--without-newlib.
281case ${with_newlib} in
282 no) skipdirs="${skipdirs} target-newlib" ;;
283 yes) skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'` ;;
284esac
285
21539e2e
MK
286# Handle --enable-gold, --enable-ld.
287# --disable-gold [--enable-ld]
288# Build only ld. Default option.
9580395f
L
289# --enable-gold [--enable-ld]
290# Build both gold and ld. Install gold as "ld.gold", install ld
291# as "ld.bfd" and "ld".
292# --enable-gold=default [--enable-ld]
21539e2e
MK
293# Build both gold and ld. Install gold as "ld.gold" and "ld",
294# install ld as "ld.bfd".
295# --enable-gold[=default] --disable-ld
296# Build only gold, which is then installed as both "ld.gold" and "ld".
297# --enable-gold --enable-ld=default
9580395f
L
298# Build both gold (installed as "ld.gold") and ld (installed as "ld"
299# and ld.bfd).
21539e2e
MK
300# In other words, ld is default
301# --enable-gold=default --enable-ld=default
302# Error.
303
304default_ld=
5afab7ad 305AC_ARG_ENABLE(gold,
33e39b66
AS
306[AS_HELP_STRING([[--enable-gold[=ARG]]],
307 [build gold @<:@ARG={default,yes,no}@:>@])],
5afab7ad
ILT
308ENABLE_GOLD=$enableval,
309ENABLE_GOLD=no)
21539e2e
MK
310case "${ENABLE_GOLD}" in
311 yes|default)
38e3d868
RM
312 # Check for ELF target.
313 is_elf=no
314 case "${target}" in
315 *-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
316 | *-*-linux* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
8c6d158a
JM
317 | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* \
318 | *-*-solaris2* | *-*-nto*)
38e3d868
RM
319 case "${target}" in
320 *-*-linux*aout* | *-*-linux*oldld*)
321 ;;
322 *)
323 is_elf=yes
324 ;;
325 esac
326 esac
327
328 if test "$is_elf" = "yes"; then
329 # Check for target supported by gold.
5afab7ad 330 case "${target}" in
38e3d868 331 i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-*)
21539e2e
MK
332 configdirs="$configdirs gold"
333 if test x${ENABLE_GOLD} = xdefault; then
334 default_ld=gold
335 fi
38e3d868 336 ENABLE_GOLD=yes
5afab7ad
ILT
337 ;;
338 esac
38e3d868
RM
339 fi
340 ;;
341 no)
342 ;;
343 *)
344 AC_MSG_ERROR([invalid --enable-gold argument])
345 ;;
21539e2e
MK
346esac
347
348AC_ARG_ENABLE(ld,
33e39b66
AS
349[AS_HELP_STRING([[--enable-ld[=ARG]]],
350 [build ld @<:@ARG={default,yes,no}@:>@])],
21539e2e
MK
351ENABLE_LD=$enableval,
352ENABLE_LD=yes)
353
354case "${ENABLE_LD}" in
355 default)
9580395f 356 if test x${default_ld} != x; then
21539e2e
MK
357 AC_MSG_ERROR([either gold or ld can be the default ld])
358 fi
359 ;;
360 yes)
361 ;;
362 no)
363 if test x${ENABLE_GOLD} != xyes; then
364 AC_MSG_WARN([neither ld nor gold are enabled])
365 fi
366 configdirs=`echo " ${configdirs} " | sed -e 's/ ld / /'`
367 ;;
368 *)
369 AC_MSG_ERROR([invalid --enable-ld argument])
370 ;;
371esac
5afab7ad 372
6599da04
JM
373# Configure extra directories which are host specific
374
375case "${host}" in
55380b08 376 *-cygwin*)
4977bab6 377 configdirs="$configdirs libtermcap" ;;
6599da04
JM
378esac
379
4fab7234
HPN
380# A target can indicate whether a language isn't supported for some reason.
381# Only spaces may be used in this macro; not newlines or tabs.
382unsupported_languages=
383
6599da04
JM
384# Remove more programs from consideration, based on the host or
385# target this usually means that a port of the program doesn't
386# exist yet.
387
6599da04 388case "${host}" in
111eeb6e 389 i[[3456789]]86-*-msdosdjgpp*)
c9bdb152 390 noconfigdirs="$noconfigdirs tcl tk itcl"
5d4a5ee6 391 ;;
6599da04
JM
392esac
393
6de9cd9a 394
87e6d9dc
TB
395AC_ARG_ENABLE(libquadmath,
396AS_HELP_STRING([--disable-libquadmath],
397 [do not build libquadmath directory]),
398ENABLE_LIBQUADMATH=$enableval,
399ENABLE_LIBQUADMATH=yes)
400if test "${ENABLE_LIBQUADMATH}" = "no" ; then
401 noconfigdirs="$noconfigdirs target-libquadmath"
402fi
403
404
405AC_ARG_ENABLE(libquadmath-support,
406AS_HELP_STRING([--disable-libquadmath-support],
407 [disable libquadmath support for Fortran]),
408ENABLE_LIBQUADMATH_SUPPORT=$enableval,
409ENABLE_LIBQUADMATH_SUPPORT=yes)
410enable_libquadmath_support=
411if test "${ENABLE_LIBQUADMATH_SUPPORT}" = "no" ; then
412 enable_libquadmath_support=no
413fi
414
415
d9cdb878 416AC_ARG_ENABLE(libada,
33e39b66 417[AS_HELP_STRING([--enable-libada], [build libada directory])],
d9cdb878
AC
418ENABLE_LIBADA=$enableval,
419ENABLE_LIBADA=yes)
420if test "${ENABLE_LIBADA}" != "yes" ; then
5395b47b 421 noconfigdirs="$noconfigdirs gnattools"
d9cdb878
AC
422fi
423
ef0087a7 424AC_ARG_ENABLE(libssp,
33e39b66 425[AS_HELP_STRING([--enable-libssp], [build libssp directory])],
ef0087a7
KH
426ENABLE_LIBSSP=$enableval,
427ENABLE_LIBSSP=yes)
ef0087a7 428
8343765d
AO
429# Save it here so that, even in case of --enable-libgcj, if the Java
430# front-end isn't enabled, we still get libgcj disabled.
431libgcj_saved=$libgcj
432case $enable_libgcj in
433yes)
434 # If we reset it here, it won't get added to noconfigdirs in the
435 # target-specific build rules, so it will be forcibly enabled
436 # (unless the Java language itself isn't enabled).
437 libgcj=
438 ;;
439no)
440 # Make sure we get it printed in the list of not supported target libs.
4da3b0f8
ILT
441 # Don't disable libffi, though, other languages use it.
442 noconfigdirs="$noconfigdirs `echo ${libgcj} | sed -e 's/target-libffi//'`"
d479b128
ILT
443 # Clear libgcj_saved so that even if java is enabled libffi won't be
444 # built.
445 libgcj_saved=
8343765d
AO
446 ;;
447esac
448
a4a2c37d
MK
449AC_ARG_ENABLE(static-libjava,
450[AS_HELP_STRING([[--enable-static-libjava[=ARG]]],
451 [build static libjava @<:@default=no@:>@])],
452ENABLE_STATIC_LIBJAVA=$enableval,
453ENABLE_STATIC_LIBJAVA=no)
454enable_static_libjava=
455if test "${ENABLE_STATIC_LIBJAVA}" = "yes" ; then
456 enable_static_libjava=yes
457fi
458
459if test x$enable_static_libjava != xyes ; then
460 EXTRA_CONFIGARGS_LIBJAVA=--disable-static
461fi
462AC_SUBST(EXTRA_CONFIGARGS_LIBJAVA)
6de9cd9a 463
27079765
AH
464# Disable libmudflap on some systems.
465if test x$enable_libmudflap = x ; then
dfcada9a 466 case "${target}" in
416ac4d4 467 *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | bfin*-*-uclinux* | *-*-kopensolaris*-gnu)
98a5bb3b 468 # Enable libmudflap by default in GNU and friends.
dfcada9a 469 ;;
a3e8d8b4
LR
470 *-*-freebsd*)
471 # Enable libmudflap by default in FreeBSD.
472 ;;
dfcada9a
MM
473 *)
474 # Disable it by default everywhere else.
475 noconfigdirs="$noconfigdirs target-libmudflap"
476 ;;
477 esac
27079765 478fi
6de9cd9a 479
27079765
AH
480# Disable libgomp on non POSIX hosted systems.
481if test x$enable_libgomp = x ; then
953ff289
DN
482 # Enable libgomp by default on hosted POSIX systems.
483 case "${target}" in
416ac4d4 484 *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
953ff289 485 ;;
8c6d158a 486 *-*-netbsd* | *-*-freebsd* | *-*-openbsd* | *-*-dragonfly*)
953ff289 487 ;;
b24513a1 488 *-*-solaris2* | *-*-hpux11*)
953ff289 489 ;;
cac90078 490 *-*-darwin* | *-*-aix*)
953ff289
DN
491 ;;
492 *)
493 noconfigdirs="$noconfigdirs target-libgomp"
494 ;;
495 esac
27079765 496fi
953ff289 497
48310492
RH
498# Disable libatomic on unsupported systems.
499if test -d ${srcdir}/libatomic; then
500 if test x$enable_libatomic = x; then
501 AC_MSG_CHECKING([for libatomic support])
502 if (srcdir=${srcdir}/libatomic; \
503 . ${srcdir}/configure.tgt; \
504 test -n "$UNSUPPORTED")
505 then
506 AC_MSG_RESULT([no])
507 noconfigdirs="$noconfigdirs target-libatomic"
508 else
509 AC_MSG_RESULT([yes])
510 fi
511 fi
512fi
513
e948157d
RH
514# Disable libitm on unsupported systems.
515if test -d ${srcdir}/libitm; then
516 if test x$enable_libitm = x; then
517 AC_MSG_CHECKING([for libitm support])
518 if (srcdir=${srcdir}/libitm; \
519 . ${srcdir}/configure.tgt; \
520 test -n "$UNSUPPORTED")
521 then
522 AC_MSG_RESULT([no])
523 noconfigdirs="$noconfigdirs target-libitm"
524 else
525 AC_MSG_RESULT([yes])
526 fi
527 fi
0a35513e
AH
528fi
529
1e9e0e23
JM
530# Disable libssp for some systems.
531case "${target}" in
532 avr-*-*)
b318fb4b 533 # No hosted I/O support.
1e9e0e23
JM
534 noconfigdirs="$noconfigdirs target-libssp"
535 ;;
536 powerpc-*-aix* | rs6000-*-aix*)
537 noconfigdirs="$noconfigdirs target-libssp"
538 ;;
85b8555e
DD
539 rl78-*-*)
540 # libssp uses a misaligned load to trigger a fault, but the RL78
541 # doesn't fault for those - instead, it gives a build-time error
542 # for explicit misaligned loads.
543 noconfigdirs="$noconfigdirs target-libssp"
544 ;;
1e9e0e23
JM
545esac
546
a4cf6e46
GJL
547# Disable libquadmath for some systems.
548case "${target}" in
549 avr-*-*)
550 noconfigdirs="$noconfigdirs target-libquadmath"
551 ;;
552esac
553
1e9e0e23
JM
554# Disable libstdc++-v3 for some systems.
555case "${target}" in
556 *-*-vxworks*)
557 # VxWorks uses the Dinkumware C++ library.
558 noconfigdirs="$noconfigdirs target-libstdc++-v3"
559 ;;
560 arm*-wince-pe*)
561 # the C++ libraries don't build on top of CE's C libraries
562 noconfigdirs="$noconfigdirs target-libstdc++-v3"
563 ;;
564 avr-*-*)
565 noconfigdirs="$noconfigdirs target-libstdc++-v3"
566 ;;
567esac
568
569# Disable Fortran for some systems.
570case "${target}" in
571 mmix-*-*)
572 # See <http://gcc.gnu.org/ml/gcc-patches/2004-11/msg00572.html>.
573 unsupported_languages="$unsupported_languages fortran"
574 ;;
575esac
576
80f81134 577# Disable Java if libffi is not supported.
2909494b 578case "${target}" in
80f81134
JM
579 alpha*-*-*)
580 ;;
581 arm*-*-*)
582 ;;
583 cris-*-*)
584 ;;
585 frv-*-*)
586 ;;
587 hppa*-*-linux*)
588 ;;
589 hppa*-*-hpux*)
590 ;;
591 i?86-*-*)
592 ;;
593 ia64*-*-*)
594 ;;
595 m32r*-*-*)
596 ;;
597 m68k-*-*)
598 ;;
b24513a1 599 mips*-*-rtems*)
80f81134
JM
600 ;;
601 mips*-*-linux*)
602 ;;
603 powerpc*-*-linux*)
604 ;;
605 powerpc-*-darwin*)
606 ;;
607 powerpc-*-aix* | rs6000-*-aix*)
608 ;;
609 powerpc-*-freebsd*)
610 ;;
611 powerpc64-*-freebsd*)
612 ;;
613 powerpc*-*-rtems*)
2909494b 614 ;;
80f81134
JM
615 s390-*-* | s390x-*-*)
616 ;;
617 sh-*-* | sh[[34]]*-*-*)
618 ;;
619 sh64-*-* | sh5*-*-*)
620 ;;
621 sparc*-*-*)
622 ;;
623 x86_64-*-*)
624 ;;
625 *-*-*)
626 unsupported_languages="$unsupported_languages java"
627 ;;
628esac
629
630# Disable Java, libgcj or related libraries for some systems.
631case "${target}" in
2909494b
JM
632 powerpc-*-darwin*)
633 ;;
634 i[[3456789]]86-*-darwin*)
635 ;;
636 x86_64-*-darwin[[912]]*)
637 ;;
638 *-*-darwin*)
639 noconfigdirs="$noconfigdirs ${libgcj}"
640 ;;
2909494b
JM
641 *-*-netware*)
642 noconfigdirs="$noconfigdirs ${libgcj}"
643 ;;
644 *-*-rtems*)
645 noconfigdirs="$noconfigdirs ${libgcj}"
646 ;;
647 *-*-tpf*)
648 noconfigdirs="$noconfigdirs ${libgcj}"
649 ;;
650 *-*-uclinux*)
651 noconfigdirs="$noconfigdirs ${libgcj}"
652 ;;
653 *-*-vxworks*)
654 noconfigdirs="$noconfigdirs ${libgcj}"
655 ;;
2909494b
JM
656 alpha*-*-*vms*)
657 noconfigdirs="$noconfigdirs ${libgcj}"
658 ;;
80f81134 659 arm-wince-pe)
2909494b
JM
660 noconfigdirs="$noconfigdirs ${libgcj}"
661 ;;
2909494b
JM
662 arm*-*-symbianelf*)
663 noconfigdirs="$noconfigdirs ${libgcj}"
664 ;;
2909494b 665 bfin-*-*)
2909494b
JM
666 noconfigdirs="$noconfigdirs target-boehm-gc"
667 ;;
2909494b
JM
668 cris-*-* | crisv32-*-*)
669 unsupported_languages="$unsupported_languages java"
670 case "${target}" in
671 *-*-linux*)
672 ;;
673 *) # See PR46792 regarding target-libffi.
674 noconfigdirs="$noconfigdirs target-libffi target-boehm-gc";;
675 esac
676 ;;
2909494b
JM
677 hppa*64*-*-linux*)
678 # In this case, it's because the hppa64-linux target is for
679 # the kernel only at this point and has no libc, and thus no
680 # headers, crt*.o, etc., all of which are needed by these.
fddf9ee7 681 unsupported_languages="$unsupported_languages java"
2909494b 682 ;;
fddf9ee7 683 hppa*64*-*-hpux*)
2909494b
JM
684 noconfigdirs="$noconfigdirs ${libgcj}"
685 ;;
686 hppa*-hp-hpux11*)
687 ;;
fddf9ee7 688 hppa*-*-hpux*)
2909494b
JM
689 # According to Alexandre Oliva <aoliva@redhat.com>, libjava won't
690 # build on HP-UX 10.20.
691 noconfigdirs="$noconfigdirs ${libgcj}"
692 ;;
2909494b
JM
693 ia64*-*-*vms*)
694 noconfigdirs="$noconfigdirs ${libgcj}"
695 ;;
2909494b
JM
696 i[[3456789]]86-w64-mingw*)
697 noconfigdirs="$noconfigdirs ${libgcj}"
698 ;;
699 i[[3456789]]86-*-mingw*)
700 noconfigdirs="$noconfigdirs ${libgcj}"
701 ;;
702 x86_64-*-mingw*)
703 noconfigdirs="$noconfigdirs ${libgcj}"
704 ;;
2909494b
JM
705 mmix-*-*)
706 noconfigdirs="$noconfigdirs target-libffi target-boehm-gc"
2909494b
JM
707 ;;
708 powerpc-*-aix*)
709 # copied from rs6000-*-* entry
710 noconfigdirs="$noconfigdirs ${libgcj}"
711 ;;
2909494b
JM
712 rs6000-*-aix*)
713 noconfigdirs="$noconfigdirs ${libgcj}"
714 ;;
2909494b
JM
715 *-*-lynxos*)
716 noconfigdirs="$noconfigdirs ${libgcj}"
717 ;;
2909494b
JM
718esac
719
c03353e2
RIL
720# Default libgloss CPU subdirectory.
721libgloss_dir="$target_cpu"
6de9cd9a 722
fbcf0dca
JM
723case "${target}" in
724 sh*-*-pe|mips*-*-pe|*arm-wince-pe)
725 libgloss_dir=wince
726 ;;
727 arm*-*-*)
728 libgloss_dir=arm
729 ;;
730 cris-*-* | crisv32-*-*)
731 libgloss_dir=cris
732 ;;
733 hppa*-*-*)
734 libgloss_dir=pa
735 ;;
736 i[[3456789]]86-*-*)
737 libgloss_dir=i386
738 ;;
739 m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)
740 libgloss_dir=m68hc11
741 ;;
742 m68*-*-* | fido-*-*)
743 libgloss_dir=m68k
744 ;;
745 mips*-*-*)
746 libgloss_dir=mips
747 ;;
748 powerpc*-*-*)
749 libgloss_dir=rs6000
750 ;;
751 sparc*-*-*)
752 libgloss_dir=sparc
753 ;;
754esac
755
6a789d5e 756# Disable newlib and libgloss for various target OSes.
6599da04 757case "${target}" in
6a789d5e
JM
758 alpha*-dec-osf*)
759 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
760 ;;
761 i[[3456789]]86-*-linux*)
762 # This section makes it possible to build newlib natively on linux.
763 # If we are using a cross compiler then don't configure newlib.
764 if test x${is_cross_compiler} != xno ; then
765 noconfigdirs="$noconfigdirs target-newlib"
766 fi
767 noconfigdirs="$noconfigdirs target-libgloss"
768 # If we are not using a cross compiler, do configure newlib.
769 # Note however, that newlib will only be configured in this situation
770 # if the --with-newlib option has been given, because otherwise
771 # 'target-newlib' will appear in skipdirs.
772 ;;
773 i[[3456789]]86-*-rdos*)
774 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
775 ;;
776 sh*-*-pe|mips*-*-pe|arm-wince-pe)
777 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
778 ;;
779 sparc-*-sunos4*)
780 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
781 ;;
782 *-*-aix*)
783 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
784 ;;
785 *-*-beos*)
786 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
787 ;;
3fa03ff9 788 *-*-chorusos)
0036370f 789 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
3fa03ff9 790 ;;
6a789d5e
JM
791 *-*-dragonfly*)
792 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
793 ;;
794 *-*-freebsd*)
795 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
796 ;;
797 *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
798 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
799 ;;
800 *-*-lynxos*)
801 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
802 ;;
803 *-*-mingw*)
804 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
805 ;;
806 *-*-netbsd*)
807 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
808 ;;
809 *-*-netware*)
810 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
811 ;;
812 *-*-tpf*)
813 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
814 ;;
815 *-*-uclinux*)
816 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
817 ;;
818 *-*-vxworks*)
819 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
820 ;;
821esac
822
823case "${target}" in
824 *-*-chorusos)
825 ;;
75eeae1a 826 powerpc-*-darwin*)
e1514c3f 827 noconfigdirs="$noconfigdirs ld gas gdb gprof"
9c8f9ec2 828 noconfigdirs="$noconfigdirs sim target-rda"
940cde4d 829 ;;
354ebf88
RW
830 i[[3456789]]86-*-darwin*)
831 noconfigdirs="$noconfigdirs ld gprof"
832 noconfigdirs="$noconfigdirs sim target-rda"
833 ;;
834 x86_64-*-darwin[[912]]*)
0db3a858
TG
835 noconfigdirs="$noconfigdirs ld gas gprof"
836 noconfigdirs="$noconfigdirs sim target-rda"
837 ;;
42c1cd8a
AT
838 *-*-darwin*)
839 noconfigdirs="$noconfigdirs ld gas gdb gprof"
840 noconfigdirs="$noconfigdirs sim target-rda"
42c1cd8a 841 ;;
8c6d158a 842 *-*-dragonfly*)
8c6d158a 843 ;;
c3f84f61 844 *-*-freebsd*)
6de9cd9a
DN
845 if test "x$with_gmp" = x && test "x$with_gmp_dir" = x \
846 && test -f /usr/local/include/gmp.h; then
847 with_gmp=/usr/local
848 fi
6de9cd9a 849 ;;
ef4e7569
US
850 *-*-kaos*)
851 # Remove unsupported stuff on all kaOS configurations.
ef4e7569
US
852 noconfigdirs="$noconfigdirs target-libgloss"
853 ;;
51584787 854 *-*-netbsd*)
51584787 855 ;;
61fec9ff 856 *-*-netware*)
6599da04 857 ;;
3fbc0b70 858 *-*-rtems*)
2909494b 859 noconfigdirs="$noconfigdirs target-libgloss"
3fbc0b70 860 ;;
a8ba31f2
EC
861 # The tpf target doesn't support gdb yet.
862 *-*-tpf*)
6a789d5e 863 noconfigdirs="$noconfigdirs gdb tcl tk libgui itcl"
a8ba31f2 864 ;;
5785c0ed 865 *-*-uclinux*)
6a789d5e 866 noconfigdirs="$noconfigdirs target-rda"
5785c0ed 867 ;;
6599da04 868 *-*-vxworks*)
6599da04 869 ;;
b104e095 870 alpha*-dec-osf*)
603606e7 871 # ld works, but does not support shared libraries.
6599da04 872 # gas doesn't generate exception information.
6a789d5e 873 noconfigdirs="$noconfigdirs gas ld"
6599da04
JM
874 ;;
875 alpha*-*-*vms*)
2909494b 876 noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss"
6599da04
JM
877 ;;
878 alpha*-*-*)
879 # newlib is not 64 bit ready
2909494b 880 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
6599da04 881 ;;
3a685f6f 882 sh*-*-pe|mips*-*-pe|*arm-wince-pe)
b4f96efe 883 noconfigdirs="$noconfigdirs tcl tk itcl libgui sim"
3a685f6f 884 ;;
d207ebef 885 arc-*-*)
ebb9f8b0 886 noconfigdirs="$noconfigdirs target-libgloss"
d207ebef 887 ;;
6599da04 888 arm-*-pe*)
2909494b 889 noconfigdirs="$noconfigdirs target-libgloss"
6599da04 890 ;;
5d4a5ee6 891 arm-*-riscix*)
0036370f 892 noconfigdirs="$noconfigdirs ld target-libgloss"
5d4a5ee6 893 ;;
a5a438f5 894 c4x-*-* | tic4x-*-*)
0036370f 895 noconfigdirs="$noconfigdirs target-libgloss"
ab50d72b 896 ;;
0036370f
JM
897 tic54x-*-*)
898 noconfigdirs="$noconfigdirs target-libgloss gdb"
ab50d72b 899 ;;
6599da04 900 d10v-*-*)
0036370f 901 noconfigdirs="$noconfigdirs target-libgloss"
d207ebef
JM
902 ;;
903 d30v-*-*)
0036370f 904 noconfigdirs="$noconfigdirs gdb"
6599da04 905 ;;
09b5f8bf 906 fr30-*-elf*)
2909494b 907 noconfigdirs="$noconfigdirs gdb"
09b5f8bf 908 ;;
55f2d967 909 moxie-*-*)
55f2d967
AG
910 noconfigdirs="$noconfigdirs gprof"
911 ;;
ab50d72b 912 h8300*-*-*)
2909494b 913 noconfigdirs="$noconfigdirs target-libgloss"
ab50d72b 914 ;;
6599da04 915 h8500-*-*)
0036370f 916 noconfigdirs="$noconfigdirs target-libgloss"
6599da04 917 ;;
9d069a4f 918 hppa1.1-*-osf* | hppa1.1-*-bsd* )
9d069a4f 919 ;;
4569f85e 920 hppa*64*-*-linux*)
cdbff0ab 921 ;;
56f8587a 922 hppa*-*-linux*)
3e732ba0 923 ;;
6599da04 924 hppa*-*-*elf* | \
bae29210 925 hppa*-*-lites* | \
66350331 926 hppa*-*-openbsd* | \
bae29210 927 hppa*64*-*-*)
6599da04 928 ;;
2a332582 929 hppa*-hp-hpux11*)
1bcce263 930 noconfigdirs="$noconfigdirs ld"
2a332582 931 ;;
c03353e2 932 hppa*-*-pro*)
c03353e2 933 ;;
6599da04 934 hppa*-*-*)
2909494b 935 noconfigdirs="$noconfigdirs ld"
d207ebef 936 ;;
fb87ad5d 937 i960-*-*)
0036370f 938 noconfigdirs="$noconfigdirs gdb"
fb87ad5d 939 ;;
d207ebef
JM
940 ia64*-*-elf*)
941 # No gdb support yet.
1bcce263 942 noconfigdirs="$noconfigdirs readline libgui itcl gdb"
d207ebef 943 ;;
ab50d72b 944 ia64*-**-hpux*)
5a2931d1 945 # No ld support yet.
2909494b 946 noconfigdirs="$noconfigdirs libgui itcl ld"
ab50d72b 947 ;;
52535a64 948 ia64*-*-*vms*)
091fe9ca
TG
949 # No ld support yet.
950 noconfigdirs="$noconfigdirs libgui itcl ld"
52535a64 951 ;;
ef4c4300 952 i[[3456789]]86-w64-mingw*)
ef4c4300
KT
953 ;;
954 i[[3456789]]86-*-mingw*)
b91f0a41 955 target_configdirs="$target_configdirs target-winsup"
5d571eaa 956 ;;
d207ebef
JM
957 *-*-cygwin*)
958 target_configdirs="$target_configdirs target-libtermcap target-winsup"
1bcce263 959 noconfigdirs="$noconfigdirs target-libgloss"
801e2270 960 # always build newlib if winsup directory is present.
b91f0a41 961 if test -d "$srcdir/winsup/cygwin"; then
801e2270 962 skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
c8e6cd41 963 elif test -d "$srcdir/newlib"; then
b91f0a41 964 echo "Warning: winsup/cygwin is missing so newlib can't be built."
801e2270 965 fi
5d571eaa 966 ;;
f2a0e225 967 i[[3456789]]86-*-pe)
ebb9f8b0 968 noconfigdirs="$noconfigdirs target-libgloss"
6599da04 969 ;;
f2a0e225 970 i[[3456789]]86-*-sco3.2v5*)
6599da04
JM
971 # The linker does not yet know about weak symbols in COFF,
972 # and is not configured to handle mixed ELF and COFF.
0036370f 973 noconfigdirs="$noconfigdirs ld target-libgloss"
6599da04 974 ;;
f2a0e225 975 i[[3456789]]86-*-sco*)
0036370f 976 noconfigdirs="$noconfigdirs gprof target-libgloss"
6599da04 977 ;;
fbdd5d87 978 i[[3456789]]86-*-solaris2* | x86_64-*-solaris2.1[[0-9]]*)
7c01b2b5 979 noconfigdirs="$noconfigdirs target-libgloss"
6599da04 980 ;;
f2a0e225 981 i[[3456789]]86-*-sysv4*)
0036370f 982 noconfigdirs="$noconfigdirs target-libgloss"
6599da04 983 ;;
f2a0e225 984 i[[3456789]]86-*-beos*)
6a789d5e 985 noconfigdirs="$noconfigdirs gdb"
3aa83176 986 ;;
d1f8db0c 987 i[[3456789]]86-*-rdos*)
6a789d5e 988 noconfigdirs="$noconfigdirs gdb"
c03353e2 989 ;;
d344dce9 990 mmix-*-*)
2909494b 991 noconfigdirs="$noconfigdirs gdb"
d344dce9 992 ;;
ab34901f 993 mt-*-*)
79dd769c
AH
994 noconfigdirs="$noconfigdirs sim"
995 ;;
6599da04
JM
996 powerpc-*-aix*)
997 # copied from rs6000-*-* entry
6a789d5e 998 noconfigdirs="$noconfigdirs gprof"
6599da04 999 ;;
4569f85e 1000 powerpc*-*-winnt* | powerpc*-*-pe*)
6599da04 1001 target_configdirs="$target_configdirs target-winsup"
0036370f 1002 noconfigdirs="$noconfigdirs gdb tcl tk target-libgloss itcl"
6599da04
JM
1003 # always build newlib.
1004 skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
1005 ;;
1006 # This is temporary until we can link against shared libraries
1007 powerpcle-*-solaris*)
0036370f 1008 noconfigdirs="$noconfigdirs gdb sim tcl tk itcl"
6599da04 1009 ;;
0da3b5a7 1010 powerpc-*-beos*)
6a789d5e 1011 noconfigdirs="$noconfigdirs gdb"
d207ebef 1012 ;;
6599da04 1013 rs6000-*-lynxos*)
6a789d5e 1014 noconfigdirs="$noconfigdirs gprof"
6599da04
JM
1015 ;;
1016 rs6000-*-aix*)
6a789d5e 1017 noconfigdirs="$noconfigdirs gprof"
6599da04
JM
1018 ;;
1019 rs6000-*-*)
2909494b 1020 noconfigdirs="$noconfigdirs gprof"
6599da04
JM
1021 ;;
1022 m68k-apollo-*)
0036370f 1023 noconfigdirs="$noconfigdirs ld binutils gprof target-libgloss"
6599da04 1024 ;;
ca9fe997 1025 microblaze*)
2909494b 1026 noconfigdirs="$noconfigdirs gprof"
ca9fe997 1027 ;;
d9dced13 1028 mips*-sde-elf*)
d9dced13
RS
1029 if test x$with_newlib = xyes; then
1030 noconfigdirs="$noconfigdirs gprof"
1031 fi
d9dced13 1032 ;;
6599da04 1033 mips*-*-irix5*)
0036370f 1034 noconfigdirs="$noconfigdirs gprof target-libgloss"
6599da04
JM
1035 ;;
1036 mips*-*-irix6*)
2909494b 1037 noconfigdirs="$noconfigdirs gprof target-libgloss"
6599da04 1038 ;;
6599da04 1039 mips*-*-bsd*)
0036370f 1040 noconfigdirs="$noconfigdirs gprof target-libgloss"
6599da04 1041 ;;
9bec4bf0 1042 mips*-*-linux*)
9bec4bf0 1043 ;;
6599da04 1044 mips*-*-*)
2909494b 1045 noconfigdirs="$noconfigdirs gprof"
6599da04 1046 ;;
669f01d8 1047 sh-*-* | sh64-*-*)
ea2002ba
CB
1048 case "${target}" in
1049 sh*-*-elf)
2909494b 1050 ;;
ea2002ba 1051 *)
2909494b 1052 noconfigdirs="$noconfigdirs target-libgloss" ;;
ea2002ba 1053 esac
6599da04
JM
1054 ;;
1055 sparc-*-sunos4*)
6a789d5e 1056 if test x${is_cross_compiler} = xno ; then
6599da04
JM
1057 use_gnu_ld=no
1058 fi
1059 ;;
b42f0d7e 1060 tic6x-*-*)
0d557ff8 1061 noconfigdirs="$noconfigdirs sim"
b42f0d7e 1062 ;;
db1d217c
WL
1063 tilepro-*-* | tilegx-*-*)
1064 noconfigdirs="$noconfigdirs sim"
1065 ;;
6599da04 1066 v810-*-*)
0036370f 1067 noconfigdirs="$noconfigdirs bfd binutils gas gdb ld opcodes target-libgloss"
6599da04
JM
1068 ;;
1069 vax-*-*)
2909494b 1070 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
6599da04 1071 ;;
6599da04
JM
1072esac
1073
6599da04
JM
1074# If we aren't building newlib, then don't build libgloss, since libgloss
1075# depends upon some newlib header files.
1076case "${noconfigdirs}" in
1077 *target-libgloss*) ;;
1078 *target-newlib*) noconfigdirs="$noconfigdirs target-libgloss" ;;
55380b08 1079esac
6599da04 1080
55380b08 1081# Work in distributions that contain no compiler tools, like Autoconf.
671aa708 1082host_makefile_frag=/dev/null
55380b08
NN
1083if test -d ${srcdir}/config ; then
1084case "${host}" in
f2a0e225 1085 i[[3456789]]86-*-msdosdjgpp*)
55380b08
NN
1086 host_makefile_frag="config/mh-djgpp"
1087 ;;
1088 *-cygwin*)
2a79c47f 1089 ACX_CHECK_CYGWIN_CAT_WORKS
55380b08
NN
1090 host_makefile_frag="config/mh-cygwin"
1091 ;;
c53a18d3 1092 *-mingw*)
1f5a6b84 1093 host_makefile_frag="config/mh-mingw"
738a52d3 1094 ;;
00afcaa0 1095 hppa*-hp-hpux10*)
00afcaa0 1096 host_makefile_frag="config/mh-pa-hpux10"
55380b08 1097 ;;
111eeb6e 1098 hppa*-hp-hpux*)
00afcaa0
PB
1099 host_makefile_frag="config/mh-pa"
1100 ;;
1101 hppa*-*)
1102 host_makefile_frag="config/mh-pa"
1103 ;;
d8ed14ce
IS
1104 *-*-darwin*)
1105 host_makefile_frag="config/mh-darwin"
be8fff81 1106 ;;
d19bca38
PB
1107 powerpc-*-aix*)
1108 host_makefile_frag="config/mh-ppc-aix"
1109 ;;
1110 rs6000-*-aix*)
1111 host_makefile_frag="config/mh-ppc-aix"
1112 ;;
55380b08
NN
1113esac
1114fi
1115
e4c9c075 1116if test "${build}" != "${host}" ; then
0999159b
PB
1117 AR_FOR_BUILD=${AR_FOR_BUILD-ar}
1118 AS_FOR_BUILD=${AS_FOR_BUILD-as}
e4c9c075 1119 CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
0999159b
PB
1120 CXX_FOR_BUILD=${CXX_FOR_BUILD-g++}
1121 GCJ_FOR_BUILD=${GCJ_FOR_BUILD-gcj}
1122 GFORTRAN_FOR_BUILD=${GFORTRAN_FOR_BUILD-gfortran}
632e2a07 1123 GOC_FOR_BUILD=${GOC_FOR_BUILD-gccgo}
0999159b
PB
1124 DLLTOOL_FOR_BUILD=${DLLTOOL_FOR_BUILD-dlltool}
1125 LD_FOR_BUILD=${LD_FOR_BUILD-ld}
1126 NM_FOR_BUILD=${NM_FOR_BUILD-nm}
1127 RANLIB_FOR_BUILD=${RANLIB_FOR_BUILD-ranlib}
1128 WINDRES_FOR_BUILD=${WINDRES_FOR_BUILD-windres}
1129 WINDMC_FOR_BUILD=${WINDMC_FOR_BUILD-windmc}
e4c9c075 1130else
0999159b
PB
1131 AR_FOR_BUILD="\$(AR)"
1132 AS_FOR_BUILD="\$(AS)"
e4c9c075 1133 CC_FOR_BUILD="\$(CC)"
0999159b
PB
1134 CXX_FOR_BUILD="\$(CXX)"
1135 GCJ_FOR_BUILD="\$(GCJ)"
1136 GFORTRAN_FOR_BUILD="\$(GFORTRAN)"
632e2a07 1137 GOC_FOR_BUILD="\$(GOC)"
0999159b
PB
1138 DLLTOOL_FOR_BUILD="\$(DLLTOOL)"
1139 LD_FOR_BUILD="\$(LD)"
1140 NM_FOR_BUILD="\$(NM)"
1141 RANLIB_FOR_BUILD="\$(RANLIB)"
1142 WINDRES_FOR_BUILD="\$(WINDRES)"
1143 WINDMC_FOR_BUILD="\$(WINDMC)"
c3a86da9 1144fi
e4c9c075 1145
c3a86da9
DJ
1146AC_PROG_CC
1147AC_PROG_CXX
1148
1149# We must set the default linker to the linker used by gcc for the correct
1150# operation of libtool. If LD is not defined and we are using gcc, try to
1151# set the LD default to the ld used by gcc.
1152if test -z "$LD"; then
1153 if test "$GCC" = yes; then
1154 case $build in
1155 *-*-mingw*)
1156 gcc_prog_ld=`$CC -print-prog-name=ld 2>&1 | tr -d '\015'` ;;
1157 *)
1158 gcc_prog_ld=`$CC -print-prog-name=ld 2>&1` ;;
1159 esac
1160 case $gcc_prog_ld in
1161 # Accept absolute paths.
1162 [[\\/]* | [A-Za-z]:[\\/]*)]
1163 LD="$gcc_prog_ld" ;;
1164 esac
1165 fi
e4c9c075
PB
1166fi
1167
1168ACX_PROG_GNAT
a76494aa 1169ACX_PROG_CMP_IGNORE_INITIAL
e4c9c075 1170
ff3ac0f4
ILT
1171AC_ARG_ENABLE([bootstrap],
1172[AS_HELP_STRING([--enable-bootstrap],
1173 [enable bootstrapping @<:@yes if native build@:>@])],,
1174enable_bootstrap=default)
1175
1176# Issue errors and warnings for invalid/strange bootstrap combinations.
bf03b9ff
ILT
1177if test -r $srcdir/gcc/configure; then
1178 have_compiler=yes
1179else
1180 have_compiler=no
1181fi
ff3ac0f4
ILT
1182
1183case "$have_compiler:$host:$target:$enable_bootstrap" in
1184 *:*:*:no) ;;
1185
1186 # Default behavior. Enable bootstrap if we have a compiler
1187 # and we are in a native configuration.
1188 yes:$build:$build:default)
1189 enable_bootstrap=yes ;;
1190
1191 *:*:*:default)
1192 enable_bootstrap=no ;;
1193
1194 # We have a compiler and we are in a native configuration, bootstrap is ok
1195 yes:$build:$build:yes)
1196 ;;
1197
1198 # Other configurations, but we have a compiler. Assume the user knows
1199 # what he's doing.
1200 yes:*:*:yes)
1201 AC_MSG_WARN([trying to bootstrap a cross compiler])
1202 ;;
1203
1204 # No compiler: if they passed --enable-bootstrap explicitly, fail
1205 no:*:*:yes)
1206 AC_MSG_ERROR([cannot bootstrap without a compiler]) ;;
1207
1208 # Fail if wrong command line
1209 *)
1210 AC_MSG_ERROR([invalid option for --enable-bootstrap])
1211 ;;
1212esac
1213
592c90ff
KG
1214# Used for setting $lt_cv_objdir
1215_LT_CHECK_OBJDIR
1216
acd26225 1217# Check for GMP, MPFR and MPC
3a5729ea 1218gmplibs="-lmpc -lmpfr -lgmp"
6de9cd9a 1219gmpinc=
e69bf64b 1220have_gmp=no
acd26225
KG
1221
1222# Specify a location for mpc
1223# check for this first so it ends up on the link line before mpfr.
33e39b66
AS
1224AC_ARG_WITH(mpc,
1225[AS_HELP_STRING([--with-mpc=PATH],
1226 [specify prefix directory for installed MPC package.
1227 Equivalent to --with-mpc-include=PATH/include
1228 plus --with-mpc-lib=PATH/lib])])
1229AC_ARG_WITH(mpc-include,
1230[AS_HELP_STRING([--with-mpc-include=PATH],
1231 [specify directory for installed MPC include files])])
1232AC_ARG_WITH(mpc-lib,
1233[AS_HELP_STRING([--with-mpc-lib=PATH],
1234 [specify directory for the installed MPC library])])
acd26225
KG
1235
1236if test "x$with_mpc" != x; then
3a5729ea
KG
1237 gmplibs="-L$with_mpc/lib $gmplibs"
1238 gmpinc="-I$with_mpc/include $gmpinc"
acd26225
KG
1239fi
1240if test "x$with_mpc_include" != x; then
3a5729ea 1241 gmpinc="-I$with_mpc_include $gmpinc"
acd26225
KG
1242fi
1243if test "x$with_mpc_lib" != x; then
3a5729ea 1244 gmplibs="-L$with_mpc_lib $gmplibs"
acd26225
KG
1245fi
1246if test "x$with_mpc$with_mpc_include$with_mpc_lib" = x && test -d ${srcdir}/mpc; then
592c90ff 1247 gmplibs='-L$$r/$(HOST_SUBDIR)/mpc/src/'"$lt_cv_objdir $gmplibs"
3a5729ea 1248 gmpinc='-I$$s/mpc/src '"$gmpinc"
acd26225
KG
1249 # Do not test the mpc version. Assume that it is sufficient, since
1250 # it is in the source tree, and the library has not been built yet
1251 # but it would be included on the link line in the version check below
1252 # hence making the test fail.
3a5729ea 1253 have_gmp=yes
acd26225 1254fi
e69bf64b 1255
bebf829d
PB
1256# Specify a location for mpfr
1257# check for this first so it ends up on the link line before gmp.
33e39b66
AS
1258AC_ARG_WITH(mpfr-dir,
1259[AS_HELP_STRING([--with-mpfr-dir=PATH], [this option has been REMOVED])],
1260[AC_MSG_ERROR([The --with-mpfr-dir=PATH option has been removed.
1261Use --with-mpfr=PATH or --with-mpfr-include=PATH plus --with-mpfr-lib=PATH])])
1262
1263AC_ARG_WITH(mpfr,
1264[AS_HELP_STRING([--with-mpfr=PATH],
1265 [specify prefix directory for installed MPFR package.
1266 Equivalent to --with-mpfr-include=PATH/include
1267 plus --with-mpfr-lib=PATH/lib])])
1268AC_ARG_WITH(mpfr-include,
1269[AS_HELP_STRING([--with-mpfr-include=PATH],
1270 [specify directory for installed MPFR include files])])
1271AC_ARG_WITH(mpfr-lib,
1272[AS_HELP_STRING([--with-mpfr-lib=PATH],
1273 [specify directory for the installed MPFR library])])
bebf829d
PB
1274
1275if test "x$with_mpfr" != x; then
1276 gmplibs="-L$with_mpfr/lib $gmplibs"
3a5729ea 1277 gmpinc="-I$with_mpfr/include $gmpinc"
bebf829d 1278fi
8a877c9c 1279if test "x$with_mpfr_include" != x; then
3a5729ea 1280 gmpinc="-I$with_mpfr_include $gmpinc"
8a877c9c
KG
1281fi
1282if test "x$with_mpfr_lib" != x; then
1283 gmplibs="-L$with_mpfr_lib $gmplibs"
1284fi
e69bf64b 1285if test "x$with_mpfr$with_mpfr_include$with_mpfr_lib" = x && test -d ${srcdir}/mpfr; then
5b0d38e4
NC
1286 # MPFR v3.1.0 moved the sources into a src sub-directory.
1287 if test -d ${srcdir}/mpfr/src; then
1288 gmplibs='-L$$r/$(HOST_SUBDIR)/mpfr/src/'"$lt_cv_objdir $gmplibs"
1289 gmpinc='-I$$r/$(HOST_SUBDIR)/mpfr/src -I$$s/mpfr/src '"$gmpinc"
1290 extra_mpc_mpfr_configure_flags='--with-mpfr-include=$$s/mpfr/src --with-mpfr-lib=$$r/$(HOST_SUBDIR)/mpfr/src/'"$lt_cv_objdir"
1291 else
1292 gmplibs='-L$$r/$(HOST_SUBDIR)/mpfr/'"$lt_cv_objdir $gmplibs"
1293 gmpinc='-I$$r/$(HOST_SUBDIR)/mpfr -I$$s/mpfr '"$gmpinc"
1294 extra_mpc_mpfr_configure_flags='--with-mpfr-include=$$s/mpfr --with-mpfr-lib=$$r/$(HOST_SUBDIR)/mpfr/'"$lt_cv_objdir"
1295 fi
e69bf64b
PB
1296 # Do not test the mpfr version. Assume that it is sufficient, since
1297 # it is in the source tree, and the library has not been built yet
1298 # but it would be included on the link line in the version check below
1299 # hence making the test fail.
1300 have_gmp=yes
1301fi
bebf829d 1302
6de9cd9a 1303# Specify a location for gmp
33e39b66
AS
1304AC_ARG_WITH(gmp-dir,
1305[AS_HELP_STRING([--with-gmp-dir=PATH], [this option has been REMOVED])],
1306[AC_MSG_ERROR([The --with-gmp-dir=PATH option has been removed.
1307Use --with-gmp=PATH or --with-gmp-include=PATH plus --with-gmp-lib=PATH])])
1308
1309AC_ARG_WITH(gmp,
1310[AS_HELP_STRING([--with-gmp=PATH],
1311 [specify prefix directory for the installed GMP package.
1312 Equivalent to --with-gmp-include=PATH/include
1313 plus --with-gmp-lib=PATH/lib])])
1314AC_ARG_WITH(gmp-include,
1315[AS_HELP_STRING([--with-gmp-include=PATH],
1316 [specify directory for installed GMP include files])])
1317AC_ARG_WITH(gmp-lib,
1318[AS_HELP_STRING([--with-gmp-lib=PATH],
1319 [specify directory for the installed GMP library])])
6de9cd9a 1320
6de9cd9a 1321
bebf829d
PB
1322if test "x$with_gmp" != x; then
1323 gmplibs="-L$with_gmp/lib $gmplibs"
1324 gmpinc="-I$with_gmp/include $gmpinc"
6de9cd9a 1325fi
8a877c9c
KG
1326if test "x$with_gmp_include" != x; then
1327 gmpinc="-I$with_gmp_include $gmpinc"
1328fi
1329if test "x$with_gmp_lib" != x; then
1330 gmplibs="-L$with_gmp_lib $gmplibs"
1331fi
e69bf64b 1332if test "x$with_gmp$with_gmp_include$with_gmp_lib" = x && test -d ${srcdir}/gmp; then
592c90ff 1333 gmplibs='-L$$r/$(HOST_SUBDIR)/gmp/'"$lt_cv_objdir $gmplibs"
e69bf64b 1334 gmpinc='-I$$r/$(HOST_SUBDIR)/gmp -I$$s/gmp '"$gmpinc"
9183bdcf 1335 extra_mpfr_configure_flags='--with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-gmp-lib=$$r/$(HOST_SUBDIR)/gmp/'"$lt_cv_objdir"
592c90ff 1336 extra_mpc_gmp_configure_flags='--with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-gmp-lib=$$r/$(HOST_SUBDIR)/gmp/'"$lt_cv_objdir"
0ff2d841 1337 extra_isl_gmp_configure_flags='--with-gmp-builddir=$$r/$(HOST_SUBDIR)/gmp'
e69bf64b
PB
1338 # Do not test the gmp version. Assume that it is sufficient, since
1339 # it is in the source tree, and the library has not been built yet
1340 # but it would be included on the link line in the version check below
1341 # hence making the test fail.
1342 have_gmp=yes
1343fi
6de9cd9a 1344
d943d7c4 1345if test -d ${srcdir}/gcc && test "x$have_gmp" = xno; then
e69bf64b
PB
1346 have_gmp=yes
1347 saved_CFLAGS="$CFLAGS"
1348 CFLAGS="$CFLAGS $gmpinc"
362c6d2f
KG
1349 # Check for the recommended and required versions of GMP.
1350 AC_MSG_CHECKING([for the correct version of gmp.h])
e69bf64b 1351 AC_TRY_COMPILE([#include "gmp.h"],[
362c6d2f
KG
1352 #define GCC_GMP_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
1353 #define GCC_GMP_VERSION GCC_GMP_VERSION_NUM(__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR,__GNU_MP_VERSION_PATCHLEVEL)
1354 #if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4,2,0)
e48d66a9 1355 choke me
e69bf64b 1356 #endif
e8fd69bb 1357 ], [AC_TRY_COMPILE([#include <gmp.h>],[
362c6d2f
KG
1358 #define GCC_GMP_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
1359 #define GCC_GMP_VERSION GCC_GMP_VERSION_NUM(__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR,__GNU_MP_VERSION_PATCHLEVEL)
1360 #if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4,3,2)
1361 choke me
1362 #endif
e8fd69bb 1363 ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])])],
362c6d2f 1364 [AC_MSG_RESULT([no]); have_gmp=no])
e69bf64b 1365
acd26225 1366 # If we have GMP, check the MPFR version.
e69bf64b 1367 if test x"$have_gmp" = xyes; then
362c6d2f
KG
1368 # Check for the recommended and required versions of MPFR.
1369 AC_MSG_CHECKING([for the correct version of mpfr.h])
acd26225 1370 AC_TRY_COMPILE([#include <gmp.h>
e69bf64b 1371 #include <mpfr.h>],[
f7d6bc01 1372 #if MPFR_VERSION < MPFR_VERSION_NUM(2,4,0)
e69bf64b
PB
1373 choke me
1374 #endif
e8fd69bb 1375 ], [AC_TRY_COMPILE([#include <gmp.h>
acd26225 1376 #include <mpfr.h>],[
362c6d2f 1377 #if MPFR_VERSION < MPFR_VERSION_NUM(2,4,2)
acd26225
KG
1378 choke me
1379 #endif
e8fd69bb 1380 ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])])],
acd26225
KG
1381 [AC_MSG_RESULT([no]); have_gmp=no])
1382 fi
1383
1384 # Check for the MPC header version.
3a5729ea 1385 if test x"$have_gmp" = xyes ; then
362c6d2f 1386 # Check for the recommended and required versions of MPC.
acd26225
KG
1387 AC_MSG_CHECKING([for the correct version of mpc.h])
1388 AC_TRY_COMPILE([#include <mpc.h>],[
362c6d2f 1389 #if MPC_VERSION < MPC_VERSION_NUM(0,8,0)
acd26225
KG
1390 choke me
1391 #endif
e8fd69bb 1392 ], [AC_TRY_COMPILE([#include <mpc.h>],[
362c6d2f
KG
1393 #if MPC_VERSION < MPC_VERSION_NUM(0,8,1)
1394 choke me
1395 #endif
e8fd69bb 1396 ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])])],
362c6d2f 1397 [AC_MSG_RESULT([no]); have_gmp=no])
acd26225
KG
1398 fi
1399
1400 # Now check the MPFR library.
1401 if test x"$have_gmp" = xyes; then
1402 saved_LIBS="$LIBS"
1403 LIBS="$LIBS $gmplibs"
3a5729ea
KG
1404 AC_MSG_CHECKING([for the correct version of the gmp/mpfr/mpc libraries])
1405 AC_TRY_LINK([#include <mpc.h>],[
54e433bc
MK
1406 mpfr_t n;
1407 mpfr_t x;
3a5729ea 1408 mpc_t c;
e69bf64b 1409 int t;
54e433bc
MK
1410 mpfr_init (n);
1411 mpfr_init (x);
e69bf64b
PB
1412 mpfr_atan2 (n, n, x, GMP_RNDN);
1413 mpfr_erfc (n, x, GMP_RNDN);
1414 mpfr_subnormalize (x, t, GMP_RNDN);
3a5729ea
KG
1415 mpfr_clear(n);
1416 mpfr_clear(x);
1417 mpc_init2 (c, 53);
1418 mpc_set_ui_ui (c, 1, 1, MPC_RNDNN);
1419 mpc_cosh (c, c, MPC_RNDNN);
1420 mpc_pow (c, c, c, MPC_RNDNN);
1421 mpc_acosh (c, c, MPC_RNDNN);
1422 mpc_clear (c);
acd26225
KG
1423 ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); have_gmp=no])
1424 LIBS="$saved_LIBS"
e69bf64b 1425 fi
acd26225 1426
e69bf64b 1427 CFLAGS="$saved_CFLAGS"
6de9cd9a 1428
362c6d2f
KG
1429# The library versions listed in the error message below should match
1430# the HARD-minimums enforced above.
e69bf64b 1431 if test x$have_gmp != xyes; then
f7d6bc01 1432 AC_MSG_ERROR([Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.
3a5729ea
KG
1433Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
1434their locations. Source code for these libraries can be found at
1435their respective hosting sites as well as at
1436ftp://gcc.gnu.org/pub/gcc/infrastructure/. See also
1437http://gcc.gnu.org/install/prerequisites.html for additional info. If
1438you obtained GMP, MPFR and/or MPC from a vendor distribution package,
1439make sure that you have installed both the libraries and the header
1440files. They may be located in separate packages.])
e69bf64b 1441 fi
70ec446f
KG
1442fi
1443
acd26225 1444# Flags needed for both GMP, MPFR and/or MPC.
6de9cd9a
DN
1445AC_SUBST(gmplibs)
1446AC_SUBST(gmpinc)
9e3eba15 1447AC_SUBST(extra_mpfr_configure_flags)
acd26225
KG
1448AC_SUBST(extra_mpc_gmp_configure_flags)
1449AC_SUBST(extra_mpc_mpfr_configure_flags)
0ff2d841 1450AC_SUBST(extra_isl_gmp_configure_flags)
6de9cd9a 1451
f38095f3 1452# Allow host libstdc++ to be specified for static linking with PPL.
33e39b66
AS
1453AC_ARG_WITH(host-libstdcxx,
1454[AS_HELP_STRING([--with-host-libstdcxx=L],
1455 [use linker arguments L to link with libstdc++
1456 when linking with PPL])])
f38095f3
JM
1457
1458case $with_host_libstdcxx in
1459 no|yes)
1460 AC_MSG_ERROR([-with-host-libstdcxx needs an argument])
1461 ;;
1462esac
f8bf9252 1463
00020c16
ILT
1464# Linker flags to use for stage1 or when not boostrapping.
1465AC_ARG_WITH(stage1-ldflags,
33e39b66 1466[AS_HELP_STRING([--with-stage1-ldflags=FLAGS], [linker flags for stage1])],
00020c16
ILT
1467[if test "$withval" = "no" -o "$withval" = "yes"; then
1468 stage1_ldflags=
1469 else
1470 stage1_ldflags=$withval
1471 fi],
1472[stage1_ldflags=])
1473AC_SUBST(stage1_ldflags)
1474
1475# Libraries to use for stage1 or when not bootstrapping.
1476AC_ARG_WITH(stage1-libs,
33e39b66 1477[AS_HELP_STRING([--with-stage1-libs=LIBS], [libraries for stage1])],
00020c16
ILT
1478[if test "$withval" = "no" -o "$withval" = "yes"; then
1479 stage1_libs=
1480 else
1481 stage1_libs=$withval
1482 fi],
1483[stage1_libs=$with_host_libstdcxx])
1484AC_SUBST(stage1_libs)
1485
00020c16
ILT
1486# Libraries to use for stage2 and later builds. This defaults to the
1487# argument passed to --with-host-libstdcxx.
1488AC_ARG_WITH(boot-libs,
33e39b66 1489[AS_HELP_STRING([--with-boot-libs=LIBS], [libraries for stage2 and later])],
00020c16
ILT
1490[if test "$withval" = "no" -o "$withval" = "yes"; then
1491 poststage1_libs=
1492 else
e90e6bd7 1493 poststage1_libs=$withval
00020c16
ILT
1494 fi],
1495[poststage1_libs=$with_host_libstdcxx])
1496AC_SUBST(poststage1_libs)
1497
ed2eaa9f
ILT
1498# Linker flags to use for stage2 and later builds.
1499AC_ARG_WITH(boot-ldflags,
33e39b66
AS
1500[AS_HELP_STRING([--with-boot-ldflags=FLAGS],
1501 [linker flags for stage2 and later])],
ed2eaa9f
ILT
1502[if test "$withval" = "no" -o "$withval" = "yes"; then
1503 poststage1_ldflags=
1504 else
1505 poststage1_ldflags=$withval
1506 fi],
1507[poststage1_ldflags=
bec93d73
ILT
1508 # In stages 2 and 3, default to linking libstdc++ and libgcc
1509 # statically. But if the user explicitly specified the libraries to
1510 # use, trust that they are doing what they want.
1511 if test "$poststage1_libs" = ""; then
ed2eaa9f
ILT
1512 poststage1_ldflags="-static-libstdc++ -static-libgcc"
1513 fi])
1514AC_SUBST(poststage1_ldflags)
1515
625afa23
RG
1516# GCC GRAPHITE dependences, ISL and CLOOG which in turn requires ISL.
1517# Basic setup is inlined here, actual checks are in config/cloog.m4 and
1518# config/isl.m4
1519
1520AC_ARG_WITH(cloog,
1521 [AS_HELP_STRING(
1522 [--with-cloog=PATH],
1523 [Specify prefix directory for the installed CLooG-ISL package.
1524 Equivalent to --with-cloog-include=PATH/include
1525 plus --with-cloog-lib=PATH/lib])])
1526AC_ARG_WITH(isl,
1527 [AS_HELP_STRING(
1528 [--with-isl=PATH],
1529 [Specify prefix directory for the installed ISL package.
1530 Equivalent to --with-isl-include=PATH/include
1531 plus --with-isl-lib=PATH/lib])])
1532
1533# Treat either --without-cloog or --without-isl as a request to disable
1534# GRAPHITE support and skip all following checks.
1535if test "x$with_isl" != "xno" &&
1536 test "x$with_cloog" != "xno"; then
1537 # Check for ISL
1538 dnl Provide configure switches and initialize islinc & isllibs
1539 dnl with user input.
1540 ISL_INIT_FLAGS
33ad93b9
RG
1541 dnl The minimal version of ISL required for Graphite.
1542 ISL_CHECK_VERSION(0,10)
33ad93b9
RG
1543 dnl Only execute fail-action, if ISL has been requested.
1544 ISL_IF_FAILED([
1545 AC_MSG_ERROR([Unable to find a usable ISL. See config.log for details.])])
d789184e 1546
625afa23
RG
1547 if test "x$gcc_cv_isl" != "xno"; then
1548 # Check for CLOOG
1549 dnl Provide configure switches and initialize clooginc & clooglibs
1550 dnl with user input.
1551 CLOOG_INIT_FLAGS
1552 dnl The minimal version of CLooG required for Graphite.
1553 dnl
1554 dnl If we use CLooG-Legacy, the provided version information is
1555 dnl ignored.
1556 CLOOG_CHECK_VERSION(0,17,0)
1557
1558 dnl Only execute fail-action, if CLooG has been requested.
1559 CLOOG_IF_FAILED([
1560 AC_MSG_ERROR([Unable to find a usable CLooG. See config.log for details.])])
1561 fi
f8bf9252 1562fi
f8bf9252 1563
32d024bf
RG
1564# If either the ISL or the CLooG check failed, disable builds of in-tree
1565# variants of both
625afa23
RG
1566if test "x$with_isl" = xno ||
1567 test "x$with_cloog" = xno ||
1568 test "x$gcc_cv_cloog" = xno ||
1569 test "x$gcc_cv_isl" = xno; then
32d024bf 1570 noconfigdirs="$noconfigdirs cloog isl"
625afa23
RG
1571 islinc=
1572 clooginc=
1573 clooglibs=
32d024bf
RG
1574fi
1575
625afa23
RG
1576AC_SUBST(islinc)
1577AC_SUBST(clooglibs)
1578AC_SUBST(clooginc)
1579
1580
d7f09764
DN
1581# Check for LTO support.
1582AC_ARG_ENABLE(lto,
33e39b66 1583[AS_HELP_STRING([--enable-lto], [enable link time optimization support])],
d7f09764
DN
1584enable_lto=$enableval,
1585enable_lto=yes; default_enable_lto=yes)
1586
48215350
DK
1587ACX_ELF_TARGET_IFELSE([# ELF platforms build the lto-plugin always.
1588 build_lto_plugin=yes
1589],[if test x"$default_enable_lto" = x"yes" ; then
bb79486c 1590 case $target in
2cd815e7 1591 *-apple-darwin9* | *-cygwin* | *-mingw*) ;;
48215350 1592 # On other non-ELF platforms, LTO has yet to be validated.
bb79486c
JH
1593 *) enable_lto=no ;;
1594 esac
3bec79c5 1595 else
db50fe7d
IS
1596 # Apart from ELF platforms, only Windows and Darwin support LTO so far.
1597 # It would also be nice to check the binutils support, but we don't
3bec79c5
DK
1598 # have gcc_GAS_CHECK_FEATURE available here. For now, we'll just
1599 # warn during gcc/ subconfigure; unless you're bootstrapping with
1600 # -flto it won't be needed until after installation anyway.
1601 case $target in
1cd0b716 1602 *-cygwin* | *-mingw* | *-apple-darwin*) ;;
3bec79c5
DK
1603 *) if test x"$enable_lto" = x"yes"; then
1604 AC_MSG_ERROR([LTO support is not enabled for this target.])
1605 fi
1606 ;;
1607 esac
1608 fi
1cd0b716 1609 # Among non-ELF, only Windows platforms support the lto-plugin so far.
48215350 1610 # Build it unless LTO was explicitly disabled.
1cd0b716 1611 case $target in
48215350 1612 *-cygwin* | *-mingw*) build_lto_plugin=$enable_lto ;;
1cd0b716
DK
1613 *) ;;
1614 esac
48215350 1615])
d7f09764 1616
f8bf9252 1617
0823efed 1618# By default, C and C++ are the only stage 1 languages.
e1888513 1619stage1_languages=,c,
2805b53a 1620
00020c16 1621# Target libraries that we bootstrap.
ad1e5170 1622bootstrap_target_libs=,target-libgcc,
00020c16 1623
e4c9c075
PB
1624# Figure out what language subdirectories are present.
1625# Look if the user specified --enable-languages="..."; if not, use
1626# the environment variable $LANGUAGES if defined. $LANGUAGES might
1627# go away some day.
1628# NB: embedded tabs in this IF block -- do not untabify
1629if test -d ${srcdir}/gcc; then
1630 if test x"${enable_languages+set}" != xset; then
1631 if test x"${LANGUAGES+set}" = xset; then
1632 enable_languages="${LANGUAGES}"
1633 echo configure.in: warning: setting LANGUAGES is deprecated, use --enable-languages instead 1>&2
1634 else
1635 enable_languages=all
1636 fi
1637 else
1638 if test x"${enable_languages}" = x ||
1639 test x"${enable_languages}" = xyes;
1640 then
1641 echo configure.in: --enable-languages needs at least one language argument 1>&2
1642 exit 1
1643 fi
1644 fi
1645 enable_languages=`echo "${enable_languages}" | sed -e 's/[[ ,]][[ ,]]*/,/g' -e 's/,$//'`
1646
7f26dfa3
FXC
1647 # 'f95' is the old name for the 'fortran' language. We issue a warning
1648 # and make the substitution.
1649 case ,${enable_languages}, in
1650 *,f95,*)
1651 echo configure.in: warning: 'f95' as language name is deprecated, use 'fortran' instead 1>&2
1652 enable_languages=`echo "${enable_languages}" | sed -e 's/f95/fortran/g'`
1653 ;;
1654 esac
1655
0823efed
DN
1656 # If bootstrapping, C++ must be enabled.
1657 case ",$enable_languages,:$enable_bootstrap" in
1658 *,c++,*:*) ;;
1659 *:yes)
ff3ac0f4
ILT
1660 if test -f ${srcdir}/gcc/cp/config-lang.in; then
1661 enable_languages="${enable_languages},c++"
1662 else
0823efed 1663 AC_MSG_ERROR([bootstrapping requires c++ sources])
ff3ac0f4
ILT
1664 fi
1665 ;;
1666 esac
1667
e4c9c075
PB
1668 # First scan to see if an enabled language requires some other language.
1669 # We assume that a given config-lang.in will list all the language
1670 # front ends it requires, even if some are required indirectly.
1671 for lang_frag in ${srcdir}/gcc/*/config-lang.in .. ; do
1672 case ${lang_frag} in
1673 ..) ;;
1674 # The odd quoting in the next line works around
1675 # an apparent bug in bash 1.12 on linux.
1676 ${srcdir}/gcc/[[*]]/config-lang.in) ;;
1677 *)
69ecd18f
ILT
1678 # From the config-lang.in, get $language, $lang_requires, and
1679 # $lang_requires_boot_languages.
e4c9c075
PB
1680 language=
1681 lang_requires=
69ecd18f 1682 lang_requires_boot_languages=
e4c9c075 1683 . ${lang_frag}
69ecd18f 1684 for other in ${lang_requires} ${lang_requires_boot_languages}; do
e4c9c075
PB
1685 case ,${enable_languages}, in
1686 *,$other,*) ;;
1687 *,all,*) ;;
1688 *,$language,*)
1689 echo " \`$other' language required by \`$language'; enabling" 1>&2
1690 enable_languages="${enable_languages},${other}"
1691 ;;
1692 esac
1693 done
69ecd18f
ILT
1694 for other in ${lang_requires_boot_languages} ; do
1695 if test "$other" != "c"; then
1696 case ,${enable_stage1_languages}, in
1697 *,$other,*) ;;
1698 *,all,*) ;;
1699 *)
1700 case ,${enable_languages}, in
1701 *,$language,*)
1702 echo " '$other' language required by '$language' in stage 1; enabling" 1>&2
1703 enable_stage1_languages="$enable_stage1_languages,${other}"
1704 ;;
1705 esac
1706 ;;
1707 esac
1708 fi
1709 done
e4c9c075
PB
1710 ;;
1711 esac
1712 done
1713
e1888513 1714 new_enable_languages=,c,
d7f09764
DN
1715
1716 # If LTO is enabled, add the LTO front end.
1717 extra_host_libiberty_configure_flags=
1718 if test "$enable_lto" = "yes" ; then
e4c5bd48
RW
1719 case ,${enable_languages}, in
1720 *,lto,*) ;;
1721 *) enable_languages="${enable_languages},lto" ;;
1722 esac
1cd0b716 1723 if test "${build_lto_plugin}" = "yes" ; then
d7f09764
DN
1724 configdirs="$configdirs lto-plugin"
1725 extra_host_libiberty_configure_flags=--enable-shared
1726 fi
1727 fi
1728 AC_SUBST(extra_host_libiberty_configure_flags)
1729
e4c9c075 1730 missing_languages=`echo ",$enable_languages," | sed -e s/,all,/,/ -e s/,c,/,/ `
e1888513 1731 potential_languages=,c,
e4c9c075 1732
4da3b0f8
ILT
1733 enabled_target_libs=
1734 disabled_target_libs=
1735
e4c9c075
PB
1736 for lang_frag in ${srcdir}/gcc/*/config-lang.in .. ; do
1737 case ${lang_frag} in
1738 ..) ;;
1739 # The odd quoting in the next line works around
1740 # an apparent bug in bash 1.12 on linux.
1741 ${srcdir}/gcc/[[*]]/config-lang.in) ;;
1742 *)
1743 # From the config-lang.in, get $language, $target_libs,
2805b53a 1744 # $lang_dirs, $boot_language, and $build_by_default
e4c9c075
PB
1745 language=
1746 target_libs=
1747 lang_dirs=
1546bb64 1748 subdir_requires=
e1888513
PB
1749 boot_language=no
1750 build_by_default=yes
e4c9c075 1751 . ${lang_frag}
e1888513
PB
1752 if test x${language} = x; then
1753 echo "${lang_frag} doesn't set \$language." 1>&2
1754 exit 1
1755 fi
1756
78767fd9 1757 if test "$language" = "c++"; then
0823efed 1758 boot_language=yes
00020c16
ILT
1759 fi
1760
e1888513
PB
1761 case ,${enable_languages}, in
1762 *,${language},*)
d4a10d0a
SB
1763 # Language was explicitly selected; include it
1764 # unless it is C, which is enabled by default.
1765 if test "$language" != "c"; then
1766 add_this_lang=yes
1767 fi
e4c9c075 1768 ;;
e1888513
PB
1769 *,all,*)
1770 # 'all' was selected, select it if it is a default language
1771 add_this_lang=${build_by_default}
e4c9c075
PB
1772 ;;
1773 *)
1774 add_this_lang=no
1775 ;;
1776 esac
6de9cd9a 1777
1546bb64 1778 # Disable languages that need other directories if these aren't available.
95695ad3 1779 for i in $subdir_requires; do
b6348cb3 1780 test -f "$srcdir/gcc/$i/config-lang.in" && continue
1546bb64
PB
1781 case ,${enable_languages}, in
1782 *,${language},*)
1783 # Specifically requested language; tell them.
1784 AC_MSG_ERROR([The gcc/$i directory contains parts of $language but is missing])
1785 ;;
1786 *)
1787 # Silently disable.
e1888513 1788 add_this_lang=unsupported
1546bb64
PB
1789 ;;
1790 esac
1791 done
1792
e1888513
PB
1793 # Disable Ada if no preexisting GNAT is available.
1794 case ,${enable_languages},:${language}:${have_gnat} in
1795 *,${language},*:ada:no)
1796 # Specifically requested language; tell them.
1797 AC_MSG_ERROR([GNAT is required to build $language])
1798 ;;
1799 *:ada:no)
1800 # Silently disable.
1801 add_this_lang=unsupported
1802 ;;
1803 esac
1804
4fab7234
HPN
1805 # Disable a language that is unsupported by the target.
1806 case " $unsupported_languages " in
1807 *" $language "*)
e1888513 1808 add_this_lang=unsupported
4fab7234
HPN
1809 ;;
1810 esac
1811
6de9cd9a 1812 case $add_this_lang in
e1888513 1813 unsupported)
e4c9c075 1814 # Remove language-dependent dirs.
4da3b0f8
ILT
1815 disabled_target_libs="$disabled_target_libs $target_libs"
1816 noconfigdirs="$noconfigdirs $lang_dirs"
2805b53a 1817 ;;
e1888513
PB
1818 no)
1819 # Remove language-dependent dirs; still show language as supported.
4da3b0f8
ILT
1820 disabled_target_libs="$disabled_target_libs $target_libs"
1821 noconfigdirs="$noconfigdirs $lang_dirs"
e1888513
PB
1822 potential_languages="${potential_languages}${language},"
1823 ;;
1824 yes)
1825 new_enable_languages="${new_enable_languages}${language},"
1826 potential_languages="${potential_languages}${language},"
2805b53a 1827 missing_languages=`echo "$missing_languages" | sed "s/,$language,/,/"`
4da3b0f8 1828 enabled_target_libs="$enabled_target_libs $target_libs"
ab9dcd0c
RW
1829 case "${boot_language}:,$enable_stage1_languages," in
1830 yes:* | *:*,$language,* | *:*,yes, | *:*,all,)
340de83f 1831 # Add to (comma-separated) list of stage 1 languages.
ab9dcd0c
RW
1832 case ",$stage1_languages," in
1833 *,$language,* | ,yes, | ,all,) ;;
1834 *) stage1_languages="${stage1_languages}${language}," ;;
1835 esac
00020c16
ILT
1836 # We need to bootstrap any supporting libraries.
1837 bootstrap_target_libs="${bootstrap_target_libs}${target_libs},"
2805b53a
NN
1838 ;;
1839 esac
1840 ;;
e4c9c075
PB
1841 esac
1842 ;;
1843 esac
1844 done
1845
4da3b0f8
ILT
1846 # Add target libraries which are only needed for disabled languages
1847 # to noconfigdirs.
1848 if test -n "$disabled_target_libs"; then
1849 for dir in $disabled_target_libs; do
1850 case " $enabled_target_libs " in
1851 *" ${dir} "*) ;;
1852 *) noconfigdirs="$noconfigdirs $dir" ;;
1853 esac
1854 done
1855 fi
1856
e1888513 1857 AC_ARG_ENABLE(stage1-languages,
33e39b66
AS
1858 [AS_HELP_STRING([[--enable-stage1-languages[=all]]],
1859 [choose additional languages to build during
1860 stage1. Mostly useful for compiler development])],
e1888513
PB
1861 [case ,${enable_stage1_languages}, in
1862 ,no,|,,)
1863 # Set it to something that will have no effect in the loop below
1864 enable_stage1_languages=c ;;
1865 ,yes,)
1866 enable_stage1_languages=`echo $new_enable_languages | \
1867 sed -e "s/^,//" -e "s/,$//" ` ;;
1868 *,all,*)
1869 enable_stage1_languages=`echo ,$enable_stage1_languages, | \
1870 sed -e "s/,all,/$new_enable_languages/" -e "s/^,//" -e "s/,$//" ` ;;
1871 esac
1872
1873 # Add "good" languages from enable_stage1_languages to stage1_languages,
1874 # while "bad" languages go in missing_languages. Leave no duplicates.
1875 for i in `echo $enable_stage1_languages | sed 's/,/ /g' `; do
1876 case $potential_languages in
1877 *,$i,*)
1878 case $stage1_languages in
1879 *,$i,*) ;;
1880 *) stage1_languages="$stage1_languages$i," ;;
1881 esac ;;
1882 *)
1883 case $missing_languages in
1884 *,$i,*) ;;
1885 *) missing_languages="$missing_languages$i," ;;
1886 esac ;;
1887 esac
1888 done])
1889
1890 # Remove leading/trailing commas that were added for simplicity
1891 potential_languages=`echo "$potential_languages" | sed -e "s/^,//" -e "s/,$//"`
79b4b7d2 1892 missing_languages=`echo "$missing_languages" | sed -e "s/^,//" -e "s/,$//"`
e1888513
PB
1893 stage1_languages=`echo "$stage1_languages" | sed -e "s/^,//" -e "s/,$//"`
1894 new_enable_languages=`echo "$new_enable_languages" | sed -e "s/^,//" -e "s/,$//"`
1895
e4c9c075
PB
1896 if test "x$missing_languages" != x; then
1897 AC_MSG_ERROR([
0cf085e4 1898The following requested languages could not be built: ${missing_languages}
e1888513 1899Supported languages are: ${potential_languages}])
e4c9c075 1900 fi
e4c9c075
PB
1901 if test "x$new_enable_languages" != "x$enable_languages"; then
1902 echo The following languages will be built: ${new_enable_languages}
e1888513 1903 enable_languages="$new_enable_languages"
e4c9c075 1904 fi
e1888513
PB
1905
1906 AC_SUBST(stage1_languages)
b2eaac4a 1907 ac_configure_args=`echo " $ac_configure_args" | sed -e "s/ '--enable-languages=[[^ ]]*'//g" -e "s/$/ '--enable-languages="$enable_languages"'/" `
e4c9c075
PB
1908fi
1909
27079765
AH
1910# Handle --disable-<component> generically.
1911for dir in $configdirs $build_configdirs $target_configdirs ; do
1912 dirname=`echo $dir | sed -e s/target-//g -e s/build-//g -e s/-/_/g`
ac9e6043
RW
1913 varname=`echo $dirname | sed -e s/+/_/g`
1914 if eval test x\${enable_${varname}} "=" xno ; then
27079765
AH
1915 noconfigdirs="$noconfigdirs $dir"
1916 fi
1917done
1918
7cd0cf9c
DA
1919# Check for Boehm's garbage collector
1920AC_ARG_ENABLE(objc-gc,
33e39b66
AS
1921[AS_HELP_STRING([--enable-objc-gc],
1922 [enable use of Boehm's garbage collector with the
1923 GNU Objective-C runtime])],
7cd0cf9c
DA
1924[case ,${enable_languages},:${enable_objc_gc}:${noconfigdirs} in
1925 *,objc,*:*:yes:*target-boehm-gc*)
1926 AC_MSG_ERROR([Boehm's garbage collector was requested yet not supported in this configuration])
1927 ;;
1928esac])
1929
1930# Make sure we only build Boehm's garbage collector if required.
2a79fd67
DA
1931case ,${enable_languages},:${enable_objc_gc} in
1932 *,objc,*:yes)
7cd0cf9c
DA
1933 # Keep target-boehm-gc if requested for Objective-C.
1934 ;;
7cd0cf9c 1935 *)
2a79fd67
DA
1936 # Otherwise remove target-boehm-gc depending on target-libjava.
1937 if echo " ${noconfigdirs} " | grep "target-libjava" >/dev/null 2>&1; then
1938 noconfigdirs="$noconfigdirs target-boehm-gc"
1939 fi
7cd0cf9c
DA
1940 ;;
1941esac
99776ebd
RH
1942
1943# Disable libitm if we're not building C++
1944case ,${enable_languages}, in
9696698a 1945 *,c++,*) ;;
99776ebd
RH
1946 *)
1947 noconfigdirs="$noconfigdirs target-libitm"
1948 ;;
1949esac
7cd0cf9c 1950
9d069a4f
PB
1951# Remove the entries in $skipdirs and $noconfigdirs from $configdirs,
1952# $build_configdirs and $target_configdirs.
e4c9c075
PB
1953# If we have the source for $noconfigdirs entries, add them to $notsupp.
1954
1955notsupp=""
1956for dir in . $skipdirs $noconfigdirs ; do
9d069a4f 1957 dirname=`echo $dir | sed -e s/target-//g -e s/build-//g`
e4c9c075
PB
1958 if test $dir != . && echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
1959 configdirs=`echo " ${configdirs} " | sed -e "s/ ${dir} / /"`
1960 if test -r $srcdir/$dirname/configure ; then
1961 if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
1962 true
1963 else
1964 notsupp="$notsupp $dir"
1965 fi
1966 fi
1967 fi
9d069a4f
PB
1968 if test $dir != . && echo " ${build_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
1969 build_configdirs=`echo " ${build_configdirs} " | sed -e "s/ ${dir} / /"`
1970 if test -r $srcdir/$dirname/configure ; then
1971 if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
1972 true
1973 else
1974 notsupp="$notsupp $dir"
1975 fi
1976 fi
1977 fi
e4c9c075
PB
1978 if test $dir != . && echo " ${target_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
1979 target_configdirs=`echo " ${target_configdirs} " | sed -e "s/ ${dir} / /"`
1980 if test -r $srcdir/$dirname/configure ; then
1981 if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
1982 true
1983 else
1984 notsupp="$notsupp $dir"
1985 fi
1986 fi
1987 fi
1988done
1989
e4c9c075
PB
1990# Quietly strip out all directories which aren't configurable in this tree.
1991# This relies on all configurable subdirectories being autoconfiscated, which
1992# is now the case.
23f6b2f9
PB
1993build_configdirs_all="$build_configdirs"
1994build_configdirs=
1995for i in ${build_configdirs_all} ; do
1996 j=`echo $i | sed -e s/build-//g`
1997 if test -f ${srcdir}/$j/configure ; then
1998 build_configdirs="${build_configdirs} $i"
1999 fi
2000done
2001
e4c9c075
PB
2002configdirs_all="$configdirs"
2003configdirs=
2004for i in ${configdirs_all} ; do
2005 if test -f ${srcdir}/$i/configure ; then
2006 configdirs="${configdirs} $i"
2007 fi
2008done
23f6b2f9 2009
e4c9c075
PB
2010target_configdirs_all="$target_configdirs"
2011target_configdirs=
2012for i in ${target_configdirs_all} ; do
2013 j=`echo $i | sed -e s/target-//g`
2014 if test -f ${srcdir}/$j/configure ; then
2015 target_configdirs="${target_configdirs} $i"
2016 fi
2017done
2018
2019# Produce a warning message for the subdirs we can't configure.
2020# This isn't especially interesting in the Cygnus tree, but in the individual
2021# FSF releases, it's important to let people know when their machine isn't
2022# supported by the one or two programs in a package.
2023
2024if test -n "${notsupp}" && test -z "${norecursion}" ; then
2025 # If $appdirs is non-empty, at least one of those directories must still
2026 # be configured, or we error out. (E.g., if the gas release supports a
2027 # specified target in some subdirs but not the gas subdir, we shouldn't
2028 # pretend that all is well.)
2029 if test -n "$appdirs" ; then
2030 for dir in $appdirs ; do
2031 if test -r $dir/Makefile.in ; then
2032 if echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
2033 appdirs=""
2034 break
2035 fi
23f6b2f9 2036 if echo " ${target_configdirs} " | grep " target-${dir} " >/dev/null 2>&1; then
e4c9c075
PB
2037 appdirs=""
2038 break
2039 fi
2040 fi
2041 done
2042 if test -n "$appdirs" ; then
2043 echo "*** This configuration is not supported by this package." 1>&2
2044 exit 1
2045 fi
2046 fi
2047 # Okay, some application will build, or we don't care to check. Still
2048 # notify of subdirs not getting built.
2049 echo "*** This configuration is not supported in the following subdirectories:" 1>&2
2050 echo " ${notsupp}" 1>&2
2051 echo " (Any other directories should still work fine.)" 1>&2
2052fi
2053
2054case "$host" in
2055 *msdosdjgpp*)
2056 enable_gdbtk=no ;;
2057esac
2058
c3a86da9
DJ
2059# To find our prefix, in gcc_cv_tool_prefix.
2060ACX_TOOL_DIRS
2061
e4c9c075
PB
2062copy_dirs=
2063
526635cb 2064AC_ARG_WITH([build-sysroot],
33e39b66
AS
2065 [AS_HELP_STRING([--with-build-sysroot=SYSROOT],
2066 [use sysroot as the system root during the build])],
526635cb
MM
2067 [if test x"$withval" != x ; then
2068 SYSROOT_CFLAGS_FOR_TARGET="--sysroot=$withval"
2069 fi],
2070 [SYSROOT_CFLAGS_FOR_TARGET=])
2071AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET)
2072
c8aea42c 2073AC_ARG_WITH([debug-prefix-map],
33e39b66
AS
2074 [AS_HELP_STRING([--with-debug-prefix-map='A=B C=D ...'],
2075 [map A to B, C to D ... in debug information])],
c8aea42c
PB
2076 [if test x"$withval" != x; then
2077 DEBUG_PREFIX_CFLAGS_FOR_TARGET=
2078 for debug_map in $withval; do
2079 DEBUG_PREFIX_CFLAGS_FOR_TARGET="$DEBUG_PREFIX_CFLAGS_FOR_TARGET -fdebug-prefix-map=$debug_map"
2080 done
2081 fi],
2082 [DEBUG_PREFIX_CFLAGS_FOR_TARGET=])
2083AC_SUBST(DEBUG_PREFIX_CFLAGS_FOR_TARGET)
2084
1c8bd6a3
PB
2085# During gcc bootstrap, if we use some random cc for stage1 then CFLAGS
2086# might be empty or "-g". We don't require a C++ compiler, so CXXFLAGS
2087# might also be empty (or "-g", if a non-GCC C++ compiler is in the path).
2088# We want to ensure that TARGET libraries (which we know are built with
2089# gcc) are built with "-O2 -g", so include those options when setting
2090# CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET.
2091if test "x$CFLAGS_FOR_TARGET" = x; then
2092 CFLAGS_FOR_TARGET=$CFLAGS
2093 case " $CFLAGS " in
2094 *" -O2 "*) ;;
bd8e704f 2095 *) CFLAGS_FOR_TARGET="-O2 $CFLAGS_FOR_TARGET" ;;
1c8bd6a3
PB
2096 esac
2097 case " $CFLAGS " in
2098 *" -g "* | *" -g3 "*) ;;
bd8e704f 2099 *) CFLAGS_FOR_TARGET="-g $CFLAGS_FOR_TARGET" ;;
1c8bd6a3
PB
2100 esac
2101fi
2102AC_SUBST(CFLAGS_FOR_TARGET)
2103
2104if test "x$CXXFLAGS_FOR_TARGET" = x; then
2105 CXXFLAGS_FOR_TARGET=$CXXFLAGS
2106 case " $CXXFLAGS " in
2107 *" -O2 "*) ;;
bd8e704f 2108 *) CXXFLAGS_FOR_TARGET="-O2 $CXXFLAGS_FOR_TARGET" ;;
1c8bd6a3
PB
2109 esac
2110 case " $CXXFLAGS " in
2111 *" -g "* | *" -g3 "*) ;;
bd8e704f 2112 *) CXXFLAGS_FOR_TARGET="-g $CXXFLAGS_FOR_TARGET" ;;
1c8bd6a3
PB
2113 esac
2114fi
2115AC_SUBST(CXXFLAGS_FOR_TARGET)
2116
6f57bdf6
DK
2117AC_SUBST(LDFLAGS_FOR_TARGET)
2118
e4c9c075
PB
2119# Handle --with-headers=XXX. If the value is not "yes", the contents of
2120# the named directory are copied to $(tooldir)/sys-include.
2121if test x"${with_headers}" != x && test x"${with_headers}" != xno ; then
2122 if test x${is_cross_compiler} = xno ; then
2123 echo 1>&2 '***' --with-headers is only supported when cross compiling
2124 exit 1
2125 fi
2126 if test x"${with_headers}" != xyes ; then
c3a86da9 2127 x=${gcc_cv_tool_prefix}
1c710c3c 2128 copy_dirs="${copy_dirs} ${with_headers} $x/${target_noncanonical}/sys-include"
e4c9c075
PB
2129 fi
2130fi
2131
2132# Handle --with-libs=XXX. If the value is not "yes", the contents of
2133# the name directories are copied to $(tooldir)/lib. Multiple directories
2134# are permitted.
2135if test x"${with_libs}" != x && test x"${with_libs}" != xno ; then
2136 if test x${is_cross_compiler} = xno ; then
2137 echo 1>&2 '***' --with-libs is only supported when cross compiling
2138 exit 1
2139 fi
2140 if test x"${with_libs}" != xyes ; then
2141 # Copy the libraries in reverse order, so that files in the first named
2142 # library override files in subsequent libraries.
c3a86da9 2143 x=${gcc_cv_tool_prefix}
e4c9c075 2144 for l in ${with_libs}; do
1c710c3c 2145 copy_dirs="$l $x/${target_noncanonical}/lib ${copy_dirs}"
e4c9c075
PB
2146 done
2147 fi
2148fi
2149
d7f09764 2150# Set with_gnu_as, with_gnu_ld, and with_system_zlib as appropriate.
e8b05380
PB
2151#
2152# This is done by determining whether or not the appropriate directory
2153# is available, and by checking whether or not specific configurations
2154# have requested that this magic not happen.
2155#
2156# The command line options always override the explicit settings in
2157# configure.in, and the settings in configure.in override this magic.
2158#
2159# If the default for a toolchain is to use GNU as and ld, and you don't
2160# want to do that, then you should use the --without-gnu-as and
d7f09764
DN
2161# --without-gnu-ld options for the configure script. Similarly, if
2162# the default is to use the included zlib and you don't want to do that,
2163# you should use the --with-system-zlib option for the configure script.
e8b05380
PB
2164
2165if test x${use_gnu_as} = x &&
2166 echo " ${configdirs} " | grep " gas " > /dev/null 2>&1 ; then
2167 with_gnu_as=yes
2168 extra_host_args="$extra_host_args --with-gnu-as"
2169fi
2170
2171if test x${use_gnu_ld} = x &&
5afab7ad 2172 echo " ${configdirs} " | egrep " (go)?ld " > /dev/null 2>&1 ; then
e8b05380
PB
2173 with_gnu_ld=yes
2174 extra_host_args="$extra_host_args --with-gnu-ld"
2175fi
2176
d7f09764
DN
2177if test x${use_included_zlib} = x &&
2178 echo " ${configdirs} " | grep " zlib " > /dev/null 2>&1 ; then
2179 :
2180else
2181 with_system_zlib=yes
2182 extra_host_args="$extra_host_args --with-system-zlib"
2183fi
2184
e8b05380
PB
2185# If using newlib, add --with-newlib to the extra_host_args so that gcc/configure
2186# can detect this case.
2187
2188if test x${with_newlib} != xno && echo " ${target_configdirs} " | grep " target-newlib " > /dev/null 2>&1 ; then
2189 with_newlib=yes
2190 extra_host_args="$extra_host_args --with-newlib"
2191fi
2192
e4c9c075
PB
2193# Handle ${copy_dirs}
2194set fnord ${copy_dirs}
2195shift
2196while test $# != 0 ; do
2197 if test -f $2/COPIED && test x"`cat $2/COPIED`" = x"$1" ; then
2198 :
2199 else
2200 echo Copying $1 to $2
2201
2202 # Use the install script to create the directory and all required
2203 # parent directories.
2204 if test -d $2 ; then
2205 :
2206 else
2207 echo >config.temp
2208 ${srcdir}/install-sh -c -m 644 config.temp $2/COPIED
2209 fi
2210
2211 # Copy the directory, assuming we have tar.
2212 # FIXME: Should we use B in the second tar? Not all systems support it.
2213 (cd $1; tar -cf - .) | (cd $2; tar -xpf -)
2214
2215 # It is the responsibility of the user to correctly adjust all
2216 # symlinks. If somebody can figure out how to handle them correctly
2217 # here, feel free to add the code.
2218
2219 echo $1 > $2/COPIED
2220 fi
2221 shift; shift
2222done
2223
e8b05380
PB
2224# Determine a target-dependent exec_prefix that the installed
2225# gcc will search in. Keep this list sorted by triplet, with
2226# the *-*-osname triplets last.
2227md_exec_prefix=
2228case "${target}" in
30b74385 2229 i[[34567]]86-pc-msdosdjgpp*)
e8b05380
PB
2230 md_exec_prefix=/dev/env/DJDIR/bin
2231 ;;
e8b05380 2232 *-*-hpux* | \
e8b05380 2233 *-*-nto-qnx* | \
6de66370 2234 *-*-solaris2*)
e8b05380
PB
2235 md_exec_prefix=/usr/ccs/bin
2236 ;;
2237esac
2238
4977bab6
ZW
2239extra_arflags_for_target=
2240extra_nmflags_for_target=
2a726918 2241extra_ranlibflags_for_target=
671aa708 2242target_makefile_frag=/dev/null
55380b08 2243case "${target}" in
58e24147
AM
2244 spu-*-*)
2245 target_makefile_frag="config/mt-spu"
2246 ;;
4bf6c438
RS
2247 mips*-sde-elf*)
2248 target_makefile_frag="config/mt-sde"
2249 ;;
1ec3b87b
RS
2250 mipsisa*-*-elfoabi*)
2251 target_makefile_frag="config/mt-mips-elfoabi"
2252 ;;
08d0963a
RS
2253 mips*-*-*linux* | mips*-*-gnu*)
2254 target_makefile_frag="config/mt-mips-gnu"
2255 ;;
416ac4d4 2256 *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
98a5bb3b 2257 target_makefile_frag="config/mt-gnu"
55380b08 2258 ;;
671aa708 2259 *-*-aix4.[[3456789]]* | *-*-aix[[56789]].*)
4977bab6
ZW
2260 # nm and ar from AIX 4.3 and above require -X32_64 flag to all ar and nm
2261 # commands to handle both 32-bit and 64-bit objects. These flags are
2262 # harmless if we're using GNU nm or ar.
2263 extra_arflags_for_target=" -X32_64"
2264 extra_nmflags_for_target=" -B -X32_64"
55380b08 2265 ;;
c3b7d169
NN
2266esac
2267
671aa708 2268alphaieee_frag=/dev/null
c3b7d169
NN
2269case $target in
2270 alpha*-*-*)
2271 # This just makes sure to use the -mieee option to build target libs.
2272 # This should probably be set individually by each library.
2273 alphaieee_frag="config/mt-alphaieee"
55380b08
NN
2274 ;;
2275esac
701afd4d 2276
55380b08
NN
2277# If --enable-target-optspace always use -Os instead of -O2 to build
2278# the target libraries, similarly if it is not specified, use -Os
2279# on selected platforms.
671aa708 2280ospace_frag=/dev/null
55380b08
NN
2281case "${enable_target_optspace}:${target}" in
2282 yes:*)
c3b7d169 2283 ospace_frag="config/mt-ospace"
55380b08
NN
2284 ;;
2285 :d30v-*)
c3b7d169 2286 ospace_frag="config/mt-d30v"
55380b08
NN
2287 ;;
2288 :m32r-* | :d10v-* | :fr30-*)
c3b7d169 2289 ospace_frag="config/mt-ospace"
55380b08
NN
2290 ;;
2291 no:* | :*)
2292 ;;
2293 *)
2294 echo "*** bad value \"${enable_target_optspace}\" for --enable-target-optspace flag; ignored" 1>&2
2295 ;;
2296esac
6599da04 2297
671aa708
NN
2298# Some systems (e.g., one of the i386-aix systems the gas testers are
2299# using) don't handle "\$" correctly, so don't use it here.
1c710c3c 2300tooldir='${exec_prefix}'/${target_noncanonical}
671aa708
NN
2301build_tooldir=${tooldir}
2302
671aa708
NN
2303# Create a .gdbinit file which runs the one in srcdir
2304# and tells GDB to look there for source files.
2305
2306if test -r ${srcdir}/.gdbinit ; then
2307 case ${srcdir} in
2308 .) ;;
2309 *) cat > ./.gdbinit <<EOF
2310# ${NO_EDIT}
2311dir ${srcdir}
2312dir .
2313source ${srcdir}/.gdbinit
2314EOF
2315 ;;
2316 esac
2317fi
2318
6599da04
JM
2319# Make sure that the compiler is able to generate an executable. If it
2320# can't, we are probably in trouble. We don't care whether we can run the
2321# executable--we might be using a cross compiler--we only care whether it
2322# can be created. At this point the main configure script has set CC.
aeaa0f2f 2323we_are_ok=no
6599da04
JM
2324echo "int main () { return 0; }" > conftest.c
2325${CC} -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c
aeaa0f2f
NN
2326if test $? = 0 ; then
2327 if test -s conftest || test -s conftest.exe ; then
2328 we_are_ok=yes
2329 fi
2330fi
2331case $we_are_ok in
2332 no)
2333 echo 1>&2 "*** The command '${CC} -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c' failed."
2334 echo 1>&2 "*** You must set the environment variable CC to a working compiler."
2335 rm -f conftest*
2336 exit 1
2337 ;;
2338esac
6599da04
JM
2339rm -f conftest*
2340
d89f0ad6 2341# Decide which environment variable is used to find dynamic libraries.
fe3d5b7f
NN
2342case "${host}" in
2343 *-*-hpux*) RPATH_ENVVAR=SHLIB_PATH ;;
111eeb6e 2344 *-*-darwin*) RPATH_ENVVAR=DYLD_LIBRARY_PATH ;;
d89f0ad6 2345 *-*-mingw* | *-*-cygwin ) RPATH_ENVVAR=PATH ;;
fe3d5b7f
NN
2346 *) RPATH_ENVVAR=LD_LIBRARY_PATH ;;
2347esac
fe3d5b7f 2348
d89f0ad6
AL
2349# On systems where the dynamic library environment variable is PATH,
2350# gcc/ will put dynamic libraries into a subdirectory to avoid adding
2351# built executables to PATH.
2352if test "$RPATH_ENVVAR" = PATH; then
2353 GCC_SHLIB_SUBDIR=/shlib
2354else
2355 GCC_SHLIB_SUBDIR=
2356fi
2357
4977bab6
ZW
2358# Record target_configdirs and the configure arguments for target and
2359# build configuration in Makefile.
2360target_configdirs=`echo "${target_configdirs}" | sed -e 's/target-//g'`
23f6b2f9 2361build_configdirs=`echo "${build_configdirs}" | sed -e 's/build-//g'`
4977bab6 2362
ad1e5170
JR
2363# If we are building libgomp, bootstrap it.
2364if echo " ${target_configdirs} " | grep " libgomp " > /dev/null 2>&1 ; then
2365 bootstrap_target_libs=${bootstrap_target_libs}target-libgomp,
2366fi
2367
4977bab6
ZW
2368# Determine whether gdb needs tk/tcl or not.
2369# Use 'maybe' since enable_gdbtk might be true even if tk isn't available
2370# and in that case we want gdb to be built without tk. Ugh!
2371# In fact I believe gdb is the *only* package directly dependent on tk,
2372# so we should be able to put the 'maybe's in unconditionally and
2373# leave out the maybe dependencies when enable_gdbtk is false. I'm not
2374# 100% sure that that's safe though.
e914a571 2375
b4f96efe 2376gdb_tk="maybe-all-tcl maybe-all-tk maybe-all-itcl maybe-all-libgui"
4977bab6
ZW
2377case "$enable_gdbtk" in
2378 no)
2379 GDB_TK="" ;;
e914a571
AC
2380 yes)
2381 GDB_TK="${gdb_tk}" ;;
4977bab6 2382 *)
e914a571
AC
2383 # Only add the dependency on gdbtk when GDBtk is part of the gdb
2384 # distro. Eventually someone will fix this and move Insight, nee
2385 # gdbtk to a separate directory.
2386 if test -d ${srcdir}/gdb/gdbtk ; then
2387 GDB_TK="${gdb_tk}"
2388 else
2389 GDB_TK=""
2390 fi
2391 ;;
4977bab6 2392esac
ef9db8d5
DJ
2393CONFIGURE_GDB_TK=`echo ${GDB_TK} | sed s/-all-/-configure-/g`
2394INSTALL_GDB_TK=`echo ${GDB_TK} | sed s/-all-/-install-/g`
4977bab6 2395
60975492 2396# Strip out unwanted targets.
8b87bb96
NN
2397
2398# While at that, we remove Makefiles if we were started for recursive
2399# configuration, so that the top-level Makefile reconfigures them,
2400# like we used to do when configure itself was recursive.
8b87bb96 2401
3e54529c
RW
2402# Loop over modules. We used to use the "$extrasub" feature from Autoconf
2403# but now we're fixing up the Makefile ourselves with the additional
2404# commands passed to AC_CONFIG_FILES. Use separate variables
2405# extrasub-{build,host,target} not because there is any reason to split
2406# the substitutions up that way, but only to remain below the limit of
2407# 99 commands in a script, for HP-UX sed.
2408# Do not nest @if/@endif pairs, because configure will not warn you at all.
8b87bb96 2409
79cd2b23
RW
2410case "$enable_bootstrap:$ENABLE_GOLD: $configdirs :,$stage1_languages," in
2411 yes:yes:*\ gold\ *:*,c++,*) ;;
2412 yes:yes:*\ gold\ *:*)
2413 AC_MSG_ERROR([in a combined tree, bootstrapping with --enable-gold requires c++ in stage1_languages])
2414 ;;
2415esac
2416
ce521a9c 2417# Adjust the toplevel makefile according to whether bootstrap was selected.
e12c4094 2418case $enable_bootstrap in
5607edfd 2419 yes)
e12c4094
AO
2420 bootstrap_suffix=bootstrap
2421 BUILD_CONFIG=bootstrap-debug
2422 ;;
5607edfd 2423 no)
e12c4094
AO
2424 bootstrap_suffix=no-bootstrap
2425 BUILD_CONFIG=
2426 ;;
5607edfd 2427esac
5607edfd 2428
e12c4094 2429AC_MSG_CHECKING(for default BUILD_CONFIG)
5646b7b9
AO
2430
2431AC_ARG_WITH([build-config],
33e39b66
AS
2432 [AS_HELP_STRING([--with-build-config='NAME NAME2...'],
2433 [use config/NAME.mk build configuration])],
5646b7b9
AO
2434 [case $with_build_config in
2435 yes) with_build_config= ;;
2436 no) with_build_config= BUILD_CONFIG= ;;
2437 esac])
2438
e12c4094
AO
2439if test "x${with_build_config}" != x; then
2440 BUILD_CONFIG=$with_build_config
2441else
2442 case $BUILD_CONFIG in
2443 bootstrap-debug)
2444 if echo "int f (void) { return 0; }" > conftest.c &&
2445 ${CC} -c conftest.c &&
2446 mv conftest.o conftest.o.g0 &&
2447 ${CC} -c -g conftest.c &&
2448 mv conftest.o conftest.o.g &&
615c8ffa 2449 ${srcdir}/contrib/compare-debug conftest.o.g0 conftest.o.g > /dev/null 2>&1; then
e12c4094
AO
2450 :
2451 else
2452 BUILD_CONFIG=
2453 fi
2454 rm -f conftest.c conftest.o conftest.o.g0 conftest.o.g
2455 ;;
2456 esac
2457fi
2458AC_MSG_RESULT($BUILD_CONFIG)
2459AC_SUBST(BUILD_CONFIG)
2460
3e54529c 2461extrasub_build=
23f6b2f9 2462for module in ${build_configdirs} ; do
8b87bb96
NN
2463 if test -z "${no_recursion}" \
2464 && test -f ${build_subdir}/${module}/Makefile; then
2465 echo 1>&2 "*** removing ${build_subdir}/${module}/Makefile to force reconfigure"
2466 rm -f ${build_subdir}/${module}/Makefile
2467 fi
3e54529c 2468 extrasub_build="$extrasub_build
60975492 2469/^@if build-$module\$/d
5607edfd
PB
2470/^@endif build-$module\$/d
2471/^@if build-$module-$bootstrap_suffix\$/d
2472/^@endif build-$module-$bootstrap_suffix\$/d"
8b87bb96 2473done
3e54529c 2474extrasub_host=
8b87bb96 2475for module in ${configdirs} ; do
a6fbc1e2 2476 if test -z "${no_recursion}"; then
f063a9ed 2477 for file in stage*-${module}/Makefile prev-${module}/Makefile ${module}/Makefile; do
a6fbc1e2
AS
2478 if test -f ${file}; then
2479 echo 1>&2 "*** removing ${file} to force reconfigure"
2480 rm -f ${file}
2481 fi
2482 done
8b87bb96 2483 fi
3e54529c 2484 extrasub_host="$extrasub_host
60975492 2485/^@if $module\$/d
5607edfd
PB
2486/^@endif $module\$/d
2487/^@if $module-$bootstrap_suffix\$/d
2488/^@endif $module-$bootstrap_suffix\$/d"
8b87bb96 2489done
3e54529c 2490extrasub_target=
8b87bb96
NN
2491for module in ${target_configdirs} ; do
2492 if test -z "${no_recursion}" \
2493 && test -f ${target_subdir}/${module}/Makefile; then
2494 echo 1>&2 "*** removing ${target_subdir}/${module}/Makefile to force reconfigure"
2495 rm -f ${target_subdir}/${module}/Makefile
2496 fi
00020c16
ILT
2497
2498 # We only bootstrap target libraries listed in bootstrap_target_libs.
2499 case $bootstrap_target_libs in
2500 *,target-$module,*) target_bootstrap_suffix=$bootstrap_suffix ;;
2501 *) target_bootstrap_suffix=no-bootstrap ;;
2502 esac
2503
3e54529c 2504 extrasub_target="$extrasub_target
60975492 2505/^@if target-$module\$/d
5607edfd 2506/^@endif target-$module\$/d
00020c16
ILT
2507/^@if target-$module-$target_bootstrap_suffix\$/d
2508/^@endif target-$module-$target_bootstrap_suffix\$/d"
4977bab6 2509done
f516a7da 2510
3e54529c
RW
2511# Do the final fixup along with target modules.
2512extrasub_target="$extrasub_target
60975492 2513/^@if /,/^@endif /d"
4977bab6
ZW
2514
2515# Create the serialization dependencies. This uses a temporary file.
2516
ade82b16 2517AC_ARG_ENABLE([serial-configure],
33e39b66
AS
2518[AS_HELP_STRING([[--enable-serial-[{host,target,build}-]configure]],
2519 [force sequential configuration of
2520 sub-packages for the host, target or build
2521 machine, or all sub-packages])])
bf1d3e81
NN
2522
2523case ${enable_serial_configure} in
2524 yes)
2525 enable_serial_build_configure=yes
2526 enable_serial_host_configure=yes
2527 enable_serial_target_configure=yes
2528 ;;
2529esac
ade82b16 2530
4977bab6
ZW
2531# These force 'configure's to be done one at a time, to avoid problems
2532# with contention over a shared config.cache.
2533rm -f serdep.tmp
ade82b16 2534echo '# serdep.tmp' > serdep.tmp
4977bab6 2535olditem=
bf1d3e81 2536test "x${enable_serial_build_configure}" = xyes &&
4977bab6
ZW
2537for item in ${build_configdirs} ; do
2538 case ${olditem} in
2539 "") ;;
ade82b16 2540 *) echo "configure-build-${item}: configure-build-${olditem}" >> serdep.tmp ;;
4977bab6
ZW
2541 esac
2542 olditem=${item}
2543done
2544olditem=
bf1d3e81 2545test "x${enable_serial_host_configure}" = xyes &&
4977bab6
ZW
2546for item in ${configdirs} ; do
2547 case ${olditem} in
2548 "") ;;
ade82b16 2549 *) echo "configure-${item}: configure-${olditem}" >> serdep.tmp ;;
4977bab6
ZW
2550 esac
2551 olditem=${item}
2552done
2553olditem=
bf1d3e81 2554test "x${enable_serial_target_configure}" = xyes &&
4977bab6
ZW
2555for item in ${target_configdirs} ; do
2556 case ${olditem} in
2557 "") ;;
ade82b16 2558 *) echo "configure-target-${item}: configure-target-${olditem}" >> serdep.tmp ;;
4977bab6
ZW
2559 esac
2560 olditem=${item}
2561done
671aa708
NN
2562serialization_dependencies=serdep.tmp
2563AC_SUBST_FILE(serialization_dependencies)
fe3d5b7f 2564
ade82b16 2565# Base args. Strip norecursion, cache-file, srcdir, host, build,
1c710c3c 2566# target, nonopt, and variable assignments. These are the ones we
f1a036e4
NC
2567# might not want to pass down to subconfigures. The exception being
2568# --cache-file=/dev/null, which is used to turn off the use of cache
2569# files altogether, and which should be passed on to subconfigures.
2570# Also strip program-prefix, program-suffix, and program-transform-name,
2571# so that we can pass down a consistent program-transform-name.
1c710c3c 2572baseargs=
29a63921 2573tbaseargs=
1c710c3c
DJ
2574keep_next=no
2575skip_next=no
2576eval "set -- $ac_configure_args"
44bfc3ac
DJ
2577for ac_arg
2578do
1c710c3c
DJ
2579 if test X"$skip_next" = X"yes"; then
2580 skip_next=no
2581 continue
2582 fi
2583 if test X"$keep_next" = X"yes"; then
2584 case $ac_arg in
2585 *\'*)
2586 ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
2587 esac
2588 baseargs="$baseargs '$ac_arg'"
29a63921 2589 tbaseargs="$tbaseargs '$ac_arg'"
1c710c3c
DJ
2590 keep_next=no
2591 continue
2592 fi
2593
2594 # Handle separated arguments. Based on the logic generated by
2595 # autoconf 2.59.
2596 case $ac_arg in
2597 *=* | --config-cache | -C | -disable-* | --disable-* \
2598 | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
2599 | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
2600 | -with-* | --with-* | -without-* | --without-* | --x)
2601 separate_arg=no
2602 ;;
2603 -*)
2604 separate_arg=yes
2605 ;;
2606 *)
2607 separate_arg=no
2608 ;;
2609 esac
2610
29a63921
AO
2611 skip_targ=no
2612 case $ac_arg in
2613changequote(,)
2614 --with-* | --without-*)
2615 libopt=`echo "$ac_arg" | sed -e 's,^--[^-_]*[-_],,' -e 's,=.*$,,'`
2616
2617 case $libopt in
2618 *[-_]include)
2619 lib=`echo "$libopt" | sed 's,[-_]include$,,'`
2620 ;;
2621 *[-_]lib)
2622 lib=`echo "$libopt" | sed 's,[-_]lib$,,'`
2623 ;;
2624 *)
2625 lib=$libopt
2626 ;;
2627 esac
2628changequote([,])
2629
2630 case $lib in
33ad93b9 2631 mpc | mpfr | gmp | cloog)
29a63921
AO
2632 # If we're processing --with-$lib, --with-$lib-include or
2633 # --with-$lib-lib, for one of the libs above, and target is
2634 # different from host, don't pass the current argument to any
2635 # target library's configure.
2636 if test x$is_cross_compiler = xyes; then
2637 skip_targ=yes
2638 fi
2639 ;;
2640 esac
2641 ;;
2642 esac
2643
1c710c3c 2644 case "$ac_arg" in
f1a036e4
NC
2645 --cache-file=/dev/null | \
2646 -cache-file=/dev/null )
2647 # Handled here to avoid the test to skip args below.
2648 baseargs="$baseargs '$ac_arg'"
29a63921 2649 tbaseargs="$tbaseargs '$ac_arg'"
f1a036e4
NC
2650 # Assert: $separate_arg should always be no.
2651 keep_next=$separate_arg
2652 ;;
1c710c3c
DJ
2653 --no*)
2654 continue
2655 ;;
2656 --c* | \
2657 --sr* | \
2658 --ho* | \
2659 --bu* | \
2660 --t* | \
2661 --program-* | \
2662 -cache_file* | \
2663 -srcdir* | \
2664 -host* | \
2665 -build* | \
2666 -target* | \
2667 -program-prefix* | \
2668 -program-suffix* | \
2669 -program-transform-name* )
2670 skip_next=$separate_arg
2671 continue
2672 ;;
2673 -*)
2674 # An option. Add it.
2675 case $ac_arg in
2676 *\'*)
2677 ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
2678 esac
2679 baseargs="$baseargs '$ac_arg'"
29a63921
AO
2680 if test X"$skip_targ" = Xno; then
2681 tbaseargs="$tbaseargs '$ac_arg'"
2682 fi
1c710c3c
DJ
2683 keep_next=$separate_arg
2684 ;;
2685 *)
2686 # Either a variable assignment, or a nonopt (triplet). Don't
2687 # pass it down; let the Makefile handle this.
2688 continue
2689 ;;
2690 esac
2691done
2692# Remove the initial space we just introduced and, as these will be
2693# expanded by make, quote '$'.
2694baseargs=`echo "x$baseargs" | sed -e 's/^x *//' -e 's,\\$,$$,g'`
6599da04 2695
43bb47c2
DJ
2696# Add in --program-transform-name, after --program-prefix and
2697# --program-suffix have been applied to it. Autoconf has already
2698# doubled dollar signs and backslashes in program_transform_name; we want
2699# the backslashes un-doubled, and then the entire thing wrapped in single
2700# quotes, because this will be expanded first by make and then by the shell.
2701# Also, because we want to override the logic in subdir configure scripts to
2702# choose program_transform_name, replace any s,x,x, with s,y,y,.
2703sed -e "s,\\\\\\\\,\\\\,g; s,','\\\\'',g; s/s,x,x,/s,y,y,/" <<EOF_SED > conftestsed.out
2704${program_transform_name}
2705EOF_SED
2706gcc_transform_name=`cat conftestsed.out`
2707rm -f conftestsed.out
2708baseargs="$baseargs --program-transform-name='${gcc_transform_name}'"
29a63921 2709tbaseargs="$tbaseargs --program-transform-name='${gcc_transform_name}'"
d9acb717
RW
2710if test "$silent" = yes; then
2711 baseargs="$baseargs --silent"
29a63921 2712 tbaseargs="$tbaseargs --silent"
d9acb717 2713fi
0115d4a3 2714baseargs="$baseargs --disable-option-checking"
29a63921 2715tbaseargs="$tbaseargs --disable-option-checking"
43bb47c2 2716
ffedf511
RW
2717# Record and document user additions to sub configure arguments.
2718AC_ARG_VAR([build_configargs],
2719 [additional configure arguments for build directories])
2720AC_ARG_VAR([host_configargs],
2721 [additional configure arguments for host directories])
2722AC_ARG_VAR([target_configargs],
2723 [additional configure arguments for target directories])
2724
e490616e
ZW
2725# For the build-side libraries, we just need to pretend we're native,
2726# and not use the same cache file. Multilibs are neither needed nor
2727# desired.
ffedf511 2728build_configargs="$build_configargs --cache-file=../config.cache ${baseargs}"
e254d6b5 2729
4977bab6
ZW
2730# For host modules, accept cache file option, or specification as blank.
2731case "${cache_file}" in
2732"") # empty
2733 cache_file_option="" ;;
671aa708 2734/* | [[A-Za-z]]:[[\\/]]* ) # absolute path
4977bab6
ZW
2735 cache_file_option="--cache-file=${cache_file}" ;;
2736*) # relative path
2737 cache_file_option="--cache-file=../${cache_file}" ;;
2738esac
2739
09438bde
NN
2740# Host dirs don't like to share a cache file either, horribly enough.
2741# This seems to be due to autoconf 2.5x stupidity.
ffedf511 2742host_configargs="$host_configargs --cache-file=./config.cache ${extra_host_args} ${baseargs}"
4977bab6 2743
29a63921 2744target_configargs="$target_configargs ${tbaseargs}"
e490616e 2745
6599da04
JM
2746# Passing a --with-cross-host argument lets the target libraries know
2747# whether they are being built with a cross-compiler or being built
2748# native. However, it would be better to use other mechanisms to make the
2749# sorts of decisions they want to make on this basis. Please consider
2750# this option to be deprecated. FIXME.
aeaa0f2f 2751if test x${is_cross_compiler} = xyes ; then
1c710c3c 2752 target_configargs="--with-cross-host=${host_noncanonical} ${target_configargs}"
6599da04
JM
2753fi
2754
dc683a3f
RW
2755# Default to --enable-multilib.
2756if test x${enable_multilib} = x ; then
3fedb745 2757 target_configargs="--enable-multilib ${target_configargs}"
dc683a3f 2758fi
6599da04 2759
5d4a5ee6
JL
2760# Pass --with-newlib if appropriate. Note that target_configdirs has
2761# changed from the earlier setting of with_newlib.
aeaa0f2f 2762if test x${with_newlib} != xno && echo " ${target_configdirs} " | grep " newlib " > /dev/null 2>&1 && test -d ${srcdir}/newlib ; then
3fedb745 2763 target_configargs="--with-newlib ${target_configargs}"
5d4a5ee6
JL
2764fi
2765
6b9eb62c
NN
2766# Different target subdirs use different values of certain variables
2767# (notably CXX). Worse, multilibs use *lots* of different values.
2768# Worse yet, autoconf 2.5x makes some of these 'precious', meaning that
2769# it doesn't automatically accept command-line overrides of them.
2770# This means it's not safe for target subdirs to share a cache file,
2771# which is disgusting, but there you have it. Hopefully this can be
2772# fixed in future. It's still worthwhile to use a cache file for each
2773# directory. I think.
2774
bebcd931
MS
2775# Pass the appropriate --build, --host, --target and --cache-file arguments.
2776# We need to pass --target, as newer autoconf's requires consistency
2777# for target_alias and gcc doesn't manage it consistently.
e69bf64b 2778target_configargs="--cache-file=./config.cache ${target_configargs}"
e490616e 2779
b87487b6 2780FLAGS_FOR_TARGET=
bb654703 2781case " $target_configdirs " in
7965440a 2782 *" newlib "*)
3fedb745 2783 case " $target_configargs " in
7965440a 2784 *" --with-newlib "*)
b87487b6 2785 case "$target" in
5d571eaa
OS
2786 *-cygwin*)
2787 FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(TARGET_SUBDIR)/winsup -L$$r/$(TARGET_SUBDIR)/winsup/cygwin -L$$r/$(TARGET_SUBDIR)/winsup/w32api/lib -isystem $$s/winsup/include -isystem $$s/winsup/cygwin/include -isystem $$s/winsup/w32api/include'
2788 ;;
b87487b6
AO
2789 esac
2790
afd7db25 2791 # If we're not building GCC, don't discard standard headers.
ef40bc65 2792 if test -d ${srcdir}/gcc; then
d4eb109c 2793 FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -nostdinc'
afd7db25
AO
2794
2795 if test "${build}" != "${host}"; then
2796 # On Canadian crosses, CC_FOR_TARGET will have already been set
2797 # by `configure', so we won't have an opportunity to add -Bgcc/
2798 # to it. This is right: we don't want to search that directory
2799 # for binaries, but we want the header files in there, so add
2800 # them explicitly.
0463992b 2801 FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -isystem $$r/$(HOST_SUBDIR)/gcc/include -isystem $$r/$(HOST_SUBDIR)/gcc/include-fixed'
afd7db25
AO
2802
2803 # Someone might think of using the pre-installed headers on
2804 # Canadian crosses, in case the installed compiler is not fully
2805 # compatible with the compiler being built. In this case, it
2806 # would be better to flag an error than risking having
2807 # incompatible object files being constructed. We can't
2808 # guarantee that an error will be flagged, but let's hope the
2809 # compiler will do it, when presented with incompatible header
2810 # files.
2811 fi
d4eb109c
AO
2812 fi
2813
ab50d72b 2814 case "${target}-${is_cross_compiler}" in
f2a0e225 2815 i[[3456789]]86-*-linux*-no)
ab50d72b
DD
2816 # Here host == target, so we don't need to build gcc,
2817 # so we don't want to discard standard headers.
2818 FLAGS_FOR_TARGET=`echo " $FLAGS_FOR_TARGET " | sed -e 's/ -nostdinc / /'`
ab50d72b
DD
2819 ;;
2820 *)
2821 # If we're building newlib, use its generic headers last, but search
2822 # for any libc-related directories first (so make it the last -B
2823 # switch).
2824 FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$$r/$(TARGET_SUBDIR)/newlib/ -isystem $$r/$(TARGET_SUBDIR)/newlib/targ-include -isystem $$s/newlib/libc/include'
c03353e2
RIL
2825
2826 # If we're building libgloss, find the startup file, simulator library
2827 # and linker script.
2828 case " $target_configdirs " in
2829 *" libgloss "*)
2830 # Look for startup file, simulator library and maybe linker script.
2831 FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$$r/$(TARGET_SUBDIR)/libgloss/'"$libgloss_dir"
2832 # Look for libnosys.a in case the target needs it.
2833 FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(TARGET_SUBDIR)/libgloss/libnosys'
2834 # Most targets have the linker script in the source directory.
2835 FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$s/libgloss/'"$libgloss_dir"
2836 ;;
2837 esac
ab50d72b
DD
2838 ;;
2839 esac
b87487b6 2840 ;;
7965440a
AO
2841 esac
2842 ;;
b87487b6 2843esac
5d571eaa 2844
b91f0a41 2845case "$target" in
5d571eaa
OS
2846 x86_64-*mingw* | *-w64-mingw*)
2847 # MinGW-w64 does not use newlib, nor does it use winsup. It may,
2848 # however, use a symlink named 'mingw' in ${prefix} .
2849 FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L${prefix}/${target}/lib -L${prefix}/mingw/lib -isystem ${prefix}/${target}/include -isystem ${prefix}/mingw/include'
2850 ;;
2851 *-mingw*)
2852 # MinGW can't be handled as Cygwin above since it does not use newlib.
2853 FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(TARGET_SUBDIR)/winsup/mingw -L$$r/$(TARGET_SUBDIR)/winsup/w32api/lib -isystem $$s/winsup/mingw/include -isystem $$s/winsup/w32api/include'
2854 ;;
b91f0a41 2855esac
d4eb109c 2856
6691a79e
ME
2857# Allow the user to override the flags for
2858# our build compiler if desired.
f019adc1
MF
2859if test x"${build}" = x"${host}" ; then
2860 CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
2861 CXXFLAGS_FOR_BUILD=${CXXFLAGS_FOR_BUILD-${CXXFLAGS}}
2862 LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-${LDFLAGS}}
2863fi
6691a79e 2864
d4eb109c
AO
2865# On Canadian crosses, we'll be searching the right directories for
2866# the previously-installed cross compiler, so don't bother to add
2867# flags for directories within the install tree of the compiler
2868# being built; programs in there won't even run.
ef40bc65 2869if test "${build}" = "${host}" && test -d ${srcdir}/gcc; then
b87487b6 2870 # Search for pre-installed headers if nothing else fits.
9124bc53 2871 FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$(build_tooldir)/bin/ -B$(build_tooldir)/lib/ -isystem $(build_tooldir)/include -isystem $(build_tooldir)/sys-include'
b87487b6 2872fi
d4eb109c 2873
bb654703 2874if test "x${use_gnu_ld}" = x &&
55380b08 2875 echo " ${configdirs} " | grep " ld " > /dev/null ; then
b87487b6 2876 # Arrange for us to find uninstalled linker scripts.
215c351a 2877 FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(HOST_SUBDIR)/ld'
b87487b6
AO
2878fi
2879
e88a2c09
DD
2880# Search for other target-specific linker scripts and such.
2881case "${target}" in
3e19841a
PB
2882 mep*)
2883 FLAGS_FOR_TARGET="$FLAGS_FOR_TARGET -mlibrary"
2884 ;;
e88a2c09
DD
2885esac
2886
671aa708 2887# Makefile fragments.
7b61653a
PE
2888for frag in host_makefile_frag target_makefile_frag alphaieee_frag ospace_frag;
2889do
2890 eval fragval=\$$frag
2891 if test $fragval != /dev/null; then
2892 eval $frag=${srcdir}/$fragval
2893 fi
2894done
671aa708
NN
2895AC_SUBST_FILE(host_makefile_frag)
2896AC_SUBST_FILE(target_makefile_frag)
2897AC_SUBST_FILE(alphaieee_frag)
2898AC_SUBST_FILE(ospace_frag)
2899
2900# Miscellanea: directories, flags, etc.
671aa708 2901AC_SUBST(RPATH_ENVVAR)
d89f0ad6 2902AC_SUBST(GCC_SHLIB_SUBDIR)
671aa708
NN
2903AC_SUBST(tooldir)
2904AC_SUBST(build_tooldir)
ef9db8d5 2905AC_SUBST(CONFIGURE_GDB_TK)
671aa708 2906AC_SUBST(GDB_TK)
ef9db8d5 2907AC_SUBST(INSTALL_GDB_TK)
671aa708
NN
2908
2909# Build module lists & subconfigure args.
671aa708 2910AC_SUBST(build_configargs)
23f6b2f9 2911AC_SUBST(build_configdirs)
671aa708
NN
2912
2913# Host module lists & subconfigure args.
2914AC_SUBST(host_configargs)
2915AC_SUBST(configdirs)
aae29963 2916AC_SUBST(target_configdirs)
671aa708
NN
2917
2918# Target module lists & subconfigure args.
671aa708 2919AC_SUBST(target_configargs)
ee2312f3 2920
671aa708
NN
2921
2922# Build tools.
0999159b
PB
2923AC_SUBST(AR_FOR_BUILD)
2924AC_SUBST(AS_FOR_BUILD)
671aa708 2925AC_SUBST(CC_FOR_BUILD)
0999159b
PB
2926AC_SUBST(CFLAGS_FOR_BUILD)
2927AC_SUBST(CXXFLAGS_FOR_BUILD)
2928AC_SUBST(CXX_FOR_BUILD)
2929AC_SUBST(DLLTOOL_FOR_BUILD)
2930AC_SUBST(GCJ_FOR_BUILD)
2931AC_SUBST(GFORTRAN_FOR_BUILD)
632e2a07 2932AC_SUBST(GOC_FOR_BUILD)
0999159b
PB
2933AC_SUBST(LDFLAGS_FOR_BUILD)
2934AC_SUBST(LD_FOR_BUILD)
2935AC_SUBST(NM_FOR_BUILD)
2936AC_SUBST(RANLIB_FOR_BUILD)
2937AC_SUBST(WINDMC_FOR_BUILD)
2938AC_SUBST(WINDRES_FOR_BUILD)
671aa708 2939
2abefe3d
PB
2940# Generate default definitions for YACC, M4, LEX and other programs that run
2941# on the build machine. These are used if the Makefile can't locate these
2942# programs in objdir.
2943MISSING=`cd $ac_aux_dir && ${PWDCMD-pwd}`/missing
2944
2945AC_CHECK_PROGS([YACC], ['bison -y' byacc yacc], [$MISSING bison -y])
2946case " $build_configdirs " in
2947 *" bison "*) YACC='$$r/$(BUILD_SUBDIR)/bison/tests/bison -y' ;;
2abefe3d
PB
2948esac
2949
2950AC_CHECK_PROGS([BISON], [bison], [$MISSING bison])
2951case " $build_configdirs " in
2952 *" bison "*) BISON='$$r/$(BUILD_SUBDIR)/bison/tests/bison' ;;
2953esac
2954
2955AC_CHECK_PROGS([M4], [gm4 gnum4 m4], [$MISSING m4])
2956case " $build_configdirs " in
2957 *" m4 "*) M4='$$r/$(BUILD_SUBDIR)/m4/m4' ;;
2958esac
2959
2960AC_CHECK_PROGS([LEX], [flex lex], [$MISSING flex])
2961case " $build_configdirs " in
2962 *" flex "*) LEX='$$r/$(BUILD_SUBDIR)/flex/flex' ;;
2963 *" lex "*) LEX='$$r/$(BUILD_SUBDIR)/lex/lex' ;;
2964esac
2965
2966AC_CHECK_PROGS([FLEX], [flex], [$MISSING flex])
2967case " $build_configdirs " in
2968 *" flex "*) FLEX='$$r/$(BUILD_SUBDIR)/flex/flex' ;;
2969esac
2970
2971AC_CHECK_PROGS([MAKEINFO], makeinfo, [$MISSING makeinfo])
2972case " $build_configdirs " in
2973 *" texinfo "*) MAKEINFO='$$r/$(BUILD_SUBDIR)/texinfo/makeinfo/makeinfo' ;;
2974 *)
2975changequote(,)
d18ff35a 2976 # For an installed makeinfo, we require it to be from texinfo 4.7 or
2abefe3d
PB
2977 # higher, else we use the "missing" dummy.
2978 if ${MAKEINFO} --version \
d18ff35a 2979 | egrep 'texinfo[^0-9]*(4\.([7-9]|[1-9][0-9])|[5-9]|[1-9][0-9])' >/dev/null 2>&1; then
2abefe3d
PB
2980 :
2981 else
2982 MAKEINFO="$MISSING makeinfo"
2983 fi
2984 ;;
2985changequote([,])
2986esac
2987
2988# FIXME: expect and dejagnu may become build tools?
2989
2990AC_CHECK_PROGS(EXPECT, expect, expect)
2991case " $configdirs " in
2992 *" expect "*)
2993 test $host = $build && EXPECT='$$r/$(HOST_SUBDIR)/expect/expect'
2994 ;;
2995esac
2996
2997AC_CHECK_PROGS(RUNTEST, runtest, runtest)
2998case " $configdirs " in
2999 *" dejagnu "*)
c394e891 3000 test $host = $build && RUNTEST='$$s/$(HOST_SUBDIR)/dejagnu/runtest'
2abefe3d
PB
3001 ;;
3002esac
3003
3004
671aa708 3005# Host tools.
2693c0b0
PB
3006NCN_STRICT_CHECK_TOOLS(AR, ar)
3007NCN_STRICT_CHECK_TOOLS(AS, as)
3008NCN_STRICT_CHECK_TOOLS(DLLTOOL, dlltool)
3009NCN_STRICT_CHECK_TOOLS(LD, ld)
2abefe3d 3010NCN_STRICT_CHECK_TOOLS(LIPO, lipo)
2693c0b0 3011NCN_STRICT_CHECK_TOOLS(NM, nm)
8927b7c0
RO
3012NCN_STRICT_CHECK_TOOLS(RANLIB, ranlib, true)
3013NCN_STRICT_CHECK_TOOLS(STRIP, strip, true)
2693c0b0 3014NCN_STRICT_CHECK_TOOLS(WINDRES, windres)
901119ae 3015NCN_STRICT_CHECK_TOOLS(WINDMC, windmc)
2693c0b0
PB
3016NCN_STRICT_CHECK_TOOLS(OBJCOPY, objcopy)
3017NCN_STRICT_CHECK_TOOLS(OBJDUMP, objdump)
e7a82751 3018NCN_STRICT_CHECK_TOOLS(READELF, readelf)
671aa708
NN
3019AC_SUBST(CC)
3020AC_SUBST(CXX)
3021AC_SUBST(CFLAGS)
3022AC_SUBST(CXXFLAGS)
671aa708 3023
2abefe3d 3024# Target tools.
e8b05380 3025AC_ARG_WITH([build-time-tools],
33e39b66
AS
3026 [AS_HELP_STRING([--with-build-time-tools=PATH],
3027 [use given path to find target tools during the build])],
e8b05380
PB
3028 [case x"$withval" in
3029 x/*) ;;
3030 *)
3031 with_build_time_tools=
3032 AC_MSG_WARN([argument to --with-build-time-tools must be an absolute path])
3033 ;;
3034 esac],
3035 [with_build_time_tools=])
3036
2693c0b0
PB
3037NCN_STRICT_CHECK_TARGET_TOOLS(CC_FOR_TARGET, cc gcc)
3038NCN_STRICT_CHECK_TARGET_TOOLS(CXX_FOR_TARGET, c++ g++ cxx gxx)
2693c0b0
PB
3039NCN_STRICT_CHECK_TARGET_TOOLS(GCC_FOR_TARGET, gcc, ${CC_FOR_TARGET})
3040NCN_STRICT_CHECK_TARGET_TOOLS(GCJ_FOR_TARGET, gcj)
3041NCN_STRICT_CHECK_TARGET_TOOLS(GFORTRAN_FOR_TARGET, gfortran)
632e2a07 3042NCN_STRICT_CHECK_TARGET_TOOLS(GOC_FOR_TARGET, gccgo)
e8b05380
PB
3043
3044ACX_CHECK_INSTALLED_TARGET_TOOL(AR_FOR_TARGET, ar)
3045ACX_CHECK_INSTALLED_TARGET_TOOL(AS_FOR_TARGET, as)
3046ACX_CHECK_INSTALLED_TARGET_TOOL(DLLTOOL_FOR_TARGET, dlltool)
3047ACX_CHECK_INSTALLED_TARGET_TOOL(LD_FOR_TARGET, ld)
3048ACX_CHECK_INSTALLED_TARGET_TOOL(LIPO_FOR_TARGET, lipo)
3049ACX_CHECK_INSTALLED_TARGET_TOOL(NM_FOR_TARGET, nm)
3050ACX_CHECK_INSTALLED_TARGET_TOOL(OBJDUMP_FOR_TARGET, objdump)
8927b7c0 3051ACX_CHECK_INSTALLED_TARGET_TOOL(RANLIB_FOR_TARGET, ranlib)
e7a82751 3052ACX_CHECK_INSTALLED_TARGET_TOOL(READELF_FOR_TARGET, readelf)
e8b05380
PB
3053ACX_CHECK_INSTALLED_TARGET_TOOL(STRIP_FOR_TARGET, strip)
3054ACX_CHECK_INSTALLED_TARGET_TOOL(WINDRES_FOR_TARGET, windres)
901119ae 3055ACX_CHECK_INSTALLED_TARGET_TOOL(WINDMC_FOR_TARGET, windmc)
4de997d1 3056
2abefe3d
PB
3057RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET"
3058
3059GCC_TARGET_TOOL(ar, AR_FOR_TARGET, AR, [binutils/ar])
3060GCC_TARGET_TOOL(as, AS_FOR_TARGET, AS, [gas/as-new])
3061GCC_TARGET_TOOL(cc, CC_FOR_TARGET, CC, [gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/])
b3f122e0 3062dnl see comments for CXX_FOR_TARGET_FLAG_TO_PASS
2abefe3d 3063GCC_TARGET_TOOL(c++, CXX_FOR_TARGET, CXX,
b3f122e0 3064 [gcc/g++ -B$$r/$(HOST_SUBDIR)/gcc/ -nostdinc++ `if test -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags; then $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags --build-includes; else echo -funconfigured-libstdc++-v3 ; fi` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs],
2abefe3d
PB
3065 c++)
3066GCC_TARGET_TOOL(c++ for libstdc++, RAW_CXX_FOR_TARGET, CXX,
3067 [gcc/xgcc -shared-libgcc -B$$r/$(HOST_SUBDIR)/gcc -nostdinc++ -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs],
3068 c++)
3069GCC_TARGET_TOOL(dlltool, DLLTOOL_FOR_TARGET, DLLTOOL, [binutils/dlltool])
3070GCC_TARGET_TOOL(gcc, GCC_FOR_TARGET, , [gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/])
3071GCC_TARGET_TOOL(gcj, GCJ_FOR_TARGET, GCJ,
3072 [gcc/gcj -B$$r/$(HOST_SUBDIR)/gcc/], java)
3073GCC_TARGET_TOOL(gfortran, GFORTRAN_FOR_TARGET, GFORTRAN,
3074 [gcc/gfortran -B$$r/$(HOST_SUBDIR)/gcc/], fortran)
632e2a07
ILT
3075GCC_TARGET_TOOL(gccgo, GOC_FOR_TARGET, GOC,
3076 [gcc/gccgo -B$$r/$(HOST_SUBDIR)/gcc/], go)
2abefe3d
PB
3077GCC_TARGET_TOOL(ld, LD_FOR_TARGET, LD, [ld/ld-new])
3078GCC_TARGET_TOOL(lipo, LIPO_FOR_TARGET, LIPO)
3079GCC_TARGET_TOOL(nm, NM_FOR_TARGET, NM, [binutils/nm-new])
3080GCC_TARGET_TOOL(objdump, OBJDUMP_FOR_TARGET, OBJDUMP, [binutils/objdump])
3081GCC_TARGET_TOOL(ranlib, RANLIB_FOR_TARGET, RANLIB, [binutils/ranlib])
e7a82751 3082GCC_TARGET_TOOL(readelf, READELF_FOR_TARGET, READELF, [binutils/readelf])
455c8f48 3083GCC_TARGET_TOOL(strip, STRIP_FOR_TARGET, STRIP, [binutils/strip-new])
2abefe3d 3084GCC_TARGET_TOOL(windres, WINDRES_FOR_TARGET, WINDRES, [binutils/windres])
901119ae 3085GCC_TARGET_TOOL(windmc, WINDMC_FOR_TARGET, WINDMC, [binutils/windmc])
4de997d1 3086
2abefe3d 3087AC_SUBST(FLAGS_FOR_TARGET)
4de997d1 3088AC_SUBST(RAW_CXX_FOR_TARGET)
be912515 3089
671aa708
NN
3090# Certain tools may need extra flags.
3091AR_FOR_TARGET=${AR_FOR_TARGET}${extra_arflags_for_target}
3092RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET}${extra_ranlibflags_for_target}
3093NM_FOR_TARGET=${NM_FOR_TARGET}${extra_nmflags_for_target}
6599da04 3094
2abefe3d
PB
3095# When building target libraries, except in a Canadian cross, we use
3096# the same toolchain as the compiler we just built.
3097COMPILER_AS_FOR_TARGET='$(AS_FOR_TARGET)'
3098COMPILER_LD_FOR_TARGET='$(LD_FOR_TARGET)'
3099COMPILER_NM_FOR_TARGET='$(NM_FOR_TARGET)'
3100if test $host = $build; then
3101 case " $configdirs " in
3102 *" gcc "*)
3103 COMPILER_AS_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/as'
3104 COMPILER_LD_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/collect-ld'
3105 COMPILER_NM_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/nm'${extra_nmflags_for_target}
3106 ;;
3107 esac
3108fi
3109
3110AC_SUBST(COMPILER_AS_FOR_TARGET)
3111AC_SUBST(COMPILER_LD_FOR_TARGET)
3112AC_SUBST(COMPILER_NM_FOR_TARGET)
3113
ee03dc5e
AO
3114AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
3115AC_ARG_ENABLE(maintainer-mode,
33e39b66
AS
3116[AS_HELP_STRING([--enable-maintainer-mode],
3117 [enable make rules and dependencies not useful
3118 (and sometimes confusing) to the casual installer])],
ee03dc5e
AO
3119 USE_MAINTAINER_MODE=$enableval,
3120 USE_MAINTAINER_MODE=no)
3121AC_MSG_RESULT($USE_MAINTAINER_MODE)
3122AC_SUBST(MAINTAINER_MODE_TRUE)
3123AC_SUBST(MAINTAINER_MODE_FALSE)
3124if test "$USE_MAINTAINER_MODE" = yes; then
3125 MAINTAINER_MODE_TRUE=
3126 MAINTAINER_MODE_FALSE='#'
3127else
3128 MAINTAINER_MODE_TRUE='#'
3129 MAINTAINER_MODE_FALSE=
3130fi
3131MAINT=$MAINTAINER_MODE_TRUE
3132AC_SUBST(MAINT)dnl
3133
2805b53a
NN
3134# ---------------------
3135# GCC bootstrap support
3136# ---------------------
3137
3138# Stage specific cflags for build.
3139stage1_cflags="-g"
3140case $build in
3141 vax-*-*)
3142 case ${GCC} in
3143 yes) stage1_cflags="-g -Wa,-J" ;;
3144 *) stage1_cflags="-g -J" ;;
3145 esac ;;
2805b53a 3146esac
0b50988a 3147
2805b53a
NN
3148AC_SUBST(stage1_cflags)
3149
8efea775
PB
3150# Enable --enable-checking in stage1 of the compiler.
3151AC_ARG_ENABLE(stage1-checking,
33e39b66
AS
3152[AS_HELP_STRING([[--enable-stage1-checking[=all]]],
3153 [choose additional checking for stage1 of the compiler])],
8efea775 3154[stage1_checking=--enable-checking=${enable_stage1_checking}],
e643dc23 3155[if test "x$enable_checking" = xno || test "x$enable_checking" = x; then
7e98624c 3156 stage1_checking=--enable-checking=yes,types
8efea775 3157else
e643dc23 3158 stage1_checking=--enable-checking=$enable_checking,types
8efea775
PB
3159fi])
3160AC_SUBST(stage1_checking)
3161
2805b53a 3162# Enable -Werror in bootstrap stage2 and later.
2805b53a 3163AC_ARG_ENABLE(werror,
33e39b66
AS
3164[AS_HELP_STRING([--enable-werror],
3165 [enable -Werror in bootstrap stage2 and later])], [],
416cfb5e 3166[if test -d ${srcdir}/gcc && test x"`cat $srcdir/gcc/DEV-PHASE`" = xexperimental; then
88fceb68
PB
3167 enable_werror=yes
3168else
3169 enable_werror=no
3170fi])
09a9c095
NN
3171case ${enable_werror} in
3172 yes) stage2_werror_flag="--enable-werror-always" ;;
3173 *) stage2_werror_flag="" ;;
2805b53a 3174esac
09a9c095 3175AC_SUBST(stage2_werror_flag)
2805b53a 3176
f2689b09
SE
3177# Specify what files to not compare during bootstrap.
3178
3179compare_exclusions="gcc/cc*-checksum\$(objext) | gcc/ada/*tools/*"
3180case "$target" in
3181 hppa*64*-*-hpux*) ;;
3182 hppa*-*-hpux*) compare_exclusions="gcc/cc*-checksum\$(objext) | */libgcc/lib2funcs* | gcc/ada/*tools/*" ;;
3183esac
3184AC_SUBST(compare_exclusions)
3185
3e54529c
RW
3186AC_CONFIG_FILES([Makefile],
3187 [sed "$extrasub_build" Makefile |
3188 sed "$extrasub_host" |
3189 sed "$extrasub_target" > mf$$
3190 mv -f mf$$ Makefile],
3191 [extrasub_build="$extrasub_build"
3192 extrasub_host="$extrasub_host"
3193 extrasub_target="$extrasub_target"])
3194AC_OUTPUT