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