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