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