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