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