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