]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - configure.ac
Fix: symbols eliminated by --gc-sections still trigger warnings for gnu.warning.SYM
[thirdparty/binutils-gdb.git] / configure.ac
CommitLineData
92f01d61 1# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
1b6c0831 2# 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012,
228cf97d 3# 2014, 2015, 2016, 2019, 2022 Free Software Foundation, Inc.
252b5132
RH
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
e8a5fa9c 7# the Free Software Foundation; either version 3 of the License, or
252b5132
RH
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
e8a5fa9c
RW
16# along with this program; see the file COPYING3. If not see
17# <http://www.gnu.org/licenses/>.
252b5132
RH
18
19##############################################################################
a0da8069
NN
20### WARNING: this file contains embedded tabs. Do not run untabify on this file.
21
266df637
PB
22m4_include(config/acx.m4)
23m4_include(config/override.m4)
58c85be7 24m4_include(config/proginstall.m4)
143754cd 25m4_include(config/elf.m4)
228cf97d 26m4_include(config/ax_cxx_compile_stdcxx.m4)
5006459c 27m4_include(config/gcc-plugin.m4)
d5f2ee2e
KG
28m4_include([libtool.m4])
29m4_include([ltoptions.m4])
30m4_include([ltsugar.m4])
31m4_include([ltversion.m4])
32m4_include([lt~obsolete.m4])
7ec59b9e 33m4_include([config/isl.m4])
656fdd47 34
a0da8069 35AC_INIT(move-if-change)
34a0f3cf 36AC_DISABLE_OPTION_CHECKING
c6b750e1 37
5b553f7e
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
c6b750e1
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
a0da8069
NN
80AC_CANONICAL_SYSTEM
81AC_ARG_PROGRAM
82
c6b750e1 83m4_pattern_allow([^AS_FOR_TARGET$])dnl
b5714970 84m4_pattern_allow([^AS_FOR_BUILD$])dnl
c6b750e1 85
e5c3f801
NN
86# Get 'install' or 'install-sh' and its variants.
87AC_PROG_INSTALL
656fdd47 88ACX_PROG_LN
dfdffa2c 89AC_PROG_LN_S
8e957354
PB
90AC_PROG_SED
91AC_PROG_AWK
e5c3f801 92
0fdbe983
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
a0da8069
NN
101# Set srcdir to "." if that's what it is.
102# This is important for multilib support.
103pwd=`${PWDCMD-pwd}`
a0da8069
NN
104if test "${pwd}" = "${srcpwd}" ; then
105 srcdir=.
106fi
107
108topsrcdir=$srcpwd
252b5132 109
ae831be5 110extra_host_args=
afefada0 111
252b5132
RH
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
a2cc058a 114### (library or tools, host or target), doing a dependency sort.
252b5132 115
7ec59b9e 116# Subdirs will be configured in the order listed in build_configdirs,
a2cc058a
NN
117# configdirs, or target_configdirs; see the serialization section below.
118
7ec59b9e
L
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
a2cc058a
NN
121# the Makefile, whether or not it's implicitly specified here.
122
123# Double entries in build_configdirs, configdirs, or target_configdirs may
124# cause circular dependencies and break everything horribly.
252b5132 125
6a9cf61e
PB
126# these library is used by various programs built for the build
127# environment
128#
1b6c0831 129build_libs="build-libiberty build-libcpp"
6a9cf61e
PB
130
131# these tools are built for the build environment
a90ef4bf 132build_tools="build-texinfo build-flex build-bison build-m4 build-fixincludes"
6a9cf61e 133
252b5132 134# these libraries are used by various programs built for the host environment
1b6c0831 135#f
862776f2 136host_libs="gettext libiberty opcodes bfd readline tcl tk itcl libgui zlib libbacktrace libcpp libcody libdecnumber gmp mpfr mpc isl libiconv libctf libsframe"
252b5132 137
252b5132
RH
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.
2af579c4
NN
141# binutils, gas and ld appear in that order because it makes sense to run
142# "make check" in that particular order.
e6de499b 143# If --enable-gold is used, "gold" may replace "ld".
917f20be 144host_tools="texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gdbserver gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1 gm2tools gotools c++tools"
75205f78 145
252b5132
RH
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)
ffdd6afc 148# Note that libiberty is not a target library.
b1299c4e 149target_libraries="target-libgcc \
2bf680c4 150 target-libbacktrace \
252b5132
RH
151 target-libgloss \
152 target-newlib \
cff87f51 153 target-libgomp \
7ec59b9e 154 target-libatomic \
d32e2926 155 target-libitm \
b9459e83 156 target-libstdc++-v3 \
5286fdef 157 target-libsanitizer \
95e43135 158 target-libvtv \
bb780410 159 target-libssp \
e552509b 160 target-libquadmath \
4b1cb4fe 161 target-libgfortran \
05a13254 162 target-libffi \
a2592b1b 163 target-libobjc \
e552509b 164 target-libada \
917f20be 165 target-libgm2 \
228cf97d
AM
166 target-libgo \
167 target-libphobos \
168 target-zlib"
252b5132 169
9c14acb8
NN
170# these tools are built using the target libraries, and are intended to
171# run only in the target environment
252b5132 172#
9c14acb8 173# note: any program that *uses* libraries that are in the "target_libraries"
0377a422 174# list belongs in this list.
252b5132 175#
a90ef4bf 176target_tools="target-rda"
252b5132
RH
177
178################################################################################
179
252b5132
RH
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.
252b5132 185configdirs=`echo ${host_libs} ${host_tools}`
9c14acb8 186target_configdirs=`echo ${target_libraries} ${target_tools}`
ee025550 187build_configdirs=`echo ${build_libs} ${build_tools}`
dd12c3a8 188
9cc8ae67 189m4_divert_text([PARSE_ARGS],
6d0cd39e
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'`
9cc8ae67
PB
198])
199
252b5132
RH
200################################################################################
201
252b5132
RH
202srcname="gnu development package"
203
204# This gets set non-empty for some net releases of packages.
205appdirs=""
206
c712250a
DD
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
7ec59b9e 213fi
c712250a 214
9175bfc0 215# Find the build and target subdir names.
dd12c3a8 216GCC_TOPLEV_SUBDIRS
2fd0b40b
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
252b5132 222
f48556b1
DD
223# Skipdirs are removed silently.
224skipdirs=
225# Noconfigdirs are removed loudly.
226noconfigdirs=""
252b5132 227
f48556b1
DD
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
93f9b408 232 noconfigdirs="$noconfigdirs ld gold"
252b5132
RH
233fi
234
f48556b1
DD
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"
252b5132
RH
240fi
241
700d40ca 242use_included_zlib=
cf39cfc5
L
243AC_ARG_WITH(system-zlib,
244[AS_HELP_STRING([--with-system-zlib], [use installed libz])])
700d40ca
ILT
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
1c232ab0
ДП
251# Don't compile the bundled readline/libreadline.a if --with-system-readline
252# is provided.
253if test x$with_system_readline = xyes ; then
254 noconfigdirs="$noconfigdirs readline"
255fi
256
2cac01e3
FS
257AC_ARG_WITH(zstd,
258[AS_HELP_STRING([--with-zstd], [Support zstd compressed debug sections (default=auto)])])
259
7ec59b9e 260# some tools are so dependent upon X11 that if we're not building with X,
f48556b1 261# it's not even worth trying to configure, much less build, that tool.
252b5132 262
f48556b1
DD
263case ${with_x} in
264 yes | "") ;; # the default value for this tree is that X11 is available
ff0a3bf8 265 no)
675c6968 266 skipdirs="${skipdirs} tk itcl libgui"
ff0a3bf8 267 # We won't be able to build gdbtk without X.
7ec59b9e 268 enable_gdbtk=no
ff0a3bf8 269 ;;
f48556b1
DD
270 *) echo "*** bad value \"${with_x}\" for -with-x flag; ignored" 1>&2 ;;
271esac
252b5132 272
0377a422 273# Some are only suitable for cross toolchains.
405ea7a0
NN
274# Remove these if host=target.
275cross_only="target-libgloss target-newlib target-opcodes"
252b5132 276
f48556b1
DD
277case $is_cross_compiler in
278 no) skipdirs="${skipdirs} ${cross_only}" ;;
f48556b1 279esac
252b5132 280
a32d391c
DD
281# If both --with-headers and --with-libs are specified, default to
282# --without-newlib.
32be62b5
RS
283if test x"${with_headers}" != x && test x"${with_headers}" != xno \
284 && test x"${with_libs}" != x && test x"${with_libs}" != xno ; then
a32d391c
DD
285 if test x"${with_newlib}" = x ; then
286 with_newlib=no
287 fi
288fi
289
290# Recognize --with-newlib/--without-newlib.
291case ${with_newlib} in
292 no) skipdirs="${skipdirs} target-newlib" ;;
293 yes) skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'` ;;
294esac
295
1b6c0831
L
296AC_ARG_ENABLE(as-accelerator-for,
297[AS_HELP_STRING([--enable-as-accelerator-for=ARG],
298 [build as offload target compiler.
299 Specify offload host triple by ARG])])
300
301AC_ARG_ENABLE(offload-targets,
302[AS_HELP_STRING([--enable-offload-targets=LIST],
303 [enable offloading to devices from comma-separated LIST of
304 TARGET[=DIR]. Use optional path to find offload target compiler
305 during the build])],
306[
307 if test x"$enable_offload_targets" = x; then
308 AC_MSG_ERROR([no offload targets specified])
309 fi
310], [enable_offload_targets=])
311
228cf97d
AM
312AC_ARG_ENABLE(offload-defaulted,
313[AS_HELP_STRING([--enable-offload-defaulted]
314 [If enabled, configured but not installed offload compilers and
315 libgomp plugins are silently ignored. Useful for distribution
316 compilers where those are in separate optional packages.])],
317[enable_offload_defaulted=$enableval],
318[enable_offload_defaulted=])
319
c7791212
NC
320# Handle --enable-gold, --enable-ld.
321# --disable-gold [--enable-ld]
322# Build only ld. Default option.
d3b50760
L
323# --enable-gold [--enable-ld]
324# Build both gold and ld. Install gold as "ld.gold", install ld
325# as "ld.bfd" and "ld".
326# --enable-gold=default [--enable-ld]
c7791212
NC
327# Build both gold and ld. Install gold as "ld.gold" and "ld",
328# install ld as "ld.bfd".
329# --enable-gold[=default] --disable-ld
330# Build only gold, which is then installed as both "ld.gold" and "ld".
331# --enable-gold --enable-ld=default
d3b50760
L
332# Build both gold (installed as "ld.gold") and ld (installed as "ld"
333# and ld.bfd).
c7791212
NC
334# In other words, ld is default
335# --enable-gold=default --enable-ld=default
336# Error.
337
338default_ld=
93f9b408 339AC_ARG_ENABLE(gold,
7837304f
AS
340[AS_HELP_STRING([[--enable-gold[=ARG]]],
341 [build gold @<:@ARG={default,yes,no}@:>@])],
93f9b408
ILT
342ENABLE_GOLD=$enableval,
343ENABLE_GOLD=no)
c7791212
NC
344case "${ENABLE_GOLD}" in
345 yes|default)
e6de499b
NC
346 # Check for ELF target.
347 is_elf=no
348 case "${target}" in
349 *-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
2344b8da 350 | *-*-linux* | *-*-gnu* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
5b806d27 351 | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* \
5006459c 352 | *-*-solaris2* | *-*-nto* | *-*-nacl* | *-*-haiku*)
e6de499b
NC
353 case "${target}" in
354 *-*-linux*aout* | *-*-linux*oldld*)
355 ;;
356 *)
357 is_elf=yes
358 ;;
359 esac
360 esac
361
362 if test "$is_elf" = "yes"; then
363 # Check for target supported by gold.
93f9b408 364 case "${target}" in
6d26190c 365 i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-* \
228cf97d 366 | aarch64*-*-* | tilegx*-*-* | mips*-*-* | s390*-*-* | loongarch*-*-*)
c7791212
NC
367 configdirs="$configdirs gold"
368 if test x${ENABLE_GOLD} = xdefault; then
369 default_ld=gold
370 fi
e6de499b 371 ENABLE_GOLD=yes
93f9b408
ILT
372 ;;
373 esac
e6de499b
NC
374 fi
375 ;;
376 no)
377 ;;
378 *)
379 AC_MSG_ERROR([invalid --enable-gold argument])
380 ;;
c7791212
NC
381esac
382
383AC_ARG_ENABLE(ld,
7837304f
AS
384[AS_HELP_STRING([[--enable-ld[=ARG]]],
385 [build ld @<:@ARG={default,yes,no}@:>@])],
c7791212
NC
386ENABLE_LD=$enableval,
387ENABLE_LD=yes)
388
389case "${ENABLE_LD}" in
390 default)
d3b50760 391 if test x${default_ld} != x; then
c7791212
NC
392 AC_MSG_ERROR([either gold or ld can be the default ld])
393 fi
394 ;;
395 yes)
396 ;;
397 no)
398 if test x${ENABLE_GOLD} != xyes; then
399 AC_MSG_WARN([neither ld nor gold are enabled])
400 fi
401 configdirs=`echo " ${configdirs} " | sed -e 's/ ld / /'`
402 ;;
403 *)
404 AC_MSG_ERROR([invalid --enable-ld argument])
405 ;;
406esac
93f9b408 407
bb368aad
VM
408AC_ARG_ENABLE(gprofng,
409[AS_HELP_STRING([[--enable-gprofng[=ARG]]],
410 [build gprofng @<:@ARG={yes,no}@:>@])],
411enable_gprofng=$enableval,
412enable_gprofng=yes)
413if test "$enable_gprofng" = "yes"; then
414 case "${target}" in
415 x86_64-*-linux* | i?86-*-linux* | aarch64-*-linux*)
416 configdirs="$configdirs gprofng"
417 ;;
418 esac
419fi
420
421
edeefb67
L
422# PR gas/19109
423# Decide the default method for compressing debug sections.
424# Provide a configure time option to override our default.
425AC_ARG_ENABLE(compressed_debug_sections,
6c3bc0f8 426[AS_HELP_STRING([--enable-compressed-debug-sections={all,gas,gold,ld,none}],
edeefb67
L
427 [Enable compressed debug sections for gas, gold or ld by
428 default])],
429[
430 if test x"$enable_compressed_debug_sections" = xyes; then
431 AC_MSG_ERROR([no program with compressed debug sections specified])
432 fi
433], [enable_compressed_debug_sections=])
434
b0c295e1
ML
435# Select default compression algorithm.
436AC_ARG_ENABLE(default_compressed_debug_sections_algorithm,
437[AS_HELP_STRING([--enable-default-compressed-debug-sections-algorithm={zlib,zstd}],
438 [Default compression algorithm for --enable-compressed-debug-sections.])],
439[], [default_compressed_debug_sections_algorithm=])
440
252b5132
RH
441# Configure extra directories which are host specific
442
443case "${host}" in
f48556b1 444 *-cygwin*)
3866be5d 445 configdirs="$configdirs libtermcap" ;;
252b5132
RH
446esac
447
59f7ec45
HPN
448# A target can indicate whether a language isn't supported for some reason.
449# Only spaces may be used in this macro; not newlines or tabs.
450unsupported_languages=
451
7ec59b9e 452# Remove more programs from consideration, based on the host or
252b5132
RH
453# target this usually means that a port of the program doesn't
454# exist yet.
455
252b5132 456case "${host}" in
3516a403 457 i[[3456789]]86-*-msdosdjgpp*)
6a608608 458 noconfigdirs="$noconfigdirs tcl tk itcl"
252b5132 459 ;;
252b5132
RH
460esac
461
e5f2f7d9
LM
462# Default to --disable-year2038 until we can handle differences between
463# projects that use gnulib (which understands year 2038) and projects that
464# do not (like BFD).
465AC_ARG_ENABLE(year2038,
466AS_HELP_STRING([--enable-year2038],
467 [enable support for timestamps past the year 2038]),
468ENABLE_YEAR2038=$enableval,
469ENABLE_YEAR2038=no)
470enable_year2038=
471if test "${ENABLE_YEAR2038}" = "no" ; then
472 enable_year2038=no
473fi
4b1cb4fe 474
89a1e9c3
PB
475AC_ARG_ENABLE(libquadmath,
476AS_HELP_STRING([--disable-libquadmath],
477 [do not build libquadmath directory]),
478ENABLE_LIBQUADMATH=$enableval,
479ENABLE_LIBQUADMATH=yes)
480if test "${ENABLE_LIBQUADMATH}" = "no" ; then
481 noconfigdirs="$noconfigdirs target-libquadmath"
482fi
483
484
485AC_ARG_ENABLE(libquadmath-support,
486AS_HELP_STRING([--disable-libquadmath-support],
487 [disable libquadmath support for Fortran]),
488ENABLE_LIBQUADMATH_SUPPORT=$enableval,
489ENABLE_LIBQUADMATH_SUPPORT=yes)
490enable_libquadmath_support=
491if test "${ENABLE_LIBQUADMATH_SUPPORT}" = "no" ; then
492 enable_libquadmath_support=no
493fi
494
495
a2592b1b 496AC_ARG_ENABLE(libada,
7837304f 497[AS_HELP_STRING([--enable-libada], [build libada directory])],
a2592b1b
DD
498ENABLE_LIBADA=$enableval,
499ENABLE_LIBADA=yes)
500if test "${ENABLE_LIBADA}" != "yes" ; then
b00612cc 501 noconfigdirs="$noconfigdirs gnattools"
a2592b1b
DD
502fi
503
917f20be
GM
504AC_ARG_ENABLE(libgm2,
505[AS_HELP_STRING([--enable-libgm2], [build libgm2 directory])],
506ENABLE_LIBGM2=$enableval,
507ENABLE_LIBGM2=no)
508if test "${ENABLE_LIBGM2}" != "yes" ; then
509 noconfigdirs="$noconfigdirs gm2tools"
510fi
511
5f128533 512AC_ARG_ENABLE(libssp,
7837304f 513[AS_HELP_STRING([--enable-libssp], [build libssp directory])],
5f128533
KH
514ENABLE_LIBSSP=$enableval,
515ENABLE_LIBSSP=yes)
5f128533 516
f66a9a70
L
517AC_ARG_ENABLE(libstdcxx,
518AS_HELP_STRING([--disable-libstdcxx],
519 [do not build libstdc++-v3 directory]),
520ENABLE_LIBSTDCXX=$enableval,
521ENABLE_LIBSTDCXX=default)
522[if test "${ENABLE_LIBSTDCXX}" = "no" ; then
1b6c0831 523 noconfigdirs="$noconfigdirs target-libstdc++-v3"
f66a9a70
L
524fi]
525
68996839 526# Enable libgomp by default on hosted POSIX systems, and a few others.
a6df5a19 527if test x$enable_libgomp = x ; then
b3ded179 528 case "${target}" in
29383458 529 *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
b3ded179 530 ;;
5b806d27 531 *-*-netbsd* | *-*-freebsd* | *-*-openbsd* | *-*-dragonfly*)
b3ded179 532 ;;
2479f722 533 *-*-solaris2* | *-*-hpux11*)
b3ded179
PB
534 ;;
535 *-*-darwin* | *-*-aix*)
536 ;;
228cf97d 537 nvptx*-*-* | amdgcn*-*-*)
68996839 538 ;;
b3ded179
PB
539 *)
540 noconfigdirs="$noconfigdirs target-libgomp"
541 ;;
542 esac
a6df5a19 543fi
b3ded179 544
7ec59b9e
L
545# Disable libatomic on unsupported systems.
546if test -d ${srcdir}/libatomic; then
547 if test x$enable_libatomic = x; then
548 AC_MSG_CHECKING([for libatomic support])
549 if (srcdir=${srcdir}/libatomic; \
550 . ${srcdir}/configure.tgt; \
551 test -n "$UNSUPPORTED")
552 then
553 AC_MSG_RESULT([no])
554 noconfigdirs="$noconfigdirs target-libatomic"
555 else
556 AC_MSG_RESULT([yes])
557 fi
558 fi
559fi
560
d32e2926
RH
561# Disable libitm on unsupported systems.
562if test -d ${srcdir}/libitm; then
563 if test x$enable_libitm = x; then
564 AC_MSG_CHECKING([for libitm support])
565 if (srcdir=${srcdir}/libitm; \
566 . ${srcdir}/configure.tgt; \
567 test -n "$UNSUPPORTED")
568 then
569 AC_MSG_RESULT([no])
570 noconfigdirs="$noconfigdirs target-libitm"
571 else
572 AC_MSG_RESULT([yes])
573 fi
574 fi
575fi
576
5286fdef
L
577# Disable libsanitizer on unsupported systems.
578if test -d ${srcdir}/libsanitizer; then
579 if test x$enable_libsanitizer = x; then
580 AC_MSG_CHECKING([for libsanitizer support])
581 if (srcdir=${srcdir}/libsanitizer; \
582 . ${srcdir}/configure.tgt; \
583 test -n "$UNSUPPORTED")
584 then
585 AC_MSG_RESULT([no])
586 noconfigdirs="$noconfigdirs target-libsanitizer"
587 else
588 AC_MSG_RESULT([yes])
589 fi
590 fi
591fi
592
95e43135
JBG
593# Disable libvtv on unsupported systems.
594if test -d ${srcdir}/libvtv; then
595 if test x$enable_libvtv = x; then
596 AC_MSG_CHECKING([for libvtv support])
597 if (srcdir=${srcdir}/libvtv; \
598 . ${srcdir}/configure.tgt; \
599 test "$VTV_SUPPORTED" != "yes")
600 then
601 AC_MSG_RESULT([no])
602 noconfigdirs="$noconfigdirs target-libvtv"
603 else
604 AC_MSG_RESULT([yes])
605 fi
606 fi
607fi
608
1488e230
DE
609# Disable libquadmath for some systems.
610case "${target}" in
5286fdef
L
611 avr-*-*)
612 noconfigdirs="$noconfigdirs target-libquadmath"
613 ;;
1488e230
DE
614 # libquadmath is unused on AIX and libquadmath build process use of
615 # LD_LIBRARY_PATH can break AIX bootstrap.
616 powerpc-*-aix* | rs6000-*-aix*)
617 noconfigdirs="$noconfigdirs target-libquadmath"
618 ;;
619esac
620
065a5627
JM
621# Disable libssp for some systems.
622case "${target}" in
623 avr-*-*)
c5f5c3c2 624 # No hosted I/O support.
065a5627
JM
625 noconfigdirs="$noconfigdirs target-libssp"
626 ;;
228cf97d
AM
627 bpf-*-*)
628 noconfigdirs="$noconfigdirs target-libssp"
629 ;;
065a5627
JM
630 powerpc-*-aix* | rs6000-*-aix*)
631 noconfigdirs="$noconfigdirs target-libssp"
632 ;;
228cf97d
AM
633 pru-*-*)
634 # No hosted I/O support.
635 noconfigdirs="$noconfigdirs target-libssp"
636 ;;
99c513f6 637 rl78-*-*)
202e2356
NC
638 # libssp uses a misaligned load to trigger a fault, but the RL78
639 # doesn't fault for those - instead, it gives a build-time error
640 # for explicit misaligned loads.
99c513f6
DD
641 noconfigdirs="$noconfigdirs target-libssp"
642 ;;
1b6c0831
L
643 visium-*-*)
644 # No hosted I/O support.
645 noconfigdirs="$noconfigdirs target-libssp"
646 ;;
065a5627
JM
647esac
648
065a5627 649# Disable libstdc++-v3 for some systems.
228cf97d 650# Allow user to override this if they pass --enable-libstdcxx
f66a9a70
L
651if test "${ENABLE_LIBSTDCXX}" = "default" ; then
652 case "${target}" in
653 *-*-vxworks*)
654 # VxWorks uses the Dinkumware C++ library.
655 noconfigdirs="$noconfigdirs target-libstdc++-v3"
656 ;;
228cf97d
AM
657 amdgcn*-*-*)
658 # Not ported/fails to build when using newlib.
659 noconfigdirs="$noconfigdirs target-libstdc++-v3"
660 ;;
f66a9a70
L
661 arm*-wince-pe*)
662 # the C++ libraries don't build on top of CE's C libraries
663 noconfigdirs="$noconfigdirs target-libstdc++-v3"
664 ;;
665 avr-*-*)
666 noconfigdirs="$noconfigdirs target-libstdc++-v3"
667 ;;
228cf97d
AM
668 bpf-*-*)
669 noconfigdirs="$noconfigdirs target-libstdc++-v3"
670 ;;
969b1713
L
671 ft32-*-*)
672 noconfigdirs="$noconfigdirs target-libstdc++-v3"
673 ;;
f66a9a70
L
674 esac
675fi
065a5627 676
228cf97d
AM
677# Disable C++ on systems where it is known to not work.
678# For testing, you can override this with --enable-languages=c++.
679case ,${enable_languages}, in
680 *,c++,*)
681 ;;
682 *)
683 case "${target}" in
684 bpf-*-*)
685 unsupported_languages="$unsupported_languages c++"
686 ;;
687 esac
688 ;;
689esac
690
691# Disable Objc on systems where it is known to not work.
692# For testing, you can override this with --enable-languages=objc.
693case ,${enable_languages}, in
694 *,objc,*)
695 ;;
696 *)
697 case "${target}" in
698 bpf-*-*)
699 unsupported_languages="$unsupported_languages objc"
700 ;;
701 esac
702 ;;
703esac
704
705# Disable D on systems where it is known to not work.
706# For testing, you can override this with --enable-languages=d.
707case ,${enable_languages}, in
708 *,d,*)
709 ;;
710 *)
711 case "${target}" in
712 bpf-*-*)
713 unsupported_languages="$unsupported_languages d"
714 ;;
715 esac
716 ;;
717esac
718
719# Disable libphobos on unsupported systems.
720# For testing, you can override this with --enable-libphobos.
721if test -d ${srcdir}/libphobos; then
722 if test x$enable_libphobos = x; then
723 AC_MSG_CHECKING([for libphobos support])
724 if (srcdir=${srcdir}/libphobos; \
725 . ${srcdir}/configure.tgt; \
726 test "$LIBPHOBOS_SUPPORTED" != "yes")
727 then
728 AC_MSG_RESULT([no])
729 noconfigdirs="$noconfigdirs target-libphobos"
730 else
731 AC_MSG_RESULT([yes])
732 fi
733 fi
734fi
735
065a5627
JM
736# Disable Fortran for some systems.
737case "${target}" in
738 mmix-*-*)
739 # See <http://gcc.gnu.org/ml/gcc-patches/2004-11/msg00572.html>.
740 unsupported_languages="$unsupported_languages fortran"
741 ;;
228cf97d
AM
742 bpf-*-*)
743 unsupported_languages="$unsupported_languages fortran"
744 ;;
065a5627
JM
745esac
746
05a13254 747# Disable libffi for some systems.
0827f9a6 748case "${target}" in
9863d716
JM
749 powerpc-*-darwin*)
750 ;;
751 i[[3456789]]86-*-darwin*)
752 ;;
753 x86_64-*-darwin[[912]]*)
754 ;;
755 *-*-darwin*)
05a13254 756 noconfigdirs="$noconfigdirs target-libffi"
9863d716 757 ;;
9863d716 758 *-*-netware*)
05a13254
NC
759 noconfigdirs="$noconfigdirs target-libffi"
760 ;;
761 *-*-phoenix*)
762 noconfigdirs="$noconfigdirs target-libffi"
9863d716
JM
763 ;;
764 *-*-rtems*)
05a13254 765 noconfigdirs="$noconfigdirs target-libffi"
9863d716
JM
766 ;;
767 *-*-tpf*)
05a13254 768 noconfigdirs="$noconfigdirs target-libffi"
9863d716
JM
769 ;;
770 *-*-uclinux*)
05a13254 771 noconfigdirs="$noconfigdirs target-libffi"
9863d716
JM
772 ;;
773 *-*-vxworks*)
05a13254
NC
774 noconfigdirs="$noconfigdirs target-libffi"
775 ;;
776 aarch64*-*-freebsd*)
777 noconfigdirs="$noconfigdirs target-libffi"
9863d716 778 ;;
9863d716 779 alpha*-*-*vms*)
05a13254 780 noconfigdirs="$noconfigdirs target-libffi"
9863d716 781 ;;
1b6c0831 782 arm*-*-freebsd*)
05a13254 783 noconfigdirs="$noconfigdirs target-libffi"
1b6c0831 784 ;;
0827f9a6 785 arm-wince-pe)
05a13254 786 noconfigdirs="$noconfigdirs target-libffi"
9863d716 787 ;;
228cf97d
AM
788 arm*-*-symbianelf*)
789 noconfigdirs="$noconfigdirs target-libffi"
790 ;;
791 bpf-*-*)
792 noconfigdirs="$noconfigdirs target-libffi"
793 ;;
9863d716 794 cris-*-* | crisv32-*-*)
9863d716
JM
795 case "${target}" in
796 *-*-linux*)
797 ;;
798 *) # See PR46792 regarding target-libffi.
05a13254 799 noconfigdirs="$noconfigdirs target-libffi";;
9863d716
JM
800 esac
801 ;;
82ae827f 802 hppa*64*-*-hpux*)
05a13254 803 noconfigdirs="$noconfigdirs target-libffi"
9863d716
JM
804 ;;
805 hppa*-hp-hpux11*)
806 ;;
82ae827f 807 hppa*-*-hpux*)
05a13254 808 noconfigdirs="$noconfigdirs target-libffi"
9863d716 809 ;;
9863d716 810 ia64*-*-*vms*)
05a13254 811 noconfigdirs="$noconfigdirs target-libffi"
9863d716 812 ;;
9863d716 813 i[[3456789]]86-w64-mingw*)
05a13254 814 noconfigdirs="$noconfigdirs target-libffi"
9863d716
JM
815 ;;
816 i[[3456789]]86-*-mingw*)
05a13254 817 noconfigdirs="$noconfigdirs target-libffi"
9863d716
JM
818 ;;
819 x86_64-*-mingw*)
05a13254 820 noconfigdirs="$noconfigdirs target-libffi"
9863d716 821 ;;
9863d716 822 mmix-*-*)
05a13254 823 noconfigdirs="$noconfigdirs target-libffi"
9863d716
JM
824 ;;
825 powerpc-*-aix*)
9863d716 826 ;;
9863d716 827 rs6000-*-aix*)
9863d716 828 ;;
3f8107ab 829 ft32-*-*)
05a13254 830 noconfigdirs="$noconfigdirs target-libffi"
3f8107ab 831 ;;
9863d716 832 *-*-lynxos*)
05a13254 833 noconfigdirs="$noconfigdirs target-libffi"
1b6c0831
L
834 ;;
835esac
836
837# Disable the go frontend on systems where it is known to not work. Please keep
838# this in sync with contrib/config-list.mk.
839case "${target}" in
228cf97d 840*-*-darwin* | *-*-cygwin* | *-*-mingw* | bpf-* )
1b6c0831
L
841 unsupported_languages="$unsupported_languages go"
842 ;;
9863d716
JM
843esac
844
919adfe8
TT
845# Only allow gdbserver on some systems.
846if test -d ${srcdir}/gdbserver; then
847 if test x$enable_gdbserver = x; then
848 AC_MSG_CHECKING([for gdbserver support])
849 if (srcdir=${srcdir}/gdbserver; \
850 . ${srcdir}/configure.srv; \
851 test -n "$UNSUPPORTED")
852 then
853 AC_MSG_RESULT([no])
854 noconfigdirs="$noconfigdirs gdbserver"
855 else
856 AC_MSG_RESULT([yes])
857 fi
858 fi
859fi
860
a413f71a
ILT
861# Disable libgo for some systems where it is known to not work.
862# For testing, you can easily override this with --enable-libgo.
863if test x$enable_libgo = x; then
864 case "${target}" in
865 *-*-darwin*)
866 # PR 46986
867 noconfigdirs="$noconfigdirs target-libgo"
868 ;;
869 *-*-cygwin* | *-*-mingw*)
870 noconfigdirs="$noconfigdirs target-libgo"
871 ;;
228cf97d
AM
872 bpf-*-*)
873 noconfigdirs="$noconfigdirs target-libgo"
874 ;;
a413f71a
ILT
875 esac
876fi
877
691bb5a1
DD
878# Default libgloss CPU subdirectory.
879libgloss_dir="$target_cpu"
4b1cb4fe 880
ff46fb8f
JM
881case "${target}" in
882 sh*-*-pe|mips*-*-pe|*arm-wince-pe)
883 libgloss_dir=wince
884 ;;
f1dd87fc
YZ
885 aarch64*-*-* )
886 libgloss_dir=aarch64
887 ;;
ff46fb8f
JM
888 arm*-*-*)
889 libgloss_dir=arm
890 ;;
891 cris-*-* | crisv32-*-*)
892 libgloss_dir=cris
893 ;;
6e712424
PI
894 kvx-*-elf)
895 libgloss_dir=kvx-elf
896 ;;
897 kvx-*-mbr)
898 libgloss_dir=kvx-mbr
899 ;;
900 kvx-*-cos)
901 libgloss_dir=kvx-cos
902 ;;
ff46fb8f
JM
903 hppa*-*-*)
904 libgloss_dir=pa
905 ;;
906 i[[3456789]]86-*-*)
907 libgloss_dir=i386
908 ;;
228cf97d
AM
909 loongarch*-*-*)
910 libgloss_dir=loongarch
911 ;;
ff46fb8f
JM
912 m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)
913 libgloss_dir=m68hc11
914 ;;
915 m68*-*-* | fido-*-*)
916 libgloss_dir=m68k
917 ;;
918 mips*-*-*)
919 libgloss_dir=mips
920 ;;
921 powerpc*-*-*)
922 libgloss_dir=rs6000
923 ;;
228cf97d
AM
924 pru-*-*)
925 libgloss_dir=pru
926 ;;
ff46fb8f
JM
927 sparc*-*-*)
928 libgloss_dir=sparc
929 ;;
930esac
931
c7e4b184 932# Disable newlib and libgloss for various target OSes.
252b5132 933case "${target}" in
c7e4b184
JM
934 alpha*-dec-osf*)
935 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
936 ;;
937 i[[3456789]]86-*-linux*)
938 # This section makes it possible to build newlib natively on linux.
939 # If we are using a cross compiler then don't configure newlib.
940 if test x${is_cross_compiler} != xno ; then
941 noconfigdirs="$noconfigdirs target-newlib"
942 fi
943 noconfigdirs="$noconfigdirs target-libgloss"
944 # If we are not using a cross compiler, do configure newlib.
945 # Note however, that newlib will only be configured in this situation
946 # if the --with-newlib option has been given, because otherwise
947 # 'target-newlib' will appear in skipdirs.
948 ;;
949 i[[3456789]]86-*-rdos*)
950 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
951 ;;
952 sh*-*-pe|mips*-*-pe|arm-wince-pe)
953 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
954 ;;
955 sparc-*-sunos4*)
956 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
957 ;;
228cf97d
AM
958 bpf-*-*)
959 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
960 ;;
c7e4b184
JM
961 *-*-aix*)
962 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
963 ;;
964 *-*-beos*)
965 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
966 ;;
75205f78 967 *-*-chorusos)
b2f14e4a 968 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
75205f78 969 ;;
c7e4b184
JM
970 *-*-dragonfly*)
971 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
972 ;;
973 *-*-freebsd*)
974 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
975 ;;
976 *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
977 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
978 ;;
979 *-*-lynxos*)
980 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
7ec59b9e 981 ;;
c7e4b184
JM
982 *-*-mingw*)
983 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
984 ;;
985 *-*-netbsd*)
986 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
987 ;;
988 *-*-netware*)
989 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
990 ;;
991 *-*-tpf*)
992 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
993 ;;
994 *-*-uclinux*)
995 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
996 ;;
997 *-*-vxworks*)
998 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
999 ;;
1000esac
1001
1002case "${target}" in
1003 *-*-chorusos)
1004 ;;
f075eb5e
TG
1005 aarch64-*-darwin*)
1006 noconfigdirs="$noconfigdirs ld gas gdb gprof"
1007 noconfigdirs="$noconfigdirs sim target-rda"
1008 ;;
228cf97d
AM
1009 amdgcn*-*-*)
1010 ;;
f075eb5e
TG
1011 arm-*-darwin*)
1012 noconfigdirs="$noconfigdirs ld gas gdb gprof"
1013 noconfigdirs="$noconfigdirs sim target-rda"
1014 ;;
24741ab2 1015 powerpc-*-darwin*)
9d39db92 1016 noconfigdirs="$noconfigdirs ld gas gdb gprof"
4e3fc8e5 1017 noconfigdirs="$noconfigdirs sim target-rda"
b3f16a9b 1018 ;;
85bd1942
TG
1019 i[[3456789]]86-*-darwin*)
1020 noconfigdirs="$noconfigdirs ld gprof"
1021 noconfigdirs="$noconfigdirs sim target-rda"
1022 ;;
e8a5fa9c 1023 x86_64-*-darwin[[912]]*)
652dec25
TG
1024 noconfigdirs="$noconfigdirs ld gas gprof"
1025 noconfigdirs="$noconfigdirs sim target-rda"
1026 ;;
04d1ab34 1027 *-*-darwin*)
d320aacb 1028 noconfigdirs="$noconfigdirs ld gas gdb gprof"
4e3fc8e5 1029 noconfigdirs="$noconfigdirs sim target-rda"
04d1ab34 1030 ;;
5b806d27 1031 *-*-dragonfly*)
5b806d27 1032 ;;
de0b4a87 1033 *-*-freebsd*)
228cf97d
AM
1034 if test "x$with_gmp" = x \
1035 && ! test -d ${srcdir}/gmp \
4b1cb4fe
DD
1036 && test -f /usr/local/include/gmp.h; then
1037 with_gmp=/usr/local
1038 fi
4b1cb4fe 1039 ;;
f8a495c8
NC
1040 *-*-kaos*)
1041 # Remove unsupported stuff on all kaOS configurations.
f8a495c8
NC
1042 noconfigdirs="$noconfigdirs target-libgloss"
1043 ;;
e82380cc 1044 *-*-netbsd*)
e82380cc 1045 ;;
2a3124ca 1046 *-*-netware*)
252b5132 1047 ;;
05a13254
NC
1048 *-*-phoenix*)
1049 noconfigdirs="$noconfigdirs target-libgloss"
1050 ;;
252b5132 1051 *-*-rtems*)
9863d716 1052 noconfigdirs="$noconfigdirs target-libgloss"
252b5132 1053 ;;
1587117a
EC
1054 # The tpf target doesn't support gdb yet.
1055 *-*-tpf*)
c7e4b184 1056 noconfigdirs="$noconfigdirs gdb tcl tk libgui itcl"
1587117a 1057 ;;
c1968181 1058 *-*-uclinux*)
c7e4b184 1059 noconfigdirs="$noconfigdirs target-rda"
c1968181 1060 ;;
252b5132 1061 *-*-vxworks*)
252b5132
RH
1062 ;;
1063 alpha*-dec-osf*)
e99daf2b 1064 # ld works, but does not support shared libraries.
252b5132 1065 # gas doesn't generate exception information.
c7e4b184 1066 noconfigdirs="$noconfigdirs gas ld"
252b5132
RH
1067 ;;
1068 alpha*-*-*vms*)
9863d716 1069 noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss"
75205f78 1070 ;;
252b5132
RH
1071 alpha*-*-*)
1072 # newlib is not 64 bit ready
9863d716 1073 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
252b5132 1074 ;;
228cf97d
AM
1075 bpf-*-*)
1076 noconfigdirs="$noconfigdirs target-libobjc target-libbacktrace"
1077 ;;
2fb651f6 1078 sh*-*-pe|mips*-*-pe|*arm-wince-pe)
675c6968 1079 noconfigdirs="$noconfigdirs tcl tk itcl libgui sim"
2fb651f6 1080 ;;
05a13254
NC
1081 arc*-*-*)
1082 noconfigdirs="$noconfigdirs sim"
252b5132
RH
1083 ;;
1084 arm-*-pe*)
9863d716 1085 noconfigdirs="$noconfigdirs target-libgloss"
252b5132 1086 ;;
252b5132 1087 arm-*-riscix*)
b2f14e4a 1088 noconfigdirs="$noconfigdirs ld target-libgloss"
252b5132 1089 ;;
8e71395b
L
1090 avr-*-*)
1091 if test x${with_avrlibc} != xno; then
1092 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
1093 fi
1094 ;;
ff72e302 1095 c4x-*-* | tic4x-*-*)
b2f14e4a 1096 noconfigdirs="$noconfigdirs target-libgloss"
077b8428 1097 ;;
b2f14e4a
JM
1098 tic54x-*-*)
1099 noconfigdirs="$noconfigdirs target-libgloss gdb"
75205f78 1100 ;;
252b5132 1101 d10v-*-*)
b2f14e4a 1102 noconfigdirs="$noconfigdirs target-libgloss"
252b5132 1103 ;;
252b5132 1104 d30v-*-*)
b2f14e4a 1105 noconfigdirs="$noconfigdirs gdb"
252b5132 1106 ;;
252b5132 1107 fr30-*-elf*)
9863d716 1108 noconfigdirs="$noconfigdirs gdb"
252b5132 1109 ;;
3f8107ab
AM
1110 ft32-*-*)
1111 noconfigdirs="$noconfigdirs target-rda gprof"
1112 ;;
20135e4c 1113 moxie-*-*)
10b8fe5e 1114 noconfigdirs="$noconfigdirs"
20135e4c 1115 ;;
dd1e52a4 1116 h8300*-*-*)
9863d716 1117 noconfigdirs="$noconfigdirs target-libgloss"
dd1e52a4 1118 ;;
252b5132 1119 h8500-*-*)
b2f14e4a 1120 noconfigdirs="$noconfigdirs target-libgloss"
75205f78 1121 ;;
caeba88f 1122 hppa1.1-*-osf* | hppa1.1-*-bsd* )
caeba88f 1123 ;;
5569a85f
JDA
1124 hppa*64*-*-hpux*)
1125 noconfigdirs="$noconfigdirs gdb"
1126 ;;
1127 hppa*-*-hpux11*)
1128 noconfigdirs="$noconfigdirs gdb ld"
1129 ;;
93cc359e 1130 hppa*64*-*-linux*)
252b5132 1131 ;;
f0ff0f90 1132 hppa*-*-linux*)
5dcac624 1133 ;;
252b5132 1134 hppa*-*-*elf* | \
09e90eb4 1135 hppa*-*-lites* | \
17240c1f 1136 hppa*-*-openbsd* | \
09e90eb4 1137 hppa*64*-*-*)
4f0ef2d8 1138 ;;
691bb5a1 1139 hppa*-*-pro*)
691bb5a1 1140 ;;
252b5132 1141 hppa*-*-*)
9863d716 1142 noconfigdirs="$noconfigdirs ld"
252b5132 1143 ;;
b07c2aad 1144 i960-*-*)
b2f14e4a 1145 noconfigdirs="$noconfigdirs gdb"
b07c2aad 1146 ;;
2315914d
JW
1147 ia64*-*-elf*)
1148 # No gdb support yet.
0377a422 1149 noconfigdirs="$noconfigdirs readline libgui itcl gdb"
2315914d 1150 ;;
a0c1c920 1151 ia64*-**-hpux*)
92c9a463 1152 # No ld support yet.
5569a85f 1153 noconfigdirs="$noconfigdirs gdb libgui itcl ld"
a0c1c920 1154 ;;
19e99079 1155 ia64*-*-*vms*)
7ec59b9e
L
1156 # No ld support yet.
1157 noconfigdirs="$noconfigdirs libgui itcl ld"
19e99079 1158 ;;
1f53ca9a 1159 i[[3456789]]86-w64-mingw*)
1f53ca9a
AO
1160 ;;
1161 i[[3456789]]86-*-mingw*)
45055374 1162 target_configdirs="$target_configdirs target-winsup"
1f53ca9a 1163 ;;
252b5132
RH
1164 *-*-cygwin*)
1165 target_configdirs="$target_configdirs target-libtermcap target-winsup"
0377a422 1166 noconfigdirs="$noconfigdirs target-libgloss"
b76d7de0 1167 # always build newlib if winsup directory is present.
45055374 1168 if test -d "$srcdir/winsup/cygwin"; then
b76d7de0 1169 skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
ac0fa625 1170 elif test -d "$srcdir/newlib"; then
45055374 1171 echo "Warning: winsup/cygwin is missing so newlib can't be built."
b76d7de0 1172 fi
1f53ca9a 1173 ;;
ec11bdc6 1174 i[[3456789]]86-*-pe)
782cb41f 1175 noconfigdirs="$noconfigdirs target-libgloss"
252b5132 1176 ;;
ec11bdc6 1177 i[[3456789]]86-*-sco3.2v5*)
252b5132
RH
1178 # The linker does not yet know about weak symbols in COFF,
1179 # and is not configured to handle mixed ELF and COFF.
b2f14e4a 1180 noconfigdirs="$noconfigdirs ld target-libgloss"
252b5132 1181 ;;
ec11bdc6 1182 i[[3456789]]86-*-sco*)
b2f14e4a 1183 noconfigdirs="$noconfigdirs gprof target-libgloss"
252b5132 1184 ;;
cff32a7c 1185 i[[3456789]]86-*-solaris2* | x86_64-*-solaris2.1[[0-9]]*)
252b5132
RH
1186 noconfigdirs="$noconfigdirs target-libgloss"
1187 ;;
ec11bdc6 1188 i[[3456789]]86-*-sysv4*)
b2f14e4a 1189 noconfigdirs="$noconfigdirs target-libgloss"
252b5132 1190 ;;
ec11bdc6 1191 i[[3456789]]86-*-beos*)
c7e4b184 1192 noconfigdirs="$noconfigdirs gdb"
bba45b8b 1193 ;;
b59bea8a 1194 i[[3456789]]86-*-rdos*)
c7e4b184 1195 noconfigdirs="$noconfigdirs gdb"
691bb5a1 1196 ;;
6e712424
PI
1197 kvx-*-*)
1198 noconfigdirs="$noconfigdirs gdb gdbserver sim"
1199 ;;
75205f78 1200 mmix-*-*)
9863d716 1201 noconfigdirs="$noconfigdirs gdb"
75205f78 1202 ;;
4970f871 1203 mt-*-*)
cdb9b172
AH
1204 noconfigdirs="$noconfigdirs sim"
1205 ;;
1063beb5
FT
1206 nfp-*-*)
1207 noconfigdirs="$noconfigdirs ld gas gdb gprof sim"
1208 noconfigdirs="$noconfigdirs $target_libraries"
1209 ;;
11104e42
SC
1210 pdp11-*-*)
1211 noconfigdirs="$noconfigdirs gdb gprof"
1212 ;;
252b5132
RH
1213 powerpc-*-aix*)
1214 # copied from rs6000-*-* entry
c7e4b184 1215 noconfigdirs="$noconfigdirs gprof"
252b5132 1216 ;;
93cc359e 1217 powerpc*-*-winnt* | powerpc*-*-pe*)
252b5132 1218 target_configdirs="$target_configdirs target-winsup"
b2f14e4a 1219 noconfigdirs="$noconfigdirs gdb tcl tk target-libgloss itcl"
252b5132
RH
1220 # always build newlib.
1221 skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
1222 ;;
1223 # This is temporary until we can link against shared libraries
1224 powerpcle-*-solaris*)
b2f14e4a 1225 noconfigdirs="$noconfigdirs gdb sim tcl tk itcl"
ba73c63f
JM
1226 ;;
1227 powerpc-*-beos*)
c7e4b184 1228 noconfigdirs="$noconfigdirs gdb"
252b5132
RH
1229 ;;
1230 rs6000-*-lynxos*)
c7e4b184 1231 noconfigdirs="$noconfigdirs gprof"
252b5132
RH
1232 ;;
1233 rs6000-*-aix*)
c7e4b184 1234 noconfigdirs="$noconfigdirs gprof"
252b5132
RH
1235 ;;
1236 rs6000-*-*)
9863d716 1237 noconfigdirs="$noconfigdirs gprof"
252b5132
RH
1238 ;;
1239 m68k-apollo-*)
b2f14e4a 1240 noconfigdirs="$noconfigdirs ld binutils gprof target-libgloss"
252b5132 1241 ;;
25a07265 1242 microblaze*)
9863d716 1243 noconfigdirs="$noconfigdirs gprof"
25a07265 1244 ;;
a9d58c06 1245 mips*-sde-elf* | mips*-mti-elf* | mips*-img-elf*)
5bd8be13
RS
1246 if test x$with_newlib = xyes; then
1247 noconfigdirs="$noconfigdirs gprof"
1248 fi
5bd8be13 1249 ;;
252b5132 1250 mips*-*-irix5*)
b2f14e4a 1251 noconfigdirs="$noconfigdirs gprof target-libgloss"
252b5132
RH
1252 ;;
1253 mips*-*-irix6*)
9863d716 1254 noconfigdirs="$noconfigdirs gprof target-libgloss"
252b5132 1255 ;;
252b5132 1256 mips*-*-bsd*)
e8044f35 1257 noconfigdirs="$noconfigdirs ld gas gprof target-libgloss"
252b5132 1258 ;;
fad93c55 1259 mips*-*-linux*)
fad93c55 1260 ;;
e8044f35
RS
1261 mips*-*-ultrix* | mips*-*-osf* | mips*-*-ecoff* | mips*-*-pe* \
1262 | mips*-*-irix* | mips*-*-lnews* | mips*-*-riscos*)
1263 noconfigdirs="$noconfigdirs ld gas gprof"
1264 ;;
252b5132 1265 mips*-*-*)
9863d716 1266 noconfigdirs="$noconfigdirs gprof"
252b5132 1267 ;;
1b6c0831 1268 nvptx*-*-*)
1b6c0831
L
1269 noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc"
1270 ;;
05a13254 1271 sh-*-*)
e8a5fa9c
RW
1272 case "${target}" in
1273 sh*-*-elf)
9863d716 1274 ;;
e8a5fa9c 1275 *)
9863d716 1276 noconfigdirs="$noconfigdirs target-libgloss" ;;
e8a5fa9c 1277 esac
252b5132 1278 ;;
252b5132 1279 sparc-*-sunos4*)
c7e4b184 1280 if test x${is_cross_compiler} = xno ; then
252b5132
RH
1281 use_gnu_ld=no
1282 fi
1283 ;;
619a3713 1284 tic6x-*-*)
40ae9136 1285 noconfigdirs="$noconfigdirs sim"
619a3713 1286 ;;
05a13254 1287 tilepro*-*-* | tilegx*-*-*)
eb4b2452
NC
1288 noconfigdirs="$noconfigdirs sim"
1289 ;;
252b5132 1290 v810-*-*)
b2f14e4a 1291 noconfigdirs="$noconfigdirs bfd binutils gas gdb ld opcodes target-libgloss"
252b5132
RH
1292 ;;
1293 vax-*-*)
9863d716 1294 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
96ce09a7 1295 ;;
b29d2641
MR
1296 wasm32-*-*)
1297 noconfigdirs="$noconfigdirs ld"
1298 ;;
228cf97d
AM
1299 loongarch*-*-linux*)
1300 ;;
1301 loongarch*-*-*)
1302 noconfigdirs="$noconfigdirs gprof"
1303 ;;
252b5132
RH
1304esac
1305
1306# If we aren't building newlib, then don't build libgloss, since libgloss
1307# depends upon some newlib header files.
1308case "${noconfigdirs}" in
1309 *target-libgloss*) ;;
1310 *target-newlib*) noconfigdirs="$noconfigdirs target-libgloss" ;;
f48556b1 1311esac
252b5132 1312
f48556b1 1313# Work in distributions that contain no compiler tools, like Autoconf.
a0da8069 1314host_makefile_frag=/dev/null
f48556b1
DD
1315if test -d ${srcdir}/config ; then
1316case "${host}" in
ec11bdc6 1317 i[[3456789]]86-*-msdosdjgpp*)
f48556b1
DD
1318 host_makefile_frag="config/mh-djgpp"
1319 ;;
1320 *-cygwin*)
e33b51a6 1321 ACX_CHECK_CYGWIN_CAT_WORKS
f48556b1
DD
1322 host_makefile_frag="config/mh-cygwin"
1323 ;;
8a1599ab 1324 *-mingw*)
84e7906e 1325 host_makefile_frag="config/mh-mingw"
80f6dcbc 1326 ;;
ce6c656d
L
1327 alpha*-linux*)
1328 host_makefile_frag="config/mh-alpha-linux"
1329 ;;
3516a403 1330 hppa*-hp-hpux*)
da888c87
PB
1331 host_makefile_frag="config/mh-pa"
1332 ;;
7ec59b9e 1333 hppa*-*)
da888c87
PB
1334 host_makefile_frag="config/mh-pa"
1335 ;;
228cf97d 1336 i?86-*-darwin[[89]]* | i?86-*-darwin1[[0-7]]* | powerpc*-*-darwin*)
e552509b 1337 host_makefile_frag="config/mh-darwin"
0df3d27f 1338 ;;
f6d183c0
PB
1339 powerpc-*-aix*)
1340 host_makefile_frag="config/mh-ppc-aix"
1341 ;;
1342 rs6000-*-aix*)
1343 host_makefile_frag="config/mh-ppc-aix"
1344 ;;
f48556b1
DD
1345esac
1346fi
1347
9e07f89d 1348if test "${build}" != "${host}" ; then
b5714970
PB
1349 AR_FOR_BUILD=${AR_FOR_BUILD-ar}
1350 AS_FOR_BUILD=${AS_FOR_BUILD-as}
9e07f89d 1351 CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
228cf97d 1352 CPP_FOR_BUILD="${CPP_FOR_BUILD-\$(CC_FOR_BUILD) -E}"
b5714970 1353 CXX_FOR_BUILD=${CXX_FOR_BUILD-g++}
228cf97d 1354 DSYMUTIL_FOR_BUILD=${DSYMUTIL_FOR_BUILD-dsymutil}
b5714970 1355 GFORTRAN_FOR_BUILD=${GFORTRAN_FOR_BUILD-gfortran}
e552509b 1356 GOC_FOR_BUILD=${GOC_FOR_BUILD-gccgo}
228cf97d 1357 GDC_FOR_BUILD=${GDC_FOR_BUILD-gdc}
b5714970
PB
1358 DLLTOOL_FOR_BUILD=${DLLTOOL_FOR_BUILD-dlltool}
1359 LD_FOR_BUILD=${LD_FOR_BUILD-ld}
1360 NM_FOR_BUILD=${NM_FOR_BUILD-nm}
1361 RANLIB_FOR_BUILD=${RANLIB_FOR_BUILD-ranlib}
1362 WINDRES_FOR_BUILD=${WINDRES_FOR_BUILD-windres}
1363 WINDMC_FOR_BUILD=${WINDMC_FOR_BUILD-windmc}
9e07f89d 1364else
b5714970
PB
1365 AR_FOR_BUILD="\$(AR)"
1366 AS_FOR_BUILD="\$(AS)"
9e07f89d 1367 CC_FOR_BUILD="\$(CC)"
b5714970 1368 CXX_FOR_BUILD="\$(CXX)"
228cf97d 1369 DSYMUTIL_FOR_BUILD="\$(DSYMUTIL)"
b5714970 1370 GFORTRAN_FOR_BUILD="\$(GFORTRAN)"
e552509b 1371 GOC_FOR_BUILD="\$(GOC)"
228cf97d 1372 GDC_FOR_BUILD="\$(GDC)"
b5714970
PB
1373 DLLTOOL_FOR_BUILD="\$(DLLTOOL)"
1374 LD_FOR_BUILD="\$(LD)"
1375 NM_FOR_BUILD="\$(NM)"
1376 RANLIB_FOR_BUILD="\$(RANLIB)"
1377 WINDRES_FOR_BUILD="\$(WINDRES)"
1378 WINDMC_FOR_BUILD="\$(WINDMC)"
24ff9987 1379fi
9e07f89d 1380
a8d6316b 1381AC_PROG_CC_C99
24ff9987
DJ
1382AC_PROG_CXX
1383
1384# We must set the default linker to the linker used by gcc for the correct
1385# operation of libtool. If LD is not defined and we are using gcc, try to
1386# set the LD default to the ld used by gcc.
1387if test -z "$LD"; then
1388 if test "$GCC" = yes; then
1389 case $build in
1390 *-*-mingw*)
1391 gcc_prog_ld=`$CC -print-prog-name=ld 2>&1 | tr -d '\015'` ;;
1392 *)
1393 gcc_prog_ld=`$CC -print-prog-name=ld 2>&1` ;;
1394 esac
1395 case $gcc_prog_ld in
1396 # Accept absolute paths.
1397 [[\\/]* | [A-Za-z]:[\\/]*)]
1398 LD="$gcc_prog_ld" ;;
1399 esac
1400 fi
9e07f89d
NN
1401fi
1402
b3676d82
EB
1403# Check whether -static-libstdc++ -static-libgcc is supported.
1404have_static_libs=no
1405if test "$GCC" = yes; then
1406 saved_LDFLAGS="$LDFLAGS"
1407
1408 LDFLAGS="$LDFLAGS -static-libstdc++ -static-libgcc"
1409 AC_MSG_CHECKING([whether g++ accepts -static-libstdc++ -static-libgcc])
1410 AC_LANG_PUSH(C++)
d0ac1c44 1411 AC_LINK_IFELSE([AC_LANG_SOURCE([
a882be68
EB
1412#if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
1413#error -static-libstdc++ not implemented
1414#endif
d0ac1c44 1415int main() {}])],
b3676d82
EB
1416 [AC_MSG_RESULT([yes]); have_static_libs=yes],
1417 [AC_MSG_RESULT([no])])
1418 AC_LANG_POP(C++)
1419
1420 LDFLAGS="$saved_LDFLAGS"
1421fi
1422
9e07f89d 1423ACX_PROG_GNAT
228cf97d 1424ACX_PROG_GDC
b8908782 1425ACX_PROG_CMP_IGNORE_INITIAL
9e07f89d 1426
ffdd6afc
ILT
1427AC_ARG_ENABLE([bootstrap],
1428[AS_HELP_STRING([--enable-bootstrap],
1429 [enable bootstrapping @<:@yes if native build@:>@])],,
1430enable_bootstrap=default)
1431
1432# Issue errors and warnings for invalid/strange bootstrap combinations.
1433if test -r $srcdir/gcc/configure; then
1434 have_compiler=yes
1435else
1436 have_compiler=no
1437fi
1438
1439case "$have_compiler:$host:$target:$enable_bootstrap" in
1440 *:*:*:no) ;;
1441
1442 # Default behavior. Enable bootstrap if we have a compiler
1443 # and we are in a native configuration.
1444 yes:$build:$build:default)
1445 enable_bootstrap=yes ;;
1446
1447 *:*:*:default)
1448 enable_bootstrap=no ;;
1449
1450 # We have a compiler and we are in a native configuration, bootstrap is ok
1451 yes:$build:$build:yes)
1452 ;;
1453
1454 # Other configurations, but we have a compiler. Assume the user knows
1455 # what he's doing.
1456 yes:*:*:yes)
1457 AC_MSG_WARN([trying to bootstrap a cross compiler])
1458 ;;
1459
1460 # No compiler: if they passed --enable-bootstrap explicitly, fail
1461 no:*:*:yes)
1462 AC_MSG_ERROR([cannot bootstrap without a compiler]) ;;
1463
1464 # Fail if wrong command line
1465 *)
1466 AC_MSG_ERROR([invalid option for --enable-bootstrap])
1467 ;;
1468esac
1469
228cf97d
AM
1470# When bootstrapping with GCC, build stage 1 in C++11 mode to ensure that a
1471# C++11 compiler can still start the bootstrap. Otherwise, if building GCC,
1472# require C++11 (or higher).
ce6c656d 1473if test "$enable_bootstrap:$GXX" = "yes:yes"; then
228cf97d
AM
1474 CXX="$CXX -std=c++11"
1475elif test "$have_compiler" = yes; then
1476 AX_CXX_COMPILE_STDCXX(11)
1477
1478 if test "${build}" != "${host}"; then
1479 AX_CXX_COMPILE_STDCXX(11, [], [], [_FOR_BUILD])
1480 fi
ce6c656d
L
1481fi
1482
af019bfd
L
1483AC_ARG_ENABLE([pgo-build],
1484[AS_HELP_STRING([--enable-pgo-build[[=lto]]],
1485 [enable the PGO build])],
1486[enable_pgo_build=$enableval],
1487[enable_pgo_build=no])
1488
1489# Issue errors and warnings for invalid/strange PGO build combinations.
1490case "$have_compiler:$host:$target:$enable_pgo_build" in
1491 *:*:*:no) ;;
1492
1493 # Allow the PGO build only if we aren't building a compiler and
1494 # we are in a native configuration.
1495 no:$build:$build:yes | no:$build:$build:lto) ;;
1496
1497 # Disallow the PGO bootstrap if we are building a compiler.
1498 yes:*:*:yes | yes:*:*:lto)
1499 AC_MSG_ERROR([cannot perform the PGO bootstrap when building a compiler]) ;;
1500
1501 *)
1502 AC_MSG_ERROR([invalid option for --enable-pgo-build])
1503 ;;
1504esac
1505
1506if test "$enable_pgo_build" != "no"; then
1507 AC_MSG_CHECKING([whether the compiler supports -fprofile-generate])
1508 old_CFLAGS="$CFLAGS"
1509 PGO_BUILD_GEN_CFLAGS="-fprofile-generate"
1510 CFLAGS="$CFLAGS $PGO_BUILD_CFLAGS"
1511 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int foo;])],,
1512 [PGO_BUILD_GEN_CFLAGS=])
1513 CFLAGS="$old_CFLAGS"
1514 if test -n "$PGO_BUILD_GEN_CFLAGS"; then
1515 AC_MSG_RESULT([yes])
1516 PGO_BUILD_USE_CFLAGS="-fprofile-use"
1517 else
1518 AC_MSG_RESULT([no])
1519 AC_MSG_ERROR([cannot perform the PGO build without -fprofile-generate])
1520 fi
1521
1522 if test "$enable_pgo_build" = "lto"; then
1523 AC_MSG_CHECKING([whether the compiler supports -flto=jobserver -ffat-lto-objects])
1524 old_CFLAGS="$CFLAGS"
1525 PGO_BUILD_LTO_CFLAGS="-flto=jobserver -ffat-lto-objects"
1526 CFLAGS="$CFLAGS $PGO_BUILD_LTO_CFLAGS"
1527 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int foo;])],,
1528 [PGO_BUILD_LTO_CFLAGS=])
1529 CFLAGS="$old_CFLAGS"
1530 if test -n "$PGO_BUILD_LTO_CFLAGS"; then
1531 AC_MSG_RESULT([yes])
1532 else
1533 AC_MSG_RESULT([no])
1534 AC_MSG_WARN([LTO is disabled for the PGO build])
1535 fi
1536 fi
1537fi
1538AC_SUBST(PGO_BUILD_GEN_CFLAGS)
1539AC_SUBST(PGO_BUILD_USE_CFLAGS)
1540AC_SUBST(PGO_BUILD_LTO_CFLAGS)
1541
d5f2ee2e
KG
1542# Used for setting $lt_cv_objdir
1543_LT_CHECK_OBJDIR
1544
e8a5fa9c 1545# Check for GMP, MPFR and MPC
99118062
AP
1546require_gmp=no
1547require_mpc=no
1548if test -d ${srcdir}/gcc ; then
1549 require_gmp=yes
1550 require_mpc=yes
1551fi
1552if test -d ${srcdir}/gdb ; then
5fb0e308
CC
1553 if test "x$enable_gdb" != xno; then
1554 require_gmp=yes
1555 fi
99118062
AP
1556fi
1557
1558gmplibs="-lmpfr -lgmp"
1559if test x"$require_mpc" = "xyes" ; then
1560 gmplibs="-lmpc $gmplibs"
1561fi
4b1cb4fe 1562gmpinc=
4b900473 1563have_gmp=no
e8a5fa9c
RW
1564
1565# Specify a location for mpc
1566# check for this first so it ends up on the link line before mpfr.
7837304f
AS
1567AC_ARG_WITH(mpc,
1568[AS_HELP_STRING([--with-mpc=PATH],
1569 [specify prefix directory for installed MPC package.
1570 Equivalent to --with-mpc-include=PATH/include
1571 plus --with-mpc-lib=PATH/lib])])
1572AC_ARG_WITH(mpc-include,
1573[AS_HELP_STRING([--with-mpc-include=PATH],
1574 [specify directory for installed MPC include files])])
1575AC_ARG_WITH(mpc-lib,
1576[AS_HELP_STRING([--with-mpc-lib=PATH],
1577 [specify directory for the installed MPC library])])
e8a5fa9c
RW
1578
1579if test "x$with_mpc" != x; then
d9b76ff9
KG
1580 gmplibs="-L$with_mpc/lib $gmplibs"
1581 gmpinc="-I$with_mpc/include $gmpinc"
e8a5fa9c
RW
1582fi
1583if test "x$with_mpc_include" != x; then
d9b76ff9 1584 gmpinc="-I$with_mpc_include $gmpinc"
e8a5fa9c
RW
1585fi
1586if test "x$with_mpc_lib" != x; then
d9b76ff9 1587 gmplibs="-L$with_mpc_lib $gmplibs"
e8a5fa9c
RW
1588fi
1589if test "x$with_mpc$with_mpc_include$with_mpc_lib" = x && test -d ${srcdir}/mpc; then
d5f2ee2e 1590 gmplibs='-L$$r/$(HOST_SUBDIR)/mpc/src/'"$lt_cv_objdir $gmplibs"
d9b76ff9 1591 gmpinc='-I$$s/mpc/src '"$gmpinc"
e8a5fa9c
RW
1592 # Do not test the mpc version. Assume that it is sufficient, since
1593 # it is in the source tree, and the library has not been built yet
1594 # but it would be included on the link line in the version check below
1595 # hence making the test fail.
d9b76ff9 1596 have_gmp=yes
e8a5fa9c 1597fi
4b900473 1598
11b04d1f
DD
1599# Specify a location for mpfr
1600# check for this first so it ends up on the link line before gmp.
7837304f
AS
1601AC_ARG_WITH(mpfr,
1602[AS_HELP_STRING([--with-mpfr=PATH],
1603 [specify prefix directory for installed MPFR package.
1604 Equivalent to --with-mpfr-include=PATH/include
1605 plus --with-mpfr-lib=PATH/lib])])
1606AC_ARG_WITH(mpfr-include,
1607[AS_HELP_STRING([--with-mpfr-include=PATH],
1608 [specify directory for installed MPFR include files])])
1609AC_ARG_WITH(mpfr-lib,
1610[AS_HELP_STRING([--with-mpfr-lib=PATH],
1611 [specify directory for the installed MPFR library])])
11b04d1f
DD
1612
1613if test "x$with_mpfr" != x; then
1614 gmplibs="-L$with_mpfr/lib $gmplibs"
d9b76ff9 1615 gmpinc="-I$with_mpfr/include $gmpinc"
11b04d1f 1616fi
8a0d8a5c 1617if test "x$with_mpfr_include" != x; then
d9b76ff9 1618 gmpinc="-I$with_mpfr_include $gmpinc"
8a0d8a5c
PB
1619fi
1620if test "x$with_mpfr_lib" != x; then
1621 gmplibs="-L$with_mpfr_lib $gmplibs"
1622fi
4b900473 1623if test "x$with_mpfr$with_mpfr_include$with_mpfr_lib" = x && test -d ${srcdir}/mpfr; then
58b1dd21 1624 # MPFR v3.1.0 moved the sources into a src sub-directory.
05a13254
NC
1625 if ! test -d ${srcdir}/mpfr/src; then
1626 AC_MSG_ERROR([dnl
1627Building GCC with MPFR in the source tree is only handled for MPFR 3.1.0+.])
58b1dd21 1628 fi
05a13254
NC
1629 gmplibs='-L$$r/$(HOST_SUBDIR)/mpfr/src/'"$lt_cv_objdir $gmplibs"
1630 gmpinc='-I$$r/$(HOST_SUBDIR)/mpfr/src -I$$s/mpfr/src '"$gmpinc"
1631 extra_mpc_mpfr_configure_flags='--with-mpfr-include=$$s/mpfr/src --with-mpfr-lib=$$r/$(HOST_SUBDIR)/mpfr/src/'"$lt_cv_objdir"
4b900473
PB
1632 # Do not test the mpfr version. Assume that it is sufficient, since
1633 # it is in the source tree, and the library has not been built yet
1634 # but it would be included on the link line in the version check below
1635 # hence making the test fail.
1636 have_gmp=yes
1637fi
11b04d1f 1638
4b1cb4fe 1639# Specify a location for gmp
7837304f
AS
1640AC_ARG_WITH(gmp,
1641[AS_HELP_STRING([--with-gmp=PATH],
1642 [specify prefix directory for the installed GMP package.
1643 Equivalent to --with-gmp-include=PATH/include
1644 plus --with-gmp-lib=PATH/lib])])
1645AC_ARG_WITH(gmp-include,
1646[AS_HELP_STRING([--with-gmp-include=PATH],
1647 [specify directory for installed GMP include files])])
1648AC_ARG_WITH(gmp-lib,
1649[AS_HELP_STRING([--with-gmp-lib=PATH],
1650 [specify directory for the installed GMP library])])
4b1cb4fe 1651
4b1cb4fe 1652
11b04d1f
DD
1653if test "x$with_gmp" != x; then
1654 gmplibs="-L$with_gmp/lib $gmplibs"
1655 gmpinc="-I$with_gmp/include $gmpinc"
4b1cb4fe 1656fi
8a0d8a5c
PB
1657if test "x$with_gmp_include" != x; then
1658 gmpinc="-I$with_gmp_include $gmpinc"
1659fi
1660if test "x$with_gmp_lib" != x; then
1661 gmplibs="-L$with_gmp_lib $gmplibs"
1662fi
4b900473 1663if test "x$with_gmp$with_gmp_include$with_gmp_lib" = x && test -d ${srcdir}/gmp; then
d5f2ee2e 1664 gmplibs='-L$$r/$(HOST_SUBDIR)/gmp/'"$lt_cv_objdir $gmplibs"
4b900473 1665 gmpinc='-I$$r/$(HOST_SUBDIR)/gmp -I$$s/gmp '"$gmpinc"
29821356 1666 extra_mpfr_configure_flags='--with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-gmp-lib=$$r/$(HOST_SUBDIR)/gmp/'"$lt_cv_objdir"
d5f2ee2e 1667 extra_mpc_gmp_configure_flags='--with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-gmp-lib=$$r/$(HOST_SUBDIR)/gmp/'"$lt_cv_objdir"
7ec59b9e 1668 extra_isl_gmp_configure_flags='--with-gmp-builddir=$$r/$(HOST_SUBDIR)/gmp'
4b900473
PB
1669 # Do not test the gmp version. Assume that it is sufficient, since
1670 # it is in the source tree, and the library has not been built yet
1671 # but it would be included on the link line in the version check below
1672 # hence making the test fail.
1673 have_gmp=yes
1674fi
4b1cb4fe 1675
99118062 1676if test "x$require_gmp" = xyes && test "x$have_gmp" = xno; then
4b900473
PB
1677 have_gmp=yes
1678 saved_CFLAGS="$CFLAGS"
1679 CFLAGS="$CFLAGS $gmpinc"
a6b5846e
KG
1680 # Check for the recommended and required versions of GMP.
1681 AC_MSG_CHECKING([for the correct version of gmp.h])
4b900473 1682 AC_TRY_COMPILE([#include "gmp.h"],[
a6b5846e
KG
1683 #define GCC_GMP_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
1684 #define GCC_GMP_VERSION GCC_GMP_VERSION_NUM(__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR,__GNU_MP_VERSION_PATCHLEVEL)
8e71395b 1685 #if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4,2,3)
9dbaa842 1686 choke me
4b900473 1687 #endif
a009f2e7 1688 ], [AC_TRY_COMPILE([#include <gmp.h>],[
a6b5846e
KG
1689 #define GCC_GMP_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
1690 #define GCC_GMP_VERSION GCC_GMP_VERSION_NUM(__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR,__GNU_MP_VERSION_PATCHLEVEL)
1691 #if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4,3,2)
1692 choke me
1693 #endif
a009f2e7 1694 ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])])],
a6b5846e 1695 [AC_MSG_RESULT([no]); have_gmp=no])
4b900473 1696
e8a5fa9c 1697 # If we have GMP, check the MPFR version.
4b900473 1698 if test x"$have_gmp" = xyes; then
a6b5846e
KG
1699 # Check for the recommended and required versions of MPFR.
1700 AC_MSG_CHECKING([for the correct version of mpfr.h])
e8a5fa9c 1701 AC_TRY_COMPILE([#include <gmp.h>
4b900473 1702 #include <mpfr.h>],[
228cf97d 1703 #if MPFR_VERSION < MPFR_VERSION_NUM(3,1,0)
4b900473
PB
1704 choke me
1705 #endif
a009f2e7 1706 ], [AC_TRY_COMPILE([#include <gmp.h>
e8a5fa9c 1707 #include <mpfr.h>],[
228cf97d 1708 #if MPFR_VERSION < MPFR_VERSION_NUM(3,1,6)
e8a5fa9c
RW
1709 choke me
1710 #endif
a009f2e7 1711 ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])])],
e8a5fa9c
RW
1712 [AC_MSG_RESULT([no]); have_gmp=no])
1713 fi
1714
1715 # Check for the MPC header version.
99118062 1716 if test "x$require_mpc" = xyes && test x"$have_gmp" = xyes ; then
a6b5846e 1717 # Check for the recommended and required versions of MPC.
e8a5fa9c
RW
1718 AC_MSG_CHECKING([for the correct version of mpc.h])
1719 AC_TRY_COMPILE([#include <mpc.h>],[
a6b5846e 1720 #if MPC_VERSION < MPC_VERSION_NUM(0,8,0)
e8a5fa9c
RW
1721 choke me
1722 #endif
a009f2e7 1723 ], [AC_TRY_COMPILE([#include <mpc.h>],[
a6b5846e
KG
1724 #if MPC_VERSION < MPC_VERSION_NUM(0,8,1)
1725 choke me
1726 #endif
a009f2e7 1727 ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])])],
a6b5846e 1728 [AC_MSG_RESULT([no]); have_gmp=no])
e8a5fa9c
RW
1729 fi
1730
1731 # Now check the MPFR library.
1732 if test x"$have_gmp" = xyes; then
1733 saved_LIBS="$LIBS"
1734 LIBS="$LIBS $gmplibs"
99118062
AP
1735 AC_MSG_CHECKING([for the correct version of the gmp/mpfr libraries])
1736 AC_TRY_LINK([#include <mpfr.h>],[
a3ca38d2
DD
1737 mpfr_t n;
1738 mpfr_t x;
4b900473 1739 int t;
a3ca38d2
DD
1740 mpfr_init (n);
1741 mpfr_init (x);
228cf97d
AM
1742 mpfr_atan2 (n, n, x, MPFR_RNDN);
1743 mpfr_erfc (n, x, MPFR_RNDN);
1744 mpfr_subnormalize (x, t, MPFR_RNDN);
d9b76ff9
KG
1745 mpfr_clear(n);
1746 mpfr_clear(x);
99118062
AP
1747 ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); have_gmp=no])
1748 LIBS="$saved_LIBS"
1749 fi
1750
1751 # Now check the MPC library
1752 if test "x$require_mpc" = xyes && test x"$have_gmp" = xyes; then
1753 saved_LIBS="$LIBS"
1754 LIBS="$LIBS $gmplibs"
1755 AC_MSG_CHECKING([for the correct version of the mpc libraries])
1756 AC_TRY_LINK([#include <mpc.h>],[
1757 mpc_t c;
d9b76ff9
KG
1758 mpc_init2 (c, 53);
1759 mpc_set_ui_ui (c, 1, 1, MPC_RNDNN);
1760 mpc_cosh (c, c, MPC_RNDNN);
1761 mpc_pow (c, c, c, MPC_RNDNN);
1762 mpc_acosh (c, c, MPC_RNDNN);
1763 mpc_clear (c);
e8a5fa9c
RW
1764 ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); have_gmp=no])
1765 LIBS="$saved_LIBS"
4b900473 1766 fi
e8a5fa9c 1767
4b900473 1768 CFLAGS="$saved_CFLAGS"
4b1cb4fe 1769
a6b5846e
KG
1770# The library versions listed in the error message below should match
1771# the HARD-minimums enforced above.
4b900473 1772 if test x$have_gmp != xyes; then
99118062
AP
1773 if test -d ${srcdir}/gcc ; then
1774 AC_MSG_ERROR([Building GCC requires GMP 4.2+, MPFR 3.1.0+ and MPC 0.8.0+.
d9b76ff9
KG
1775Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
1776their locations. Source code for these libraries can be found at
1777their respective hosting sites as well as at
228cf97d 1778https://gcc.gnu.org/pub/gcc/infrastructure/. See also
d9b76ff9
KG
1779http://gcc.gnu.org/install/prerequisites.html for additional info. If
1780you obtained GMP, MPFR and/or MPC from a vendor distribution package,
1781make sure that you have installed both the libraries and the header
1782files. They may be located in separate packages.])
99118062
AP
1783 else
1784 AC_MSG_ERROR([Building GDB requires GMP 4.2+, and MPFR 3.1.0+.
1785Try the --with-gmp and/or --with-mpfr options to specify
1786their locations. If you obtained GMP and/or MPFR from a vendor
1787distribution package, make sure that you have installed both the libraries
1788and the header files. They may be located in separate packages.])
1789 fi
4b900473 1790 fi
9dbaa842
DD
1791fi
1792
e8a5fa9c 1793# Flags needed for both GMP, MPFR and/or MPC.
4b1cb4fe
DD
1794AC_SUBST(gmplibs)
1795AC_SUBST(gmpinc)
e8a5fa9c
RW
1796AC_SUBST(extra_mpfr_configure_flags)
1797AC_SUBST(extra_mpc_gmp_configure_flags)
1798AC_SUBST(extra_mpc_mpfr_configure_flags)
7ec59b9e 1799AC_SUBST(extra_isl_gmp_configure_flags)
4b1cb4fe 1800
e8a5fa9c
RW
1801# Libraries to use for stage1 or when not bootstrapping.
1802AC_ARG_WITH(stage1-libs,
7837304f 1803[AS_HELP_STRING([--with-stage1-libs=LIBS], [libraries for stage1])],
e8a5fa9c
RW
1804[if test "$withval" = "no" -o "$withval" = "yes"; then
1805 stage1_libs=
1806 else
1807 stage1_libs=$withval
1808 fi],
68996839 1809[stage1_libs=])
e8a5fa9c
RW
1810AC_SUBST(stage1_libs)
1811
c1a5d03a
TT
1812# Whether or not to use -static-libstdc++ and -static-libgcc. The
1813# default is yes if gcc is being built; no otherwise. The reason for
1814# this default is that gdb is sometimes linked against GNU Source
1815# Highlight, which is a shared library that uses C++ exceptions. In
1816# this case, -static-libstdc++ will cause crashes.
1817AC_ARG_WITH(static-standard-libraries,
1818[AS_HELP_STRING([--with-static-standard-libraries],
1819 [use -static-libstdc++ and -static-libgcc (default=auto)])],
1820[], [with_static_standard_libraries=auto])
1821if test "$with_static_standard_libraries" = auto; then
1822 with_static_standard_libraries=$have_compiler
1823fi
1824
b3676d82
EB
1825# Linker flags to use for stage1 or when not bootstrapping.
1826AC_ARG_WITH(stage1-ldflags,
1827[AS_HELP_STRING([--with-stage1-ldflags=FLAGS], [linker flags for stage1])],
1828[if test "$withval" = "no" -o "$withval" = "yes"; then
1829 stage1_ldflags=
1830 else
1831 stage1_ldflags=$withval
1832 fi],
1833[stage1_ldflags=
1834 # In stage 1, default to linking libstdc++ and libgcc statically with GCC
1835 # if supported. But if the user explicitly specified the libraries to use,
1836 # trust that they are doing what they want.
c1a5d03a
TT
1837 if test "$with_static_standard_libraries" = yes -a "$stage1_libs" = "" \
1838 -a "$have_static_libs" = yes; then
b3676d82
EB
1839 stage1_ldflags="-static-libstdc++ -static-libgcc"
1840 fi])
1841AC_SUBST(stage1_ldflags)
1842
68996839 1843# Libraries to use for stage2 and later builds.
e8a5fa9c 1844AC_ARG_WITH(boot-libs,
7837304f 1845[AS_HELP_STRING([--with-boot-libs=LIBS], [libraries for stage2 and later])],
e8a5fa9c
RW
1846[if test "$withval" = "no" -o "$withval" = "yes"; then
1847 poststage1_libs=
1848 else
1849 poststage1_libs=$withval
1850 fi],
68996839 1851[poststage1_libs=])
e8a5fa9c
RW
1852AC_SUBST(poststage1_libs)
1853
143754cd
NC
1854# Linker flags to use for stage2 and later builds.
1855AC_ARG_WITH(boot-ldflags,
7837304f
AS
1856[AS_HELP_STRING([--with-boot-ldflags=FLAGS],
1857 [linker flags for stage2 and later])],
143754cd
NC
1858[if test "$withval" = "no" -o "$withval" = "yes"; then
1859 poststage1_ldflags=
1860 else
1861 poststage1_ldflags=$withval
1862 fi],
1863[poststage1_ldflags=
4f11b223
ILT
1864 # In stages 2 and 3, default to linking libstdc++ and libgcc
1865 # statically. But if the user explicitly specified the libraries to
1866 # use, trust that they are doing what they want.
1867 if test "$poststage1_libs" = ""; then
143754cd
NC
1868 poststage1_ldflags="-static-libstdc++ -static-libgcc"
1869 fi])
1870AC_SUBST(poststage1_ldflags)
1871
4849dfd8 1872# GCC GRAPHITE dependency isl.
1b6c0831 1873# Basic setup is inlined here, actual checks are in config/isl.m4
8e71395b 1874
8e71395b
L
1875AC_ARG_WITH(isl,
1876 [AS_HELP_STRING(
1877 [--with-isl=PATH],
4849dfd8 1878 [Specify prefix directory for the installed isl package.
8e71395b
L
1879 Equivalent to --with-isl-include=PATH/include
1880 plus --with-isl-lib=PATH/lib])])
1881
1b6c0831 1882# Treat --without-isl as a request to disable
8e71395b 1883# GRAPHITE support and skip all following checks.
1b6c0831 1884if test "x$with_isl" != "xno"; then
4849dfd8 1885 # Check for isl
8e71395b
L
1886 dnl Provide configure switches and initialize islinc & isllibs
1887 dnl with user input.
1888 ISL_INIT_FLAGS
4849dfd8 1889 dnl The versions of isl that work for Graphite
1b6c0831 1890 ISL_CHECK_VERSION()
4849dfd8 1891 dnl Only execute fail-action, if isl has been requested.
7ec59b9e 1892 ISL_IF_FAILED([
4849dfd8 1893 AC_MSG_ERROR([Unable to find a usable isl. See config.log for details.])])
e28c595f
JM
1894fi
1895
4849dfd8 1896# If the isl check failed, disable builds of in-tree variant of isl
8e71395b 1897if test "x$with_isl" = xno ||
8e71395b 1898 test "x$gcc_cv_isl" = xno; then
1b6c0831 1899 noconfigdirs="$noconfigdirs isl"
8e71395b 1900 islinc=
7ec59b9e
L
1901fi
1902
1b6c0831 1903AC_SUBST(isllibs)
8e71395b 1904AC_SUBST(islinc)
8e71395b 1905
700d40ca
ILT
1906# Check for LTO support.
1907AC_ARG_ENABLE(lto,
7837304f 1908[AS_HELP_STRING([--enable-lto], [enable link time optimization support])],
700d40ca
ILT
1909enable_lto=$enableval,
1910enable_lto=yes; default_enable_lto=yes)
1911
74cea91b
DK
1912ACX_ELF_TARGET_IFELSE([# ELF platforms build the lto-plugin always.
1913 build_lto_plugin=yes
1914],[if test x"$default_enable_lto" = x"yes" ; then
29821356 1915 case $target in
bf41f30d 1916 *-apple-darwin[[912]]* | *-cygwin* | *-mingw* | *djgpp*) ;;
74cea91b 1917 # On other non-ELF platforms, LTO has yet to be validated.
29821356
RW
1918 *) enable_lto=no ;;
1919 esac
e49e5c92 1920 else
29821356
RW
1921 # Apart from ELF platforms, only Windows and Darwin support LTO so far.
1922 # It would also be nice to check the binutils support, but we don't
e49e5c92
DK
1923 # have gcc_GAS_CHECK_FEATURE available here. For now, we'll just
1924 # warn during gcc/ subconfigure; unless you're bootstrapping with
1925 # -flto it won't be needed until after installation anyway.
1926 case $target in
52cf9762 1927 *-cygwin* | *-mingw* | *-apple-darwin* | *djgpp*) ;;
e49e5c92
DK
1928 *) if test x"$enable_lto" = x"yes"; then
1929 AC_MSG_ERROR([LTO support is not enabled for this target.])
1930 fi
1931 ;;
1932 esac
1933 fi
a8eb3f0a 1934 # Among non-ELF, only Windows platforms support the lto-plugin so far.
74cea91b 1935 # Build it unless LTO was explicitly disabled.
a8eb3f0a 1936 case $target in
74cea91b 1937 *-cygwin* | *-mingw*) build_lto_plugin=$enable_lto ;;
a8eb3f0a
DK
1938 *) ;;
1939 esac
74cea91b 1940])
700d40ca 1941
1b6c0831
L
1942AC_ARG_ENABLE(linker-plugin-configure-flags,
1943 [AS_HELP_STRING([[--enable-linker-plugin-configure-flags=FLAGS]],
1944 [additional flags for configuring linker plugins @<:@none@:>@])],
1945 extra_linker_plugin_configure_flags=$enableval,
1946 extra_linker_plugin_configure_flags=)
1947AC_SUBST(extra_linker_plugin_configure_flags)
1948AC_ARG_ENABLE(linker-plugin-flags,
1949 [AS_HELP_STRING([[--enable-linker-plugin-flags=FLAGS]],
1950 [additional flags for configuring and building linker plugins @<:@none@:>@])],
1951 extra_linker_plugin_flags=$enableval,
1952 extra_linker_plugin_flags=)
1953AC_SUBST(extra_linker_plugin_flags)
1954
ed0a861b
IS
1955# Handle --enable-host-pie
1956# If host PIE executables are the default (or must be forced on) for some host,
1957# we must pass that configuration to the gcc directory.
1958gcc_host_pie=
60b42421
MP
1959AC_ARG_ENABLE(host-pie,
1960[AS_HELP_STRING([--enable-host-pie],
1961 [build position independent host executables])],
1962[host_pie=$enableval
1963 case $host in
ed0a861b 1964 *-*-darwin2*)
60b42421 1965 if test x$host_pie != xyes ; then
ed0a861b
IS
1966 # for Darwin20+ this is required.
1967 AC_MSG_WARN([PIE executables are required for the configured host, host-pie setting ignored.])
60b42421 1968 host_pie=yes
ed0a861b 1969 gcc_host_pie=--enable-host-pie
60b42421
MP
1970 fi ;;
1971 *) ;;
1972 esac],
1973[case $host in
ed0a861b
IS
1974 *-*-darwin2*)
1975 # Default to PIE (mandatory for aarch64).
1976 host_pie=yes
1977 gcc_host_pie=--enable-host-pie
1978 ;;
60b42421
MP
1979 *) host_pie=no ;;
1980 esac])
1981
1982AC_SUBST(host_pie)
ed0a861b 1983AC_SUBST(gcc_host_pie)
60b42421 1984
bf41f30d
NC
1985# Enable --enable-host-shared.
1986# Checked early to determine whether jit is an 'all' language
1987AC_ARG_ENABLE(host-shared,
1988[AS_HELP_STRING([--enable-host-shared],
1989 [build host code as shared libraries])],
228cf97d
AM
1990[host_shared=$enableval
1991 case $host in
1992 x86_64-*-darwin* | aarch64-*-darwin*)
1993 if test x$host_shared != xyes ; then
1994 # PIC is the default, and actually cannot be switched off.
ed0a861b 1995 AC_MSG_WARN([PIC code is required for the configured host; host-shared setting ignored.])
228cf97d
AM
1996 host_shared=yes
1997 fi ;;
60b42421 1998 *-*-darwin*)
ed0a861b
IS
1999 if test x$host_pie = xyes -a x$host_shared != xyes ; then
2000 AC_MSG_WARN([PIC code is required for PIE host executables host-shared setting ignored.])
60b42421
MP
2001 host_shared=yes
2002 fi ;;
228cf97d
AM
2003 *) ;;
2004 esac],
2005[case $host in
ed0a861b 2006 # 64B x86_64 and Aarch64 Darwin default to PIC.
228cf97d 2007 x86_64-*-darwin* | aarch64-*-darwin*) host_shared=yes ;;
ed0a861b
IS
2008 # 32B and powerpc64 Darwin must use PIC to link PIE exes.
2009 *-*-darwin*) host_shared=$host_pie ;;
60b42421 2010 *) host_shared=no;;
228cf97d 2011 esac])
947edb09 2012
bf41f30d 2013AC_SUBST(host_shared)
e28c595f 2014
60b42421 2015if test x$host_shared = xyes; then
ed0a861b
IS
2016 case $host in
2017 *-*-darwin*)
2018 # Since host shared is the default for 64b Darwin, and also enabled for
2019 # host_pie, ensure that we present the PIE flag when host_pie is active.
2020 if test x$host_pie = xyes; then
2021 PICFLAG=-fPIE
2022 fi
2023 ;;
2024 *)
2025 PICFLAG=-fPIC
2026 ;;
2027 esac
60b42421
MP
2028elif test x$host_pie = xyes; then
2029 PICFLAG=-fPIE
2030else
2031 PICFLAG=
2032fi
2033
2034AC_SUBST(PICFLAG)
2035
947edb09
IS
2036# If we are building PIC/PIE host executables, and we are building dependent
2037# libs (e.g. GMP) in-tree those libs need to be configured to generate PIC
2038# code.
2039host_libs_picflag=
60b42421 2040if test "$host_shared" = "yes" -o "$host_pie" = "yes"; then
947edb09
IS
2041host_libs_picflag='--with-pic'
2042fi
2043AC_SUBST(host_libs_picflag)
2044
7ec59b9e 2045# By default, C and C++ are the only stage 1 languages.
9b134994 2046stage1_languages=,c,
1d39f329 2047
e8a5fa9c 2048# Target libraries that we bootstrap.
2aa2364a 2049bootstrap_target_libs=,target-libgcc,
e8a5fa9c 2050
9e07f89d
NN
2051# Figure out what language subdirectories are present.
2052# Look if the user specified --enable-languages="..."; if not, use
2053# the environment variable $LANGUAGES if defined. $LANGUAGES might
2054# go away some day.
2055# NB: embedded tabs in this IF block -- do not untabify
2056if test -d ${srcdir}/gcc; then
2057 if test x"${enable_languages+set}" != xset; then
2058 if test x"${LANGUAGES+set}" = xset; then
2059 enable_languages="${LANGUAGES}"
136bb21f 2060 echo configure.ac: warning: setting LANGUAGES is deprecated, use --enable-languages instead 1>&2
9e07f89d 2061 else
bf41f30d 2062 enable_languages=default
9e07f89d
NN
2063 fi
2064 else
2065 if test x"${enable_languages}" = x ||
2066 test x"${enable_languages}" = xyes;
2067 then
136bb21f 2068 echo configure.ac: --enable-languages needs at least one language argument 1>&2
9e07f89d
NN
2069 exit 1
2070 fi
2071 fi
2072 enable_languages=`echo "${enable_languages}" | sed -e 's/[[ ,]][[ ,]]*/,/g' -e 's/,$//'`
2073
096f7d00
DE
2074 # 'f95' is the old name for the 'fortran' language. We issue a warning
2075 # and make the substitution.
2076 case ,${enable_languages}, in
2077 *,f95,*)
136bb21f 2078 echo configure.ac: warning: 'f95' as language name is deprecated, use 'fortran' instead 1>&2
096f7d00
DE
2079 enable_languages=`echo "${enable_languages}" | sed -e 's/f95/fortran/g'`
2080 ;;
2081 esac
2082
7ec59b9e
L
2083 # If bootstrapping, C++ must be enabled.
2084 case ",$enable_languages,:$enable_bootstrap" in
2085 *,c++,*:*) ;;
2086 *:yes)
ffdd6afc
ILT
2087 if test -f ${srcdir}/gcc/cp/config-lang.in; then
2088 enable_languages="${enable_languages},c++"
2089 else
7ec59b9e 2090 AC_MSG_ERROR([bootstrapping requires c++ sources])
ffdd6afc
ILT
2091 fi
2092 ;;
2093 esac
2094
9e07f89d
NN
2095 # First scan to see if an enabled language requires some other language.
2096 # We assume that a given config-lang.in will list all the language
2097 # front ends it requires, even if some are required indirectly.
2098 for lang_frag in ${srcdir}/gcc/*/config-lang.in .. ; do
2099 case ${lang_frag} in
2100 ..) ;;
2101 # The odd quoting in the next line works around
2102 # an apparent bug in bash 1.12 on linux.
2103 ${srcdir}/gcc/[[*]]/config-lang.in) ;;
2104 *)
e552509b
ILT
2105 # From the config-lang.in, get $language, $lang_requires, and
2106 # $lang_requires_boot_languages.
9e07f89d
NN
2107 language=
2108 lang_requires=
e552509b 2109 lang_requires_boot_languages=
bf41f30d
NC
2110 # set srcdir during sourcing lang_frag to the gcc dir.
2111 # Sadly overriding srcdir on the . line doesn't work in plain sh as it
2112 # polutes this shell
2113 saved_srcdir=${srcdir}
2114 srcdir=${srcdir}/gcc . ${lang_frag}
2115 srcdir=${saved_srcdir}
e552509b 2116 for other in ${lang_requires} ${lang_requires_boot_languages}; do
9e07f89d
NN
2117 case ,${enable_languages}, in
2118 *,$other,*) ;;
bf41f30d 2119 *,default,*) ;;
9e07f89d
NN
2120 *,all,*) ;;
2121 *,$language,*)
2122 echo " \`$other' language required by \`$language'; enabling" 1>&2
2123 enable_languages="${enable_languages},${other}"
2124 ;;
2125 esac
2126 done
e552509b
ILT
2127 for other in ${lang_requires_boot_languages} ; do
2128 if test "$other" != "c"; then
2129 case ,${enable_stage1_languages}, in
2130 *,$other,*) ;;
bf41f30d 2131 *,default,*) ;;
e552509b
ILT
2132 *,all,*) ;;
2133 *)
2134 case ,${enable_languages}, in
2135 *,$language,*)
2136 echo " '$other' language required by '$language' in stage 1; enabling" 1>&2
2137 enable_stage1_languages="$enable_stage1_languages,${other}"
2138 ;;
2139 esac
2140 ;;
2141 esac
2142 fi
2143 done
9e07f89d
NN
2144 ;;
2145 esac
2146 done
2147
9b134994 2148 new_enable_languages=,c,
700d40ca
ILT
2149
2150 # If LTO is enabled, add the LTO front end.
700d40ca 2151 if test "$enable_lto" = "yes" ; then
6811fb56
RW
2152 case ,${enable_languages}, in
2153 *,lto,*) ;;
2154 *) enable_languages="${enable_languages},lto" ;;
2155 esac
a8eb3f0a 2156 if test "${build_lto_plugin}" = "yes" ; then
700d40ca 2157 configdirs="$configdirs lto-plugin"
700d40ca
ILT
2158 fi
2159 fi
1b6c0831
L
2160
2161 # If we're building an offloading compiler, add the LTO front end.
2162 if test x"$enable_as_accelerator_for" != x ; then
2163 case ,${enable_languages}, in
2164 *,lto,*) ;;
2165 *) enable_languages="${enable_languages},lto" ;;
2166 esac
2167 fi
700d40ca 2168
bf41f30d 2169 missing_languages=`echo ",$enable_languages," | sed -e s/,default,/,/ -e s/,all,/,/ -e s/,c,/,/ `
9b134994 2170 potential_languages=,c,
9e07f89d 2171
9e1a94f4
ILT
2172 enabled_target_libs=
2173 disabled_target_libs=
2174
9e07f89d
NN
2175 for lang_frag in ${srcdir}/gcc/*/config-lang.in .. ; do
2176 case ${lang_frag} in
2177 ..) ;;
2178 # The odd quoting in the next line works around
2179 # an apparent bug in bash 1.12 on linux.
2180 ${srcdir}/gcc/[[*]]/config-lang.in) ;;
2181 *)
7ec59b9e 2182 # From the config-lang.in, get $language, $target_libs,
1d39f329 2183 # $lang_dirs, $boot_language, and $build_by_default
9e07f89d
NN
2184 language=
2185 target_libs=
2186 lang_dirs=
64ce424c 2187 subdir_requires=
9b134994
PB
2188 boot_language=no
2189 build_by_default=yes
bf41f30d
NC
2190 # set srcdir during sourcing. See above about save & restore
2191 saved_srcdir=${srcdir}
2192 srcdir=${srcdir}/gcc . ${lang_frag}
2193 srcdir=${saved_srcdir}
9b134994
PB
2194 if test x${language} = x; then
2195 echo "${lang_frag} doesn't set \$language." 1>&2
2196 exit 1
2197 fi
2198
ffdd6afc 2199 if test "$language" = "c++"; then
7ec59b9e 2200 boot_language=yes
e8a5fa9c
RW
2201 fi
2202
8e71395b 2203 add_this_lang=no
bf41f30d
NC
2204 # C is always enabled, so no need to add it again
2205 if test "$language" != "c"; then
2206 case ,${enable_languages}, in
2207 *,${language},*)
2208 # Language was explicitly selected; include it
7ec59b9e 2209 add_this_lang=yes
bf41f30d
NC
2210 ;;
2211 *,all,*)
2212 # All languages are enabled
2213 add_this_lang=all
2214 ;;
2215 *,default,*)
2216 # 'default' was selected, select it if it is a default language
8e71395b 2217 add_this_lang=${build_by_default}
bf41f30d
NC
2218 ;;
2219 esac
2220 fi
4b1cb4fe 2221
64ce424c 2222 # Disable languages that need other directories if these aren't available.
1f3f1bbf 2223 for i in $subdir_requires; do
3d3adb43 2224 test -f "$srcdir/gcc/$i/config-lang.in" && continue
bf41f30d
NC
2225 case ${add_this_lang} in
2226 yes)
64ce424c
PB
2227 # Specifically requested language; tell them.
2228 AC_MSG_ERROR([The gcc/$i directory contains parts of $language but is missing])
2229 ;;
bf41f30d
NC
2230 all)
2231 AC_MSG_WARN([The gcc/$i directory contains parts of $language but is missing])
2232 add_this_lang=unsupported
2233 ;;
64ce424c
PB
2234 *)
2235 # Silently disable.
9b134994 2236 add_this_lang=unsupported
64ce424c
PB
2237 ;;
2238 esac
2239 done
2240
9b134994 2241 # Disable Ada if no preexisting GNAT is available.
bf41f30d
NC
2242 case ${add_this_lang}:${language}:${have_gnat} in
2243 yes:ada:no)
9b134994
PB
2244 # Specifically requested language; tell them.
2245 AC_MSG_ERROR([GNAT is required to build $language])
2246 ;;
bf41f30d
NC
2247 all:ada:no)
2248 AC_MSG_WARN([GNAT is required to build $language])
2249 add_this_lang=unsupported
2250 ;;
9b134994
PB
2251 *:ada:no)
2252 # Silently disable.
2253 add_this_lang=unsupported
2254 ;;
2255 esac
2256
228cf97d
AM
2257 # Disable D if no preexisting GDC is available.
2258 case ${add_this_lang}:${language}:${have_gdc} in
2259 yes:d:no)
2260 # Specifically requested language; tell them.
2261 AC_MSG_ERROR([GDC is required to build $language])
2262 ;;
2263 all:d:no)
2264 AC_MSG_WARN([GDC is required to build $language])
2265 add_this_lang=unsupported
2266 ;;
2267 *:d:no)
2268 # Silently disable.
2269 add_this_lang=unsupported
2270 ;;
2271 esac
2272
bf41f30d 2273 # Disable jit if -enable-host-shared not specified
228cf97d
AM
2274 # but not if building for Mingw. All code in Windows
2275 # is position independent code (PIC).
2276 case $target in
2277 *mingw*) ;;
2278 *)
2279 case ${add_this_lang}:${language}:${host_shared} in
2280 yes:jit:no)
2281 # PR jit/64780: explicitly specify --enable-host-shared
bf41f30d
NC
2282 AC_MSG_ERROR([
2283Enabling language "jit" requires --enable-host-shared.
2284
2285--enable-host-shared typically slows the rest of the compiler down by
2286a few %, so you must explicitly enable it.
2287
2288If you want to build both the jit and the regular compiler, it is often
2289best to do this via two separate configure/builds, in separate
2290directories, to avoid imposing the performance cost of
2291--enable-host-shared on the regular compiler.])
228cf97d
AM
2292 ;;
2293 all:jit:no)
2294 AC_MSG_WARN([--enable-host-shared required to build $language])
2295 add_this_lang=unsupported
2296 ;;
2297 *:jit:no)
2298 # Silently disable.
2299 add_this_lang=unsupported
2300 ;;
2301 esac
2302 ;;
2303 esac
bf41f30d
NC
2304
2305 # Disable a language that is unsupported by the target.
2306 case "${add_this_lang}: $unsupported_languages " in
2307 no:*) ;;
2308 unsupported:*) ;;
2309 *:*" $language "*)
2310 AC_MSG_WARN([${language} not supported for this target])
9b134994 2311 add_this_lang=unsupported
59f7ec45
HPN
2312 ;;
2313 esac
2314
4b1cb4fe 2315 case $add_this_lang in
9b134994 2316 unsupported)
9e07f89d 2317 # Remove language-dependent dirs.
9e1a94f4
ILT
2318 disabled_target_libs="$disabled_target_libs $target_libs"
2319 noconfigdirs="$noconfigdirs $lang_dirs"
1d39f329 2320 ;;
9b134994
PB
2321 no)
2322 # Remove language-dependent dirs; still show language as supported.
9e1a94f4
ILT
2323 disabled_target_libs="$disabled_target_libs $target_libs"
2324 noconfigdirs="$noconfigdirs $lang_dirs"
9b134994
PB
2325 potential_languages="${potential_languages}${language},"
2326 ;;
bf41f30d 2327 all|yes)
9b134994
PB
2328 new_enable_languages="${new_enable_languages}${language},"
2329 potential_languages="${potential_languages}${language},"
1d39f329 2330 missing_languages=`echo "$missing_languages" | sed "s/,$language,/,/"`
9e1a94f4 2331 enabled_target_libs="$enabled_target_libs $target_libs"
f8dc745f
RW
2332 case "${boot_language}:,$enable_stage1_languages," in
2333 yes:* | *:*,$language,* | *:*,yes, | *:*,all,)
4fa63067 2334 # Add to (comma-separated) list of stage 1 languages.
f8dc745f
RW
2335 case ",$stage1_languages," in
2336 *,$language,* | ,yes, | ,all,) ;;
2337 *) stage1_languages="${stage1_languages}${language}," ;;
2338 esac
e8a5fa9c 2339 # We need to bootstrap any supporting libraries.
228cf97d 2340 bootstrap_target_libs=`echo "${bootstrap_target_libs}${target_libs}," | sed "s/ /,/g"`
1d39f329
NN
2341 ;;
2342 esac
2343 ;;
9e07f89d
NN
2344 esac
2345 ;;
2346 esac
2347 done
2348
9e1a94f4
ILT
2349 # Add target libraries which are only needed for disabled languages
2350 # to noconfigdirs.
2351 if test -n "$disabled_target_libs"; then
2352 for dir in $disabled_target_libs; do
2353 case " $enabled_target_libs " in
2354 *" ${dir} "*) ;;
2355 *) noconfigdirs="$noconfigdirs $dir" ;;
2356 esac
2357 done
2358 fi
2359
9b134994 2360 AC_ARG_ENABLE(stage1-languages,
7837304f
AS
2361 [AS_HELP_STRING([[--enable-stage1-languages[=all]]],
2362 [choose additional languages to build during
2363 stage1. Mostly useful for compiler development])],
9b134994
PB
2364 [case ,${enable_stage1_languages}, in
2365 ,no,|,,)
2366 # Set it to something that will have no effect in the loop below
2367 enable_stage1_languages=c ;;
2368 ,yes,)
2369 enable_stage1_languages=`echo $new_enable_languages | \
2370 sed -e "s/^,//" -e "s/,$//" ` ;;
2371 *,all,*)
2372 enable_stage1_languages=`echo ,$enable_stage1_languages, | \
2373 sed -e "s/,all,/$new_enable_languages/" -e "s/^,//" -e "s/,$//" ` ;;
2374 esac
2375
2376 # Add "good" languages from enable_stage1_languages to stage1_languages,
2377 # while "bad" languages go in missing_languages. Leave no duplicates.
2378 for i in `echo $enable_stage1_languages | sed 's/,/ /g' `; do
2379 case $potential_languages in
2380 *,$i,*)
2381 case $stage1_languages in
2382 *,$i,*) ;;
2383 *) stage1_languages="$stage1_languages$i," ;;
2384 esac ;;
2385 *)
2386 case $missing_languages in
2387 *,$i,*) ;;
2388 *) missing_languages="$missing_languages$i," ;;
2389 esac ;;
2390 esac
2391 done])
2392
2393 # Remove leading/trailing commas that were added for simplicity
2394 potential_languages=`echo "$potential_languages" | sed -e "s/^,//" -e "s/,$//"`
4b0ac75d 2395 missing_languages=`echo "$missing_languages" | sed -e "s/^,//" -e "s/,$//"`
9b134994
PB
2396 stage1_languages=`echo "$stage1_languages" | sed -e "s/^,//" -e "s/,$//"`
2397 new_enable_languages=`echo "$new_enable_languages" | sed -e "s/^,//" -e "s/,$//"`
2398
9e07f89d
NN
2399 if test "x$missing_languages" != x; then
2400 AC_MSG_ERROR([
27258dd4 2401The following requested languages could not be built: ${missing_languages}
9b134994 2402Supported languages are: ${potential_languages}])
9e07f89d 2403 fi
9e07f89d
NN
2404 if test "x$new_enable_languages" != "x$enable_languages"; then
2405 echo The following languages will be built: ${new_enable_languages}
9b134994 2406 enable_languages="$new_enable_languages"
9e07f89d 2407 fi
9b134994
PB
2408
2409 AC_SUBST(stage1_languages)
81ec575a 2410 ac_configure_args=`echo " $ac_configure_args" | sed -e "s/ '--enable-languages=[[^ ]]*'//g" -e "s/$/ '--enable-languages="$enable_languages"'/" `
9e07f89d
NN
2411fi
2412
a6df5a19
PB
2413# Handle --disable-<component> generically.
2414for dir in $configdirs $build_configdirs $target_configdirs ; do
2415 dirname=`echo $dir | sed -e s/target-//g -e s/build-//g -e s/-/_/g`
9cc8ae67
PB
2416 varname=`echo $dirname | sed -e s/+/_/g`
2417 if eval test x\${enable_${varname}} "=" xno ; then
a6df5a19
PB
2418 noconfigdirs="$noconfigdirs $dir"
2419 fi
2420done
2421
4f0ef2d8
CD
2422# Check for Boehm's garbage collector
2423AC_ARG_ENABLE(objc-gc,
7837304f
AS
2424[AS_HELP_STRING([--enable-objc-gc],
2425 [enable use of Boehm's garbage collector with the
05a13254
NC
2426 GNU Objective-C runtime])])
2427AC_ARG_WITH([target-bdw-gc],
2428[AS_HELP_STRING([--with-target-bdw-gc=PATHLIST],
2429 [specify prefix directory for installed bdw-gc package.
2430 Equivalent to --with-target-bdw-gc-include=PATH/include
2431 plus --with-target-bdw-gc-lib=PATH/lib])])
2432AC_ARG_WITH([target-bdw-gc-include],
2433[AS_HELP_STRING([--with-target-bdw-gc-include=PATHLIST],
2434 [specify directories for installed bdw-gc include files])])
2435AC_ARG_WITH([target-bdw-gc-lib],
2436[AS_HELP_STRING([--with-target-bdw-gc-lib=PATHLIST],
2437 [specify directories for installed bdw-gc library])])
2438
2439case ,${enable_languages},:${enable_objc_gc} in *,objc,*:yes|*,objc,*:auto)
2440 AC_MSG_CHECKING([for bdw garbage collector])
2441 if test "x$with_target_bdw_gc$with_target_bdw_gc_include$with_target_bdw_gc_lib" = x; then
2442 dnl no bdw-gw options, assume default locations
2443 AC_MSG_RESULT([using bdw-gc in default locations])
2444 else
2445 dnl bdw-gw options, first error checking, complete checking in libobjc
2446 if test "x$with_target_bdw_gc_include" = x && test "x$with_target_bdw_gc_lib" != x; then
2447 AC_MSG_ERROR([found --with-target-bdw-gc-lib but --with-target-bdw-gc-include missing])
2448 elif test "x$with_target_bdw_gc_include" != x && test "x$with_target_bdw_gc_lib" = x; then
2449 AC_MSG_ERROR([found --with-target-bdw-gc-include but --with-target-bdw-gc-lib missing])
2450 else
2451 AC_MSG_RESULT([using paths configured with --with-target-bdw-gc options])
d42c4017 2452 fi
05a13254 2453 fi
4f0ef2d8
CD
2454esac
2455
ddb5be24 2456# Disable libitm, libsanitizer, libvtv if we're not building C++
7ec59b9e 2457case ,${enable_languages}, in
1b6c0831 2458 *,c++,*)
bf41f30d 2459 # Disable libitm, libsanitizer if we're not building libstdc++
1b6c0831
L
2460 case "${noconfigdirs}" in
2461 *target-libstdc++-v3*)
bf41f30d 2462 noconfigdirs="$noconfigdirs target-libitm target-libsanitizer"
1b6c0831
L
2463 ;;
2464 *) ;;
2465 esac
2466 ;;
7ec59b9e 2467 *)
ddb5be24 2468 noconfigdirs="$noconfigdirs target-libitm target-libsanitizer target-libvtv"
7ec59b9e
L
2469 ;;
2470esac
2471
d33228c9
AB
2472# If gcc/ is not in the source tree then we'll not be building a
2473# target compiler, assume in that case we don't want to build any
2474# target libraries or tools.
2475#
2476# This was added primarily for the benefit for binutils-gdb who reuse
2477# this configure script, but don't always have target tools available.
2478if test ! -d ${srcdir}/gcc; then
2479 skipdirs="${skipdirs} ${target_configdirs}"
2480fi
2481
caeba88f
AL
2482# Remove the entries in $skipdirs and $noconfigdirs from $configdirs,
2483# $build_configdirs and $target_configdirs.
9e07f89d
NN
2484# If we have the source for $noconfigdirs entries, add them to $notsupp.
2485
2486notsupp=""
2487for dir in . $skipdirs $noconfigdirs ; do
caeba88f 2488 dirname=`echo $dir | sed -e s/target-//g -e s/build-//g`
9e07f89d
NN
2489 if test $dir != . && echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
2490 configdirs=`echo " ${configdirs} " | sed -e "s/ ${dir} / /"`
2491 if test -r $srcdir/$dirname/configure ; then
2492 if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
2493 true
2494 else
2495 notsupp="$notsupp $dir"
2496 fi
2497 fi
2498 fi
caeba88f
AL
2499 if test $dir != . && echo " ${build_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
2500 build_configdirs=`echo " ${build_configdirs} " | sed -e "s/ ${dir} / /"`
2501 if test -r $srcdir/$dirname/configure ; then
2502 if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
2503 true
2504 else
2505 notsupp="$notsupp $dir"
2506 fi
2507 fi
2508 fi
9e07f89d
NN
2509 if test $dir != . && echo " ${target_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
2510 target_configdirs=`echo " ${target_configdirs} " | sed -e "s/ ${dir} / /"`
2511 if test -r $srcdir/$dirname/configure ; then
2512 if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
2513 true
2514 else
2515 notsupp="$notsupp $dir"
2516 fi
2517 fi
2518 fi
2519done
2520
9e07f89d
NN
2521# Quietly strip out all directories which aren't configurable in this tree.
2522# This relies on all configurable subdirectories being autoconfiscated, which
2523# is now the case.
6a9cf61e
PB
2524build_configdirs_all="$build_configdirs"
2525build_configdirs=
2526for i in ${build_configdirs_all} ; do
7ec59b9e 2527 j=`echo $i | sed -e s/build-//g`
6a9cf61e
PB
2528 if test -f ${srcdir}/$j/configure ; then
2529 build_configdirs="${build_configdirs} $i"
2530 fi
2531done
2532
9e07f89d
NN
2533configdirs_all="$configdirs"
2534configdirs=
2535for i in ${configdirs_all} ; do
2536 if test -f ${srcdir}/$i/configure ; then
2537 configdirs="${configdirs} $i"
2538 fi
2539done
6a9cf61e 2540
9e07f89d
NN
2541target_configdirs_all="$target_configdirs"
2542target_configdirs=
2543for i in ${target_configdirs_all} ; do
7ec59b9e 2544 j=`echo $i | sed -e s/target-//g`
9e07f89d
NN
2545 if test -f ${srcdir}/$j/configure ; then
2546 target_configdirs="${target_configdirs} $i"
2547 fi
2548done
2549
1b6c0831
L
2550# libiberty-linker-plugin is special: it doesn't have its own source directory,
2551# so we have to add it after the preceding checks.
2552if test x"$extra_linker_plugin_flags$extra_linker_plugin_configure_flags" != x
2553then
2554 case " $configdirs " in
2555 *" libiberty "*)
2556 # If we can build libiberty, we can also build libiberty-linker-plugin.
2557 configdirs="$configdirs libiberty-linker-plugin"
2558 extra_linker_plugin_configure_flags="$extra_linker_plugin_configure_flags \
2559 --with-libiberty=../libiberty-linker-plugin";;
2560 *)
2561 AC_MSG_ERROR([libiberty missing]);;
2562 esac
2563fi
2564
2565# Sometimes we have special requirements for the host libiberty.
2566extra_host_libiberty_configure_flags=
2567case " $configdirs " in
a08bdb15 2568 *" lto-plugin "* | *" libcc1 "* | *" gdbserver "*)
1b6c0831
L
2569 # When these are to be built as shared libraries, the same applies to
2570 # libiberty.
2571 extra_host_libiberty_configure_flags=--enable-shared
2572 ;;
95127faf
TV
2573esac
2574AC_SUBST(extra_host_libiberty_configure_flags)
2575
2576# Sometimes we have special requirements for the host zlib.
2577extra_host_zlib_configure_flags=
2578case " $configdirs " in
e81d5d05
L
2579 *" bfd "*)
2580 # When bfd is to be built as a shared library, the same applies to
2581 # zlib.
2582 if test "$enable_shared" = "yes"; then
2583 extra_host_zlib_configure_flags=--enable-host-shared
2584 fi
2585 ;;
1b6c0831 2586esac
e81d5d05 2587AC_SUBST(extra_host_zlib_configure_flags)
1b6c0831 2588
9e07f89d
NN
2589# Produce a warning message for the subdirs we can't configure.
2590# This isn't especially interesting in the Cygnus tree, but in the individual
2591# FSF releases, it's important to let people know when their machine isn't
2592# supported by the one or two programs in a package.
2593
2594if test -n "${notsupp}" && test -z "${norecursion}" ; then
2595 # If $appdirs is non-empty, at least one of those directories must still
2596 # be configured, or we error out. (E.g., if the gas release supports a
2597 # specified target in some subdirs but not the gas subdir, we shouldn't
2598 # pretend that all is well.)
2599 if test -n "$appdirs" ; then
2600 for dir in $appdirs ; do
2601 if test -r $dir/Makefile.in ; then
2602 if echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
2603 appdirs=""
2604 break
2605 fi
6a9cf61e 2606 if echo " ${target_configdirs} " | grep " target-${dir} " >/dev/null 2>&1; then
9e07f89d
NN
2607 appdirs=""
2608 break
2609 fi
2610 fi
2611 done
2612 if test -n "$appdirs" ; then
2613 echo "*** This configuration is not supported by this package." 1>&2
2614 exit 1
2615 fi
2616 fi
2617 # Okay, some application will build, or we don't care to check. Still
2618 # notify of subdirs not getting built.
2619 echo "*** This configuration is not supported in the following subdirectories:" 1>&2
2620 echo " ${notsupp}" 1>&2
2621 echo " (Any other directories should still work fine.)" 1>&2
2622fi
2623
2624case "$host" in
2625 *msdosdjgpp*)
2626 enable_gdbtk=no ;;
2627esac
2628
24ff9987
DJ
2629# To find our prefix, in gcc_cv_tool_prefix.
2630ACX_TOOL_DIRS
2631
9e07f89d
NN
2632copy_dirs=
2633
7ec59b9e 2634AC_ARG_WITH([build-sysroot],
7837304f
AS
2635 [AS_HELP_STRING([--with-build-sysroot=SYSROOT],
2636 [use sysroot as the system root during the build])],
a19b6204
MM
2637 [if test x"$withval" != x ; then
2638 SYSROOT_CFLAGS_FOR_TARGET="--sysroot=$withval"
2639 fi],
2640 [SYSROOT_CFLAGS_FOR_TARGET=])
2641AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET)
2642
8a6ee3ab 2643AC_ARG_WITH([debug-prefix-map],
7837304f
AS
2644 [AS_HELP_STRING([--with-debug-prefix-map='A=B C=D ...'],
2645 [map A to B, C to D ... in debug information])],
8a6ee3ab
JM
2646 [if test x"$withval" != x; then
2647 DEBUG_PREFIX_CFLAGS_FOR_TARGET=
2648 for debug_map in $withval; do
2649 DEBUG_PREFIX_CFLAGS_FOR_TARGET="$DEBUG_PREFIX_CFLAGS_FOR_TARGET -fdebug-prefix-map=$debug_map"
2650 done
2651 fi],
2652 [DEBUG_PREFIX_CFLAGS_FOR_TARGET=])
2653AC_SUBST(DEBUG_PREFIX_CFLAGS_FOR_TARGET)
2654
7f6ef0c0
PB
2655# During gcc bootstrap, if we use some random cc for stage1 then CFLAGS
2656# might be empty or "-g". We don't require a C++ compiler, so CXXFLAGS
2657# might also be empty (or "-g", if a non-GCC C++ compiler is in the path).
2658# We want to ensure that TARGET libraries (which we know are built with
2659# gcc) are built with "-O2 -g", so include those options when setting
2660# CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET.
2661if test "x$CFLAGS_FOR_TARGET" = x; then
1b6c0831
L
2662 if test "x${is_cross_compiler}" = xyes; then
2663 CFLAGS_FOR_TARGET="-g -O2"
2664 else
2665 CFLAGS_FOR_TARGET=$CFLAGS
2666 case " $CFLAGS " in
2667 *" -O2 "*) ;;
2668 *) CFLAGS_FOR_TARGET="-O2 $CFLAGS_FOR_TARGET" ;;
2669 esac
2670 case " $CFLAGS " in
2671 *" -g "* | *" -g3 "*) ;;
2672 *) CFLAGS_FOR_TARGET="-g $CFLAGS_FOR_TARGET" ;;
2673 esac
2674 fi
7f6ef0c0
PB
2675fi
2676AC_SUBST(CFLAGS_FOR_TARGET)
2677
2678if test "x$CXXFLAGS_FOR_TARGET" = x; then
1b6c0831
L
2679 if test "x${is_cross_compiler}" = xyes; then
2680 CXXFLAGS_FOR_TARGET="-g -O2"
2681 else
2682 CXXFLAGS_FOR_TARGET=$CXXFLAGS
2683 case " $CXXFLAGS " in
2684 *" -O2 "*) ;;
2685 *) CXXFLAGS_FOR_TARGET="-O2 $CXXFLAGS_FOR_TARGET" ;;
2686 esac
2687 case " $CXXFLAGS " in
2688 *" -g "* | *" -g3 "*) ;;
2689 *) CXXFLAGS_FOR_TARGET="-g $CXXFLAGS_FOR_TARGET" ;;
2690 esac
2691 fi
7f6ef0c0
PB
2692fi
2693AC_SUBST(CXXFLAGS_FOR_TARGET)
2694
91c1f14c
DK
2695AC_SUBST(LDFLAGS_FOR_TARGET)
2696
9e07f89d
NN
2697# Handle --with-headers=XXX. If the value is not "yes", the contents of
2698# the named directory are copied to $(tooldir)/sys-include.
2699if test x"${with_headers}" != x && test x"${with_headers}" != xno ; then
2700 if test x${is_cross_compiler} = xno ; then
2701 echo 1>&2 '***' --with-headers is only supported when cross compiling
2702 exit 1
2703 fi
2704 if test x"${with_headers}" != xyes ; then
24ff9987 2705 x=${gcc_cv_tool_prefix}
c6b750e1 2706 copy_dirs="${copy_dirs} ${with_headers} $x/${target_noncanonical}/sys-include"
9e07f89d
NN
2707 fi
2708fi
2709
2710# Handle --with-libs=XXX. If the value is not "yes", the contents of
2711# the name directories are copied to $(tooldir)/lib. Multiple directories
2712# are permitted.
2713if test x"${with_libs}" != x && test x"${with_libs}" != xno ; then
2714 if test x${is_cross_compiler} = xno ; then
2715 echo 1>&2 '***' --with-libs is only supported when cross compiling
2716 exit 1
2717 fi
2718 if test x"${with_libs}" != xyes ; then
2719 # Copy the libraries in reverse order, so that files in the first named
2720 # library override files in subsequent libraries.
24ff9987 2721 x=${gcc_cv_tool_prefix}
9e07f89d 2722 for l in ${with_libs}; do
c6b750e1 2723 copy_dirs="$l $x/${target_noncanonical}/lib ${copy_dirs}"
9e07f89d
NN
2724 done
2725 fi
2726fi
2727
700d40ca 2728# Set with_gnu_as, with_gnu_ld, and with_system_zlib as appropriate.
2429c060
PB
2729#
2730# This is done by determining whether or not the appropriate directory
2731# is available, and by checking whether or not specific configurations
2732# have requested that this magic not happen.
7ec59b9e
L
2733#
2734# The command line options always override the explicit settings in
136bb21f 2735# configure.ac, and the settings in configure.ac override this magic.
2429c060 2736#
7ec59b9e 2737# If the default for a toolchain is to use GNU as and ld, and you don't
2429c060 2738# want to do that, then you should use the --without-gnu-as and
700d40ca
ILT
2739# --without-gnu-ld options for the configure script. Similarly, if
2740# the default is to use the included zlib and you don't want to do that,
2741# you should use the --with-system-zlib option for the configure script.
2429c060
PB
2742
2743if test x${use_gnu_as} = x &&
2744 echo " ${configdirs} " | grep " gas " > /dev/null 2>&1 ; then
2745 with_gnu_as=yes
2746 extra_host_args="$extra_host_args --with-gnu-as"
2747fi
2748
2749if test x${use_gnu_ld} = x &&
93f9b408 2750 echo " ${configdirs} " | egrep " (go)?ld " > /dev/null 2>&1 ; then
2429c060
PB
2751 with_gnu_ld=yes
2752 extra_host_args="$extra_host_args --with-gnu-ld"
2753fi
2754
700d40ca
ILT
2755if test x${use_included_zlib} = x &&
2756 echo " ${configdirs} " | grep " zlib " > /dev/null 2>&1 ; then
2757 :
2758else
2759 with_system_zlib=yes
2760 extra_host_args="$extra_host_args --with-system-zlib"
2761fi
2762
2429c060
PB
2763# If using newlib, add --with-newlib to the extra_host_args so that gcc/configure
2764# can detect this case.
2765
2766if test x${with_newlib} != xno && echo " ${target_configdirs} " | grep " target-newlib " > /dev/null 2>&1 ; then
2767 with_newlib=yes
2768 extra_host_args="$extra_host_args --with-newlib"
2769fi
2770
9e07f89d
NN
2771# Handle ${copy_dirs}
2772set fnord ${copy_dirs}
2773shift
2774while test $# != 0 ; do
2775 if test -f $2/COPIED && test x"`cat $2/COPIED`" = x"$1" ; then
2776 :
2777 else
2778 echo Copying $1 to $2
2779
2780 # Use the install script to create the directory and all required
2781 # parent directories.
2782 if test -d $2 ; then
2783 :
2784 else
2785 echo >config.temp
2786 ${srcdir}/install-sh -c -m 644 config.temp $2/COPIED
2787 fi
2788
2789 # Copy the directory, assuming we have tar.
2790 # FIXME: Should we use B in the second tar? Not all systems support it.
2791 (cd $1; tar -cf - .) | (cd $2; tar -xpf -)
2792
2793 # It is the responsibility of the user to correctly adjust all
2794 # symlinks. If somebody can figure out how to handle them correctly
2795 # here, feel free to add the code.
2796
2797 echo $1 > $2/COPIED
2798 fi
2799 shift; shift
2800done
2801
2429c060
PB
2802# Determine a target-dependent exec_prefix that the installed
2803# gcc will search in. Keep this list sorted by triplet, with
2804# the *-*-osname triplets last.
2805md_exec_prefix=
2806case "${target}" in
521ec477 2807 i[[34567]]86-pc-msdosdjgpp*)
2429c060
PB
2808 md_exec_prefix=/dev/env/DJDIR/bin
2809 ;;
2429c060 2810 *-*-hpux* | \
2429c060 2811 *-*-nto-qnx* | \
1f111696 2812 *-*-solaris2*)
2429c060
PB
2813 md_exec_prefix=/usr/ccs/bin
2814 ;;
2815esac
2816
874e38b4
NN
2817extra_arflags_for_target=
2818extra_nmflags_for_target=
1086bc09 2819extra_ranlibflags_for_target=
a0da8069 2820target_makefile_frag=/dev/null
f48556b1 2821case "${target}" in
77d7106f
AM
2822 spu-*-*)
2823 target_makefile_frag="config/mt-spu"
2824 ;;
a9d58c06 2825 mips*-sde-elf* | mips*-mti-elf* | mips*-img-elf*)
429acdec
RS
2826 target_makefile_frag="config/mt-sde"
2827 ;;
f3b1e08e
RS
2828 mipsisa*-*-elfoabi*)
2829 target_makefile_frag="config/mt-mips-elfoabi"
2830 ;;
e7c8859c
RS
2831 mips*-*-*linux* | mips*-*-gnu*)
2832 target_makefile_frag="config/mt-mips-gnu"
2833 ;;
d9e042ac
SL
2834 nios2-*-elf*)
2835 target_makefile_frag="config/mt-nios2-elf"
2836 ;;
bf41f30d
NC
2837 *-*-linux-android*)
2838 target_makefile_frag="config/mt-android"
2839 ;;
29383458 2840 *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
3d6dfe0f 2841 target_makefile_frag="config/mt-gnu"
f48556b1 2842 ;;
a0da8069 2843 *-*-aix4.[[3456789]]* | *-*-aix[[56789]].*)
7ec59b9e 2844 # nm and ar from AIX 4.3 and above require -X32_64 flag to all ar and nm
874e38b4
NN
2845 # commands to handle both 32-bit and 64-bit objects. These flags are
2846 # harmless if we're using GNU nm or ar.
2847 extra_arflags_for_target=" -X32_64"
2848 extra_nmflags_for_target=" -B -X32_64"
f48556b1 2849 ;;
b6f83f2a
DD
2850esac
2851
a0da8069 2852alphaieee_frag=/dev/null
b6f83f2a
DD
2853case $target in
2854 alpha*-*-*)
2855 # This just makes sure to use the -mieee option to build target libs.
2856 # This should probably be set individually by each library.
2857 alphaieee_frag="config/mt-alphaieee"
f48556b1
DD
2858 ;;
2859esac
a0a2c6c6 2860
f48556b1
DD
2861# If --enable-target-optspace always use -Os instead of -O2 to build
2862# the target libraries, similarly if it is not specified, use -Os
2863# on selected platforms.
a0da8069 2864ospace_frag=/dev/null
f48556b1
DD
2865case "${enable_target_optspace}:${target}" in
2866 yes:*)
b6f83f2a 2867 ospace_frag="config/mt-ospace"
f48556b1
DD
2868 ;;
2869 :d30v-*)
b6f83f2a 2870 ospace_frag="config/mt-d30v"
f48556b1 2871 ;;
16beab3d 2872 :m32r-* | :d10v-* | :fr30-* | :i?86*-*-elfiamcu)
b6f83f2a 2873 ospace_frag="config/mt-ospace"
f48556b1
DD
2874 ;;
2875 no:* | :*)
2876 ;;
2877 *)
2878 echo "*** bad value \"${enable_target_optspace}\" for --enable-target-optspace flag; ignored" 1>&2
2879 ;;
2880esac
252b5132 2881
a0da8069
NN
2882# Some systems (e.g., one of the i386-aix systems the gas testers are
2883# using) don't handle "\$" correctly, so don't use it here.
c6b750e1 2884tooldir='${exec_prefix}'/${target_noncanonical}
a0da8069
NN
2885build_tooldir=${tooldir}
2886
a0da8069
NN
2887# Create a .gdbinit file which runs the one in srcdir
2888# and tells GDB to look there for source files.
2889
2890if test -r ${srcdir}/.gdbinit ; then
2891 case ${srcdir} in
2892 .) ;;
2893 *) cat > ./.gdbinit <<EOF
2894# ${NO_EDIT}
2895dir ${srcdir}
2896dir .
2897source ${srcdir}/.gdbinit
2898EOF
2899 ;;
2900 esac
2901fi
2902
252b5132
RH
2903# Make sure that the compiler is able to generate an executable. If it
2904# can't, we are probably in trouble. We don't care whether we can run the
2905# executable--we might be using a cross compiler--we only care whether it
2906# can be created. At this point the main configure script has set CC.
a0c4f3a0 2907we_are_ok=no
252b5132
RH
2908echo "int main () { return 0; }" > conftest.c
2909${CC} -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c
a0c4f3a0
DD
2910if test $? = 0 ; then
2911 if test -s conftest || test -s conftest.exe ; then
2912 we_are_ok=yes
2913 fi
7ec59b9e 2914fi
a0c4f3a0
DD
2915case $we_are_ok in
2916 no)
2917 echo 1>&2 "*** The command '${CC} -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c' failed."
2918 echo 1>&2 "*** You must set the environment variable CC to a working compiler."
2919 rm -f conftest*
2920 exit 1
2921 ;;
2922esac
252b5132
RH
2923rm -f conftest*
2924
3bbd2f8f 2925# Decide which environment variable is used to find dynamic libraries.
8607b6c9
NN
2926case "${host}" in
2927 *-*-hpux*) RPATH_ENVVAR=SHLIB_PATH ;;
3516a403 2928 *-*-darwin*) RPATH_ENVVAR=DYLD_LIBRARY_PATH ;;
3bbd2f8f 2929 *-*-mingw* | *-*-cygwin ) RPATH_ENVVAR=PATH ;;
8607b6c9
NN
2930 *) RPATH_ENVVAR=LD_LIBRARY_PATH ;;
2931esac
8607b6c9 2932
3bbd2f8f 2933# On systems where the dynamic library environment variable is PATH,
e28c595f
JM
2934# gcc/ will put dynamic libraries into a subdirectory to avoid adding
2935# built executables to PATH.
3bbd2f8f
AL
2936if test "$RPATH_ENVVAR" = PATH; then
2937 GCC_SHLIB_SUBDIR=/shlib
2938else
2939 GCC_SHLIB_SUBDIR=
2940fi
2941
730af8ee 2942# Adjust the toplevel makefile according to whether bootstrap was selected.
2943case $enable_bootstrap in
2944 yes)
2945 bootstrap_suffix=bootstrap
2946 BUILD_CONFIG=bootstrap-debug
2947 ;;
2948 no)
2949 bootstrap_suffix=no-bootstrap
2950 BUILD_CONFIG=
2951 ;;
2952esac
2953
2954AC_MSG_CHECKING(for default BUILD_CONFIG)
2955
2956AC_ARG_WITH([build-config],
2957 [AS_HELP_STRING([--with-build-config='NAME NAME2...'],
2958 [use config/NAME.mk build configuration])],
2959 [case $with_build_config in
2960 yes) with_build_config= ;;
2961 no) with_build_config= BUILD_CONFIG= ;;
2962 esac])
2963
2964if test "x${with_build_config}" != x; then
2965 BUILD_CONFIG=$with_build_config
2966else
2967 case $BUILD_CONFIG in
2968 bootstrap-debug)
2969 if echo "int f (void) { return 0; }" > conftest.c &&
2970 ${CC} -c conftest.c &&
2971 mv conftest.o conftest.o.g0 &&
2972 ${CC} -c -g conftest.c &&
2973 mv conftest.o conftest.o.g &&
2974 ${srcdir}/contrib/compare-debug conftest.o.g0 conftest.o.g > /dev/null 2>&1; then
2975 :
2976 else
2977 BUILD_CONFIG=
2978 fi
2979 rm -f conftest.c conftest.o conftest.o.g0 conftest.o.g
2980 ;;
2981 esac
2982fi
2983AC_MSG_RESULT($BUILD_CONFIG)
2984AC_SUBST(BUILD_CONFIG)
2985
2986# Use same top-level configure hooks in libgcc/libstdc++/libvtv.
2987AC_MSG_CHECKING([for --enable-vtable-verify])
2988AC_ARG_ENABLE(vtable-verify,
ce6c656d
L
2989[AS_HELP_STRING([--enable-vtable-verify],
2990 [Enable vtable verification feature])],
730af8ee 2991[case "$enableval" in
2992 yes) enable_vtable_verify=yes ;;
2993 no) enable_vtable_verify=no ;;
2994 *) enable_vtable_verify=no;;
2995 esac],
2996[enable_vtable_verify=no])
2997AC_MSG_RESULT($enable_vtable_verify)
2998
3866be5d
NN
2999# Record target_configdirs and the configure arguments for target and
3000# build configuration in Makefile.
3001target_configdirs=`echo "${target_configdirs}" | sed -e 's/target-//g'`
6a9cf61e 3002build_configdirs=`echo "${build_configdirs}" | sed -e 's/build-//g'`
201f096f 3003bootstrap_fixincludes=no
930314a4 3004
2aa2364a
JR
3005# If we are building libgomp, bootstrap it.
3006if echo " ${target_configdirs} " | grep " libgomp " > /dev/null 2>&1 ; then
3007 bootstrap_target_libs=${bootstrap_target_libs}target-libgomp,
3008fi
3009
730af8ee 3010# If we are building libsanitizer and $BUILD_CONFIG contains bootstrap-asan
3011# or bootstrap-ubsan, bootstrap it.
3012if echo " ${target_configdirs} " | grep " libsanitizer " > /dev/null 2>&1; then
3013 case "$BUILD_CONFIG" in
228cf97d 3014 *bootstrap-hwasan* | *bootstrap-asan* | *bootstrap-ubsan* )
730af8ee 3015 bootstrap_target_libs=${bootstrap_target_libs}target-libsanitizer,
201f096f 3016 bootstrap_fixincludes=yes
730af8ee 3017 ;;
3018 esac
5eb08693
L
3019fi
3020
730af8ee 3021# If we are building libvtv and --enable-vtable-verify, bootstrap it.
3022if echo " ${target_configdirs} " | grep " libvtv " > /dev/null 2>&1 &&
3023 test "$enable_vtable_verify" != no; then
95e43135
JBG
3024 bootstrap_target_libs=${bootstrap_target_libs}target-libvtv,
3025fi
3026
228cf97d
AM
3027# If we are building libatomic and the list of enabled languages includes the
3028# D frontend, bootstrap it.
3029if echo " ${target_configdirs} " | grep " libatomic " > /dev/null 2>&1; then
3030 case ,${enable_languages}, in
3031 *,d,*)
3032 bootstrap_target_libs=${bootstrap_target_libs}target-libatomic,
3033 ;;
3034 esac
3035fi
3036
930314a4
NN
3037# Determine whether gdb needs tk/tcl or not.
3038# Use 'maybe' since enable_gdbtk might be true even if tk isn't available
3039# and in that case we want gdb to be built without tk. Ugh!
3040# In fact I believe gdb is the *only* package directly dependent on tk,
3041# so we should be able to put the 'maybe's in unconditionally and
3042# leave out the maybe dependencies when enable_gdbtk is false. I'm not
3043# 100% sure that that's safe though.
c180f501 3044
675c6968 3045gdb_tk="maybe-all-tcl maybe-all-tk maybe-all-itcl maybe-all-libgui"
930314a4
NN
3046case "$enable_gdbtk" in
3047 no)
3048 GDB_TK="" ;;
c180f501
AC
3049 yes)
3050 GDB_TK="${gdb_tk}" ;;
930314a4 3051 *)
c180f501
AC
3052 # Only add the dependency on gdbtk when GDBtk is part of the gdb
3053 # distro. Eventually someone will fix this and move Insight, nee
3054 # gdbtk to a separate directory.
3055 if test -d ${srcdir}/gdb/gdbtk ; then
3056 GDB_TK="${gdb_tk}"
3057 else
3058 GDB_TK=""
3059 fi
3060 ;;
930314a4 3061esac
907be67c
DJ
3062CONFIGURE_GDB_TK=`echo ${GDB_TK} | sed s/-all-/-configure-/g`
3063INSTALL_GDB_TK=`echo ${GDB_TK} | sed s/-all-/-install-/g`
930314a4 3064
b6f9caee
TT
3065# gdb and gdbserver depend on gnulib and gdbsupport, but as nothing
3066# else does, only include them if one of these is built. The Makefile
3067# provides the ordering, so it's enough here to add to the list.
3068case " ${configdirs} " in
3069 *\ gdb\ *)
3070 configdirs="${configdirs} gnulib gdbsupport"
3071 ;;
3072 *\ gdbserver\ *)
3073 configdirs="${configdirs} gnulib gdbsupport"
3074 ;;
5c9e84c2
MF
3075 *\ sim\ *)
3076 configdirs="${configdirs} gnulib"
3077 ;;
b6f9caee 3078esac
73cc7272 3079
6bd3dfaa 3080# Strip out unwanted targets.
dd12c3a8
NN
3081
3082# While at that, we remove Makefiles if we were started for recursive
3083# configuration, so that the top-level Makefile reconfigures them,
3084# like we used to do when configure itself was recursive.
dd12c3a8 3085
06a51eac
RW
3086# Loop over modules. We used to use the "$extrasub" feature from Autoconf
3087# but now we're fixing up the Makefile ourselves with the additional
3088# commands passed to AC_CONFIG_FILES. Use separate variables
3089# extrasub-{build,host,target} not because there is any reason to split
3090# the substitutions up that way, but only to remain below the limit of
3091# 99 commands in a script, for HP-UX sed.
4119873a
AO
3092
3093# Do not nest @if/@endif or @unless/@endunless pairs, because
3094# configure will not warn you at all.
dd12c3a8 3095
16b1ad29
RW
3096case "$enable_bootstrap:$ENABLE_GOLD: $configdirs :,$stage1_languages," in
3097 yes:yes:*\ gold\ *:*,c++,*) ;;
3098 yes:yes:*\ gold\ *:*)
3099 AC_MSG_ERROR([in a combined tree, bootstrapping with --enable-gold requires c++ in stage1_languages])
3100 ;;
3101esac
3102
06a51eac 3103extrasub_build=
6a9cf61e 3104for module in ${build_configdirs} ; do
dd12c3a8
NN
3105 if test -z "${no_recursion}" \
3106 && test -f ${build_subdir}/${module}/Makefile; then
3107 echo 1>&2 "*** removing ${build_subdir}/${module}/Makefile to force reconfigure"
3108 rm -f ${build_subdir}/${module}/Makefile
3109 fi
06a51eac 3110 extrasub_build="$extrasub_build
6bd3dfaa 3111/^@if build-$module\$/d
498d4a71 3112/^@endif build-$module\$/d
4119873a 3113/^@unless build-$module\$/,/^@endunless build-$module\$/d
498d4a71 3114/^@if build-$module-$bootstrap_suffix\$/d
4119873a
AO
3115/^@endif build-$module-$bootstrap_suffix\$/d
3116/^@unless build-$module-$bootstrap_suffix\$/,/^@endunless build-$module-$bootstrap_suffix\$/d"
dd12c3a8 3117done
06a51eac 3118extrasub_host=
dd12c3a8 3119for module in ${configdirs} ; do
80911fe1 3120 if test -z "${no_recursion}"; then
8cf39b1b 3121 for file in stage*-${module}/Makefile prev-${module}/Makefile ${module}/Makefile; do
80911fe1
PB
3122 if test -f ${file}; then
3123 echo 1>&2 "*** removing ${file} to force reconfigure"
3124 rm -f ${file}
3125 fi
3126 done
dd12c3a8 3127 fi
201f096f 3128 case ${module},${bootstrap_fixincludes} in
3129 fixincludes,no) host_bootstrap_suffix=no-bootstrap ;;
3130 *) host_bootstrap_suffix=$bootstrap_suffix ;;
3131 esac
06a51eac 3132 extrasub_host="$extrasub_host
6bd3dfaa 3133/^@if $module\$/d
498d4a71 3134/^@endif $module\$/d
4119873a 3135/^@unless $module\$/,/^@endunless $module\$/d
201f096f 3136/^@if $module-$host_bootstrap_suffix\$/d
4119873a
AO
3137/^@endif $module-$host_bootstrap_suffix\$/d
3138/^@unless $module-$host_bootstrap_suffix\$/,/^@endunless $module-$host_bootstrap_suffix\$/d"
dd12c3a8 3139done
06a51eac 3140extrasub_target=
dd12c3a8
NN
3141for module in ${target_configdirs} ; do
3142 if test -z "${no_recursion}" \
3143 && test -f ${target_subdir}/${module}/Makefile; then
3144 echo 1>&2 "*** removing ${target_subdir}/${module}/Makefile to force reconfigure"
3145 rm -f ${target_subdir}/${module}/Makefile
3146 fi
e8a5fa9c
RW
3147
3148 # We only bootstrap target libraries listed in bootstrap_target_libs.
3149 case $bootstrap_target_libs in
3150 *,target-$module,*) target_bootstrap_suffix=$bootstrap_suffix ;;
3151 *) target_bootstrap_suffix=no-bootstrap ;;
3152 esac
3153
06a51eac 3154 extrasub_target="$extrasub_target
6bd3dfaa 3155/^@if target-$module\$/d
498d4a71 3156/^@endif target-$module\$/d
4119873a 3157/^@unless target-$module\$/,/^@endunless target-$module\$/d
e8a5fa9c 3158/^@if target-$module-$target_bootstrap_suffix\$/d
4119873a
AO
3159/^@endif target-$module-$target_bootstrap_suffix\$/d
3160/^@unless target-$module-$target_bootstrap_suffix\$/,/^@endunless target-$module-$target_bootstrap_suffix\$/d"
930314a4 3161done
319cab08 3162
06a51eac
RW
3163# Do the final fixup along with target modules.
3164extrasub_target="$extrasub_target
4119873a
AO
3165/^@if /,/^@endif /d
3166/^@unless /d
3167/^@endunless /d"
930314a4 3168
af019bfd
L
3169if test "$enable_pgo_build" != "no"; then
3170 extrasub_build="$extrasub_build
3171/^@if pgo-build\$/d
3172/^@endif pgo-build\$/d"
3173fi
3174
a2cc058a
NN
3175# Create the serialization dependencies. This uses a temporary file.
3176
e6bfb94a 3177AC_ARG_ENABLE([serial-configure],
7837304f
AS
3178[AS_HELP_STRING([[--enable-serial-[{host,target,build}-]configure]],
3179 [force sequential configuration of
3180 sub-packages for the host, target or build
3181 machine, or all sub-packages])])
1047cb91
DD
3182
3183case ${enable_serial_configure} in
3184 yes)
3185 enable_serial_build_configure=yes
3186 enable_serial_host_configure=yes
3187 enable_serial_target_configure=yes
3188 ;;
3189esac
e6bfb94a 3190
a2cc058a
NN
3191# These force 'configure's to be done one at a time, to avoid problems
3192# with contention over a shared config.cache.
3193rm -f serdep.tmp
d0aa61ca 3194if test "x${enable_serial_build_configure}" = xyes || test "x${enable_serial_host_configure}" = xyes || test "x${enable_serial_target_configure}" = xyes; then
e6bfb94a 3195echo '# serdep.tmp' > serdep.tmp
d0aa61ca 3196fi
a2cc058a 3197olditem=
1047cb91 3198test "x${enable_serial_build_configure}" = xyes &&
a2cc058a
NN
3199for item in ${build_configdirs} ; do
3200 case ${olditem} in
3201 "") ;;
e6bfb94a 3202 *) echo "configure-build-${item}: configure-build-${olditem}" >> serdep.tmp ;;
a2cc058a
NN
3203 esac
3204 olditem=${item}
3205done
3206olditem=
1047cb91 3207test "x${enable_serial_host_configure}" = xyes &&
a2cc058a
NN
3208for item in ${configdirs} ; do
3209 case ${olditem} in
3210 "") ;;
e6bfb94a 3211 *) echo "configure-${item}: configure-${olditem}" >> serdep.tmp ;;
a2cc058a
NN
3212 esac
3213 olditem=${item}
3214done
3215olditem=
1047cb91 3216test "x${enable_serial_target_configure}" = xyes &&
a2cc058a
NN
3217for item in ${target_configdirs} ; do
3218 case ${olditem} in
3219 "") ;;
e6bfb94a 3220 *) echo "configure-target-${item}: configure-target-${olditem}" >> serdep.tmp ;;
a2cc058a
NN
3221 esac
3222 olditem=${item}
3223done
a0da8069
NN
3224serialization_dependencies=serdep.tmp
3225AC_SUBST_FILE(serialization_dependencies)
a2cc058a 3226
e6bfb94a 3227# Base args. Strip norecursion, cache-file, srcdir, host, build,
c6b750e1 3228# target, nonopt, and variable assignments. These are the ones we
30167e0a
NC
3229# might not want to pass down to subconfigures. The exception being
3230# --cache-file=/dev/null, which is used to turn off the use of cache
3231# files altogether, and which should be passed on to subconfigures.
3232# Also strip program-prefix, program-suffix, and program-transform-name,
3233# so that we can pass down a consistent program-transform-name.
862776f2
AA
3234hbaseargs=
3235bbaseargs=
65b4571a 3236tbaseargs=
c6b750e1
DJ
3237keep_next=no
3238skip_next=no
3239eval "set -- $ac_configure_args"
b0aaa663
DJ
3240for ac_arg
3241do
c6b750e1
DJ
3242 if test X"$skip_next" = X"yes"; then
3243 skip_next=no
3244 continue
3245 fi
3246 if test X"$keep_next" = X"yes"; then
3247 case $ac_arg in
3248 *\'*)
3249 ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
3250 esac
862776f2
AA
3251 hbaseargs="$hbaseargs '$ac_arg'"
3252 bbaseargs="$bbaseargs '$ac_arg'"
65b4571a 3253 tbaseargs="$tbaseargs '$ac_arg'"
c6b750e1
DJ
3254 keep_next=no
3255 continue
3256 fi
3257
3258 # Handle separated arguments. Based on the logic generated by
3259 # autoconf 2.59.
3260 case $ac_arg in
3261 *=* | --config-cache | -C | -disable-* | --disable-* \
3262 | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
3263 | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
3264 | -with-* | --with-* | -without-* | --without-* | --x)
3265 separate_arg=no
3266 ;;
3267 -*)
3268 separate_arg=yes
3269 ;;
3270 *)
3271 separate_arg=no
3272 ;;
3273 esac
3274
65b4571a 3275 skip_targ=no
862776f2 3276 skip_barg=no
65b4571a
AO
3277 case $ac_arg in
3278changequote(,)
3279 --with-* | --without-*)
3280 libopt=`echo "$ac_arg" | sed -e 's,^--[^-_]*[-_],,' -e 's,=.*$,,'`
3281
3282 case $libopt in
3283 *[-_]include)
3284 lib=`echo "$libopt" | sed 's,[-_]include$,,'`
3285 ;;
3286 *[-_]lib)
3287 lib=`echo "$libopt" | sed 's,[-_]lib$,,'`
3288 ;;
862776f2
AA
3289 *[-_]prefix)
3290 lib=`echo "$libopt" | sed 's,[-_]prefix$,,'`
3291 ;;
3292 *[-_]type)
3293 lib=`echo "$libopt" | sed 's,[-_]type$,,'`
3294 ;;
65b4571a
AO
3295 *)
3296 lib=$libopt
3297 ;;
3298 esac
3299changequote([,])
3300
3301 case $lib in
1b6c0831 3302 mpc | mpfr | gmp | isl)
65b4571a
AO
3303 # If we're processing --with-$lib, --with-$lib-include or
3304 # --with-$lib-lib, for one of the libs above, and target is
3305 # different from host, don't pass the current argument to any
3306 # target library's configure.
3307 if test x$is_cross_compiler = xyes; then
3308 skip_targ=yes
3309 fi
3310 ;;
862776f2
AA
3311 libintl | libiconv)
3312 # We don't want libintl (and co.) in anything but the host arguments.
3313 skip_targ=yes
3314 skip_barg=yes
3315 ;;
65b4571a
AO
3316 esac
3317 ;;
3318 esac
3319
c6b750e1 3320 case "$ac_arg" in
30167e0a
NC
3321 --cache-file=/dev/null | \
3322 -cache-file=/dev/null )
3323 # Handled here to avoid the test to skip args below.
862776f2
AA
3324 hbaseargs="$hbaseargs '$ac_arg'"
3325 bbaseargs="$bbaseargs '$ac_arg'"
65b4571a 3326 tbaseargs="$tbaseargs '$ac_arg'"
30167e0a
NC
3327 # Assert: $separate_arg should always be no.
3328 keep_next=$separate_arg
3329 ;;
c6b750e1
DJ
3330 --no*)
3331 continue
3332 ;;
3333 --c* | \
3334 --sr* | \
3335 --ho* | \
3336 --bu* | \
3337 --t* | \
3338 --program-* | \
3339 -cache_file* | \
3340 -srcdir* | \
3341 -host* | \
3342 -build* | \
3343 -target* | \
3344 -program-prefix* | \
3345 -program-suffix* | \
3346 -program-transform-name* )
3347 skip_next=$separate_arg
3348 continue
3349 ;;
3350 -*)
3351 # An option. Add it.
3352 case $ac_arg in
3353 *\'*)
3354 ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
3355 esac
862776f2
AA
3356 hbaseargs="$hbaseargs '$ac_arg'"
3357 if test X"$skip_barg" = Xno; then
3358 bbaseargs="$bbaseargs '$ac_arg'"
3359 fi
65b4571a
AO
3360 if test X"$skip_targ" = Xno; then
3361 tbaseargs="$tbaseargs '$ac_arg'"
3362 fi
c6b750e1
DJ
3363 keep_next=$separate_arg
3364 ;;
3365 *)
3366 # Either a variable assignment, or a nonopt (triplet). Don't
3367 # pass it down; let the Makefile handle this.
3368 continue
3369 ;;
3370 esac
3371done
3372# Remove the initial space we just introduced and, as these will be
3373# expanded by make, quote '$'.
862776f2
AA
3374hbaseargs=`echo "x$hbaseargs" | sed -e 's/^x *//' -e 's,\\$,$$,g'`
3375bbaseargs=`echo "x$bbaseargs" | sed -e 's/^x *//' -e 's,\\$,$$,g'`
252b5132 3376
f27d4f92
DJ
3377# Add in --program-transform-name, after --program-prefix and
3378# --program-suffix have been applied to it. Autoconf has already
3379# doubled dollar signs and backslashes in program_transform_name; we want
3380# the backslashes un-doubled, and then the entire thing wrapped in single
7ec59b9e 3381# quotes, because this will be expanded first by make and then by the shell.
f27d4f92
DJ
3382# Also, because we want to override the logic in subdir configure scripts to
3383# choose program_transform_name, replace any s,x,x, with s,y,y,.
3384sed -e "s,\\\\\\\\,\\\\,g; s,','\\\\'',g; s/s,x,x,/s,y,y,/" <<EOF_SED > conftestsed.out
3385${program_transform_name}
3386EOF_SED
3387gcc_transform_name=`cat conftestsed.out`
3388rm -f conftestsed.out
862776f2
AA
3389hbaseargs="$hbaseargs --program-transform-name='${gcc_transform_name}'"
3390bbaseargs="$bbaseargs --program-transform-name='${gcc_transform_name}'"
65b4571a 3391tbaseargs="$tbaseargs --program-transform-name='${gcc_transform_name}'"
2444379b 3392if test "$silent" = yes; then
862776f2
AA
3393 bbaseargs="$bbaseargs --silent"
3394 hbaseargs="$hbaseargs --silent"
65b4571a 3395 tbaseargs="$tbaseargs --silent"
2444379b 3396fi
e5f2f7d9 3397
862776f2
AA
3398bbaseargs="$bbaseargs --disable-option-checking"
3399hbaseargs="$hbaseargs --disable-option-checking"
65b4571a 3400tbaseargs="$tbaseargs --disable-option-checking"
f27d4f92 3401
e5f2f7d9
LM
3402if test "$enable_year2038" = no; then
3403 baseargs="$baseargs --disable-year2038"
3404 tbaseargs="$tbaseargs --disable-year2038"
3405fi
3406
4074d5f2
RW
3407# Record and document user additions to sub configure arguments.
3408AC_ARG_VAR([build_configargs],
3409 [additional configure arguments for build directories])
3410AC_ARG_VAR([host_configargs],
3411 [additional configure arguments for host directories])
3412AC_ARG_VAR([target_configargs],
3413 [additional configure arguments for target directories])
3414
49b7683b
DD
3415# For the build-side libraries, we just need to pretend we're native,
3416# and not use the same cache file. Multilibs are neither needed nor
1b6c0831
L
3417# desired. We can't even use the same cache file for all build-side
3418# libraries, as they're compiled differently; some with C, some with
3419# C++ or with different feature-enabling options.
862776f2 3420build_configargs="$build_configargs --cache-file=./config.cache ${bbaseargs}"
91e060aa 3421
ae831be5
NN
3422# For host modules, accept cache file option, or specification as blank.
3423case "${cache_file}" in
3424"") # empty
3425 cache_file_option="" ;;
a0da8069 3426/* | [[A-Za-z]]:[[\\/]]* ) # absolute path
ae831be5
NN
3427 cache_file_option="--cache-file=${cache_file}" ;;
3428*) # relative path
3429 cache_file_option="--cache-file=../${cache_file}" ;;
3430esac
3431
82252c06
NN
3432# Host dirs don't like to share a cache file either, horribly enough.
3433# This seems to be due to autoconf 2.5x stupidity.
862776f2 3434host_configargs="$host_configargs --cache-file=./config.cache ${extra_host_args} ${hbaseargs}"
ae831be5 3435
65b4571a 3436target_configargs="$target_configargs ${tbaseargs}"
49b7683b 3437
252b5132
RH
3438# Passing a --with-cross-host argument lets the target libraries know
3439# whether they are being built with a cross-compiler or being built
3440# native. However, it would be better to use other mechanisms to make the
3441# sorts of decisions they want to make on this basis. Please consider
3442# this option to be deprecated. FIXME.
a0c4f3a0 3443if test x${is_cross_compiler} = xyes ; then
c6b750e1 3444 target_configargs="--with-cross-host=${host_noncanonical} ${target_configargs}"
252b5132
RH
3445fi
3446
afc0578d 3447# Special user-friendly check for native x86_64-linux build, if
3448# multilib is not explicitly enabled.
3449case "$target:$have_compiler:$host:$target:$enable_multilib" in
3450 x86_64-*linux*:yes:$build:$build:)
ce6c656d 3451 # Make sure we have a development environment that handles 32-bit
afc0578d 3452 dev64=no
3453 echo "int main () { return 0; }" > conftest.c
3454 ${CC} -m32 -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c
3455 if test $? = 0 ; then
3456 if test -s conftest || test -s conftest.exe ; then
3457 dev64=yes
3458 fi
3459 fi
3460 rm -f conftest*
3461 if test x${dev64} != xyes ; then
ce6c656d 3462 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.])
afc0578d 3463 fi
3464 ;;
3465esac
3466
938d2b74
RW
3467# Default to --enable-multilib.
3468if test x${enable_multilib} = x ; then
a0da8069 3469 target_configargs="--enable-multilib ${target_configargs}"
938d2b74 3470fi
252b5132
RH
3471
3472# Pass --with-newlib if appropriate. Note that target_configdirs has
3473# changed from the earlier setting of with_newlib.
a0c4f3a0 3474if test x${with_newlib} != xno && echo " ${target_configdirs} " | grep " newlib " > /dev/null 2>&1 && test -d ${srcdir}/newlib ; then
a0da8069 3475 target_configargs="--with-newlib ${target_configargs}"
252b5132
RH
3476fi
3477
95036d20
NN
3478# Different target subdirs use different values of certain variables
3479# (notably CXX). Worse, multilibs use *lots* of different values.
3480# Worse yet, autoconf 2.5x makes some of these 'precious', meaning that
3481# it doesn't automatically accept command-line overrides of them.
3482# This means it's not safe for target subdirs to share a cache file,
3483# which is disgusting, but there you have it. Hopefully this can be
3484# fixed in future. It's still worthwhile to use a cache file for each
3485# directory. I think.
3486
ae380b45
MS
3487# Pass the appropriate --build, --host, --target and --cache-file arguments.
3488# We need to pass --target, as newer autoconf's requires consistency
3489# for target_alias and gcc doesn't manage it consistently.
4b900473 3490target_configargs="--cache-file=./config.cache ${target_configargs}"
49b7683b 3491
9e449d3e 3492FLAGS_FOR_TARGET=
7c1f909c 3493case " $target_configdirs " in
75205f78 3494 *" newlib "*)
a0da8069 3495 case " $target_configargs " in
75205f78 3496 *" --with-newlib "*)
9e449d3e 3497 case "$target" in
1f53ca9a 3498 *-cygwin*)
6d94c122 3499 FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(TARGET_SUBDIR)/winsup/cygwin -isystem $$s/winsup/cygwin/include'
1f53ca9a 3500 ;;
9e449d3e
AO
3501 esac
3502
7450026c 3503 # If we're not building GCC, don't discard standard headers.
4d5fd396 3504 if test -d ${srcdir}/gcc; then
63266560 3505 FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -nostdinc'
7450026c
AO
3506
3507 if test "${build}" != "${host}"; then
3508 # On Canadian crosses, CC_FOR_TARGET will have already been set
3509 # by `configure', so we won't have an opportunity to add -Bgcc/
3510 # to it. This is right: we don't want to search that directory
3511 # for binaries, but we want the header files in there, so add
3512 # them explicitly.
e552509b 3513 FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -isystem $$r/$(HOST_SUBDIR)/gcc/include -isystem $$r/$(HOST_SUBDIR)/gcc/include-fixed'
7450026c
AO
3514
3515 # Someone might think of using the pre-installed headers on
3516 # Canadian crosses, in case the installed compiler is not fully
3517 # compatible with the compiler being built. In this case, it
3518 # would be better to flag an error than risking having
3519 # incompatible object files being constructed. We can't
3520 # guarantee that an error will be flagged, but let's hope the
3521 # compiler will do it, when presented with incompatible header
3522 # files.
3523 fi
63266560
DD
3524 fi
3525
0a0d0041 3526 case "${target}-${is_cross_compiler}" in
ec11bdc6 3527 i[[3456789]]86-*-linux*-no)
0a0d0041
TF
3528 # Here host == target, so we don't need to build gcc,
3529 # so we don't want to discard standard headers.
3530 FLAGS_FOR_TARGET=`echo " $FLAGS_FOR_TARGET " | sed -e 's/ -nostdinc / /'`
0a0d0041
TF
3531 ;;
3532 *)
3533 # If we're building newlib, use its generic headers last, but search
3534 # for any libc-related directories first (so make it the last -B
3535 # switch).
3536 FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$$r/$(TARGET_SUBDIR)/newlib/ -isystem $$r/$(TARGET_SUBDIR)/newlib/targ-include -isystem $$s/newlib/libc/include'
691bb5a1
DD
3537
3538 # If we're building libgloss, find the startup file, simulator library
3539 # and linker script.
3540 case " $target_configdirs " in
3541 *" libgloss "*)
3542 # Look for startup file, simulator library and maybe linker script.
3543 FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$$r/$(TARGET_SUBDIR)/libgloss/'"$libgloss_dir"
3544 # Look for libnosys.a in case the target needs it.
3545 FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(TARGET_SUBDIR)/libgloss/libnosys'
3546 # Most targets have the linker script in the source directory.
3547 FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$s/libgloss/'"$libgloss_dir"
3548 ;;
3549 esac
0a0d0041
TF
3550 ;;
3551 esac
9e449d3e 3552 ;;
75205f78
DD
3553 esac
3554 ;;
9e449d3e 3555esac
1f53ca9a 3556
45055374 3557case "$target" in
1f53ca9a
AO
3558 x86_64-*mingw* | *-w64-mingw*)
3559 # MinGW-w64 does not use newlib, nor does it use winsup. It may,
3560 # however, use a symlink named 'mingw' in ${prefix} .
3561 FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L${prefix}/${target}/lib -L${prefix}/mingw/lib -isystem ${prefix}/${target}/include -isystem ${prefix}/mingw/include'
3562 ;;
3563 *-mingw*)
3564 # MinGW can't be handled as Cygwin above since it does not use newlib.
3565 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'
3566 ;;
45055374 3567esac
63266560 3568
5fbad20a
DD
3569# Allow the user to override the flags for
3570# our build compiler if desired.
c66487f8
NC
3571if test x"${build}" = x"${host}" ; then
3572 CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
e472ec9f 3573 CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-${CPPFLAGS}}
c66487f8
NC
3574 CXXFLAGS_FOR_BUILD=${CXXFLAGS_FOR_BUILD-${CXXFLAGS}}
3575 LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-${LDFLAGS}}
3576fi
5fbad20a 3577
63266560
DD
3578# On Canadian crosses, we'll be searching the right directories for
3579# the previously-installed cross compiler, so don't bother to add
3580# flags for directories within the install tree of the compiler
3581# being built; programs in there won't even run.
4d5fd396 3582if test "${build}" = "${host}" && test -d ${srcdir}/gcc; then
9e449d3e 3583 # Search for pre-installed headers if nothing else fits.
bba45b8b 3584 FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$(build_tooldir)/bin/ -B$(build_tooldir)/lib/ -isystem $(build_tooldir)/include -isystem $(build_tooldir)/sys-include'
9e449d3e 3585fi
63266560 3586
7c1f909c 3587if test "x${use_gnu_ld}" = x &&
f48556b1 3588 echo " ${configdirs} " | grep " ld " > /dev/null ; then
9e449d3e 3589 # Arrange for us to find uninstalled linker scripts.
b00612cc 3590 FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(HOST_SUBDIR)/ld'
9e449d3e
AO
3591fi
3592
a481dbb7
DD
3593# Search for other target-specific linker scripts and such.
3594case "${target}" in
4e206d7e
DB
3595 mep*)
3596 FLAGS_FOR_TARGET="$FLAGS_FOR_TARGET -mlibrary"
3597 ;;
228cf97d
AM
3598 # The VxWorks support for shared libraries is getting in
3599 # incrementally. Make sure it doesn't get activated implicitly:
3600 *vxworks*)
3601 if test "${enable_shared-unset}" = unset ; then
3602 enable_shared=no
3603 # So the build of libraries knows ...
3604 target_configargs="${target_configargs} --disable-shared"
3605 # So gcc knows ...
3606 host_configargs="${host_configargs} --disable-shared"
3607 fi
3608 ;;
4e206d7e
DB
3609esac
3610
a0da8069 3611# Makefile fragments.
3e707e94
PB
3612for frag in host_makefile_frag target_makefile_frag alphaieee_frag ospace_frag;
3613do
3614 eval fragval=\$$frag
3615 if test $fragval != /dev/null; then
3616 eval $frag=${srcdir}/$fragval
3617 fi
3618done
a0da8069
NN
3619AC_SUBST_FILE(host_makefile_frag)
3620AC_SUBST_FILE(target_makefile_frag)
3621AC_SUBST_FILE(alphaieee_frag)
3622AC_SUBST_FILE(ospace_frag)
3623
3624# Miscellanea: directories, flags, etc.
a0da8069 3625AC_SUBST(RPATH_ENVVAR)
3bbd2f8f 3626AC_SUBST(GCC_SHLIB_SUBDIR)
a0da8069
NN
3627AC_SUBST(tooldir)
3628AC_SUBST(build_tooldir)
907be67c 3629AC_SUBST(CONFIGURE_GDB_TK)
a0da8069 3630AC_SUBST(GDB_TK)
907be67c 3631AC_SUBST(INSTALL_GDB_TK)
a0da8069
NN
3632
3633# Build module lists & subconfigure args.
a0da8069 3634AC_SUBST(build_configargs)
6a9cf61e 3635AC_SUBST(build_configdirs)
a0da8069
NN
3636
3637# Host module lists & subconfigure args.
3638AC_SUBST(host_configargs)
3639AC_SUBST(configdirs)
911e63d0 3640AC_SUBST(target_configdirs)
a0da8069
NN
3641
3642# Target module lists & subconfigure args.
a0da8069 3643AC_SUBST(target_configargs)
a6df5a19 3644
a0da8069
NN
3645
3646# Build tools.
b5714970
PB
3647AC_SUBST(AR_FOR_BUILD)
3648AC_SUBST(AS_FOR_BUILD)
a0da8069 3649AC_SUBST(CC_FOR_BUILD)
b5714970 3650AC_SUBST(CFLAGS_FOR_BUILD)
228cf97d 3651AC_SUBST(CPP_FOR_BUILD)
e472ec9f 3652AC_SUBST(CPPFLAGS_FOR_BUILD)
b5714970
PB
3653AC_SUBST(CXXFLAGS_FOR_BUILD)
3654AC_SUBST(CXX_FOR_BUILD)
3655AC_SUBST(DLLTOOL_FOR_BUILD)
228cf97d 3656AC_SUBST(DSYMUTIL_FOR_BUILD)
b5714970 3657AC_SUBST(GFORTRAN_FOR_BUILD)
e552509b 3658AC_SUBST(GOC_FOR_BUILD)
228cf97d 3659AC_SUBST(GDC_FOR_BUILD)
b5714970
PB
3660AC_SUBST(LDFLAGS_FOR_BUILD)
3661AC_SUBST(LD_FOR_BUILD)
3662AC_SUBST(NM_FOR_BUILD)
3663AC_SUBST(RANLIB_FOR_BUILD)
3664AC_SUBST(WINDMC_FOR_BUILD)
3665AC_SUBST(WINDRES_FOR_BUILD)
a0da8069 3666
be01d343
PB
3667# Generate default definitions for YACC, M4, LEX and other programs that run
3668# on the build machine. These are used if the Makefile can't locate these
3669# programs in objdir.
3670MISSING=`cd $ac_aux_dir && ${PWDCMD-pwd}`/missing
3671
3672AC_CHECK_PROGS([YACC], ['bison -y' byacc yacc], [$MISSING bison -y])
3673case " $build_configdirs " in
3674 *" bison "*) YACC='$$r/$(BUILD_SUBDIR)/bison/tests/bison -y' ;;
be01d343
PB
3675esac
3676
3677AC_CHECK_PROGS([BISON], [bison], [$MISSING bison])
3678case " $build_configdirs " in
3679 *" bison "*) BISON='$$r/$(BUILD_SUBDIR)/bison/tests/bison' ;;
3680esac
3681
3682AC_CHECK_PROGS([M4], [gm4 gnum4 m4], [$MISSING m4])
3683case " $build_configdirs " in
3684 *" m4 "*) M4='$$r/$(BUILD_SUBDIR)/m4/m4' ;;
3685esac
3686
3687AC_CHECK_PROGS([LEX], [flex lex], [$MISSING flex])
3688case " $build_configdirs " in
3689 *" flex "*) LEX='$$r/$(BUILD_SUBDIR)/flex/flex' ;;
3690 *" lex "*) LEX='$$r/$(BUILD_SUBDIR)/lex/lex' ;;
3691esac
3692
3693AC_CHECK_PROGS([FLEX], [flex], [$MISSING flex])
3694case " $build_configdirs " in
3695 *" flex "*) FLEX='$$r/$(BUILD_SUBDIR)/flex/flex' ;;
3696esac
3697
3698AC_CHECK_PROGS([MAKEINFO], makeinfo, [$MISSING makeinfo])
3699case " $build_configdirs " in
3700 *" texinfo "*) MAKEINFO='$$r/$(BUILD_SUBDIR)/texinfo/makeinfo/makeinfo' ;;
3701 *)
3702changequote(,)
10ad8ef3 3703 # For an installed makeinfo, we require it to be from texinfo 4.7 or
be01d343
PB
3704 # higher, else we use the "missing" dummy.
3705 if ${MAKEINFO} --version \
10ad8ef3 3706 | egrep 'texinfo[^0-9]*(4\.([7-9]|[1-9][0-9])|[5-9]|[1-9][0-9])' >/dev/null 2>&1; then
be01d343
PB
3707 :
3708 else
3709 MAKEINFO="$MISSING makeinfo"
3710 fi
3711 ;;
3712changequote([,])
3713esac
3714
3715# FIXME: expect and dejagnu may become build tools?
3716
3717AC_CHECK_PROGS(EXPECT, expect, expect)
3718case " $configdirs " in
3719 *" expect "*)
3720 test $host = $build && EXPECT='$$r/$(HOST_SUBDIR)/expect/expect'
3721 ;;
3722esac
3723
3724AC_CHECK_PROGS(RUNTEST, runtest, runtest)
3725case " $configdirs " in
3726 *" dejagnu "*)
6b89cc21 3727 test $host = $build && RUNTEST='$$s/$(HOST_SUBDIR)/dejagnu/runtest'
be01d343
PB
3728 ;;
3729esac
3730
3731
a0da8069 3732# Host tools.
05cbd757
PB
3733NCN_STRICT_CHECK_TOOLS(AR, ar)
3734NCN_STRICT_CHECK_TOOLS(AS, as)
3735NCN_STRICT_CHECK_TOOLS(DLLTOOL, dlltool)
228cf97d 3736NCN_STRICT_CHECK_TOOLS(DSYMUTIL, dsymutil)
05cbd757 3737NCN_STRICT_CHECK_TOOLS(LD, ld)
be01d343 3738NCN_STRICT_CHECK_TOOLS(LIPO, lipo)
05cbd757 3739NCN_STRICT_CHECK_TOOLS(NM, nm)
ba98da75
RO
3740NCN_STRICT_CHECK_TOOLS(RANLIB, ranlib, true)
3741NCN_STRICT_CHECK_TOOLS(STRIP, strip, true)
05cbd757 3742NCN_STRICT_CHECK_TOOLS(WINDRES, windres)
0c24b341 3743NCN_STRICT_CHECK_TOOLS(WINDMC, windmc)
05cbd757
PB
3744NCN_STRICT_CHECK_TOOLS(OBJCOPY, objcopy)
3745NCN_STRICT_CHECK_TOOLS(OBJDUMP, objdump)
228cf97d 3746NCN_STRICT_CHECK_TOOLS(OTOOL, otool)
b121d7d4 3747NCN_STRICT_CHECK_TOOLS(READELF, readelf)
a0da8069
NN
3748AC_SUBST(CC)
3749AC_SUBST(CXX)
3750AC_SUBST(CFLAGS)
3751AC_SUBST(CXXFLAGS)
228cf97d
AM
3752AC_SUBST(GDC)
3753AC_SUBST(GDCFLAGS)
19824f6f 3754GDCFLAGS=${GDCFLAGS-${CFLAGS}}
9e65489a 3755AC_SUBST(PKG_CONFIG_PATH)
a0da8069 3756
50ad1254
L
3757GCC_PLUGIN_OPTION(PLUGIN_OPTION)
3758AR_PLUGIN_OPTION=
3759RANLIB_PLUGIN_OPTION=
3760if test -n "$PLUGIN_OPTION"; then
3761 if $AR --help 2>&1 | grep -q "\--plugin"; then
3762 AR_PLUGIN_OPTION="$PLUGIN_OPTION"
3763 fi
3764 if $RANLIB --help 2>&1 | grep -q "\--plugin"; then
3765 RANLIB_PLUGIN_OPTION="$PLUGIN_OPTION"
3766 fi
3767fi
3768AC_SUBST(AR_PLUGIN_OPTION)
3769AC_SUBST(RANLIB_PLUGIN_OPTION)
3770
be01d343 3771# Target tools.
7ec59b9e 3772AC_ARG_WITH([build-time-tools],
7837304f
AS
3773 [AS_HELP_STRING([--with-build-time-tools=PATH],
3774 [use given path to find target tools during the build])],
2429c060
PB
3775 [case x"$withval" in
3776 x/*) ;;
3777 *)
3778 with_build_time_tools=
3779 AC_MSG_WARN([argument to --with-build-time-tools must be an absolute path])
3780 ;;
3781 esac],
3782 [with_build_time_tools=])
3783
05cbd757
PB
3784NCN_STRICT_CHECK_TARGET_TOOLS(CC_FOR_TARGET, cc gcc)
3785NCN_STRICT_CHECK_TARGET_TOOLS(CXX_FOR_TARGET, c++ g++ cxx gxx)
05cbd757 3786NCN_STRICT_CHECK_TARGET_TOOLS(GCC_FOR_TARGET, gcc, ${CC_FOR_TARGET})
05cbd757 3787NCN_STRICT_CHECK_TARGET_TOOLS(GFORTRAN_FOR_TARGET, gfortran)
e552509b 3788NCN_STRICT_CHECK_TARGET_TOOLS(GOC_FOR_TARGET, gccgo)
228cf97d 3789NCN_STRICT_CHECK_TARGET_TOOLS(GDC_FOR_TARGET, gdc)
917f20be 3790NCN_STRICT_CHECK_TARGET_TOOLS(GM2_FOR_TARGET, gm2)
2429c060
PB
3791
3792ACX_CHECK_INSTALLED_TARGET_TOOL(AR_FOR_TARGET, ar)
3793ACX_CHECK_INSTALLED_TARGET_TOOL(AS_FOR_TARGET, as)
3794ACX_CHECK_INSTALLED_TARGET_TOOL(DLLTOOL_FOR_TARGET, dlltool)
228cf97d 3795ACX_CHECK_INSTALLED_TARGET_TOOL(DSYMUTIL_FOR_TARGET, dsymutil)
2429c060
PB
3796ACX_CHECK_INSTALLED_TARGET_TOOL(LD_FOR_TARGET, ld)
3797ACX_CHECK_INSTALLED_TARGET_TOOL(LIPO_FOR_TARGET, lipo)
3798ACX_CHECK_INSTALLED_TARGET_TOOL(NM_FOR_TARGET, nm)
6b91c541 3799ACX_CHECK_INSTALLED_TARGET_TOOL(OBJCOPY_FOR_TARGET, objcopy)
2429c060 3800ACX_CHECK_INSTALLED_TARGET_TOOL(OBJDUMP_FOR_TARGET, objdump)
228cf97d 3801ACX_CHECK_INSTALLED_TARGET_TOOL(OTOOL_FOR_TARGET, otool)
ba98da75 3802ACX_CHECK_INSTALLED_TARGET_TOOL(RANLIB_FOR_TARGET, ranlib)
b121d7d4 3803ACX_CHECK_INSTALLED_TARGET_TOOL(READELF_FOR_TARGET, readelf)
2429c060
PB
3804ACX_CHECK_INSTALLED_TARGET_TOOL(STRIP_FOR_TARGET, strip)
3805ACX_CHECK_INSTALLED_TARGET_TOOL(WINDRES_FOR_TARGET, windres)
0c24b341 3806ACX_CHECK_INSTALLED_TARGET_TOOL(WINDMC_FOR_TARGET, windmc)
55db4b87 3807
be01d343
PB
3808RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET"
3809
3810GCC_TARGET_TOOL(ar, AR_FOR_TARGET, AR, [binutils/ar])
3811GCC_TARGET_TOOL(as, AS_FOR_TARGET, AS, [gas/as-new])
3812GCC_TARGET_TOOL(cc, CC_FOR_TARGET, CC, [gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/])
950386c6 3813dnl see comments for CXX_FOR_TARGET_FLAG_TO_PASS
be01d343 3814GCC_TARGET_TOOL(c++, CXX_FOR_TARGET, CXX,
95e43135 3815 [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],
be01d343
PB
3816 c++)
3817GCC_TARGET_TOOL(c++ for libstdc++, RAW_CXX_FOR_TARGET, CXX,
95e43135 3818 [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],
be01d343
PB
3819 c++)
3820GCC_TARGET_TOOL(dlltool, DLLTOOL_FOR_TARGET, DLLTOOL, [binutils/dlltool])
228cf97d 3821GCC_TARGET_TOOL(dsymutil, DSYMUTIL_FOR_TARGET, DSYMUTIL)
be01d343 3822GCC_TARGET_TOOL(gcc, GCC_FOR_TARGET, , [gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/])
be01d343
PB
3823GCC_TARGET_TOOL(gfortran, GFORTRAN_FOR_TARGET, GFORTRAN,
3824 [gcc/gfortran -B$$r/$(HOST_SUBDIR)/gcc/], fortran)
e552509b
ILT
3825GCC_TARGET_TOOL(gccgo, GOC_FOR_TARGET, GOC,
3826 [gcc/gccgo -B$$r/$(HOST_SUBDIR)/gcc/], go)
228cf97d
AM
3827GCC_TARGET_TOOL(gdc, GDC_FOR_TARGET, GDC,
3828 [gcc/gdc -B$$r/$(HOST_SUBDIR)/gcc/], d)
917f20be
GM
3829GCC_TARGET_TOOL(gm2, GM2_FOR_TARGET, GM2,
3830 [gcc/gm2 -B$$r/$(HOST_SUBDIR)/gcc/], m2)
be01d343
PB
3831GCC_TARGET_TOOL(ld, LD_FOR_TARGET, LD, [ld/ld-new])
3832GCC_TARGET_TOOL(lipo, LIPO_FOR_TARGET, LIPO)
3833GCC_TARGET_TOOL(nm, NM_FOR_TARGET, NM, [binutils/nm-new])
1b6c0831 3834GCC_TARGET_TOOL(objcopy, OBJCOPY_FOR_TARGET, OBJCOPY, [binutils/objcopy])
be01d343 3835GCC_TARGET_TOOL(objdump, OBJDUMP_FOR_TARGET, OBJDUMP, [binutils/objdump])
228cf97d 3836GCC_TARGET_TOOL(otool, OTOOL_FOR_TARGET, OTOOL)
be01d343 3837GCC_TARGET_TOOL(ranlib, RANLIB_FOR_TARGET, RANLIB, [binutils/ranlib])
b121d7d4 3838GCC_TARGET_TOOL(readelf, READELF_FOR_TARGET, READELF, [binutils/readelf])
9b980aa1 3839GCC_TARGET_TOOL(strip, STRIP_FOR_TARGET, STRIP, [binutils/strip-new])
be01d343 3840GCC_TARGET_TOOL(windres, WINDRES_FOR_TARGET, WINDRES, [binutils/windres])
0c24b341 3841GCC_TARGET_TOOL(windmc, WINDMC_FOR_TARGET, WINDMC, [binutils/windmc])
55db4b87 3842
be01d343 3843AC_SUBST(FLAGS_FOR_TARGET)
55db4b87 3844AC_SUBST(RAW_CXX_FOR_TARGET)
54752a6b 3845
a0da8069
NN
3846# Certain tools may need extra flags.
3847AR_FOR_TARGET=${AR_FOR_TARGET}${extra_arflags_for_target}
3848RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET}${extra_ranlibflags_for_target}
3849NM_FOR_TARGET=${NM_FOR_TARGET}${extra_nmflags_for_target}
252b5132 3850
be01d343
PB
3851# When building target libraries, except in a Canadian cross, we use
3852# the same toolchain as the compiler we just built.
3853COMPILER_AS_FOR_TARGET='$(AS_FOR_TARGET)'
3854COMPILER_LD_FOR_TARGET='$(LD_FOR_TARGET)'
3855COMPILER_NM_FOR_TARGET='$(NM_FOR_TARGET)'
3856if test $host = $build; then
3857 case " $configdirs " in
3858 *" gcc "*)
3859 COMPILER_AS_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/as'
3860 COMPILER_LD_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/collect-ld'
3861 COMPILER_NM_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/nm'${extra_nmflags_for_target}
3862 ;;
3863 esac
3864fi
3865
3866AC_SUBST(COMPILER_AS_FOR_TARGET)
3867AC_SUBST(COMPILER_LD_FOR_TARGET)
3868AC_SUBST(COMPILER_NM_FOR_TARGET)
3869
6b784d9f
AO
3870AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
3871AC_ARG_ENABLE(maintainer-mode,
7837304f
AS
3872[AS_HELP_STRING([--enable-maintainer-mode],
3873 [enable make rules and dependencies not useful
3874 (and sometimes confusing) to the casual installer])],
6b784d9f
AO
3875 USE_MAINTAINER_MODE=$enableval,
3876 USE_MAINTAINER_MODE=no)
3877AC_MSG_RESULT($USE_MAINTAINER_MODE)
3878AC_SUBST(MAINTAINER_MODE_TRUE)
3879AC_SUBST(MAINTAINER_MODE_FALSE)
3880if test "$USE_MAINTAINER_MODE" = yes; then
3881 MAINTAINER_MODE_TRUE=
3882 MAINTAINER_MODE_FALSE='#'
3883else
3884 MAINTAINER_MODE_TRUE='#'
3885 MAINTAINER_MODE_FALSE=
7ec59b9e 3886fi
6b784d9f
AO
3887MAINT=$MAINTAINER_MODE_TRUE
3888AC_SUBST(MAINT)dnl
3889
1d39f329
NN
3890# ---------------------
3891# GCC bootstrap support
3892# ---------------------
3893
3894# Stage specific cflags for build.
3895stage1_cflags="-g"
3896case $build in
3897 vax-*-*)
3898 case ${GCC} in
3899 yes) stage1_cflags="-g -Wa,-J" ;;
3900 *) stage1_cflags="-g -J" ;;
3901 esac ;;
1d39f329 3902esac
1d89b610 3903
1d39f329
NN
3904AC_SUBST(stage1_cflags)
3905
8a0d8a5c
PB
3906# Enable --enable-checking in stage1 of the compiler.
3907AC_ARG_ENABLE(stage1-checking,
7837304f
AS
3908[AS_HELP_STRING([[--enable-stage1-checking[=all]]],
3909 [choose additional checking for stage1 of the compiler])],
8a0d8a5c 3910[stage1_checking=--enable-checking=${enable_stage1_checking}],
5566c1fa 3911[if test "x$enable_checking" = xno || test "x$enable_checking" = x; then
ce6c656d
L
3912 # For --disable-checking or implicit --enable-checking=release, avoid
3913 # setting --enable-checking=gc in the default stage1 checking for LTO
3914 # bootstraps. See PR62077.
ce6c656d
L
3915 case $BUILD_CONFIG in
3916 *lto*)
05a13254
NC
3917 stage1_checking=--enable-checking=release,misc,gimple,rtlflag,tree,types;;
3918 *)
3919 stage1_checking=--enable-checking=yes,types;;
ce6c656d 3920 esac
05a13254
NC
3921 if test "x$enable_checking" = x && \
3922 test -d ${srcdir}/gcc && \
3923 test x"`cat ${srcdir}/gcc/DEV-PHASE`" = xexperimental; then
3924 stage1_checking=--enable-checking=yes,types,extra
3925 fi
8a0d8a5c 3926else
5566c1fa 3927 stage1_checking=--enable-checking=$enable_checking,types
8a0d8a5c
PB
3928fi])
3929AC_SUBST(stage1_checking)
3930
1d39f329 3931# Enable -Werror in bootstrap stage2 and later.
1d39f329 3932AC_ARG_ENABLE(werror,
7837304f 3933[AS_HELP_STRING([--enable-werror],
bf41f30d
NC
3934 [enable -Werror in bootstrap stage2 and later])],
3935[
1a6f2dc7
NN
3936case ${enable_werror} in
3937 yes) stage2_werror_flag="--enable-werror-always" ;;
3938 *) stage2_werror_flag="" ;;
1d39f329 3939esac
bf41f30d
NC
3940],
3941[
3942if test -d ${srcdir}/gcc && test x"`cat $srcdir/gcc/DEV-PHASE`" = xexperimental; then
3943 case $BUILD_CONFIG in
3944 bootstrap-debug)
3945 stage2_werror_flag="--enable-werror-always" ;;
3946 "")
3947 stage2_werror_flag="--enable-werror-always" ;;
1b6c0831
L
3948 esac
3949fi
bf41f30d
NC
3950])
3951
3952AC_SUBST(stage2_werror_flag)
1b6c0831 3953
e8a5fa9c
RW
3954# Specify what files to not compare during bootstrap.
3955
3956compare_exclusions="gcc/cc*-checksum\$(objext) | gcc/ada/*tools/*"
917f20be
GM
3957compare_exclusions="$compare_exclusions | gcc/m2/gm2-compiler-boot/M2Version*"
3958compare_exclusions="$compare_exclusions | gcc/m2/gm2-compiler-boot/SYSTEM*"
3959compare_exclusions="$compare_exclusions | gcc/m2/gm2version*"
e8a5fa9c
RW
3960case "$target" in
3961 hppa*64*-*-hpux*) ;;
228cf97d 3962 powerpc*-ibm-aix*) compare_exclusions="$compare_exclusions | *libgomp*\$(objext)" ;;
e8a5fa9c
RW
3963esac
3964AC_SUBST(compare_exclusions)
3965
06a51eac
RW
3966AC_CONFIG_FILES([Makefile],
3967 [sed "$extrasub_build" Makefile |
3968 sed "$extrasub_host" |
3969 sed "$extrasub_target" > mf$$
3970 mv -f mf$$ Makefile],
3971 [extrasub_build="$extrasub_build"
3972 extrasub_host="$extrasub_host"
3973 extrasub_target="$extrasub_target"])
3974AC_OUTPUT