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, 2022 Free Software Foundation, Inc.
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.
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.
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/>.
19 ##############################################################################
20 ### WARNING: this file contains embedded tabs. Do not run untabify on this file.
22 m4_include(config/acx.m4)
23 m4_include(config/override.m4)
24 m4_include(config/proginstall.m4)
25 m4_include(config/elf.m4)
26 m4_include(config/ax_cxx_compile_stdcxx.m4)
27 m4_include([libtool.m4])
28 m4_include([ltoptions.m4])
29 m4_include([ltsugar.m4])
30 m4_include([ltversion.m4])
31 m4_include([lt~obsolete.m4])
32 m4_include([config/isl.m4])
34 AC_INIT(move-if-change)
35 AC_DISABLE_OPTION_CHECKING
38 # if PWD already has a value, it is probably wrong.
39 if test -n "$PWD" ; then PWD=`${PWDCMD-pwd}`; fi
41 # Export original configure arguments for use by sub-configures.
42 # Quote arguments with shell meta charatcers.
43 TOPLEVEL_CONFIGURE_ARGUMENTS=
44 set -- "$progname" "$@"
48 *" "*|*" "*|*[[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\']]*)
49 ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"`
50 # if the argument is of the form -foo=baz, quote the baz part only
51 ac_arg=`echo "'$ac_arg'" | sed "s/^'\([[-a-zA-Z0-9]]*=\)/\\1'/"` ;;
54 # Add the quoted argument to the list.
55 TOPLEVEL_CONFIGURE_ARGUMENTS="$TOPLEVEL_CONFIGURE_ARGUMENTS $ac_arg"
57 if test "$silent" = yes; then
58 TOPLEVEL_CONFIGURE_ARGUMENTS="$TOPLEVEL_CONFIGURE_ARGUMENTS --silent"
60 # Remove the initial space we just introduced and, as these will be
61 # expanded by make, quote '$'.
62 TOPLEVEL_CONFIGURE_ARGUMENTS=`echo "x$TOPLEVEL_CONFIGURE_ARGUMENTS" | sed -e 's/^x *//' -e 's,\\$,$$,g'`
63 AC_SUBST(TOPLEVEL_CONFIGURE_ARGUMENTS)
65 # Find the build, host, and target systems.
66 ACX_NONCANONICAL_BUILD
68 ACX_NONCANONICAL_TARGET
73 AC_SUBST(stage1_ldflags)
74 AC_SUBST(poststage1_libs)
75 AC_SUBST(poststage1_ldflags)
79 # By default, C and C++ are the only stage 1 languages.
82 dnl Autoconf 2.5x and later will set a default program prefix if
83 dnl --target was used, even if it was the same as --host. Disable
84 dnl that behavior. This must be done before AC_CANONICAL_SYSTEM
86 test "$host_noncanonical" = "$target_noncanonical" &&
87 test "$program_prefix$program_suffix$program_transform_name" = \
89 program_transform_name=s,y,y,
94 m4_pattern_allow([^AS_FOR_TARGET$])dnl
95 m4_pattern_allow([^AS_FOR_BUILD$])dnl
97 # Get 'install' or 'install-sh' and its variants.
104 srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
106 # We pass INSTALL explicitly to sub-makes. Make sure that it is not
108 if test "$INSTALL" = "${srcdir}/install-sh -c"; then
109 INSTALL="${srcpwd}/install-sh -c"
112 # Set srcdir to "." if that's what it is.
113 # This is important for multilib support.
115 if test "${pwd}" = "${srcpwd}" ; then
123 ### To add a new directory to the tree, first choose whether it is a target
124 ### or a host dependent tool. Then put it into the appropriate list
125 ### (library or tools, host or target), doing a dependency sort.
127 # Subdirs will be configured in the order listed in build_configdirs,
128 # configdirs, or target_configdirs; see the serialization section below.
130 # Dependency sorting is only needed when *configuration* must be done in
131 # a particular order. In all cases a dependency should be specified in
132 # the Makefile, whether or not it's implicitly specified here.
134 # Double entries in build_configdirs, configdirs, or target_configdirs may
135 # cause circular dependencies and break everything horribly.
137 # these library is used by various programs built for the build
140 build_libs="build-libiberty build-libcpp"
142 # these tools are built for the build environment
143 build_tools="build-texinfo build-flex build-bison build-m4 build-fixincludes"
145 # these libraries are used by various programs built for the host environment
147 host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libbacktrace libcpp libcody libdecnumber gmp mpfr mpc isl libelf libiconv libctf"
149 # these tools are built for the host environment
150 # Note, the powerpc-eabi build depends on sim occurring before gdb in order to
151 # know that we are building the simulator.
152 # binutils, gas and ld appear in that order because it makes sense to run
153 # "make check" in that particular order.
154 # If --enable-gold is used, "gold" may replace "ld".
155 host_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 c++tools"
157 # these libraries are built for the target environment, and are built after
158 # the host libraries and the host tools (which may be a cross compiler)
159 # Note that libiberty is not a target library.
162 # these tools are built using the target libraries, and are intended to
163 # run only in the target environment
165 # note: any program that *uses* libraries that are in the "target_libraries"
166 # list belongs in this list.
168 target_tools="target-rda"
170 ################################################################################
172 ## All tools belong in one of the four categories, and are assigned above
173 ## We assign ${configdirs} this way to remove all embedded newlines. This
174 ## is important because configure will choke if they ever get through.
175 ## ${configdirs} is directories we build using the host tools.
176 ## ${target_configdirs} is directories we build using the target tools.
177 configdirs=`echo ${host_libs} ${host_tools}`
178 target_configdirs=`echo ${target_libraries} ${target_tools}`
179 build_configdirs=`echo ${build_libs} ${build_tools}`
181 m4_divert_text([PARSE_ARGS],
184 m4_pushdef([AS_MESSAGE_LOG_FD], [])dnl
185 AC_MSG_ERROR([path to source, $srcdir, contains spaces])
186 m4_popdef([AS_MESSAGE_LOG_FD])dnl
189 ac_subdirs_all=`cd $srcdir && echo */configure | sed 's,/configure,,g'`
192 ################################################################################
194 srcname="gnu development package"
196 # This gets set non-empty for some net releases of packages.
199 # Define is_cross_compiler to save on calls to 'test'.
201 if test x"${host}" = x"${target}" ; then
204 is_cross_compiler=yes
207 # Find the build and target subdir names.
210 # Skipdirs are removed silently.
212 # Noconfigdirs are removed loudly.
216 # Make sure we don't let GNU ld be added if we didn't want it.
217 if test x$with_gnu_ld = xno ; then
219 noconfigdirs="$noconfigdirs ld gold"
223 # Make sure we don't let GNU as be added if we didn't want it.
224 if test x$with_gnu_as = xno ; then
226 noconfigdirs="$noconfigdirs gas"
230 AC_ARG_WITH(system-zlib,
231 [AS_HELP_STRING([--with-system-zlib], [use installed libz])])
232 # Make sure we don't let ZLIB be added if we didn't want it.
233 if test x$with_system_zlib = xyes ; then
235 noconfigdirs="$noconfigdirs zlib"
238 # some tools are so dependent upon X11 that if we're not building with X,
239 # it's not even worth trying to configure, much less build, that tool.
242 yes | "") ;; # the default value for this tree is that X11 is available
244 skipdirs="${skipdirs} tk itcl libgui"
245 # We won't be able to build gdbtk without X.
248 *) echo "*** bad value \"${with_x}\" for -with-x flag; ignored" 1>&2 ;;
251 # Some are only suitable for cross toolchains.
252 # Remove these if host=target.
253 cross_only="target-libgloss target-newlib target-opcodes"
255 case $is_cross_compiler in
256 no) skipdirs="${skipdirs} ${cross_only}" ;;
259 # If both --with-headers and --with-libs are specified, default to
261 if test x"${with_headers}" != x && test x"${with_headers}" != xno \
262 && test x"${with_libs}" != x && test x"${with_libs}" != xno ; then
263 if test x"${with_newlib}" = x ; then
268 # Recognize --with-newlib/--without-newlib.
269 case ${with_newlib} in
270 no) skipdirs="${skipdirs} target-newlib" ;;
271 yes) skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'` ;;
274 AC_ARG_ENABLE(as-accelerator-for,
275 [AS_HELP_STRING([--enable-as-accelerator-for=ARG],
276 [build as offload target compiler.
277 Specify offload host triple by ARG])])
279 AC_ARG_ENABLE(offload-targets,
280 [AS_HELP_STRING([--enable-offload-targets=LIST],
281 [enable offloading to devices from comma-separated LIST of
282 TARGET[=DIR]. Use optional path to find offload target compiler
285 if test x"$enable_offload_targets" = x; then
286 AC_MSG_ERROR([no offload targets specified])
288 ], [enable_offload_targets=])
290 AC_ARG_ENABLE(offload-defaulted,
291 [AS_HELP_STRING([--enable-offload-defaulted]
292 [If enabled, configured but not installed offload compilers and
293 libgomp plugins are silently ignored. Useful for distribution
294 compilers where those are in separate optional packages.])],
295 [enable_offload_defaulted=$enableval],
296 [enable_offload_defaulted=])
298 # Handle --enable-gold, --enable-ld.
299 # --disable-gold [--enable-ld]
300 # Build only ld. Default option.
301 # --enable-gold [--enable-ld]
302 # Build both gold and ld. Install gold as "ld.gold", install ld
303 # as "ld.bfd" and "ld".
304 # --enable-gold=default [--enable-ld]
305 # Build both gold and ld. Install gold as "ld.gold" and "ld",
306 # install ld as "ld.bfd".
307 # --enable-gold[=default] --disable-ld
308 # Build only gold, which is then installed as both "ld.gold" and "ld".
309 # --enable-gold --enable-ld=default
310 # Build both gold (installed as "ld.gold") and ld (installed as "ld"
312 # In other words, ld is default
313 # --enable-gold=default --enable-ld=default
318 [AS_HELP_STRING([[--enable-gold[=ARG]]],
319 [build gold @<:@ARG={default,yes,no}@:>@])],
320 ENABLE_GOLD=$enableval,
322 case "${ENABLE_GOLD}" in
324 # Check for ELF target.
327 *-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
328 | *-*-linux* | *-*-gnu* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
329 | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* \
330 | *-*-solaris2* | *-*-nto* | *-*-nacl*)
332 *-*-linux*aout* | *-*-linux*oldld*)
340 if test "$is_elf" = "yes"; then
341 # Check for target supported by gold.
343 i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-* \
344 | aarch64*-*-* | tilegx*-*-* | mips*-*-* | s390*-*-* | loongarch*-*-*)
345 configdirs="$configdirs gold"
346 if test x${ENABLE_GOLD} = xdefault; then
357 AC_MSG_ERROR([invalid --enable-gold argument])
362 [AS_HELP_STRING([[--enable-ld[=ARG]]],
363 [build ld @<:@ARG={default,yes,no}@:>@])],
364 ENABLE_LD=$enableval,
367 case "${ENABLE_LD}" in
369 if test x${default_ld} != x; then
370 AC_MSG_ERROR([either gold or ld can be the default ld])
376 if test x${ENABLE_GOLD} != xyes; then
377 AC_MSG_WARN([neither ld nor gold are enabled])
379 configdirs=`echo " ${configdirs} " | sed -e 's/ ld / /'`
382 AC_MSG_ERROR([invalid --enable-ld argument])
387 # Decide the default method for compressing debug sections.
388 # Provide a configure time option to override our default.
389 AC_ARG_ENABLE(compressed_debug_sections,
390 [AS_HELP_STRING([--enable-compressed-debug-sections={all,gas,gold,ld,none}],
391 [Enable compressed debug sections for gas, gold or ld by
394 if test x"$enable_compressed_debug_sections" = xyes; then
395 AC_MSG_ERROR([no program with compressed debug sections specified])
397 ], [enable_compressed_debug_sections=])
399 # Configure extra directories which are host specific
403 configdirs="$configdirs libtermcap" ;;
406 # A target can indicate whether a language isn't supported for some reason.
407 # Only spaces may be used in this macro; not newlines or tabs.
408 unsupported_languages=
410 # Remove more programs from consideration, based on the host or
411 # target this usually means that a port of the program doesn't
415 i[[3456789]]86-*-msdosdjgpp*)
416 noconfigdirs="$noconfigdirs tcl tk itcl"
421 AC_ARG_ENABLE(libquadmath,
422 AS_HELP_STRING([--disable-libquadmath],
423 [do not build libquadmath directory]),
424 ENABLE_LIBQUADMATH=$enableval,
425 ENABLE_LIBQUADMATH=yes)
426 if test "${ENABLE_LIBQUADMATH}" = "no" ; then
427 noconfigdirs="$noconfigdirs target-libquadmath"
431 AC_ARG_ENABLE(libquadmath-support,
432 AS_HELP_STRING([--disable-libquadmath-support],
433 [disable libquadmath support for Fortran]),
434 ENABLE_LIBQUADMATH_SUPPORT=$enableval,
435 ENABLE_LIBQUADMATH_SUPPORT=yes)
436 enable_libquadmath_support=
437 if test "${ENABLE_LIBQUADMATH_SUPPORT}" = "no" ; then
438 enable_libquadmath_support=no
442 AC_ARG_ENABLE(libada,
443 [AS_HELP_STRING([--enable-libada], [build libada directory])],
444 ENABLE_LIBADA=$enableval,
446 if test "${ENABLE_LIBADA}" != "yes" ; then
447 noconfigdirs="$noconfigdirs gnattools"
450 AC_ARG_ENABLE(libssp,
451 [AS_HELP_STRING([--enable-libssp], [build libssp directory])],
452 ENABLE_LIBSSP=$enableval,
455 AC_ARG_ENABLE(libstdcxx,
456 AS_HELP_STRING([--disable-libstdcxx],
457 [do not build libstdc++-v3 directory]),
458 ENABLE_LIBSTDCXX=$enableval,
459 ENABLE_LIBSTDCXX=default)
460 [if test "${ENABLE_LIBSTDCXX}" = "no" ; then
461 noconfigdirs="$noconfigdirs target-libstdc++-v3"
464 # If this is accelerator compiler and its target is intelmic we enable
465 # target liboffloadmic by default. If this is compiler with offloading
466 # for intelmic we enable host liboffloadmic by default. Otherwise
467 # liboffloadmic is disabled by default.
468 AC_ARG_ENABLE([liboffloadmic],
469 AC_HELP_STRING([[--enable-liboffloadmic[=ARG]]],
470 [build liboffloadmic @<:@ARG={no,host,target}@:>@]),
471 [case "$enableval" in
473 enable_liboffloadmic=$enableval ;;
475 AC_MSG_ERROR([--enable-liboffloadmic=no/host/target]) ;;
477 [if test x"$enable_as_accelerator_for" != x; then
479 *-intelmic-* | *-intelmicemul-*)
480 enable_liboffloadmic=target
481 extra_liboffloadmic_configure_flags="--enable-liboffloadmic=target"
484 enable_liboffloadmic=no
488 case "${enable_offload_targets}" in
489 *-intelmic-* | *-intelmicemul-*)
490 enable_liboffloadmic=host
491 extra_liboffloadmic_configure_flags="--enable-liboffloadmic=host"
494 enable_liboffloadmic=no
498 AC_SUBST(extra_liboffloadmic_configure_flags)
500 # Enable libgomp by default on hosted POSIX systems, and a few others.
501 if test x$enable_libgomp = x ; then
503 *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
505 *-*-netbsd* | *-*-freebsd* | *-*-openbsd* | *-*-dragonfly*)
507 *-*-solaris2* | *-*-hpux11*)
509 *-*-darwin* | *-*-aix*)
511 nvptx*-*-* | amdgcn*-*-*)
514 noconfigdirs="$noconfigdirs target-libgomp"
519 # Disable libatomic on unsupported systems.
520 if test -d ${srcdir}/libatomic; then
521 if test x$enable_libatomic = x; then
522 AC_MSG_CHECKING([for libatomic support])
523 if (srcdir=${srcdir}/libatomic; \
524 . ${srcdir}/configure.tgt; \
525 test -n "$UNSUPPORTED")
528 noconfigdirs="$noconfigdirs target-libatomic"
535 # Disable liboffloadmic on unsupported systems.
536 if test -d ${srcdir}/liboffloadmic; then
537 if test x$enable_liboffloadmic != xno; then
538 AC_MSG_CHECKING([for liboffloadmic support])
539 if (srcdir=${srcdir}/liboffloadmic; \
540 . ${srcdir}/configure.tgt; \
541 test -n "$UNSUPPORTED")
544 noconfigdirs="$noconfigdirs target-liboffloadmic"
551 # Disable libitm on unsupported systems.
552 if test -d ${srcdir}/libitm; then
553 if test x$enable_libitm = x; then
554 AC_MSG_CHECKING([for libitm support])
555 if (srcdir=${srcdir}/libitm; \
556 . ${srcdir}/configure.tgt; \
557 test -n "$UNSUPPORTED")
560 noconfigdirs="$noconfigdirs target-libitm"
567 # Disable libsanitizer on unsupported systems.
568 if test -d ${srcdir}/libsanitizer; then
569 if test x$enable_libsanitizer = x; then
570 AC_MSG_CHECKING([for libsanitizer support])
571 if (srcdir=${srcdir}/libsanitizer; \
572 . ${srcdir}/configure.tgt; \
573 test -n "$UNSUPPORTED")
576 noconfigdirs="$noconfigdirs target-libsanitizer"
583 # Disable libvtv on unsupported systems.
584 if test -d ${srcdir}/libvtv; then
585 if test x$enable_libvtv = x; then
586 AC_MSG_CHECKING([for libvtv support])
587 if (srcdir=${srcdir}/libvtv; \
588 . ${srcdir}/configure.tgt; \
589 test "$VTV_SUPPORTED" != "yes")
592 noconfigdirs="$noconfigdirs target-libvtv"
599 # Disable libquadmath for some systems.
602 noconfigdirs="$noconfigdirs target-libquadmath"
604 # libquadmath is unused on AIX and libquadmath build process use of
605 # LD_LIBRARY_PATH can break AIX bootstrap.
606 powerpc-*-aix* | rs6000-*-aix*)
607 noconfigdirs="$noconfigdirs target-libquadmath"
611 # Disable libssp for some systems.
614 # No hosted I/O support.
615 noconfigdirs="$noconfigdirs target-libssp"
618 noconfigdirs="$noconfigdirs target-libssp"
620 powerpc-*-aix* | rs6000-*-aix*)
621 noconfigdirs="$noconfigdirs target-libssp"
624 # No hosted I/O support.
625 noconfigdirs="$noconfigdirs target-libssp"
628 # libssp uses a misaligned load to trigger a fault, but the RL78
629 # doesn't fault for those - instead, it gives a build-time error
630 # for explicit misaligned loads.
631 noconfigdirs="$noconfigdirs target-libssp"
634 # No hosted I/O support.
635 noconfigdirs="$noconfigdirs target-libssp"
639 # Disable libstdc++-v3 for some systems.
640 # Allow user to override this if they pass --enable-libstdcxx
641 if test "${ENABLE_LIBSTDCXX}" = "default" ; then
644 # VxWorks uses the Dinkumware C++ library.
645 noconfigdirs="$noconfigdirs target-libstdc++-v3"
648 # Not ported/fails to build when using newlib.
649 noconfigdirs="$noconfigdirs target-libstdc++-v3"
652 # the C++ libraries don't build on top of CE's C libraries
653 noconfigdirs="$noconfigdirs target-libstdc++-v3"
656 noconfigdirs="$noconfigdirs target-libstdc++-v3"
659 noconfigdirs="$noconfigdirs target-libstdc++-v3"
662 noconfigdirs="$noconfigdirs target-libstdc++-v3"
667 # Disable C++ on systems where it is known to not work.
668 # For testing, you can override this with --enable-languages=c++.
669 case ,${enable_languages}, in
675 unsupported_languages="$unsupported_languages c++"
681 # Disable Objc on systems where it is known to not work.
682 # For testing, you can override this with --enable-languages=objc.
683 case ,${enable_languages}, in
689 unsupported_languages="$unsupported_languages objc"
695 # Disable D on systems where it is known to not work.
696 # For testing, you can override this with --enable-languages=d.
697 case ,${enable_languages}, in
703 unsupported_languages="$unsupported_languages d"
709 # Disable libphobos on unsupported systems.
710 # For testing, you can override this with --enable-libphobos.
711 if test -d ${srcdir}/libphobos; then
712 if test x$enable_libphobos = x; then
713 AC_MSG_CHECKING([for libphobos support])
714 if (srcdir=${srcdir}/libphobos; \
715 . ${srcdir}/configure.tgt; \
716 test "$LIBPHOBOS_SUPPORTED" != "yes")
719 noconfigdirs="$noconfigdirs target-libphobos"
726 # Disable Fortran for some systems.
729 # See <http://gcc.gnu.org/ml/gcc-patches/2004-11/msg00572.html>.
730 unsupported_languages="$unsupported_languages fortran"
733 unsupported_languages="$unsupported_languages fortran"
737 # Disable libffi for some systems.
741 i[[3456789]]86-*-darwin*)
743 x86_64-*-darwin[[912]]*)
746 noconfigdirs="$noconfigdirs target-libffi"
749 noconfigdirs="$noconfigdirs target-libffi"
752 noconfigdirs="$noconfigdirs target-libffi"
755 noconfigdirs="$noconfigdirs target-libffi"
758 noconfigdirs="$noconfigdirs target-libffi"
761 noconfigdirs="$noconfigdirs target-libffi"
764 noconfigdirs="$noconfigdirs target-libffi"
767 noconfigdirs="$noconfigdirs target-libffi"
770 noconfigdirs="$noconfigdirs target-libffi"
773 noconfigdirs="$noconfigdirs target-libffi"
776 noconfigdirs="$noconfigdirs target-libffi"
779 noconfigdirs="$noconfigdirs target-libffi"
782 noconfigdirs="$noconfigdirs target-libffi"
784 cris-*-* | crisv32-*-*)
788 *) # See PR46792 regarding target-libffi.
789 noconfigdirs="$noconfigdirs target-libffi";;
793 noconfigdirs="$noconfigdirs target-libffi"
798 noconfigdirs="$noconfigdirs target-libffi"
801 noconfigdirs="$noconfigdirs target-libffi"
803 i[[3456789]]86-w64-mingw*)
804 noconfigdirs="$noconfigdirs target-libffi"
806 i[[3456789]]86-*-mingw*)
807 noconfigdirs="$noconfigdirs target-libffi"
810 noconfigdirs="$noconfigdirs target-libffi"
813 noconfigdirs="$noconfigdirs target-libffi"
820 noconfigdirs="$noconfigdirs target-libffi"
823 noconfigdirs="$noconfigdirs target-libffi"
827 # Disable the go frontend on systems where it is known to not work. Please keep
828 # this in sync with contrib/config-list.mk.
830 *-*-darwin* | *-*-cygwin* | *-*-mingw* | bpf-* )
831 unsupported_languages="$unsupported_languages go"
835 # Only allow gdbserver on some systems.
836 if test -d ${srcdir}/gdbserver; then
837 if test x$enable_gdbserver = x; then
838 AC_MSG_CHECKING([for gdbserver support])
839 if (srcdir=${srcdir}/gdbserver; \
840 . ${srcdir}/configure.srv; \
841 test -n "$UNSUPPORTED")
844 noconfigdirs="$noconfigdirs gdbserver"
851 # Disable libgo for some systems where it is known to not work.
852 # For testing, you can easily override this with --enable-libgo.
853 if test x$enable_libgo = x; then
857 noconfigdirs="$noconfigdirs target-libgo"
859 *-*-cygwin* | *-*-mingw*)
860 noconfigdirs="$noconfigdirs target-libgo"
863 noconfigdirs="$noconfigdirs target-libgo"
868 # Default libgloss CPU subdirectory.
869 libgloss_dir="$target_cpu"
872 sh*-*-pe|mips*-*-pe|*arm-wince-pe)
881 cris-*-* | crisv32-*-*)
891 libgloss_dir=loongarch
893 m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)
913 # Disable newlib and libgloss for various target OSes.
916 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
918 i[[3456789]]86-*-linux*)
919 # This section makes it possible to build newlib natively on linux.
920 # If we are using a cross compiler then don't configure newlib.
921 if test x${is_cross_compiler} != xno ; then
922 noconfigdirs="$noconfigdirs target-newlib"
924 noconfigdirs="$noconfigdirs target-libgloss"
925 # If we are not using a cross compiler, do configure newlib.
926 # Note however, that newlib will only be configured in this situation
927 # if the --with-newlib option has been given, because otherwise
928 # 'target-newlib' will appear in skipdirs.
930 i[[3456789]]86-*-rdos*)
931 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
933 sh*-*-pe|mips*-*-pe|arm-wince-pe)
934 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
937 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
940 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
943 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
946 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
949 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
952 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
955 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
957 *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
958 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
961 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
964 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
967 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
970 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
973 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
976 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
979 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
987 noconfigdirs="$noconfigdirs ld gas gdb gprof"
988 noconfigdirs="$noconfigdirs sim target-rda"
993 noconfigdirs="$noconfigdirs ld gas gdb gprof"
994 noconfigdirs="$noconfigdirs sim target-rda"
997 noconfigdirs="$noconfigdirs ld gas gdb gprof"
998 noconfigdirs="$noconfigdirs sim target-rda"
1000 i[[3456789]]86-*-darwin*)
1001 noconfigdirs="$noconfigdirs ld gprof"
1002 noconfigdirs="$noconfigdirs sim target-rda"
1004 x86_64-*-darwin[[912]]*)
1005 noconfigdirs="$noconfigdirs ld gas gprof"
1006 noconfigdirs="$noconfigdirs sim target-rda"
1009 noconfigdirs="$noconfigdirs ld gas gdb gprof"
1010 noconfigdirs="$noconfigdirs sim target-rda"
1015 if test "x$with_gmp" = x \
1016 && ! test -d ${srcdir}/gmp \
1017 && test -f /usr/local/include/gmp.h; then
1022 # Remove unsupported stuff on all kaOS configurations.
1023 noconfigdirs="$noconfigdirs target-libgloss"
1030 noconfigdirs="$noconfigdirs target-libgloss"
1033 noconfigdirs="$noconfigdirs target-libgloss"
1035 # The tpf target doesn't support gdb yet.
1037 noconfigdirs="$noconfigdirs gdb tcl tk libgui itcl"
1040 noconfigdirs="$noconfigdirs target-rda"
1045 # ld works, but does not support shared libraries.
1046 # gas doesn't generate exception information.
1047 noconfigdirs="$noconfigdirs gas ld"
1050 noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss"
1053 # newlib is not 64 bit ready
1054 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
1057 noconfigdirs="$noconfigdirs target-libobjc target-libbacktrace"
1059 sh*-*-pe|mips*-*-pe|*arm-wince-pe)
1060 noconfigdirs="$noconfigdirs tcl tk itcl libgui sim"
1063 noconfigdirs="$noconfigdirs sim"
1066 noconfigdirs="$noconfigdirs target-libgloss"
1069 noconfigdirs="$noconfigdirs ld target-libgloss"
1072 if test x${with_avrlibc} != xno; then
1073 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
1076 c4x-*-* | tic4x-*-*)
1077 noconfigdirs="$noconfigdirs target-libgloss"
1080 noconfigdirs="$noconfigdirs target-libgloss gdb"
1083 noconfigdirs="$noconfigdirs target-libgloss"
1086 noconfigdirs="$noconfigdirs gdb"
1089 noconfigdirs="$noconfigdirs gdb"
1092 noconfigdirs="$noconfigdirs target-rda gprof"
1095 noconfigdirs="$noconfigdirs"
1098 noconfigdirs="$noconfigdirs target-libgloss"
1101 noconfigdirs="$noconfigdirs target-libgloss"
1103 hppa1.1-*-osf* | hppa1.1-*-bsd* )
1106 noconfigdirs="$noconfigdirs gdb"
1109 noconfigdirs="$noconfigdirs gdb ld"
1117 hppa*-*-openbsd* | \
1123 noconfigdirs="$noconfigdirs ld"
1126 noconfigdirs="$noconfigdirs gdb"
1129 # No gdb support yet.
1130 noconfigdirs="$noconfigdirs readline libgui itcl gdb"
1133 # No ld support yet.
1134 noconfigdirs="$noconfigdirs gdb libgui itcl ld"
1137 # No ld support yet.
1138 noconfigdirs="$noconfigdirs libgui itcl ld"
1140 i[[3456789]]86-w64-mingw*)
1142 i[[3456789]]86-*-mingw*)
1143 target_configdirs="$target_configdirs target-winsup"
1146 target_configdirs="$target_configdirs target-libtermcap target-winsup"
1147 noconfigdirs="$noconfigdirs target-libgloss"
1148 # always build newlib if winsup directory is present.
1149 if test -d "$srcdir/winsup/cygwin"; then
1150 skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
1151 elif test -d "$srcdir/newlib"; then
1152 echo "Warning: winsup/cygwin is missing so newlib can't be built."
1155 i[[3456789]]86-*-pe)
1156 noconfigdirs="$noconfigdirs target-libgloss"
1158 i[[3456789]]86-*-sco3.2v5*)
1159 # The linker does not yet know about weak symbols in COFF,
1160 # and is not configured to handle mixed ELF and COFF.
1161 noconfigdirs="$noconfigdirs ld target-libgloss"
1163 i[[3456789]]86-*-sco*)
1164 noconfigdirs="$noconfigdirs gprof target-libgloss"
1166 i[[3456789]]86-*-solaris2* | x86_64-*-solaris2.1[[0-9]]*)
1167 noconfigdirs="$noconfigdirs target-libgloss"
1169 i[[3456789]]86-*-sysv4*)
1170 noconfigdirs="$noconfigdirs target-libgloss"
1172 i[[3456789]]86-*-beos*)
1173 noconfigdirs="$noconfigdirs gdb"
1175 i[[3456789]]86-*-rdos*)
1176 noconfigdirs="$noconfigdirs gdb"
1179 noconfigdirs="$noconfigdirs gdb"
1182 noconfigdirs="$noconfigdirs sim"
1185 noconfigdirs="$noconfigdirs ld gas gdb gprof sim"
1186 noconfigdirs="$noconfigdirs $target_libraries"
1189 noconfigdirs="$noconfigdirs gdb gprof"
1192 # copied from rs6000-*-* entry
1193 noconfigdirs="$noconfigdirs gprof"
1195 powerpc*-*-winnt* | powerpc*-*-pe*)
1196 target_configdirs="$target_configdirs target-winsup"
1197 noconfigdirs="$noconfigdirs gdb tcl tk target-libgloss itcl"
1198 # always build newlib.
1199 skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
1201 # This is temporary until we can link against shared libraries
1202 powerpcle-*-solaris*)
1203 noconfigdirs="$noconfigdirs gdb sim tcl tk itcl"
1206 noconfigdirs="$noconfigdirs gdb"
1209 noconfigdirs="$noconfigdirs gprof"
1212 noconfigdirs="$noconfigdirs gprof"
1215 noconfigdirs="$noconfigdirs gprof"
1218 noconfigdirs="$noconfigdirs ld binutils gprof target-libgloss"
1221 noconfigdirs="$noconfigdirs gprof"
1223 mips*-sde-elf* | mips*-mti-elf* | mips*-img-elf*)
1224 if test x$with_newlib = xyes; then
1225 noconfigdirs="$noconfigdirs gprof"
1229 noconfigdirs="$noconfigdirs gprof target-libgloss"
1232 noconfigdirs="$noconfigdirs gprof target-libgloss"
1235 noconfigdirs="$noconfigdirs ld gas gprof target-libgloss"
1239 mips*-*-ultrix* | mips*-*-osf* | mips*-*-ecoff* | mips*-*-pe* \
1240 | mips*-*-irix* | mips*-*-lnews* | mips*-*-riscos*)
1241 noconfigdirs="$noconfigdirs ld gas gprof"
1244 noconfigdirs="$noconfigdirs gprof"
1247 noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc"
1254 noconfigdirs="$noconfigdirs target-libgloss" ;;
1258 if test x${is_cross_compiler} = xno ; then
1263 noconfigdirs="$noconfigdirs sim"
1265 tilepro*-*-* | tilegx*-*-*)
1266 noconfigdirs="$noconfigdirs sim"
1269 noconfigdirs="$noconfigdirs bfd binutils gas gdb ld opcodes target-libgloss"
1272 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
1275 noconfigdirs="$noconfigdirs ld"
1277 loongarch*-*-linux*)
1280 noconfigdirs="$noconfigdirs gprof"
1284 # If we aren't building newlib, then don't build libgloss, since libgloss
1285 # depends upon some newlib header files.
1286 case "${noconfigdirs}" in
1287 *target-libgloss*) ;;
1288 *target-newlib*) noconfigdirs="$noconfigdirs target-libgloss" ;;
1291 # Work in distributions that contain no compiler tools, like Autoconf.
1292 host_makefile_frag=/dev/null
1293 if test -d ${srcdir}/config ; then
1295 i[[3456789]]86-*-msdosdjgpp*)
1296 host_makefile_frag="config/mh-djgpp"
1299 ACX_CHECK_CYGWIN_CAT_WORKS
1300 host_makefile_frag="config/mh-cygwin"
1303 host_makefile_frag="config/mh-mingw"
1306 host_makefile_frag="config/mh-alpha-linux"
1309 host_makefile_frag="config/mh-pa-hpux10"
1312 host_makefile_frag="config/mh-pa"
1315 host_makefile_frag="config/mh-pa"
1317 i?86-*-darwin[[89]]* | i?86-*-darwin1[[0-7]]* | powerpc*-*-darwin*)
1318 host_makefile_frag="config/mh-darwin"
1321 host_makefile_frag="config/mh-ppc-aix"
1324 host_makefile_frag="config/mh-ppc-aix"
1329 if test "${build}" != "${host}" ; then
1330 AR_FOR_BUILD=${AR_FOR_BUILD-ar}
1331 AS_FOR_BUILD=${AS_FOR_BUILD-as}
1332 CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
1333 CPP_FOR_BUILD="${CPP_FOR_BUILD-\$(CC_FOR_BUILD) -E}"
1334 CXX_FOR_BUILD=${CXX_FOR_BUILD-g++}
1335 DSYMUTIL_FOR_BUILD=${DSYMUTIL_FOR_BUILD-dsymutil}
1336 GFORTRAN_FOR_BUILD=${GFORTRAN_FOR_BUILD-gfortran}
1337 GOC_FOR_BUILD=${GOC_FOR_BUILD-gccgo}
1338 GDC_FOR_BUILD=${GDC_FOR_BUILD-gdc}
1339 DLLTOOL_FOR_BUILD=${DLLTOOL_FOR_BUILD-dlltool}
1340 LD_FOR_BUILD=${LD_FOR_BUILD-ld}
1341 NM_FOR_BUILD=${NM_FOR_BUILD-nm}
1342 RANLIB_FOR_BUILD=${RANLIB_FOR_BUILD-ranlib}
1343 WINDRES_FOR_BUILD=${WINDRES_FOR_BUILD-windres}
1344 WINDMC_FOR_BUILD=${WINDMC_FOR_BUILD-windmc}
1346 AR_FOR_BUILD="\$(AR)"
1347 AS_FOR_BUILD="\$(AS)"
1348 CC_FOR_BUILD="\$(CC)"
1349 CXX_FOR_BUILD="\$(CXX)"
1350 DSYMUTIL_FOR_BUILD="\$(DSYMUTIL)"
1351 GFORTRAN_FOR_BUILD="\$(GFORTRAN)"
1352 GOC_FOR_BUILD="\$(GOC)"
1353 GDC_FOR_BUILD="\$(GDC)"
1354 DLLTOOL_FOR_BUILD="\$(DLLTOOL)"
1355 LD_FOR_BUILD="\$(LD)"
1356 NM_FOR_BUILD="\$(NM)"
1357 RANLIB_FOR_BUILD="\$(RANLIB)"
1358 WINDRES_FOR_BUILD="\$(WINDRES)"
1359 WINDMC_FOR_BUILD="\$(WINDMC)"
1365 # We must set the default linker to the linker used by gcc for the correct
1366 # operation of libtool. If LD is not defined and we are using gcc, try to
1367 # set the LD default to the ld used by gcc.
1368 if test -z "$LD"; then
1369 if test "$GCC" = yes; then
1372 gcc_prog_ld=`$CC -print-prog-name=ld 2>&1 | tr -d '\015'` ;;
1374 gcc_prog_ld=`$CC -print-prog-name=ld 2>&1` ;;
1376 case $gcc_prog_ld in
1377 # Accept absolute paths.
1378 [[\\/]* | [A-Za-z]:[\\/]*)]
1379 LD="$gcc_prog_ld" ;;
1384 # Check whether -static-libstdc++ -static-libgcc is supported.
1386 if test "$GCC" = yes; then
1387 saved_LDFLAGS="$LDFLAGS"
1389 LDFLAGS="$LDFLAGS -static-libstdc++ -static-libgcc"
1390 AC_MSG_CHECKING([whether g++ accepts -static-libstdc++ -static-libgcc])
1392 AC_LINK_IFELSE([AC_LANG_SOURCE([
1393 #if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
1394 #error -static-libstdc++ not implemented
1397 [AC_MSG_RESULT([yes]); have_static_libs=yes],
1398 [AC_MSG_RESULT([no])])
1401 LDFLAGS="$saved_LDFLAGS"
1406 ACX_PROG_CMP_IGNORE_INITIAL
1408 AC_ARG_ENABLE([bootstrap],
1409 [AS_HELP_STRING([--enable-bootstrap],
1410 [enable bootstrapping @<:@yes if native build@:>@])],,
1411 enable_bootstrap=default)
1413 # Issue errors and warnings for invalid/strange bootstrap combinations.
1414 if test -r $srcdir/gcc/configure; then
1420 case "$have_compiler:$host:$target:$enable_bootstrap" in
1423 # Default behavior. Enable bootstrap if we have a compiler
1424 # and we are in a native configuration.
1425 yes:$build:$build:default)
1426 enable_bootstrap=yes ;;
1429 enable_bootstrap=no ;;
1431 # We have a compiler and we are in a native configuration, bootstrap is ok
1432 yes:$build:$build:yes)
1435 # Other configurations, but we have a compiler. Assume the user knows
1438 AC_MSG_WARN([trying to bootstrap a cross compiler])
1441 # No compiler: if they passed --enable-bootstrap explicitly, fail
1443 AC_MSG_ERROR([cannot bootstrap without a compiler]) ;;
1445 # Fail if wrong command line
1447 AC_MSG_ERROR([invalid option for --enable-bootstrap])
1451 # When bootstrapping with GCC, build stage 1 in C++11 mode to ensure that a
1452 # C++11 compiler can still start the bootstrap. Otherwise, if building GCC,
1453 # require C++11 (or higher).
1454 if test "$enable_bootstrap:$GXX" = "yes:yes"; then
1455 CXX="$CXX -std=c++11"
1456 elif test "$have_compiler" = yes; then
1457 AX_CXX_COMPILE_STDCXX(11)
1459 if test "${build}" != "${host}"; then
1460 AX_CXX_COMPILE_STDCXX(11, [], [], [_FOR_BUILD])
1464 AC_ARG_ENABLE([pgo-build],
1465 [AS_HELP_STRING([--enable-pgo-build[[=lto]]],
1466 [enable the PGO build])],
1467 [enable_pgo_build=$enableval],
1468 [enable_pgo_build=no])
1470 # Issue errors and warnings for invalid/strange PGO build combinations.
1471 case "$have_compiler:$host:$target:$enable_pgo_build" in
1474 # Allow the PGO build only if we aren't building a compiler and
1475 # we are in a native configuration.
1476 no:$build:$build:yes | no:$build:$build:lto) ;;
1478 # Disallow the PGO bootstrap if we are building a compiler.
1479 yes:*:*:yes | yes:*:*:lto)
1480 AC_MSG_ERROR([cannot perform the PGO bootstrap when building a compiler]) ;;
1483 AC_MSG_ERROR([invalid option for --enable-pgo-build])
1487 if test "$enable_pgo_build" != "no"; then
1488 AC_MSG_CHECKING([whether the compiler supports -fprofile-generate])
1489 old_CFLAGS="$CFLAGS"
1490 PGO_BUILD_GEN_CFLAGS="-fprofile-generate"
1491 CFLAGS="$CFLAGS $PGO_BUILD_CFLAGS"
1492 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int foo;])],,
1493 [PGO_BUILD_GEN_CFLAGS=])
1494 CFLAGS="$old_CFLAGS"
1495 if test -n "$PGO_BUILD_GEN_CFLAGS"; then
1496 AC_MSG_RESULT([yes])
1497 PGO_BUILD_USE_CFLAGS="-fprofile-use"
1500 AC_MSG_ERROR([cannot perform the PGO build without -fprofile-generate])
1503 if test "$enable_pgo_build" = "lto"; then
1504 AC_MSG_CHECKING([whether the compiler supports -flto=jobserver -ffat-lto-objects])
1505 old_CFLAGS="$CFLAGS"
1506 PGO_BUILD_LTO_CFLAGS="-flto=jobserver -ffat-lto-objects"
1507 CFLAGS="$CFLAGS $PGO_BUILD_LTO_CFLAGS"
1508 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int foo;])],,
1509 [PGO_BUILD_LTO_CFLAGS=])
1510 CFLAGS="$old_CFLAGS"
1511 if test -n "$PGO_BUILD_LTO_CFLAGS"; then
1512 AC_MSG_RESULT([yes])
1515 AC_MSG_WARN([LTO is disabled for the PGO build])
1519 AC_SUBST(PGO_BUILD_GEN_CFLAGS)
1520 AC_SUBST(PGO_BUILD_USE_CFLAGS)
1521 AC_SUBST(PGO_BUILD_LTO_CFLAGS)
1523 # Used for setting $lt_cv_objdir
1526 # Check for GMP, MPFR and MPC
1527 gmplibs="-lmpc -lmpfr -lgmp"
1531 # Specify a location for mpc
1532 # check for this first so it ends up on the link line before mpfr.
1534 [AS_HELP_STRING([--with-mpc=PATH],
1535 [specify prefix directory for installed MPC package.
1536 Equivalent to --with-mpc-include=PATH/include
1537 plus --with-mpc-lib=PATH/lib])])
1538 AC_ARG_WITH(mpc-include,
1539 [AS_HELP_STRING([--with-mpc-include=PATH],
1540 [specify directory for installed MPC include files])])
1541 AC_ARG_WITH(mpc-lib,
1542 [AS_HELP_STRING([--with-mpc-lib=PATH],
1543 [specify directory for the installed MPC library])])
1545 if test "x$with_mpc" != x; then
1546 gmplibs="-L$with_mpc/lib $gmplibs"
1547 gmpinc="-I$with_mpc/include $gmpinc"
1549 if test "x$with_mpc_include" != x; then
1550 gmpinc="-I$with_mpc_include $gmpinc"
1552 if test "x$with_mpc_lib" != x; then
1553 gmplibs="-L$with_mpc_lib $gmplibs"
1555 if test "x$with_mpc$with_mpc_include$with_mpc_lib" = x && test -d ${srcdir}/mpc; then
1556 gmplibs='-L$$r/$(HOST_SUBDIR)/mpc/src/'"$lt_cv_objdir $gmplibs"
1557 gmpinc='-I$$s/mpc/src '"$gmpinc"
1558 # Do not test the mpc version. Assume that it is sufficient, since
1559 # it is in the source tree, and the library has not been built yet
1560 # but it would be included on the link line in the version check below
1561 # hence making the test fail.
1565 # Specify a location for mpfr
1566 # check for this first so it ends up on the link line before gmp.
1568 [AS_HELP_STRING([--with-mpfr=PATH],
1569 [specify prefix directory for installed MPFR package.
1570 Equivalent to --with-mpfr-include=PATH/include
1571 plus --with-mpfr-lib=PATH/lib])])
1572 AC_ARG_WITH(mpfr-include,
1573 [AS_HELP_STRING([--with-mpfr-include=PATH],
1574 [specify directory for installed MPFR include files])])
1575 AC_ARG_WITH(mpfr-lib,
1576 [AS_HELP_STRING([--with-mpfr-lib=PATH],
1577 [specify directory for the installed MPFR library])])
1579 if test "x$with_mpfr" != x; then
1580 gmplibs="-L$with_mpfr/lib $gmplibs"
1581 gmpinc="-I$with_mpfr/include $gmpinc"
1583 if test "x$with_mpfr_include" != x; then
1584 gmpinc="-I$with_mpfr_include $gmpinc"
1586 if test "x$with_mpfr_lib" != x; then
1587 gmplibs="-L$with_mpfr_lib $gmplibs"
1589 if test "x$with_mpfr$with_mpfr_include$with_mpfr_lib" = x && test -d ${srcdir}/mpfr; then
1590 # MPFR v3.1.0 moved the sources into a src sub-directory.
1591 if ! test -d ${srcdir}/mpfr/src; then
1593 Building GCC with MPFR in the source tree is only handled for MPFR 3.1.0+.])
1595 gmplibs='-L$$r/$(HOST_SUBDIR)/mpfr/src/'"$lt_cv_objdir $gmplibs"
1596 gmpinc='-I$$r/$(HOST_SUBDIR)/mpfr/src -I$$s/mpfr/src '"$gmpinc"
1597 extra_mpc_mpfr_configure_flags='--with-mpfr-include=$$s/mpfr/src --with-mpfr-lib=$$r/$(HOST_SUBDIR)/mpfr/src/'"$lt_cv_objdir"
1598 # Do not test the mpfr version. Assume that it is sufficient, since
1599 # it is in the source tree, and the library has not been built yet
1600 # but it would be included on the link line in the version check below
1601 # hence making the test fail.
1605 # Specify a location for gmp
1608 # The library versions listed in the error message below should match
1609 # the HARD-minimums enforced above.
1612 # Flags needed for both GMP, MPFR and/or MPC.
1615 AC_SUBST(extra_mpfr_configure_flags)
1616 AC_SUBST(extra_mpc_gmp_configure_flags)
1617 AC_SUBST(extra_mpc_mpfr_configure_flags)
1618 AC_SUBST(extra_isl_gmp_configure_flags)
1620 # Libraries to use for stage1 or when not bootstrapping.
1621 AC_ARG_WITH(stage1-libs,
1622 [AS_HELP_STRING([--with-stage1-libs=LIBS], [libraries for stage1])],
1623 [if test "$withval" = "no" -o "$withval" = "yes"; then
1626 stage1_libs=$withval
1629 AC_SUBST(stage1_libs)
1631 # Whether or not to use -static-libstdc++ and -static-libgcc. The
1632 # default is yes if gcc is being built; no otherwise. The reason for
1633 # this default is that gdb is sometimes linked against GNU Source
1634 # Highlight, which is a shared library that uses C++ exceptions. In
1635 # this case, -static-libstdc++ will cause crashes.
1636 AC_ARG_WITH(static-standard-libraries,
1637 [AS_HELP_STRING([--with-static-standard-libraries],
1638 [use -static-libstdc++ and -static-libgcc (default=auto)])],
1639 [], [with_static_standard_libraries=auto])
1640 if test "$with_static_standard_libraries" = auto; then
1641 with_static_standard_libraries=$have_compiler
1644 # Linker flags to use for stage1 or when not bootstrapping.
1645 AC_ARG_WITH(stage1-ldflags,
1646 [AS_HELP_STRING([--with-stage1-ldflags=FLAGS], [linker flags for stage1])],
1647 [if test "$withval" = "no" -o "$withval" = "yes"; then
1650 stage1_ldflags=$withval
1653 # In stage 1, default to linking libstdc++ and libgcc statically with GCC
1654 # if supported. But if the user explicitly specified the libraries to use,
1655 # trust that they are doing what they want.
1656 if test "$with_static_standard_libraries" = yes -a "$stage1_libs" = "" \
1657 -a "$have_static_libs" = yes; then
1658 stage1_ldflags="-static-libstdc++ -static-libgcc"
1660 AC_SUBST(stage1_ldflags)
1662 # Libraries to use for stage2 and later builds.
1663 AC_ARG_WITH(boot-libs,
1664 [AS_HELP_STRING([--with-boot-libs=LIBS], [libraries for stage2 and later])],
1665 [if test "$withval" = "no" -o "$withval" = "yes"; then
1668 poststage1_libs=$withval
1671 AC_SUBST(poststage1_libs)
1673 # Linker flags to use for stage2 and later builds.
1674 AC_ARG_WITH(boot-ldflags,
1675 [AS_HELP_STRING([--with-boot-ldflags=FLAGS],
1676 [linker flags for stage2 and later])],
1677 [if test "$withval" = "no" -o "$withval" = "yes"; then
1680 poststage1_ldflags=$withval
1682 [poststage1_ldflags=
1683 # In stages 2 and 3, default to linking libstdc++ and libgcc
1684 # statically. But if the user explicitly specified the libraries to
1685 # use, trust that they are doing what they want.
1686 if test "$poststage1_libs" = ""; then
1687 poststage1_ldflags="-static-libstdc++ -static-libgcc"
1689 AC_SUBST(poststage1_ldflags)
1691 # GCC GRAPHITE dependency isl.
1692 # Basic setup is inlined here, actual checks are in config/isl.m4
1697 [Specify prefix directory for the installed isl package.
1698 Equivalent to --with-isl-include=PATH/include
1699 plus --with-isl-lib=PATH/lib])])
1701 # Treat --without-isl as a request to disable
1702 # GRAPHITE support and skip all following checks.
1703 if test "x$with_isl" != "xno"; then
1705 dnl Provide configure switches and initialize islinc & isllibs
1706 dnl with user input.
1708 dnl The versions of isl that work for Graphite
1710 dnl Only execute fail-action, if isl has been requested.
1712 AC_MSG_ERROR([Unable to find a usable isl. See config.log for details.])])
1715 # If the isl check failed, disable builds of in-tree variant of isl
1716 if test "x$with_isl" = xno ||
1717 test "x$gcc_cv_isl" = xno; then
1718 noconfigdirs="$noconfigdirs isl"
1725 # Check for LTO support.
1727 [AS_HELP_STRING([--enable-lto], [enable link time optimization support])],
1728 enable_lto=$enableval,
1729 enable_lto=yes; default_enable_lto=yes)
1731 ACX_ELF_TARGET_IFELSE([# ELF platforms build the lto-plugin always.
1732 build_lto_plugin=yes
1733 ],[if test x"$default_enable_lto" = x"yes" ; then
1735 *-apple-darwin[[912]]* | *-cygwin* | *-mingw* | *djgpp*) ;;
1736 # On other non-ELF platforms, LTO has yet to be validated.
1740 # Apart from ELF platforms, only Windows and Darwin support LTO so far.
1741 # It would also be nice to check the binutils support, but we don't
1742 # have gcc_GAS_CHECK_FEATURE available here. For now, we'll just
1743 # warn during gcc/ subconfigure; unless you're bootstrapping with
1744 # -flto it won't be needed until after installation anyway.
1746 *-cygwin* | *-mingw* | *-apple-darwin* | *djgpp*) ;;
1747 *) if test x"$enable_lto" = x"yes"; then
1748 AC_MSG_ERROR([LTO support is not enabled for this target.])
1753 # Among non-ELF, only Windows platforms support the lto-plugin so far.
1754 # Build it unless LTO was explicitly disabled.
1756 *-cygwin* | *-mingw*) build_lto_plugin=$enable_lto ;;
1761 AC_ARG_ENABLE(linker-plugin-configure-flags,
1762 [AS_HELP_STRING([[--enable-linker-plugin-configure-flags=FLAGS]],
1763 [additional flags for configuring linker plugins @<:@none@:>@])],
1764 extra_linker_plugin_configure_flags=$enableval,
1765 extra_linker_plugin_configure_flags=)
1766 AC_SUBST(extra_linker_plugin_configure_flags)
1767 AC_ARG_ENABLE(linker-plugin-flags,
1768 [AS_HELP_STRING([[--enable-linker-plugin-flags=FLAGS]],
1769 [additional flags for configuring and building linker plugins @<:@none@:>@])],
1770 extra_linker_plugin_flags=$enableval,
1771 extra_linker_plugin_flags=)
1772 AC_SUBST(extra_linker_plugin_flags)
1774 # Enable --enable-host-shared.
1775 # Checked early to determine whether jit is an 'all' language
1776 AC_ARG_ENABLE(host-shared,
1777 [AS_HELP_STRING([--enable-host-shared],
1778 [build host code as shared libraries])],
1779 [host_shared=$enableval
1781 x86_64-*-darwin* | aarch64-*-darwin*)
1782 if test x$host_shared != xyes ; then
1783 # PIC is the default, and actually cannot be switched off.
1784 echo configure.ac: warning: PIC code is required for the configured target, host-shared setting ignored. 1>&2
1790 x86_64-*-darwin* | aarch64-*-darwin*) host_shared=yes ;;
1791 *) host_shared=no ;;
1793 AC_SUBST(host_shared)
1795 # By default, C and C++ are the only stage 1 languages.
1796 stage1_languages=,c,
1798 # Target libraries that we bootstrap.
1799 bootstrap_target_libs=,target-libgcc,
1801 # Figure out what language subdirectories are present.
1802 # Look if the user specified --enable-languages="..."; if not, use
1803 # the environment variable $LANGUAGES if defined. $LANGUAGES might
1805 # NB: embedded tabs in this IF block -- do not untabify
1806 if test -d ${srcdir}/gcc; then
1807 if test x"${enable_languages+set}" != xset; then
1808 if test x"${LANGUAGES+set}" = xset; then
1809 enable_languages="${LANGUAGES}"
1810 echo configure.ac: warning: setting LANGUAGES is deprecated, use --enable-languages instead 1>&2
1812 enable_languages=default
1815 if test x"${enable_languages}" = x ||
1816 test x"${enable_languages}" = xyes;
1818 echo configure.ac: --enable-languages needs at least one language argument 1>&2
1822 enable_languages=`echo "${enable_languages}" | sed -e 's/[[ ,]][[ ,]]*/,/g' -e 's/,$//'`
1824 # 'f95' is the old name for the 'fortran' language. We issue a warning
1825 # and make the substitution.
1826 case ,${enable_languages}, in
1828 echo configure.ac: warning: 'f95' as language name is deprecated, use 'fortran' instead 1>&2
1829 enable_languages=`echo "${enable_languages}" | sed -e 's/f95/fortran/g'`
1833 # If bootstrapping, C++ must be enabled.
1834 case ",$enable_languages,:$enable_bootstrap" in
1837 if test -f ${srcdir}/gcc/c/c-lang.cc; then
1838 enable_languages="${enable_languages},c++"
1840 AC_MSG_ERROR([bootstrapping requires c++ sources])
1845 # First scan to see if an enabled language requires some other language.
1846 # We assume that a given config-lang.in will list all the language
1847 # front ends it requires, even if some are required indirectly.
1848 for lang_frag in ${srcdir}/gcc/*/config-lang.in .. ; do
1849 case ${lang_frag} in
1851 # The odd quoting in the next line works around
1852 # an apparent bug in bash 1.12 on linux.
1853 ${srcdir}/gcc/[[*]]/config-lang.in) ;;
1855 # From the config-lang.in, get $language, $lang_requires, and
1856 # $lang_requires_boot_languages.
1859 lang_requires_boot_languages=
1860 # set srcdir during sourcing lang_frag to the gcc dir.
1861 # Sadly overriding srcdir on the . line doesn't work in plain sh as it
1862 # polutes this shell
1863 saved_srcdir=${srcdir}
1864 srcdir=${srcdir}/gcc . ${lang_frag}
1865 srcdir=${saved_srcdir}
1866 for other in ${lang_requires} ${lang_requires_boot_languages}; do
1867 case ,${enable_languages}, in
1872 echo " \`$other' language required by \`$language'; enabling" 1>&2
1873 enable_languages="${enable_languages},${other}"
1877 for other in ${lang_requires_boot_languages} ; do
1878 if test "$other" != "c"; then
1879 case ,${enable_stage1_languages}, in
1884 case ,${enable_languages}, in
1886 echo " '$other' language required by '$language' in stage 1; enabling" 1>&2
1887 enable_stage1_languages="$enable_stage1_languages,${other}"
1898 new_enable_languages=,c,
1900 # If LTO is enabled, add the LTO front end.
1901 if test "$enable_lto" = "yes" ; then
1902 case ,${enable_languages}, in
1904 *) enable_languages="${enable_languages},lto" ;;
1906 if test "${build_lto_plugin}" = "yes" ; then
1907 configdirs="$configdirs lto-plugin"
1911 # If we're building an offloading compiler, add the LTO front end.
1912 if test x"$enable_as_accelerator_for" != x ; then
1913 case ,${enable_languages}, in
1915 *) enable_languages="${enable_languages},lto" ;;
1919 missing_languages= # `echo ",$enable_languages," | sed -e s/,default,/,/ -e s/,all,/,/ -e s/,c,/,/ `
1920 potential_languages=,c,
1922 enabled_target_libs=
1923 disabled_target_libs=
1925 for lang_frag in ${srcdir}/gcc/*/config-lang.in .. ; do
1926 case ${lang_frag} in
1928 # The odd quoting in the next line works around
1929 # an apparent bug in bash 1.12 on linux.
1930 ${srcdir}/gcc/[[*]]/config-lang.in) ;;
1932 # From the config-lang.in, get $language, $target_libs,
1933 # $lang_dirs, $boot_language, and $build_by_default
1939 build_by_default=yes
1940 # set srcdir during sourcing. See above about save & restore
1941 saved_srcdir=${srcdir}
1942 srcdir=${srcdir}/gcc . ${lang_frag}
1943 srcdir=${saved_srcdir}
1944 if test x${language} = x; then
1945 echo "${lang_frag} doesn't set \$language." 1>&2
1949 if test "$language" = "c++"; then
1954 # C is always enabled, so no need to add it again
1955 if test "$language" != "c"; then
1956 case ,${enable_languages}, in
1958 # Language was explicitly selected; include it
1962 # All languages are enabled
1966 # 'default' was selected, select it if it is a default language
1967 add_this_lang=${build_by_default}
1972 # Disable languages that need other directories if these aren't available.
1973 for i in $subdir_requires; do
1974 test -f "$srcdir/gcc/$i/config-lang.in" && continue
1975 case ${add_this_lang} in
1977 # Specifically requested language; tell them.
1978 AC_MSG_ERROR([The gcc/$i directory contains parts of $language but is missing])
1981 AC_MSG_WARN([The gcc/$i directory contains parts of $language but is missing])
1982 add_this_lang=unsupported
1986 add_this_lang=unsupported
1991 # Disable Ada if no preexisting GNAT is available.
1992 case ${add_this_lang}:${language}:${have_gnat} in
1994 # Specifically requested language; tell them.
1995 AC_MSG_ERROR([GNAT is required to build $language])
1998 AC_MSG_WARN([GNAT is required to build $language])
1999 add_this_lang=unsupported
2003 add_this_lang=unsupported
2007 # Disable D if no preexisting GDC is available.
2008 case ${add_this_lang}:${language}:${have_gdc} in
2010 # Specifically requested language; tell them.
2011 AC_MSG_ERROR([GDC is required to build $language])
2014 AC_MSG_WARN([GDC is required to build $language])
2015 add_this_lang=unsupported
2019 add_this_lang=unsupported
2023 # Disable jit if -enable-host-shared not specified
2024 # but not if building for Mingw. All code in Windows
2025 # is position independent code (PIC).
2029 case ${add_this_lang}:${language}:${host_shared} in
2031 # PR jit/64780: explicitly specify --enable-host-shared
2033 Enabling language "jit" requires --enable-host-shared.
2035 --enable-host-shared typically slows the rest of the compiler down by
2036 a few %, so you must explicitly enable it.
2038 If you want to build both the jit and the regular compiler, it is often
2039 best to do this via two separate configure/builds, in separate
2040 directories, to avoid imposing the performance cost of
2041 --enable-host-shared on the regular compiler.])
2044 AC_MSG_WARN([--enable-host-shared required to build $language])
2045 add_this_lang=unsupported
2049 add_this_lang=unsupported
2055 # Disable a language that is unsupported by the target.
2056 case "${add_this_lang}: $unsupported_languages " in
2060 AC_MSG_WARN([${language} not supported for this target])
2061 add_this_lang=unsupported
2065 case $add_this_lang in
2067 # Remove language-dependent dirs.
2068 disabled_target_libs="$disabled_target_libs $target_libs"
2069 noconfigdirs="$noconfigdirs $lang_dirs"
2072 # Remove language-dependent dirs; still show language as supported.
2073 disabled_target_libs="$disabled_target_libs $target_libs"
2074 noconfigdirs="$noconfigdirs $lang_dirs"
2075 potential_languages="${potential_languages}${language},"
2078 new_enable_languages="${new_enable_languages}${language},"
2079 potential_languages="${potential_languages}${language},"
2080 missing_languages=`echo "$missing_languages" | sed "s/,$language,/,/"`
2081 enabled_target_libs="$enabled_target_libs $target_libs"
2082 case "${boot_language}:,$enable_stage1_languages," in
2083 yes:* | *:*,$language,* | *:*,yes, | *:*,all,)
2084 # Add to (comma-separated) list of stage 1 languages.
2085 case ",$stage1_languages," in
2086 *,$language,* | ,yes, | ,all,) ;;
2087 *) stage1_languages="${stage1_languages}${language}," ;;
2089 # We need to bootstrap any supporting libraries.
2090 bootstrap_target_libs=`echo "${bootstrap_target_libs}${target_libs}," | sed "s/ /,/g"`
2099 # Add target libraries which are only needed for disabled languages
2101 if test -n "$disabled_target_libs"; then
2102 for dir in $disabled_target_libs; do
2103 case " $enabled_target_libs " in
2105 *) noconfigdirs="$noconfigdirs $dir" ;;
2110 AC_ARG_ENABLE(stage1-languages,
2111 [AS_HELP_STRING([[--enable-stage1-languages[=all]]],
2112 [choose additional languages to build during
2113 stage1. Mostly useful for compiler development])],
2114 [case ,${enable_stage1_languages}, in
2116 # Set it to something that will have no effect in the loop below
2117 enable_stage1_languages=c ;;
2119 enable_stage1_languages=`echo $new_enable_languages | \
2120 sed -e "s/^,//" -e "s/,$//" ` ;;
2122 enable_stage1_languages=`echo ,$enable_stage1_languages, | \
2123 sed -e "s/,all,/$new_enable_languages/" -e "s/^,//" -e "s/,$//" ` ;;
2126 # Add "good" languages from enable_stage1_languages to stage1_languages,
2127 # while "bad" languages go in missing_languages. Leave no duplicates.
2128 for i in `echo $enable_stage1_languages | sed 's/,/ /g' `; do
2129 case $potential_languages in
2131 case $stage1_languages in
2133 *) stage1_languages="$stage1_languages$i," ;;
2136 case $missing_languages in
2138 *) missing_languages="$missing_languages$i," ;;
2143 # Remove leading/trailing commas that were added for simplicity
2144 potential_languages=`echo "$potential_languages" | sed -e "s/^,//" -e "s/,$//"`
2145 missing_languages=`echo "$missing_languages" | sed -e "s/^,//" -e "s/,$//"`
2146 stage1_languages=`echo "$stage1_languages" | sed -e "s/^,//" -e "s/,$//"`
2147 new_enable_languages=`echo "$new_enable_languages" | sed -e "s/^,//" -e "s/,$//"`
2149 if test "x$missing_languages" != x; then
2151 The following requested languages could not be built: ${missing_languages}
2152 Supported languages are: ${potential_languages}])
2154 if test "x$new_enable_languages" != "x$enable_languages"; then
2155 echo The following languages will be built: ${new_enable_languages}
2156 enable_languages="$new_enable_languages"
2159 AC_SUBST(stage1_languages)
2160 ac_configure_args=`echo " $ac_configure_args" | sed -e "s/ '--enable-languages=[[^ ]]*'//g" -e "s/$/ '--enable-languages="$enable_languages"'/" `
2163 # Handle --disable-<component> generically.
2164 for dir in $configdirs $build_configdirs $target_configdirs ; do
2165 dirname=`echo $dir | sed -e s/target-//g -e s/build-//g -e s/-/_/g`
2166 varname=`echo $dirname | sed -e s/+/_/g`
2167 if eval test x\${enable_${varname}} "=" xno ; then
2168 noconfigdirs="$noconfigdirs $dir"
2172 # Check for Boehm's garbage collector
2175 # Disable libitm, libsanitizer, libvtv, liboffloadmic if we're not building C++
2178 # If gcc/ is not in the source tree then we'll not be building a
2179 # target compiler, assume in that case we don't want to build any
2180 # target libraries or tools.
2182 # This was added primarily for the benefit for binutils-gdb who reuse
2183 # this configure script, but don't always have target tools available.
2184 if test ! -d ${srcdir}/gcc; then
2185 skipdirs="${skipdirs} ${target_configdirs}"
2188 # Remove the entries in $skipdirs and $noconfigdirs from $configdirs,
2189 # $build_configdirs and $target_configdirs.
2190 # If we have the source for $noconfigdirs entries, add them to $notsupp.
2193 # Quietly strip out all directories which aren't configurable in this tree.
2194 # This relies on all configurable subdirectories being autoconfiscated, which
2198 # libiberty-linker-plugin is special: it doesn't have its own source directory,
2199 # so we have to add it after the preceding checks.
2202 # Sometimes we have special requirements for the host libiberty.
2205 # Produce a warning message for the subdirs we can't configure.
2206 # This isn't especially interesting in the Cygnus tree, but in the individual
2207 # FSF releases, it's important to let people know when their machine isn't
2208 # supported by the one or two programs in a package.
2211 # During gcc bootstrap, if we use some random cc for stage1 then CFLAGS
2212 # might be empty or "-g". We don't require a C++ compiler, so CXXFLAGS
2213 # might also be empty (or "-g", if a non-GCC C++ compiler is in the path).
2214 # We want to ensure that TARGET libraries (which we know are built with
2215 # gcc) are built with "-O2 -g", so include those options when setting
2216 # CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET.
2219 # Handle --with-headers=XXX. If the value is not "yes", the contents of
2220 # the named directory are copied to $(tooldir)/sys-include.
2223 # Handle --with-libs=XXX. If the value is not "yes", the contents of
2224 # the name directories are copied to $(tooldir)/lib. Multiple directories
2228 # Set with_gnu_as, with_gnu_ld, and with_system_zlib as appropriate.
2230 # This is done by determining whether or not the appropriate directory
2231 # is available, and by checking whether or not specific configurations
2232 # have requested that this magic not happen.
2234 # The command line options always override the explicit settings in
2235 # configure.ac, and the settings in configure.ac override this magic.
2237 # If the default for a toolchain is to use GNU as and ld, and you don't
2238 # want to do that, then you should use the --without-gnu-as and
2239 # --without-gnu-ld options for the configure script. Similarly, if
2240 # the default is to use the included zlib and you don't want to do that,
2241 # you should use the --with-system-zlib option for the configure script.
2243 if test x${use_gnu_as} = x &&
2244 echo " ${configdirs} " | grep " gas " > /dev/null 2>&1 ; then
2246 extra_host_args="$extra_host_args --with-gnu-as"
2249 if test x${use_gnu_ld} = x &&
2250 echo " ${configdirs} " | egrep " (go)?ld " > /dev/null 2>&1 ; then
2252 extra_host_args="$extra_host_args --with-gnu-ld"
2255 if test x${use_included_zlib} = x &&
2256 echo " ${configdirs} " | grep " zlib " > /dev/null 2>&1 ; then
2259 with_system_zlib=yes
2260 extra_host_args="$extra_host_args --with-system-zlib"
2263 # If using newlib, add --with-newlib to the extra_host_args so that gcc/configure
2264 # can detect this case.
2266 if test x${with_newlib} != xno && echo " ${target_configdirs} " | grep " target-newlib " > /dev/null 2>&1 ; then
2268 extra_host_args="$extra_host_args --with-newlib"
2271 # Handle ${copy_dirs}
2272 set fnord ${copy_dirs}
2274 while test $# != 0 ; do
2275 if test -f $2/COPIED && test x"`cat $2/COPIED`" = x"$1" ; then
2278 echo Copying $1 to $2
2280 # Use the install script to create the directory and all required
2281 # parent directories.
2282 if test -d $2 ; then
2286 ${srcdir}/install-sh -c -m 644 config.temp $2/COPIED
2289 # Copy the directory, assuming we have tar.
2290 # FIXME: Should we use B in the second tar? Not all systems support it.
2291 (cd $1; tar -cf - .) | (cd $2; tar -xpf -)
2293 # It is the responsibility of the user to correctly adjust all
2294 # symlinks. If somebody can figure out how to handle them correctly
2295 # here, feel free to add the code.
2302 # Determine a target-dependent exec_prefix that the installed
2303 # gcc will search in. Keep this list sorted by triplet, with
2304 # the *-*-osname triplets last.
2307 i[[34567]]86-pc-msdosdjgpp*)
2308 md_exec_prefix=/dev/env/DJDIR/bin
2313 md_exec_prefix=/usr/ccs/bin
2317 ################################################################################
2319 # mkdir takes a single argument on some systems.
2320 gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG
2330 build_install_headers_dir=install-headers-tar
2335 host_truncate_target=
2338 # Decode the host machine, then the target machine.
2339 # For the host machine, we save the xm_file variable as host_xm_file;
2340 # then we decode the target machine and forget everything else
2341 # that came from the host machine.
2342 #for machine in $build $host $target; do
2343 # . ${srcdir}/config.gcc
2346 extra_objs="${host_extra_objs} ${extra_objs}"
2348 # Default the target-machine variables that were not explicitly set.
2349 if test x"$tm_file" = x
2350 then tm_file=$cpu_type/$cpu_type.h; fi
2352 if test x"$extra_headers" = x
2353 then extra_headers=; fi
2355 if test x$md_file = x
2356 then md_file=$cpu_type/$cpu_type.md; fi
2358 if test x$out_file = x
2359 then out_file=$cpu_type/$cpu_type.c; fi
2361 if test x"$tmake_file" = x
2362 then tmake_file=$cpu_type/t-$cpu_type
2365 if test x"$dwarf2" = xyes
2366 then tm_file="$tm_file tm-dwarf2.h"
2369 # Handle cpp installation.
2370 if test x$enable_cpp != xno
2372 tmake_file="$tmake_file t-install-cpp"
2375 # auto-host.h is the file containing items generated by autoconf and is
2376 # the first file included by config.h.
2377 # If host=build, it is correct to have hconfig include auto-host.h
2378 # as well. If host!=build, we are in error and need to do more
2379 # work to find out the build config parameters.
2380 if test x$host = x$build
2382 build_auto=auto-host.h
2384 # We create a subdir, then run autoconf in the subdir.
2385 # To prevent recursion we set host and build for the new
2386 # invocation of configure to the build for this invocation
2393 /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};;
2394 *) realsrcdir=../${srcdir};;
2396 CC=${CC_FOR_BUILD} ${realsrcdir}/configure \
2397 --target=$target --host=$build --build=$build
2399 # We just finished tests for the build machine, so rename
2400 # the file auto-build.h in the gcc directory.
2401 mv auto-host.h ../auto-build.h
2404 build_auto=auto-build.h
2407 tm_file="${tm_file} defaults.h"
2408 host_xm_file="auto-host.h ansidecl.h ${host_xm_file} ${tm_file}"
2409 build_xm_file="${build_auto} ansidecl.h ${build_xm_file} ${tm_file}"
2410 xm_file="ansidecl.h ${xm_file} ${tm_file}"
2412 # Truncate the target if necessary
2413 if test x$host_truncate_target != x; then
2414 target=`echo $target | sed -e 's/\(..............\).*/\1/'`
2417 # Get the version trigger filename from the toplevel
2418 if test "${with_gcc_version_trigger+set}" = set; then
2419 gcc_version_trigger=$with_gcc_version_trigger
2421 gcc_version_trigger=${srcdir}/version.c
2424 ## changequote(,)dnl
2425 ## gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*"\([^"]*\)".*/\1/'`
2426 ## gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
2428 ## changequote([,])dnl
2430 ## # Internationalization
2432 ## VERSION="$gcc_version"
2433 ## AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE",
2434 ## [Define to the name of the distribution.])
2435 ## AC_DEFINE_UNQUOTED(VERSION, "$VERSION",
2436 ## [Define to the version of the distribution.])
2437 ## AC_SUBST(PACKAGE)
2438 ## AC_SUBST(VERSION)
2440 extra_arflags_for_target=
2441 extra_nmflags_for_target=
2442 extra_ranlibflags_for_target=
2443 target_makefile_frag=/dev/null
2446 target_makefile_frag="config/mt-spu"
2448 mips*-sde-elf* | mips*-mti-elf* | mips*-img-elf*)
2449 target_makefile_frag="config/mt-sde"
2451 mipsisa*-*-elfoabi*)
2452 target_makefile_frag="config/mt-mips-elfoabi"
2454 mips*-*-*linux* | mips*-*-gnu*)
2455 target_makefile_frag="config/mt-mips-gnu"
2458 target_makefile_frag="config/mt-nios2-elf"
2461 target_makefile_frag="config/mt-android"
2463 *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
2464 target_makefile_frag="config/mt-gnu"
2466 *-*-aix4.[[3456789]]* | *-*-aix[[56789]].*)
2467 # nm and ar from AIX 4.3 and above require -X32_64 flag to all ar and nm
2468 # commands to handle both 32-bit and 64-bit objects. These flags are
2469 # harmless if we're using GNU nm or ar.
2470 extra_arflags_for_target=" -X32_64"
2471 extra_nmflags_for_target=" -B -X32_64"
2475 alphaieee_frag=/dev/null
2478 # This just makes sure to use the -mieee option to build target libs.
2479 # This should probably be set individually by each library.
2480 alphaieee_frag="config/mt-alphaieee"
2484 # If --enable-target-optspace always use -Os instead of -O2 to build
2485 # the target libraries, similarly if it is not specified, use -Os
2486 # on selected platforms.
2487 ospace_frag=/dev/null
2488 case "${enable_target_optspace}:${target}" in
2490 ospace_frag="config/mt-ospace"
2493 ospace_frag="config/mt-d30v"
2495 :m32r-* | :d10v-* | :fr30-* | :i?86*-*-elfiamcu)
2496 ospace_frag="config/mt-ospace"
2501 echo "*** bad value \"${enable_target_optspace}\" for --enable-target-optspace flag; ignored" 1>&2
2505 # Some systems (e.g., one of the i386-aix systems the gas testers are
2506 # using) don't handle "\$" correctly, so don't use it here.
2507 tooldir='${exec_prefix}'/${target_noncanonical}
2508 build_tooldir=${tooldir}
2510 # Create a .gdbinit file which runs the one in srcdir
2511 # and tells GDB to look there for source files.
2513 if test -r ${srcdir}/.gdbinit ; then
2516 *) cat > ./.gdbinit <<EOF
2520 source ${srcdir}/.gdbinit
2526 # Make sure that the compiler is able to generate an executable. If it
2527 # can't, we are probably in trouble. We don't care whether we can run the
2528 # executable--we might be using a cross compiler--we only care whether it
2529 # can be created. At this point the main configure script has set CC.
2531 echo "int main () { return 0; }" > conftest.c
2532 ${CC} -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c
2533 if test $? = 0 ; then
2534 if test -s conftest || test -s conftest.exe ; then
2540 echo 1>&2 "*** The command '${CC} -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c' failed."
2541 echo 1>&2 "*** You must set the environment variable CC to a working compiler."
2548 # Decide which environment variable is used to find dynamic libraries.
2550 *-*-hpux*) RPATH_ENVVAR=SHLIB_PATH ;;
2551 *-*-darwin*) RPATH_ENVVAR=DYLD_LIBRARY_PATH ;;
2552 *-*-mingw* | *-*-cygwin ) RPATH_ENVVAR=PATH ;;
2553 *) RPATH_ENVVAR=LD_LIBRARY_PATH ;;
2556 # On systems where the dynamic library environment variable is PATH,
2557 # gcc/ will put dynamic libraries into a subdirectory to avoid adding
2558 # built executables to PATH.
2559 if test "$RPATH_ENVVAR" = PATH; then
2560 GCC_SHLIB_SUBDIR=/shlib
2565 # Adjust the toplevel makefile according to whether bootstrap was selected.
2566 case $enable_bootstrap in
2568 bootstrap_suffix=bootstrap
2569 BUILD_CONFIG=bootstrap-debug
2572 bootstrap_suffix=no-bootstrap
2577 AC_MSG_CHECKING(for default BUILD_CONFIG)
2579 AC_ARG_WITH([build-config],
2580 [AS_HELP_STRING([--with-build-config='NAME NAME2...'],
2581 [use config/NAME.mk build configuration])],
2582 [case $with_build_config in
2583 yes) with_build_config= ;;
2584 no) with_build_config= BUILD_CONFIG= ;;
2587 if test "x${with_build_config}" != x; then
2588 BUILD_CONFIG=$with_build_config
2590 case $BUILD_CONFIG in
2592 if echo "int f (void) { return 0; }" > conftest.c &&
2593 ${CC} -c conftest.c &&
2594 mv conftest.o conftest.o.g0 &&
2595 ${CC} -c -g conftest.c &&
2596 mv conftest.o conftest.o.g &&
2597 ${srcdir}/contrib/compare-debug conftest.o.g0 conftest.o.g > /dev/null 2>&1; then
2602 rm -f conftest.c conftest.o conftest.o.g0 conftest.o.g
2606 AC_MSG_RESULT($BUILD_CONFIG)
2607 AC_SUBST(BUILD_CONFIG)
2609 # Use same top-level configure hooks in libgcc/libstdc++/libvtv.
2610 AC_MSG_CHECKING([for --enable-vtable-verify])
2611 AC_ARG_ENABLE(vtable-verify,
2612 [AS_HELP_STRING([--enable-vtable-verify],
2613 [Enable vtable verification feature])],
2614 [case "$enableval" in
2615 yes) enable_vtable_verify=yes ;;
2616 no) enable_vtable_verify=no ;;
2617 *) enable_vtable_verify=no;;
2619 [enable_vtable_verify=no])
2620 AC_MSG_RESULT($enable_vtable_verify)
2622 # Record target_configdirs and the configure arguments for target and
2623 # build configuration in Makefile.
2624 target_configdirs=`echo "${target_configdirs}" | sed -e 's/target-//g'`
2625 build_configdirs=`echo "${build_configdirs}" | sed -e 's/build-//g'`
2626 bootstrap_fixincludes=no
2628 # If we are building libgomp, bootstrap it.
2629 if echo " ${target_configdirs} " | grep " libgomp " > /dev/null 2>&1 ; then
2630 bootstrap_target_libs=${bootstrap_target_libs}target-libgomp,
2633 # If we are building libsanitizer and $BUILD_CONFIG contains bootstrap-asan
2634 # or bootstrap-ubsan, bootstrap it.
2635 if echo " ${target_configdirs} " | grep " libsanitizer " > /dev/null 2>&1; then
2636 case "$BUILD_CONFIG" in
2637 *bootstrap-hwasan* | *bootstrap-asan* | *bootstrap-ubsan* )
2638 bootstrap_target_libs=${bootstrap_target_libs}target-libsanitizer,
2639 bootstrap_fixincludes=yes
2644 # If we are building libvtv and --enable-vtable-verify, bootstrap it.
2645 if echo " ${target_configdirs} " | grep " libvtv " > /dev/null 2>&1 &&
2646 test "$enable_vtable_verify" != no; then
2647 bootstrap_target_libs=${bootstrap_target_libs}target-libvtv,
2650 # If we are building libatomic and the list of enabled languages includes the
2651 # D frontend, bootstrap it.
2652 if echo " ${target_configdirs} " | grep " libatomic " > /dev/null 2>&1; then
2653 case ,${enable_languages}, in
2655 bootstrap_target_libs=${bootstrap_target_libs}target-libatomic,
2660 # Determine whether gdb needs tk/tcl or not.
2661 # Use 'maybe' since enable_gdbtk might be true even if tk isn't available
2662 # and in that case we want gdb to be built without tk. Ugh!
2663 # In fact I believe gdb is the *only* package directly dependent on tk,
2664 # so we should be able to put the 'maybe's in unconditionally and
2665 # leave out the maybe dependencies when enable_gdbtk is false. I'm not
2666 # 100% sure that that's safe though.
2668 gdb_tk="maybe-all-tcl maybe-all-tk maybe-all-itcl maybe-all-libgui"
2669 case "$enable_gdbtk" in
2673 GDB_TK="${gdb_tk}" ;;
2675 # Only add the dependency on gdbtk when GDBtk is part of the gdb
2676 # distro. Eventually someone will fix this and move Insight, nee
2677 # gdbtk to a separate directory.
2678 if test -d ${srcdir}/gdb/gdbtk ; then
2685 CONFIGURE_GDB_TK=`echo ${GDB_TK} | sed s/-all-/-configure-/g`
2686 INSTALL_GDB_TK=`echo ${GDB_TK} | sed s/-all-/-install-/g`
2688 # gdb and gdbserver depend on gnulib and gdbsupport, but as nothing
2689 # else does, only include them if one of these is built. The Makefile
2690 # provides the ordering, so it's enough here to add to the list.
2691 case " ${configdirs} " in
2693 configdirs="${configdirs} gnulib gdbsupport"
2696 configdirs="${configdirs} gnulib gdbsupport"
2699 configdirs="${configdirs} gnulib"
2703 # Strip out unwanted targets.
2705 # While at that, we remove Makefiles if we were started for recursive
2706 # configuration, so that the top-level Makefile reconfigures them,
2707 # like we used to do when configure itself was recursive.
2709 # Loop over modules. We used to use the "$extrasub" feature from Autoconf
2710 # but now we're fixing up the Makefile ourselves with the additional
2711 # commands passed to AC_CONFIG_FILES. Use separate variables
2712 # extrasub-{build,host,target} not because there is any reason to split
2713 # the substitutions up that way, but only to remain below the limit of
2714 # 99 commands in a script, for HP-UX sed.
2716 # Do not nest @if/@endif or @unless/@endunless pairs, because
2717 # configure will not warn you at all.
2719 case "$enable_bootstrap:$ENABLE_GOLD: $configdirs :,$stage1_languages," in
2720 yes:yes:*\ gold\ *:*,c++,*) ;;
2721 yes:yes:*\ gold\ *:*)
2722 AC_MSG_ERROR([in a combined tree, bootstrapping with --enable-gold requires c++ in stage1_languages])
2727 for module in ${build_configdirs} ; do
2728 if test -z "${no_recursion}" \
2729 && test -f ${build_subdir}/${module}/Makefile; then
2730 echo 1>&2 "*** removing ${build_subdir}/${module}/Makefile to force reconfigure"
2731 rm -f ${build_subdir}/${module}/Makefile
2733 extrasub_build="$extrasub_build
2734 /^@if build-$module\$/d
2735 /^@endif build-$module\$/d
2736 /^@unless build-$module\$/,/^@endunless build-$module\$/d
2737 /^@if build-$module-$bootstrap_suffix\$/d
2738 /^@endif build-$module-$bootstrap_suffix\$/d
2739 /^@unless build-$module-$bootstrap_suffix\$/,/^@endunless build-$module-$bootstrap_suffix\$/d"
2742 for module in ${configdirs} ; do
2743 if test -z "${no_recursion}"; then
2744 for file in stage*-${module}/Makefile prev-${module}/Makefile ${module}/Makefile; do
2745 if test -f ${file}; then
2746 echo 1>&2 "*** removing ${file} to force reconfigure"
2751 case ${module},${bootstrap_fixincludes} in
2752 fixincludes,no) host_bootstrap_suffix=no-bootstrap ;;
2753 *) host_bootstrap_suffix=$bootstrap_suffix ;;
2755 extrasub_host="$extrasub_host
2757 /^@endif $module\$/d
2758 /^@unless $module\$/,/^@endunless $module\$/d
2759 /^@if $module-$host_bootstrap_suffix\$/d
2760 /^@endif $module-$host_bootstrap_suffix\$/d
2761 /^@unless $module-$host_bootstrap_suffix\$/,/^@endunless $module-$host_bootstrap_suffix\$/d"
2764 for module in ${target_configdirs} ; do
2765 if test -z "${no_recursion}" \
2766 && test -f ${target_subdir}/${module}/Makefile; then
2767 echo 1>&2 "*** removing ${target_subdir}/${module}/Makefile to force reconfigure"
2768 rm -f ${target_subdir}/${module}/Makefile
2771 # We only bootstrap target libraries listed in bootstrap_target_libs.
2772 case $bootstrap_target_libs in
2773 *,target-$module,*) target_bootstrap_suffix=$bootstrap_suffix ;;
2774 *) target_bootstrap_suffix=no-bootstrap ;;
2777 extrasub_target="$extrasub_target
2778 /^@if target-$module\$/d
2779 /^@endif target-$module\$/d
2780 /^@unless target-$module\$/,/^@endunless target-$module\$/d
2781 /^@if target-$module-$target_bootstrap_suffix\$/d
2782 /^@endif target-$module-$target_bootstrap_suffix\$/d
2783 /^@unless target-$module-$target_bootstrap_suffix\$/,/^@endunless target-$module-$target_bootstrap_suffix\$/d"
2786 # Do the final fixup along with target modules.
2787 extrasub_target="$extrasub_target
2792 if test "$enable_pgo_build" != "no"; then
2793 extrasub_build="$extrasub_build
2795 /^@endif pgo-build\$/d"
2798 # Create the serialization dependencies. This uses a temporary file.
2800 AC_ARG_ENABLE([serial-configure],
2801 [AS_HELP_STRING([[--enable-serial-[{host,target,build}-]configure]],
2802 [force sequential configuration of
2803 sub-packages for the host, target or build
2804 machine, or all sub-packages])])
2806 case ${enable_serial_configure} in
2808 enable_serial_build_configure=yes
2809 enable_serial_host_configure=yes
2810 enable_serial_target_configure=yes
2814 # These force 'configure's to be done one at a time, to avoid problems
2815 # with contention over a shared config.cache.
2817 echo '# serdep.tmp' > serdep.tmp
2819 test "x${enable_serial_build_configure}" = xyes &&
2820 for item in ${build_configdirs} ; do
2823 *) echo "configure-build-${item}: configure-build-${olditem}" >> serdep.tmp ;;
2828 test "x${enable_serial_host_configure}" = xyes &&
2829 for item in ${configdirs} ; do
2832 *) echo "configure-${item}: configure-${olditem}" >> serdep.tmp ;;
2837 test "x${enable_serial_target_configure}" = xyes &&
2838 for item in ${target_configdirs} ; do
2841 *) echo "configure-target-${item}: configure-target-${olditem}" >> serdep.tmp ;;
2845 serialization_dependencies=serdep.tmp
2846 AC_SUBST_FILE(serialization_dependencies)
2848 # Base args. Strip norecursion, cache-file, srcdir, host, build,
2849 # target, nonopt, and variable assignments. These are the ones we
2850 # might not want to pass down to subconfigures. The exception being
2851 # --cache-file=/dev/null, which is used to turn off the use of cache
2852 # files altogether, and which should be passed on to subconfigures.
2853 # Also strip program-prefix, program-suffix, and program-transform-name,
2854 # so that we can pass down a consistent program-transform-name.
2859 eval "set -- $ac_configure_args"
2862 if test X"$skip_next" = X"yes"; then
2866 if test X"$keep_next" = X"yes"; then
2869 ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
2871 baseargs="$baseargs '$ac_arg'"
2872 tbaseargs="$tbaseargs '$ac_arg'"
2877 # Handle separated arguments. Based on the logic generated by
2880 *=* | --config-cache | -C | -disable-* | --disable-* \
2881 | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
2882 | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
2883 | -with-* | --with-* | -without-* | --without-* | --x)
2897 --with-* | --without-*)
2898 libopt=`echo "$ac_arg" | sed -e 's,^--[^-_]*[-_],,' -e 's,=.*$,,'`
2902 lib=`echo "$libopt" | sed 's,[-_]include$,,'`
2905 lib=`echo "$libopt" | sed 's,[-_]lib$,,'`
2914 mpc | mpfr | gmp | isl)
2915 # If we're processing --with-$lib, --with-$lib-include or
2916 # --with-$lib-lib, for one of the libs above, and target is
2917 # different from host, don't pass the current argument to any
2918 # target library's configure.
2919 if test x$is_cross_compiler = xyes; then
2928 --cache-file=/dev/null | \
2929 -cache-file=/dev/null )
2930 # Handled here to avoid the test to skip args below.
2931 baseargs="$baseargs '$ac_arg'"
2932 tbaseargs="$tbaseargs '$ac_arg'"
2933 # Assert: $separate_arg should always be no.
2934 keep_next=$separate_arg
2950 -program-prefix* | \
2951 -program-suffix* | \
2952 -program-transform-name* )
2953 skip_next=$separate_arg
2957 # An option. Add it.
2960 ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
2962 baseargs="$baseargs '$ac_arg'"
2963 if test X"$skip_targ" = Xno; then
2964 tbaseargs="$tbaseargs '$ac_arg'"
2966 keep_next=$separate_arg
2969 # Either a variable assignment, or a nonopt (triplet). Don't
2970 # pass it down; let the Makefile handle this.
2975 # Remove the initial space we just introduced and, as these will be
2976 # expanded by make, quote '$'.
2977 baseargs=`echo "x$baseargs" | sed -e 's/^x *//' -e 's,\\$,$$,g'`
2979 # Add in --program-transform-name, after --program-prefix and
2980 # --program-suffix have been applied to it. Autoconf has already
2981 # doubled dollar signs and backslashes in program_transform_name; we want
2982 # the backslashes un-doubled, and then the entire thing wrapped in single
2983 # quotes, because this will be expanded first by make and then by the shell.
2984 # Also, because we want to override the logic in subdir configure scripts to
2985 # choose program_transform_name, replace any s,x,x, with s,y,y,.
2986 sed -e "s,\\\\\\\\,\\\\,g; s,','\\\\'',g; s/s,x,x,/s,y,y,/" <<EOF_SED > conftestsed.out
2987 ${program_transform_name}
2989 gcc_transform_name=`cat conftestsed.out`
2990 rm -f conftestsed.out
2991 baseargs="$baseargs --program-transform-name='${gcc_transform_name}'"
2992 tbaseargs="$tbaseargs --program-transform-name='${gcc_transform_name}'"
2993 if test "$silent" = yes; then
2994 baseargs="$baseargs --silent"
2995 tbaseargs="$tbaseargs --silent"
2997 baseargs="$baseargs --disable-option-checking"
2998 tbaseargs="$tbaseargs --disable-option-checking"
3000 # Record and document user additions to sub configure arguments.
3001 AC_ARG_VAR([build_configargs],
3002 [additional configure arguments for build directories])
3003 AC_ARG_VAR([host_configargs],
3004 [additional configure arguments for host directories])
3005 AC_ARG_VAR([target_configargs],
3006 [additional configure arguments for target directories])
3008 # For the build-side libraries, we just need to pretend we're native,
3009 # and not use the same cache file. Multilibs are neither needed nor
3010 # desired. We can't even use the same cache file for all build-side
3011 # libraries, as they're compiled differently; some with C, some with
3012 # C++ or with different feature-enabling options.
3013 build_configargs="$build_configargs --cache-file=./config.cache ${baseargs}"
3015 # For host modules, accept cache file option, or specification as blank.
3016 case "${cache_file}" in
3018 cache_file_option="" ;;
3019 /* | [[A-Za-z]]:[[\\/]]* ) # absolute path
3020 cache_file_option="--cache-file=${cache_file}" ;;
3022 cache_file_option="--cache-file=../${cache_file}" ;;
3025 # Host dirs don't like to share a cache file either, horribly enough.
3026 # This seems to be due to autoconf 2.5x stupidity.
3027 host_configargs="$host_configargs --cache-file=./config.cache ${extra_host_args} ${baseargs}"
3029 target_configargs="$target_configargs ${tbaseargs}"
3031 # Passing a --with-cross-host argument lets the target libraries know
3032 # whether they are being built with a cross-compiler or being built
3033 # native. However, it would be better to use other mechanisms to make the
3034 # sorts of decisions they want to make on this basis. Please consider
3035 # this option to be deprecated. FIXME.
3036 if test x${is_cross_compiler} = xyes ; then
3037 target_configargs="--with-cross-host=${host_noncanonical} ${target_configargs}"
3040 # Special user-friendly check for native x86_64-linux build, if
3041 # multilib is not explicitly enabled.
3044 # Default to --enable-multilib.
3045 if test x${enable_multilib} = x ; then
3046 target_configargs="--disable-multilib ${target_configargs}"
3049 # Pass --with-newlib if appropriate. Note that target_configdirs has
3050 # changed from the earlier setting of with_newlib.
3051 if test x${with_newlib} != xno && echo " ${target_configdirs} " | grep " newlib " > /dev/null 2>&1 && test -d ${srcdir}/newlib ; then
3052 target_configargs="--with-newlib ${target_configargs}"
3055 # Different target subdirs use different values of certain variables
3056 # (notably CXX). Worse, multilibs use *lots* of different values.
3057 # Worse yet, autoconf 2.5x makes some of these 'precious', meaning that
3058 # it doesn't automatically accept command-line overrides of them.
3059 # This means it's not safe for target subdirs to share a cache file,
3060 # which is disgusting, but there you have it. Hopefully this can be
3061 # fixed in future. It's still worthwhile to use a cache file for each
3062 # directory. I think.
3064 # Pass the appropriate --build, --host, --target and --cache-file arguments.
3065 # We need to pass --target, as newer autoconf's requires consistency
3066 # for target_alias and gcc doesn't manage it consistently.
3067 target_configargs="--cache-file=./config.cache ${target_configargs}"
3070 case " $target_configdirs " in
3072 case " $target_configargs " in
3073 *" --with-newlib "*)
3076 FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(TARGET_SUBDIR)/winsup/cygwin -isystem $$s/winsup/cygwin/include'
3080 # If we're not building GCC, don't discard standard headers.
3081 if test -d ${srcdir}/gcc; then
3082 FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -nostdinc'
3084 if test "${build}" != "${host}"; then
3085 # On Canadian crosses, CC_FOR_TARGET will have already been set
3086 # by `configure', so we won't have an opportunity to add -Bgcc/
3087 # to it. This is right: we don't want to search that directory
3088 # for binaries, but we want the header files in there, so add
3090 FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -isystem $$r/$(HOST_SUBDIR)/gcc/include -isystem $$r/$(HOST_SUBDIR)/gcc/include-fixed'
3092 # Someone might think of using the pre-installed headers on
3093 # Canadian crosses, in case the installed compiler is not fully
3094 # compatible with the compiler being built. In this case, it
3095 # would be better to flag an error than risking having
3096 # incompatible object files being constructed. We can't
3097 # guarantee that an error will be flagged, but let's hope the
3098 # compiler will do it, when presented with incompatible header
3103 case "${target}-${is_cross_compiler}" in
3104 i[[3456789]]86-*-linux*-no)
3105 # Here host == target, so we don't need to build gcc,
3106 # so we don't want to discard standard headers.
3107 FLAGS_FOR_TARGET=`echo " $FLAGS_FOR_TARGET " | sed -e 's/ -nostdinc / /'`
3110 # If we're building newlib, use its generic headers last, but search
3111 # for any libc-related directories first (so make it the last -B
3113 FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$$r/$(TARGET_SUBDIR)/newlib/ -isystem $$r/$(TARGET_SUBDIR)/newlib/targ-include -isystem $$s/newlib/libc/include'
3115 # If we're building libgloss, find the startup file, simulator library
3116 # and linker script.
3117 case " $target_configdirs " in
3119 # Look for startup file, simulator library and maybe linker script.
3120 FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$$r/$(TARGET_SUBDIR)/libgloss/'"$libgloss_dir"
3121 # Look for libnosys.a in case the target needs it.
3122 FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(TARGET_SUBDIR)/libgloss/libnosys'
3123 # Most targets have the linker script in the source directory.
3124 FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$s/libgloss/'"$libgloss_dir"
3135 x86_64-*mingw* | *-w64-mingw*)
3136 # MinGW-w64 does not use newlib, nor does it use winsup. It may,
3137 # however, use a symlink named 'mingw' in ${prefix} .
3138 FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L${prefix}/${target}/lib -L${prefix}/mingw/lib -isystem ${prefix}/${target}/include -isystem ${prefix}/mingw/include'
3141 # MinGW can't be handled as Cygwin above since it does not use newlib.
3142 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'
3146 # Allow the user to override the flags for
3147 # our build compiler if desired.
3148 if test x"${build}" = x"${host}" ; then
3149 CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
3150 CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-${CPPFLAGS}}
3151 CXXFLAGS_FOR_BUILD=${CXXFLAGS_FOR_BUILD-${CXXFLAGS}}
3152 LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-${LDFLAGS}}
3155 # On Canadian crosses, we'll be searching the right directories for
3156 # the previously-installed cross compiler, so don't bother to add
3157 # flags for directories within the install tree of the compiler
3158 # being built; programs in there won't even run.
3159 if test "${build}" = "${host}" && test -d ${srcdir}/gcc; then
3160 # Search for pre-installed headers if nothing else fits.
3161 FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$(build_tooldir)/bin/ -B$(build_tooldir)/lib/ -isystem $(build_tooldir)/include -isystem $(build_tooldir)/sys-include'
3164 if test "x${use_gnu_ld}" = x &&
3165 echo " ${configdirs} " | grep " ld " > /dev/null ; then
3166 # Arrange for us to find uninstalled linker scripts.
3167 FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(HOST_SUBDIR)/ld'
3170 # Search for other target-specific linker scripts and such.
3173 FLAGS_FOR_TARGET="$FLAGS_FOR_TARGET -mlibrary"
3177 # Makefile fragments.
3178 for frag in host_makefile_frag target_makefile_frag alphaieee_frag ospace_frag;
3180 eval fragval=\$$frag
3181 if test $fragval != /dev/null; then
3182 eval $frag=${srcdir}/$fragval
3185 AC_SUBST_FILE(host_makefile_frag)
3186 AC_SUBST_FILE(target_makefile_frag)
3187 AC_SUBST_FILE(alphaieee_frag)
3188 AC_SUBST_FILE(ospace_frag)
3190 # Miscellanea: directories, flags, etc.
3191 AC_SUBST(RPATH_ENVVAR)
3192 AC_SUBST(GCC_SHLIB_SUBDIR)
3194 AC_SUBST(build_tooldir)
3195 AC_SUBST(CONFIGURE_GDB_TK)
3197 AC_SUBST(INSTALL_GDB_TK)
3199 # Build module lists & subconfigure args.
3200 AC_SUBST(build_configargs)
3201 AC_SUBST(build_configdirs)
3203 # Host module lists & subconfigure args.
3204 AC_SUBST(host_configargs)
3205 AC_SUBST(configdirs)
3206 AC_SUBST(target_configdirs)
3208 # Target module lists & subconfigure args.
3209 AC_SUBST(target_configargs)
3213 AC_SUBST(AR_FOR_BUILD)
3214 AC_SUBST(AS_FOR_BUILD)
3215 AC_SUBST(CC_FOR_BUILD)
3216 AC_SUBST(CFLAGS_FOR_BUILD)
3217 AC_SUBST(CPP_FOR_BUILD)
3218 AC_SUBST(CPPFLAGS_FOR_BUILD)
3219 AC_SUBST(CXXFLAGS_FOR_BUILD)
3220 AC_SUBST(CXX_FOR_BUILD)
3221 AC_SUBST(DLLTOOL_FOR_BUILD)
3222 AC_SUBST(DSYMUTIL_FOR_BUILD)
3223 AC_SUBST(GFORTRAN_FOR_BUILD)
3224 AC_SUBST(GOC_FOR_BUILD)
3225 AC_SUBST(GDC_FOR_BUILD)
3226 AC_SUBST(LDFLAGS_FOR_BUILD)
3227 AC_SUBST(LD_FOR_BUILD)
3228 AC_SUBST(NM_FOR_BUILD)
3229 AC_SUBST(RANLIB_FOR_BUILD)
3230 AC_SUBST(WINDMC_FOR_BUILD)
3231 AC_SUBST(WINDRES_FOR_BUILD)
3233 # sdcpp (?) Substitute configuration variables
3234 AC_SUBST(all_stagestuff)
3235 AC_SUBST(build_exeext)
3236 AC_SUBST(build_install_headers_dir)
3237 AC_SUBST(build_xm_file_list)
3238 AC_SUBST(build_xm_file)
3239 AC_SUBST(build_xm_defines)
3240 AC_SUBST(check_languages)
3241 AC_SUBST(dep_host_xmake_file)
3242 AC_SUBST(dep_tmake_file)
3243 AC_SUBST(extra_c_flags)
3244 AC_SUBST(extra_headers_list)
3245 AC_SUBST(extra_objs)
3246 AC_SUBST(extra_parts)
3247 AC_SUBST(extra_passes)
3248 AC_SUBST(extra_programs)
3249 AC_SUBST(gcc_config_arguments)
3250 AC_SUBST(gcc_version)
3251 AC_SUBST(gcc_version_full)
3252 AC_SUBST(gcc_version_trigger)
3253 AC_SUBST(host_exeext)
3254 AC_SUBST(host_extra_gcc_objs)
3256 AC_SUBST(lang_tree_files)
3257 AC_SUBST(local_prefix)
3260 AC_SUBST(out_object_file)
3261 AC_SUBST(symbolic_link)
3262 AC_SUBST(thread_file)
3263 AC_SUBST(c_target_objs)
3265 AC_SUBST_FILE(host_makefile_frag)
3266 AC_SUBST_FILE(target_makefile_frag)
3267 AC_SUBST_FILE(alphaieee_frag)
3268 AC_SUBST_FILE(ospace_frag)
3270 # why? (not in gcc/configure.ac)
3271 AC_SUBST(host_makefile_frag)
3272 AC_SUBST(target_makefile_frag)
3273 AC_SUBST(alphaieee_frag)
3274 AC_SUBST(ospace_frag)
3276 # Generate default definitions for YACC, M4, LEX and other programs that run
3277 # on the build machine. These are used if the Makefile can't locate these
3278 # programs in objdir.
3279 MISSING=`cd $ac_aux_dir && ${PWDCMD-pwd}`/missing
3281 AC_CHECK_PROGS([YACC], ['bison -y' byacc yacc], [$MISSING bison -y])
3282 # case " $build_configdirs " in
3283 # *" bison "*) YACC='$$r/$(BUILD_SUBDIR)/bison/tests/bison -y' ;;
3286 AC_CHECK_PROGS([BISON], [bison], [$MISSING bison])
3287 # case " $build_configdirs " in
3288 # *" bison "*) BISON='$$r/$(BUILD_SUBDIR)/bison/tests/bison' ;;
3291 AC_CHECK_PROGS([M4], [gm4 gnum4 m4], [$MISSING m4])
3292 # case " $build_configdirs " in
3293 # *" m4 "*) M4='$$r/$(BUILD_SUBDIR)/m4/m4' ;;
3296 AC_CHECK_PROGS([LEX], [flex lex], [$MISSING flex])
3297 # case " $build_configdirs " in
3298 # *" flex "*) LEX='$$r/$(BUILD_SUBDIR)/flex/flex' ;;
3299 # *" lex "*) LEX='$$r/$(BUILD_SUBDIR)/lex/lex' ;;
3302 AC_CHECK_PROGS([FLEX], [flex], [$MISSING flex])
3303 # case " $build_configdirs " in
3304 # *" flex "*) FLEX='$$r/$(BUILD_SUBDIR)/flex/flex' ;;
3307 AC_CHECK_PROGS([MAKEINFO], makeinfo, [$MISSING makeinfo])
3308 case " $build_configdirs " in
3309 *" texinfo "*) MAKEINFO='$$r/$(BUILD_SUBDIR)/texinfo/makeinfo/makeinfo' ;;
3312 # For an installed makeinfo, we require it to be from texinfo 4.7 or
3313 # higher, else we use the "missing" dummy.
3314 if ${MAKEINFO} --version \
3315 | egrep 'texinfo[^0-9]*(4\.([7-9]|[1-9][0-9])|[5-9]|[1-9][0-9])' >/dev/null 2>&1; then
3318 MAKEINFO="$MISSING makeinfo"
3324 # FIXME: expect and dejagnu may become build tools?
3326 AC_CHECK_PROGS(EXPECT, expect, expect)
3327 case " $configdirs " in
3329 test $host = $build && EXPECT='$$r/$(HOST_SUBDIR)/expect/expect'
3333 AC_CHECK_PROGS(RUNTEST, runtest, runtest)
3334 case " $configdirs " in
3336 test $host = $build && RUNTEST='$$s/$(HOST_SUBDIR)/dejagnu/runtest'
3342 NCN_STRICT_CHECK_TOOLS(AR, ar)
3343 NCN_STRICT_CHECK_TOOLS(AS, as)
3344 NCN_STRICT_CHECK_TOOLS(DLLTOOL, dlltool)
3345 NCN_STRICT_CHECK_TOOLS(DSYMUTIL, dsymutil)
3346 NCN_STRICT_CHECK_TOOLS(LD, ld)
3347 NCN_STRICT_CHECK_TOOLS(LIPO, lipo)
3348 NCN_STRICT_CHECK_TOOLS(NM, nm)
3349 NCN_STRICT_CHECK_TOOLS(RANLIB, ranlib, true)
3350 NCN_STRICT_CHECK_TOOLS(STRIP, strip, true)
3351 NCN_STRICT_CHECK_TOOLS(WINDRES, windres)
3352 NCN_STRICT_CHECK_TOOLS(WINDMC, windmc)
3353 NCN_STRICT_CHECK_TOOLS(OBJCOPY, objcopy)
3354 NCN_STRICT_CHECK_TOOLS(OBJDUMP, objdump)
3355 NCN_STRICT_CHECK_TOOLS(OTOOL, otool)
3356 NCN_STRICT_CHECK_TOOLS(READELF, readelf)
3365 AC_ARG_WITH([build-time-tools],
3366 [AS_HELP_STRING([--with-build-time-tools=PATH],
3367 [use given path to find target tools during the build])],
3368 [case x"$withval" in
3371 with_build_time_tools=
3372 AC_MSG_WARN([argument to --with-build-time-tools must be an absolute path])
3375 [with_build_time_tools=])
3377 NCN_STRICT_CHECK_TARGET_TOOLS(CC_FOR_TARGET, cc gcc)
3378 NCN_STRICT_CHECK_TARGET_TOOLS(CXX_FOR_TARGET, c++ g++ cxx gxx)
3379 NCN_STRICT_CHECK_TARGET_TOOLS(GCC_FOR_TARGET, gcc, ${CC_FOR_TARGET})
3380 NCN_STRICT_CHECK_TARGET_TOOLS(GFORTRAN_FOR_TARGET, gfortran)
3381 NCN_STRICT_CHECK_TARGET_TOOLS(GOC_FOR_TARGET, gccgo)
3382 NCN_STRICT_CHECK_TARGET_TOOLS(GDC_FOR_TARGET, gdc)
3384 ACX_CHECK_INSTALLED_TARGET_TOOL(AR_FOR_TARGET, ar)
3385 ACX_CHECK_INSTALLED_TARGET_TOOL(AS_FOR_TARGET, as)
3386 ACX_CHECK_INSTALLED_TARGET_TOOL(DLLTOOL_FOR_TARGET, dlltool)
3387 ACX_CHECK_INSTALLED_TARGET_TOOL(DSYMUTIL_FOR_TARGET, dsymutil)
3388 ACX_CHECK_INSTALLED_TARGET_TOOL(LD_FOR_TARGET, ld)
3389 ACX_CHECK_INSTALLED_TARGET_TOOL(LIPO_FOR_TARGET, lipo)
3390 ACX_CHECK_INSTALLED_TARGET_TOOL(NM_FOR_TARGET, nm)
3391 ACX_CHECK_INSTALLED_TARGET_TOOL(OBJCOPY_FOR_TARGET, objcopy)
3392 ACX_CHECK_INSTALLED_TARGET_TOOL(OBJDUMP_FOR_TARGET, objdump)
3393 ACX_CHECK_INSTALLED_TARGET_TOOL(OTOOL_FOR_TARGET, otool)
3394 ACX_CHECK_INSTALLED_TARGET_TOOL(RANLIB_FOR_TARGET, ranlib)
3395 ACX_CHECK_INSTALLED_TARGET_TOOL(READELF_FOR_TARGET, readelf)
3396 ACX_CHECK_INSTALLED_TARGET_TOOL(STRIP_FOR_TARGET, strip)
3397 ACX_CHECK_INSTALLED_TARGET_TOOL(WINDRES_FOR_TARGET, windres)
3398 ACX_CHECK_INSTALLED_TARGET_TOOL(WINDMC_FOR_TARGET, windmc)
3400 RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET"
3402 GCC_TARGET_TOOL(ar, AR_FOR_TARGET, AR, [binutils/ar])
3403 GCC_TARGET_TOOL(as, AS_FOR_TARGET, AS, [gas/as-new])
3404 GCC_TARGET_TOOL(cc, CC_FOR_TARGET, CC, [gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/])
3405 dnl see comments for CXX_FOR_TARGET_FLAG_TO_PASS
3406 GCC_TARGET_TOOL(c++, CXX_FOR_TARGET, CXX,
3407 [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],
3409 GCC_TARGET_TOOL(c++ for libstdc++, RAW_CXX_FOR_TARGET, CXX,
3410 [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],
3412 GCC_TARGET_TOOL(dlltool, DLLTOOL_FOR_TARGET, DLLTOOL, [binutils/dlltool])
3413 GCC_TARGET_TOOL(dsymutil, DSYMUTIL_FOR_TARGET, DSYMUTIL)
3414 GCC_TARGET_TOOL(gcc, GCC_FOR_TARGET, , [gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/])
3415 GCC_TARGET_TOOL(gfortran, GFORTRAN_FOR_TARGET, GFORTRAN,
3416 [gcc/gfortran -B$$r/$(HOST_SUBDIR)/gcc/], fortran)
3417 GCC_TARGET_TOOL(gccgo, GOC_FOR_TARGET, GOC,
3418 [gcc/gccgo -B$$r/$(HOST_SUBDIR)/gcc/], go)
3419 GCC_TARGET_TOOL(gdc, GDC_FOR_TARGET, GDC,
3420 [gcc/gdc -B$$r/$(HOST_SUBDIR)/gcc/], d)
3421 GCC_TARGET_TOOL(ld, LD_FOR_TARGET, LD, [ld/ld-new])
3422 GCC_TARGET_TOOL(lipo, LIPO_FOR_TARGET, LIPO)
3423 GCC_TARGET_TOOL(nm, NM_FOR_TARGET, NM, [binutils/nm-new])
3424 GCC_TARGET_TOOL(objcopy, OBJCOPY_FOR_TARGET, OBJCOPY, [binutils/objcopy])
3425 GCC_TARGET_TOOL(objdump, OBJDUMP_FOR_TARGET, OBJDUMP, [binutils/objdump])
3426 GCC_TARGET_TOOL(otool, OTOOL_FOR_TARGET, OTOOL)
3427 GCC_TARGET_TOOL(ranlib, RANLIB_FOR_TARGET, RANLIB, [binutils/ranlib])
3428 GCC_TARGET_TOOL(readelf, READELF_FOR_TARGET, READELF, [binutils/readelf])
3429 GCC_TARGET_TOOL(strip, STRIP_FOR_TARGET, STRIP, [binutils/strip-new])
3430 GCC_TARGET_TOOL(windres, WINDRES_FOR_TARGET, WINDRES, [binutils/windres])
3431 GCC_TARGET_TOOL(windmc, WINDMC_FOR_TARGET, WINDMC, [binutils/windmc])
3433 AC_SUBST(FLAGS_FOR_TARGET)
3434 AC_SUBST(RAW_CXX_FOR_TARGET)
3436 # Certain tools may need extra flags.
3437 AR_FOR_TARGET=${AR_FOR_TARGET}${extra_arflags_for_target}
3438 RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET}${extra_ranlibflags_for_target}
3439 NM_FOR_TARGET=${NM_FOR_TARGET}${extra_nmflags_for_target}
3441 # When building target libraries, except in a Canadian cross, we use
3442 # the same toolchain as the compiler we just built.
3443 COMPILER_AS_FOR_TARGET='$(AS_FOR_TARGET)'
3444 COMPILER_LD_FOR_TARGET='$(LD_FOR_TARGET)'
3445 COMPILER_NM_FOR_TARGET='$(NM_FOR_TARGET)'
3446 if test $host = $build; then
3447 case " $configdirs " in
3449 COMPILER_AS_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/as'
3450 COMPILER_LD_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/collect-ld'
3451 COMPILER_NM_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/nm'${extra_nmflags_for_target}
3456 AC_SUBST(COMPILER_AS_FOR_TARGET)
3457 AC_SUBST(COMPILER_LD_FOR_TARGET)
3458 AC_SUBST(COMPILER_NM_FOR_TARGET)
3460 AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
3461 AC_ARG_ENABLE(maintainer-mode,
3462 [AS_HELP_STRING([--enable-maintainer-mode],
3463 [enable make rules and dependencies not useful
3464 (and sometimes confusing) to the casual installer])],
3465 USE_MAINTAINER_MODE=$enableval,
3466 USE_MAINTAINER_MODE=no)
3467 AC_MSG_RESULT($USE_MAINTAINER_MODE)
3468 AC_SUBST(MAINTAINER_MODE_TRUE)
3469 AC_SUBST(MAINTAINER_MODE_FALSE)
3470 if test "$USE_MAINTAINER_MODE" = yes; then
3471 MAINTAINER_MODE_TRUE=
3472 MAINTAINER_MODE_FALSE='#'
3474 MAINTAINER_MODE_TRUE='#'
3475 MAINTAINER_MODE_FALSE=
3477 MAINT=$MAINTAINER_MODE_TRUE
3480 # ---------------------
3481 # GCC bootstrap support
3482 # ---------------------
3486 AC_CONFIG_FILES([Makefile],
3487 [sed "$extrasub_build" Makefile |
3488 sed "$extrasub_host" |
3489 sed "$extrasub_target" > mf$$
3490 mv -f mf$$ Makefile],
3491 [extrasub_build="$extrasub_build"
3492 extrasub_host="$extrasub_host"
3493 extrasub_target="$extrasub_target"])