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