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