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