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