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