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