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