Debian Codegraph @

configure.ac

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