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