xref: /openbsd-src/gnu/usr.bin/binutils-2.17/configure.in (revision 18a81a05d6e3098eadc4b5e23d6656377f87591a)
13d8817e4Smiod#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
23d8817e4Smiod#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
33d8817e4Smiod#
43d8817e4Smiod# This file is free software; you can redistribute it and/or modify it
53d8817e4Smiod# under the terms of the GNU General Public License as published by
63d8817e4Smiod# the Free Software Foundation; either version 2 of the License, or
73d8817e4Smiod# (at your option) any later version.
83d8817e4Smiod#
93d8817e4Smiod# This program is distributed in the hope that it will be useful, but
103d8817e4Smiod# WITHOUT ANY WARRANTY; without even the implied warranty of
113d8817e4Smiod# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
123d8817e4Smiod# General Public License for more details.
133d8817e4Smiod#
143d8817e4Smiod# You should have received a copy of the GNU General Public License
153d8817e4Smiod# along with this program; if not, write to the Free Software
163d8817e4Smiod# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
173d8817e4Smiod
183d8817e4Smiod##############################################################################
193d8817e4Smiod### WARNING: this file contains embedded tabs.  Do not run untabify on this file.
203d8817e4Smiod
213d8817e4Smiodsinclude(config/acx.m4)
223d8817e4Smiod
233d8817e4SmiodAC_INIT(move-if-change)
243d8817e4SmiodAC_PREREQ(2.13)
253d8817e4SmiodAC_CANONICAL_SYSTEM
263d8817e4SmiodAC_ARG_PROGRAM
273d8817e4Smiod
283d8817e4Smiod# Get 'install' or 'install-sh' and its variants.
293d8817e4SmiodAC_PROG_INSTALL
303d8817e4SmiodACX_PROG_LN
313d8817e4SmiodAC_PROG_LN_S
323d8817e4Smiod
333d8817e4Smiod### we might need to use some other shell than /bin/sh for running subshells
343d8817e4Smiod### If we are on Windows, search for the shell.  This will permit people
353d8817e4Smiod### to not have /bin/sh, but to be able to see /SOME/PATH/sh configure
363d8817e4Smiod### without also having to set CONFIG_SHELL.  This code will work when
373d8817e4Smiod### using bash, which sets OSTYPE.
383d8817e4Smiodcase "${OSTYPE}" in
393d8817e4Smiod*win32*)
403d8817e4Smiod  if test x${CONFIG_SHELL} = x ; then
413d8817e4Smiod    if test ! -f /bin/sh ; then
423d8817e4Smiod      if test x${SHELL} != x && test -f ${SHELL} ; then
433d8817e4Smiod	CONFIG_SHELL=${SHELL}
443d8817e4Smiod	export CONFIG_SHELL
453d8817e4Smiod      else
463d8817e4Smiod	for prog in sh sh.exe bash bash.exe; do
473d8817e4Smiod	  IFS="${IFS=	}"; save_ifs="$IFS"; IFS="${IFS}:"
483d8817e4Smiod	  for dir in $PATH; do
493d8817e4Smiod	    test -z "$dir" && dir=.
503d8817e4Smiod	    if test -f $dir/$prog; then
513d8817e4Smiod	      CONFIG_SHELL=$dir/$prog
523d8817e4Smiod	      export CONFIG_SHELL
533d8817e4Smiod	      break
543d8817e4Smiod	    fi
553d8817e4Smiod	  done
563d8817e4Smiod	  IFS="$save_ifs"
573d8817e4Smiod	  test -n "${CONFIG_SHELL}" && break
583d8817e4Smiod	done
593d8817e4Smiod      fi
603d8817e4Smiod    fi
613d8817e4Smiod  fi
623d8817e4Smiod  ;;
633d8817e4Smiodesac
643d8817e4Smiod
653d8817e4Smiodconfig_shell=${CONFIG_SHELL-/bin/sh}
663d8817e4Smiod
673d8817e4Smiodprogname=$0
683d8817e4Smiod# if PWD already has a value, it is probably wrong.
693d8817e4Smiodif test -n "$PWD" ; then PWD=`${PWDCMD-pwd}`; fi
703d8817e4Smiod
713d8817e4Smiod# Export original configure arguments for use by sub-configures.  These
723d8817e4Smiod# will be expanded by make, so quote '$'.
733d8817e4Smiodtmp="$progname $@"
743d8817e4Smiodsed -e 's,\$,$$,g' <<EOF_SED > conftestsed.out
753d8817e4Smiod$tmp
763d8817e4SmiodEOF_SED
773d8817e4SmiodTOPLEVEL_CONFIGURE_ARGUMENTS=`cat conftestsed.out`
783d8817e4Smiodrm -f conftestsed.out
793d8817e4SmiodAC_SUBST(TOPLEVEL_CONFIGURE_ARGUMENTS)
803d8817e4Smiod
813d8817e4Smiodmoveifchange=${srcdir}/move-if-change
823d8817e4Smiod
833d8817e4Smiodsrcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
843d8817e4Smiod
853d8817e4Smiod# We pass INSTALL explicitly to sub-makes.  Make sure that it is not
863d8817e4Smiod# a relative path.
873d8817e4Smiodif test "$INSTALL" = "${srcdir}/install-sh -c"; then
883d8817e4Smiod  INSTALL="${srcpwd}/install-sh -c"
893d8817e4Smiodfi
903d8817e4Smiod
913d8817e4Smiod# Set srcdir to "." if that's what it is.
923d8817e4Smiod# This is important for multilib support.
933d8817e4Smiodpwd=`${PWDCMD-pwd}`
943d8817e4Smiodif test "${pwd}" = "${srcpwd}" ; then
953d8817e4Smiod  srcdir=.
963d8817e4Smiodfi
973d8817e4Smiod
983d8817e4Smiodtopsrcdir=$srcpwd
993d8817e4Smiod
1003d8817e4Smiodextra_host_args=
1013d8817e4Smiod
1023d8817e4Smiod### To add a new directory to the tree, first choose whether it is a target
1033d8817e4Smiod### or a host dependent tool.  Then put it into the appropriate list
1043d8817e4Smiod### (library or tools, host or target), doing a dependency sort.
1053d8817e4Smiod
1063d8817e4Smiod# Subdirs will be configured in the order listed in build_configdirs,
1073d8817e4Smiod# configdirs, or target_configdirs; see the serialization section below.
1083d8817e4Smiod
1093d8817e4Smiod# Dependency sorting is only needed when *configuration* must be done in
1103d8817e4Smiod# a particular order.  In all cases a dependency should be specified in
1113d8817e4Smiod# the Makefile, whether or not it's implicitly specified here.
1123d8817e4Smiod
1133d8817e4Smiod# Double entries in build_configdirs, configdirs, or target_configdirs may
1143d8817e4Smiod# cause circular dependencies and break everything horribly.
1153d8817e4Smiod
1163d8817e4Smiod# these library is used by various programs built for the build
1173d8817e4Smiod# environment
1183d8817e4Smiod#
1193d8817e4Smiodbuild_libs="build-libiberty"
1203d8817e4Smiod
1213d8817e4Smiod# these tools are built for the build environment
1223d8817e4Smiodbuild_tools="build-texinfo build-byacc build-flex build-bison build-m4 build-fixincludes"
1233d8817e4Smiod
1243d8817e4Smiod# these libraries are used by various programs built for the host environment
1253d8817e4Smiod#
1263d8817e4Smiodhost_libs="intl mmalloc libiberty opcodes bfd readline tcl tk itcl libgui zlib libcpp libdecnumber"
1273d8817e4Smiod
1283d8817e4Smiod# these tools are built for the host environment
1293d8817e4Smiod# Note, the powerpc-eabi build depends on sim occurring before gdb in order to
1303d8817e4Smiod# know that we are building the simulator.
1313d8817e4Smiod# binutils, gas and ld appear in that order because it makes sense to run
1323d8817e4Smiod# "make check" in that particular order.
1333d8817e4Smiodhost_tools="byacc flex bison binutils gas ld fixincludes gcc sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar gnattools"
1343d8817e4Smiod
1353d8817e4Smiod# libgcj represents the runtime libraries only used by gcj.
1363d8817e4Smiodlibgcj="target-libffi \
1373d8817e4Smiod	target-boehm-gc \
1383d8817e4Smiod	target-zlib \
1393d8817e4Smiod	target-qthreads \
1403d8817e4Smiod	target-libjava"
1413d8817e4Smiod
1423d8817e4Smiod# these libraries are built for the target environment, and are built after
1433d8817e4Smiod# the host libraries and the host tools (which may be a cross compiler)
1443d8817e4Smiod#
1453d8817e4Smiodtarget_libraries="target-libiberty \
1463d8817e4Smiod		target-libgloss \
1473d8817e4Smiod		target-newlib \
1483d8817e4Smiod		target-libstdc++-v3 \
1493d8817e4Smiod		target-libmudflap \
1503d8817e4Smiod		target-libssp \
1513d8817e4Smiod		target-libgcc-math \
1523d8817e4Smiod		target-libgfortran \
1533d8817e4Smiod		${libgcj} \
1543d8817e4Smiod		target-libobjc \
1553d8817e4Smiod		target-libada \
1563d8817e4Smiod		target-libgomp"
1573d8817e4Smiod
1583d8817e4Smiod# these tools are built using the target libraries, and are intended to
1593d8817e4Smiod# run only in the target environment
1603d8817e4Smiod#
1613d8817e4Smiod# note: any program that *uses* libraries that are in the "target_libraries"
1623d8817e4Smiod# list belongs in this list.  those programs are also very likely
1633d8817e4Smiod# candidates for the "native_only" list which follows
1643d8817e4Smiod#
1653d8817e4Smiodtarget_tools="target-examples target-groff target-gperf target-rda"
1663d8817e4Smiod
1673d8817e4Smiod################################################################################
1683d8817e4Smiod
1693d8817e4Smiod## All tools belong in one of the four categories, and are assigned above
1703d8817e4Smiod## We assign ${configdirs} this way to remove all embedded newlines.  This
1713d8817e4Smiod## is important because configure will choke if they ever get through.
1723d8817e4Smiod## ${configdirs} is directories we build using the host tools.
1733d8817e4Smiod## ${target_configdirs} is directories we build using the target tools.
1743d8817e4Smiodconfigdirs=`echo ${host_libs} ${host_tools}`
1753d8817e4Smiodtarget_configdirs=`echo ${target_libraries} ${target_tools}`
1763d8817e4Smiodbuild_configdirs=`echo ${build_libs} ${build_tools}`
1773d8817e4Smiod
1783d8817e4Smiod################################################################################
1793d8817e4Smiod
1803d8817e4Smiodsrcname="gnu development package"
1813d8817e4Smiod
1823d8817e4Smiod# This gets set non-empty for some net releases of packages.
1833d8817e4Smiodappdirs=""
1843d8817e4Smiod
1853d8817e4Smiod# Define is_cross_compiler to save on calls to 'test'.
1863d8817e4Smiodis_cross_compiler=
1873d8817e4Smiodif test x"${host}" = x"${target}" ; then
1883d8817e4Smiod  is_cross_compiler=no
1893d8817e4Smiodelse
1903d8817e4Smiod  is_cross_compiler=yes
1913d8817e4Smiodfi
1923d8817e4Smiod
1933d8817e4Smiod# Find the build and target subdir names.
1943d8817e4SmiodGCC_TOPLEV_SUBDIRS
1953d8817e4Smiod
1963d8817e4Smiod# Skipdirs are removed silently.
1973d8817e4Smiodskipdirs=
1983d8817e4Smiod# Noconfigdirs are removed loudly.
1993d8817e4Smiodnoconfigdirs=""
2003d8817e4Smiod
2013d8817e4Smioduse_gnu_ld=
2023d8817e4Smiod# Make sure we don't let GNU ld be added if we didn't want it.
2033d8817e4Smiodif test x$with_gnu_ld = xno ; then
2043d8817e4Smiod  use_gnu_ld=no
2053d8817e4Smiod  noconfigdirs="$noconfigdirs ld"
2063d8817e4Smiodfi
2073d8817e4Smiod
2083d8817e4Smioduse_gnu_as=
2093d8817e4Smiod# Make sure we don't let GNU as be added if we didn't want it.
2103d8817e4Smiodif test x$with_gnu_as = xno ; then
2113d8817e4Smiod  use_gnu_as=no
2123d8817e4Smiod  noconfigdirs="$noconfigdirs gas"
2133d8817e4Smiodfi
2143d8817e4Smiod
2153d8817e4Smiod# some tools are so dependent upon X11 that if we're not building with X,
2163d8817e4Smiod# it's not even worth trying to configure, much less build, that tool.
2173d8817e4Smiod
2183d8817e4Smiodcase ${with_x} in
2193d8817e4Smiod  yes | "") ;; # the default value for this tree is that X11 is available
2203d8817e4Smiod  no)
2213d8817e4Smiod    skipdirs="${skipdirs} tk itcl libgui"
2223d8817e4Smiod    # We won't be able to build gdbtk without X.
2233d8817e4Smiod    enable_gdbtk=no
2243d8817e4Smiod    ;;
2253d8817e4Smiod  *)  echo "*** bad value \"${with_x}\" for -with-x flag; ignored" 1>&2 ;;
2263d8817e4Smiodesac
2273d8817e4Smiod
2283d8817e4Smiod# Some tools are only suitable for building in a "native" situation.
2293d8817e4Smiod# Remove these if host!=target.
2303d8817e4Smiodnative_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf"
2313d8817e4Smiod
2323d8817e4Smiod# Similarly, some are only suitable for cross toolchains.
2333d8817e4Smiod# Remove these if host=target.
2343d8817e4Smiodcross_only="target-libgloss target-newlib target-opcodes"
2353d8817e4Smiod
2363d8817e4Smiodcase $is_cross_compiler in
2373d8817e4Smiod  no) skipdirs="${skipdirs} ${cross_only}" ;;
2383d8817e4Smiod  yes) skipdirs="${skipdirs} ${native_only}" ;;
2393d8817e4Smiodesac
2403d8817e4Smiod
2413d8817e4Smiod# If both --with-headers and --with-libs are specified, default to
2423d8817e4Smiod# --without-newlib.
2433d8817e4Smiodif test x"${with_headers}" != x && test x"${with_headers}" != xno \
2443d8817e4Smiod   && test x"${with_libs}" != x && test x"${with_libs}" != xno ; then
2453d8817e4Smiod  if test x"${with_newlib}" = x ; then
2463d8817e4Smiod    with_newlib=no
2473d8817e4Smiod  fi
2483d8817e4Smiodfi
2493d8817e4Smiod
2503d8817e4Smiod# Recognize --with-newlib/--without-newlib.
2513d8817e4Smiodcase ${with_newlib} in
2523d8817e4Smiod  no) skipdirs="${skipdirs} target-newlib" ;;
2533d8817e4Smiod  yes) skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'` ;;
2543d8817e4Smiodesac
2553d8817e4Smiod
2563d8817e4Smiod# Configure extra directories which are host specific
2573d8817e4Smiod
2583d8817e4Smiodcase "${host}" in
2593d8817e4Smiod  *-cygwin*)
2603d8817e4Smiod    configdirs="$configdirs libtermcap" ;;
2613d8817e4Smiodesac
2623d8817e4Smiod
2633d8817e4Smiod# A target can indicate whether a language isn't supported for some reason.
2643d8817e4Smiod# Only spaces may be used in this macro; not newlines or tabs.
2653d8817e4Smiodunsupported_languages=
2663d8817e4Smiod
2673d8817e4Smiod# Remove more programs from consideration, based on the host or
2683d8817e4Smiod# target this usually means that a port of the program doesn't
2693d8817e4Smiod# exist yet.
2703d8817e4Smiod
2713d8817e4Smiodcase "${host}" in
2723d8817e4Smiod  hppa*64*-*-*)
2733d8817e4Smiod    noconfigdirs="$noconfigdirs byacc"
2743d8817e4Smiod    ;;
2753d8817e4Smiod  i[[3456789]]86-*-vsta)
2763d8817e4Smiod    noconfigdirs="$noconfigdirs tcl expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff guile perl itcl gnuserv gettext"
2773d8817e4Smiod    ;;
2783d8817e4Smiod  i[[3456789]]86-*-go32* | i[[3456789]]86-*-msdosdjgpp*)
2793d8817e4Smiod    noconfigdirs="$noconfigdirs tcl tk expect dejagnu send-pr uudecode guile itcl gnuserv libffi"
2803d8817e4Smiod    ;;
2813d8817e4Smiod  i[[3456789]]86-*-mingw32*)
2823d8817e4Smiod    # noconfigdirs="tcl tk expect dejagnu make texinfo bison patch flex byacc send-pr uudecode dejagnu diff guile perl itcl gnuserv"
2833d8817e4Smiod    noconfigdirs="$noconfigdirs expect dejagnu autoconf automake send-pr rcs guile perl texinfo libtool"
2843d8817e4Smiod    ;;
2853d8817e4Smiod  i[[3456789]]86-*-beos*)
2863d8817e4Smiod    noconfigdirs="$noconfigdirs tk itcl libgui gdb"
2873d8817e4Smiod    ;;
2883d8817e4Smiod  *-*-cygwin*)
2893d8817e4Smiod    noconfigdirs="$noconfigdirs autoconf automake send-pr rcs guile perl"
2903d8817e4Smiod    ;;
2913d8817e4Smiod  *-*-netbsd*)
2923d8817e4Smiod    noconfigdirs="$noconfigdirs rcs"
2933d8817e4Smiod    ;;
2943d8817e4Smiod  ppc*-*-pe)
2953d8817e4Smiod    noconfigdirs="$noconfigdirs patch diff make tk tcl expect dejagnu autoconf automake texinfo bison send-pr gprof rcs guile perl itcl gnuserv"
2963d8817e4Smiod    ;;
2973d8817e4Smiod  powerpc-*-beos*)
2983d8817e4Smiod    noconfigdirs="$noconfigdirs tk itcl libgui gdb dejagnu readline"
2993d8817e4Smiod    ;;
3003d8817e4Smiodesac
3013d8817e4Smiod
3023d8817e4Smiod
3033d8817e4SmiodAC_ARG_ENABLE(libada,
3043d8817e4Smiod[  --enable-libada        Builds libada directory],
3053d8817e4SmiodENABLE_LIBADA=$enableval,
3063d8817e4SmiodENABLE_LIBADA=yes)
3073d8817e4Smiodif test "${ENABLE_LIBADA}" != "yes" ; then
3083d8817e4Smiod  noconfigdirs="$noconfigdirs gnattools"
3093d8817e4Smiodfi
3103d8817e4Smiod
3113d8817e4SmiodAC_ARG_ENABLE(libssp,
3123d8817e4Smiod[  --enable-libssp        Builds libssp directory],
3133d8817e4SmiodENABLE_LIBSSP=$enableval,
3143d8817e4SmiodENABLE_LIBSSP=yes)
3153d8817e4Smiod
3163d8817e4Smiod# Set the default so we build libgcc-math for ix86 and x86_64
3173d8817e4SmiodAC_ARG_ENABLE(libgcc-math,
3183d8817e4Smiod[  --enable-libgcc-math   Builds libgcc-math directory],,
3193d8817e4Smiod[
3203d8817e4Smiodcase "${target}" in
3213d8817e4Smiod  i?86-* | x86_64-* )
3223d8817e4Smiod    enable_libgcc_math=yes ;;
3233d8817e4Smiod  *)
3243d8817e4Smiod    enable_libgcc_math=no ;;
3253d8817e4Smiodesac
3263d8817e4Smiod])
3273d8817e4Smiod
3283d8817e4Smiod# Save it here so that, even in case of --enable-libgcj, if the Java
3293d8817e4Smiod# front-end isn't enabled, we still get libgcj disabled.
3303d8817e4Smiodlibgcj_saved=$libgcj
3313d8817e4Smiodcase $enable_libgcj in
3323d8817e4Smiodyes)
3333d8817e4Smiod  # If we reset it here, it won't get added to noconfigdirs in the
3343d8817e4Smiod  # target-specific build rules, so it will be forcibly enabled
3353d8817e4Smiod  # (unless the Java language itself isn't enabled).
3363d8817e4Smiod  libgcj=
3373d8817e4Smiod  ;;
3383d8817e4Smiodno)
3393d8817e4Smiod  # Make sure we get it printed in the list of not supported target libs.
3403d8817e4Smiod  noconfigdirs="$noconfigdirs ${libgcj}"
3413d8817e4Smiod  ;;
3423d8817e4Smiodesac
3433d8817e4Smiod
3443d8817e4Smiod
3453d8817e4Smiod# Disable libmudflap on some systems.
3463d8817e4Smiodif test x$enable_libmudflap = x ; then
3473d8817e4Smiod    case "${target}" in
3483d8817e4Smiod    *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu)
3493d8817e4Smiod        # Enable libmudflap by default in GNU and friends.
3503d8817e4Smiod	;;
3513d8817e4Smiod    *-*-freebsd*)
3523d8817e4Smiod        # Enable libmudflap by default in FreeBSD.
3533d8817e4Smiod	;;
3543d8817e4Smiod    *)
3553d8817e4Smiod        # Disable it by default everywhere else.
3563d8817e4Smiod	noconfigdirs="$noconfigdirs target-libmudflap"
3573d8817e4Smiod	;;
3583d8817e4Smiod    esac
3593d8817e4Smiodfi
3603d8817e4Smiod
3613d8817e4Smiod# Disable libgomp on non POSIX hosted systems.
3623d8817e4Smiodif test x$enable_libgomp = x ; then
3633d8817e4Smiod    # Enable libgomp by default on hosted POSIX systems.
3643d8817e4Smiod    case "${target}" in
3653d8817e4Smiod    *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu)
3663d8817e4Smiod	;;
3673d8817e4Smiod    *-*-netbsd* | *-*-freebsd* | *-*-openbsd*)
3683d8817e4Smiod	;;
3693d8817e4Smiod    *-*-solaris2* | *-*-sysv4* | *-*-irix* | *-*-osf* | *-*-hpux*)
3703d8817e4Smiod	;;
3713d8817e4Smiod    *-*-darwin* | *-*-aix*)
3723d8817e4Smiod	;;
3733d8817e4Smiod    *)
3743d8817e4Smiod	noconfigdirs="$noconfigdirs target-libgomp"
3753d8817e4Smiod	;;
3763d8817e4Smiod    esac
3773d8817e4Smiodfi
3783d8817e4Smiod
3793d8817e4Smiod
3803d8817e4Smiodcase "${target}" in
3813d8817e4Smiod  *-*-chorusos)
3823d8817e4Smiod    noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
3833d8817e4Smiod    ;;
3843d8817e4Smiod  powerpc-*-darwin*)
3853d8817e4Smiod    noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb gprof"
3863d8817e4Smiod    noconfigdirs="$noconfigdirs sim target-rda"
3873d8817e4Smiod    ;;
3883d8817e4Smiod  *-*-darwin*)
3893d8817e4Smiod    noconfigdirs="$noconfigdirs ld gas gdb gprof"
3903d8817e4Smiod    noconfigdirs="$noconfigdirs sim target-rda"
3913d8817e4Smiod    noconfigdirs="$noconfigdirs ${libgcj}"
3923d8817e4Smiod    ;;
3933d8817e4Smiod  *-*-freebsd[[12]] | *-*-freebsd[[12]].* | *-*-freebsd*aout*)
3943d8817e4Smiod    noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
3953d8817e4Smiod    ;;
3963d8817e4Smiod  *-*-freebsd*)
3973d8817e4Smiod    noconfigdirs="$noconfigdirs target-newlib target-libgloss"
3983d8817e4Smiod    if test "x$with_gmp" = x && test "x$with_gmp_dir" = x \
3993d8817e4Smiod	&& test -f /usr/local/include/gmp.h; then
4003d8817e4Smiod      with_gmp=/usr/local
4013d8817e4Smiod    fi
4023d8817e4Smiod
4033d8817e4Smiod    # Skip some stuff that's unsupported on some FreeBSD configurations.
4043d8817e4Smiod    case "${target}" in
4053d8817e4Smiod      i*86-*-*) ;;
4063d8817e4Smiod      alpha*-*-*) ;;
4073d8817e4Smiod      *)
4083d8817e4Smiod	noconfigdirs="$noconfigdirs ${libgcj}"
4093d8817e4Smiod	;;
4103d8817e4Smiod    esac
4113d8817e4Smiod    ;;
4123d8817e4Smiod  *-*-kaos*)
4133d8817e4Smiod    # Remove unsupported stuff on all kaOS configurations.
4143d8817e4Smiod    skipdirs="target-libiberty ${libgcj} target-libstdc++-v3 target-librx"
4153d8817e4Smiod    skipdirs="$skipdirs target-libobjc target-examples target-groff target-gperf"
4163d8817e4Smiod    skipdirs="$skipdirs zlib fastjar target-libjava target-boehm-gc target-zlib"
4173d8817e4Smiod    noconfigdirs="$noconfigdirs target-libgloss"
4183d8817e4Smiod    ;;
4193d8817e4Smiod  *-*-netbsd*)
4203d8817e4Smiod    # Skip some stuff on all NetBSD configurations.
4213d8817e4Smiod    noconfigdirs="$noconfigdirs target-newlib target-libiberty target-libgloss"
4223d8817e4Smiod
4233d8817e4Smiod    # Skip some stuff that's unsupported on some NetBSD configurations.
4243d8817e4Smiod    case "${target}" in
4253d8817e4Smiod      i*86-*-netbsdelf*) ;;
4263d8817e4Smiod      arm*-*-netbsdelf*) ;;
4273d8817e4Smiod      *)
4283d8817e4Smiod	noconfigdirs="$noconfigdirs ${libgcj}"
4293d8817e4Smiod	;;
4303d8817e4Smiod    esac
4313d8817e4Smiod    ;;
4323d8817e4Smiod  *-*-netware*)
4333d8817e4Smiod    noconfigdirs="$noconfigdirs target-newlib target-libiberty target-libgloss ${libgcj} target-libmudflap"
4343d8817e4Smiod    ;;
435d2386abeSmiod  *-*-openbsd*)
436d2386abeSmiod    # Skip some stuff on all OpenBSD configurations.
43765ddc896Smiod    noconfigdirs="$noconfigdirs etc gdb gprof target-libiberty"
438d2386abeSmiod    ;;
4393d8817e4Smiod  *-*-rtems*)
4403d8817e4Smiod    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
4413d8817e4Smiod    ;;
4423d8817e4Smiod    # The tpf target doesn't support gdb yet.
4433d8817e4Smiod  *-*-tpf*)
4443d8817e4Smiod    noconfigdirs="$noconfigdirs target-newlib target-libgloss target-libiberty ${libgcj} target-libmudflap gdb tcl tk libgui itcl"
4453d8817e4Smiod    ;;
4463d8817e4Smiod  *-*-uclinux*)
4473d8817e4Smiod    noconfigdirs="$noconfigdirs target-newlib target-libgloss target-rda ${libgcj}"
4483d8817e4Smiod    ;;
4493d8817e4Smiod  *-*-vxworks*)
4503d8817e4Smiod    noconfigdirs="$noconfigdirs target-newlib target-libgloss target-libiberty target-libstdc++-v3 ${libgcj}"
4513d8817e4Smiod    ;;
4523d8817e4Smiod  m32c-*-*)
4533d8817e4Smiod    noconfigdirs="$noconfigdirs target-libstdc++-v3"
4543d8817e4Smiod    ;;
4553d8817e4Smiod  alpha*-dec-osf*)
4563d8817e4Smiod    # ld works, but does not support shared libraries.
4573d8817e4Smiod    # newlib is not 64 bit ready.  I'm not sure about fileutils.
4583d8817e4Smiod    # gas doesn't generate exception information.
4593d8817e4Smiod    noconfigdirs="$noconfigdirs gas ld fileutils target-newlib target-libgloss"
4603d8817e4Smiod    ;;
4613d8817e4Smiod  alpha*-*-*vms*)
4623d8817e4Smiod    noconfigdirs="$noconfigdirs gdb ld target-newlib target-libgloss ${libgcj}"
4633d8817e4Smiod    ;;
4643d8817e4Smiod  alpha*-*-linux*)
4653d8817e4Smiod    # newlib is not 64 bit ready
4663d8817e4Smiod    noconfigdirs="$noconfigdirs target-newlib target-libgloss"
4673d8817e4Smiod    ;;
4683d8817e4Smiod  alpha*-*-*)
4693d8817e4Smiod    # newlib is not 64 bit ready
4703d8817e4Smiod    noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
4713d8817e4Smiod    ;;
4723d8817e4Smiod  am33_2.0-*-linux*)
4733d8817e4Smiod    noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
4743d8817e4Smiod    ;;
4753d8817e4Smiod  sh-*-linux*)
4763d8817e4Smiod    noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
4773d8817e4Smiod    ;;
4783d8817e4Smiod  sh*-*-pe|mips*-*-pe|*arm-wince-pe)
4793d8817e4Smiod    noconfigdirs="$noconfigdirs ${libgcj}"
4803d8817e4Smiod    noconfigdirs="$noconfigdirs target-examples"
4813d8817e4Smiod    noconfigdirs="$noconfigdirs target-libiberty texinfo send-pr"
4823d8817e4Smiod    noconfigdirs="$noconfigdirs tcl tk itcl libgui sim"
4833d8817e4Smiod    noconfigdirs="$noconfigdirs expect dejagnu"
4843d8817e4Smiod    # the C++ libraries don't build on top of CE's C libraries
4853d8817e4Smiod    noconfigdirs="$noconfigdirs target-libstdc++-v3"
4863d8817e4Smiod    noconfigdirs="$noconfigdirs target-newlib"
4873d8817e4Smiod    case "${host}" in
4883d8817e4Smiod      *-*-cygwin*) ;; # keep gdb and readline
4893d8817e4Smiod      *) noconfigdirs="$noconfigdirs gdb readline"
4903d8817e4Smiod	 ;;
4913d8817e4Smiod    esac
4923d8817e4Smiod    ;;
4933d8817e4Smiod  arc-*-*)
4943d8817e4Smiod    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
4953d8817e4Smiod    ;;
4963d8817e4Smiod  arm-semi-aof )
4973d8817e4Smiod    ;;
4983d8817e4Smiod  arm-*-coff | strongarm-*-coff | xscale-*-coff)
4993d8817e4Smiod    noconfigdirs="$noconfigdirs ${libgcj}"
5003d8817e4Smiod    ;;
5013d8817e4Smiod  arm-*-elf* | strongarm-*-elf* | xscale-*-elf* | arm*-*-eabi* )
5023d8817e4Smiod    noconfigdirs="$noconfigdirs target-libffi target-qthreads"
5033d8817e4Smiod    ;;
5043d8817e4Smiod  arm*-*-linux-gnueabi)
5053d8817e4Smiod    noconfigdirs="$noconfigdirs target-libffi target-qthreads"
5063d8817e4Smiod    noconfigdirs="$noconfigdirs target-libjava target-libobjc"
5073d8817e4Smiod    ;;
5083d8817e4Smiod  arm*-*-symbianelf*)
5093d8817e4Smiod    noconfigdirs="$noconfigdirs ${libgcj} target-libiberty"
5103d8817e4Smiod    ;;
5113d8817e4Smiod  arm-*-pe*)
5123d8817e4Smiod    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
5133d8817e4Smiod    ;;
5143d8817e4Smiod  thumb-*-coff)
5153d8817e4Smiod    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
5163d8817e4Smiod    ;;
5173d8817e4Smiod  thumb-*-elf)
5183d8817e4Smiod    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
5193d8817e4Smiod    ;;
5203d8817e4Smiod  thumb-*-pe)
5213d8817e4Smiod    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
5223d8817e4Smiod    ;;
5233d8817e4Smiod  arm-*-riscix*)
5243d8817e4Smiod    noconfigdirs="$noconfigdirs ld target-libgloss ${libgcj}"
5253d8817e4Smiod    ;;
5263d8817e4Smiod  avr-*-*)
5273d8817e4Smiod    noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj}"
5283d8817e4Smiod    ;;
5293d8817e4Smiod  bfin-*-*)
5303d8817e4Smiod    noconfigdirs="$noconfigdirs target-libgloss gdb"
5313d8817e4Smiod    if test x${is_cross_compiler} != xno ; then
5323d8817e4Smiod      target_configdirs="${target_configdirs} target-bsp target-cygmon"
5333d8817e4Smiod    fi
5343d8817e4Smiod    ;;
5353d8817e4Smiod  c4x-*-* | tic4x-*-*)
5363d8817e4Smiod    noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libgloss ${libgcj}"
5373d8817e4Smiod    ;;
5383d8817e4Smiod  c54x*-*-* | tic54x-*-*)
5393d8817e4Smiod    noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libgloss ${libgcj} gcc gdb newlib"
5403d8817e4Smiod    ;;
5413d8817e4Smiod  cris-*-* | crisv32-*-*)
5423d8817e4Smiod    unsupported_languages="$unsupported_languages java"
5433d8817e4Smiod    case "${target}" in
5443d8817e4Smiod      *-*-aout)
5453d8817e4Smiod	unsupported_languages="$unsupported_languages fortran"
5463d8817e4Smiod	noconfigdirs="$noconfigdirs target-libffi target-boehm-gc";;
5473d8817e4Smiod      *-*-elf)
5483d8817e4Smiod	unsupported_languages="$unsupported_languages fortran"
5493d8817e4Smiod	noconfigdirs="$noconfigdirs target-boehm-gc";;
5503d8817e4Smiod      *-*-linux*)
5513d8817e4Smiod	noconfigdirs="$noconfigdirs target-newlib target-libgloss";;
5523d8817e4Smiod      *)
5533d8817e4Smiod	unsupported_languages="$unsupported_languages fortran"
5543d8817e4Smiod	noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss";;
5553d8817e4Smiod    esac
5563d8817e4Smiod    ;;
5573d8817e4Smiod  crx-*-*)
5583d8817e4Smiod    noconfigdirs="$noconfigdirs target-libstdc++-v3 target-mudflap ${libgcj}"
5593d8817e4Smiod    ;;
5603d8817e4Smiod  d10v-*-*)
5613d8817e4Smiod    noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libgloss ${libgcj}"
5623d8817e4Smiod    ;;
5633d8817e4Smiod  d30v-*-*)
5643d8817e4Smiod    noconfigdirs="$noconfigdirs ${libgcj} gdb"
5653d8817e4Smiod    ;;
5663d8817e4Smiod  fr30-*-elf*)
5673d8817e4Smiod    noconfigdirs="$noconfigdirs ${libgcj} gdb"
5683d8817e4Smiod    ;;
5693d8817e4Smiod  frv-*-*)
5703d8817e4Smiod    noconfigdirs="$noconfigdirs ${libgcj}"
5713d8817e4Smiod    ;;
5723d8817e4Smiod  h8300*-*-*)
5733d8817e4Smiod    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
5743d8817e4Smiod    ;;
5753d8817e4Smiod  h8500-*-*)
5763d8817e4Smiod    noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libgloss ${libgcj}"
5773d8817e4Smiod    ;;
5783d8817e4Smiod  hppa1.1-*-osf* | hppa1.1-*-bsd* )
5793d8817e4Smiod    ;;
5803d8817e4Smiod  hppa*64*-*-linux* | parisc*64*-*-linux*)
5813d8817e4Smiod    # In this case, it's because the hppa64-linux target is for
5823d8817e4Smiod    # the kernel only at this point and has no libc, and thus no
5833d8817e4Smiod    # headers, crt*.o, etc., all of which are needed by these.
5843d8817e4Smiod    noconfigdirs="$noconfigdirs target-zlib"
5853d8817e4Smiod    ;;
5863d8817e4Smiod  parisc*-*-linux* | hppa*-*-linux*)
5873d8817e4Smiod    ;;
5883d8817e4Smiod  hppa*-*-*elf* | \
5893d8817e4Smiod  hppa*-*-lites* | \
5903d8817e4Smiod  hppa*-*-openbsd* | \
5913d8817e4Smiod  hppa*64*-*-*)
5923d8817e4Smiod    noconfigdirs="$noconfigdirs ${libgcj}"
5933d8817e4Smiod    ;;
5943d8817e4Smiod  hppa*-*-*)
5953d8817e4Smiod    # According to Alexandre Oliva <aoliva@redhat.com>, libjava won't
5963d8817e4Smiod    # build on HP-UX 10.20.
5973d8817e4Smiod    noconfigdirs="$noconfigdirs ld shellutils ${libgcj}"
5983d8817e4Smiod    ;;
5993d8817e4Smiod  i960-*-*)
6003d8817e4Smiod    noconfigdirs="$noconfigdirs ${libgcj} gdb"
6013d8817e4Smiod    ;;
6023d8817e4Smiod  ia64*-*-elf*)
6033d8817e4Smiod    # No gdb support yet.
6043d8817e4Smiod    noconfigdirs="$noconfigdirs readline mmalloc libgui itcl gdb"
6053d8817e4Smiod    ;;
6063d8817e4Smiod  ia64*-**-hpux*)
6073d8817e4Smiod    # No gdb or ld support yet.
6083d8817e4Smiod    noconfigdirs="$noconfigdirs ${libgcj} readline mmalloc libgui itcl gdb ld"
6093d8817e4Smiod    ;;
6103d8817e4Smiod  i370-*-opened*)
6113d8817e4Smiod    ;;
6123d8817e4Smiod  i[[3456789]]86-*-coff | i[[3456789]]86-*-elf)
6133d8817e4Smiod    noconfigdirs="$noconfigdirs ${libgcj}"
6143d8817e4Smiod    ;;
6153d8817e4Smiod  i[[3456789]]86-*-linux*)
6163d8817e4Smiod    # The GCC port for glibc1 has no MD_FALLBACK_FRAME_STATE_FOR, so let's
6173d8817e4Smiod    # not build java stuff by default.
6183d8817e4Smiod    case "${target}" in
6193d8817e4Smiod      *-*-*libc1*)
6203d8817e4Smiod	noconfigdirs="$noconfigdirs ${libgcj}";;
6213d8817e4Smiod    esac
6223d8817e4Smiod
6233d8817e4Smiod    # This section makes it possible to build newlib natively on linux.
6243d8817e4Smiod    # If we are using a cross compiler then don't configure newlib.
6253d8817e4Smiod    if test x${is_cross_compiler} != xno ; then
6263d8817e4Smiod      noconfigdirs="$noconfigdirs target-newlib"
6273d8817e4Smiod    fi
6283d8817e4Smiod    noconfigdirs="$noconfigdirs target-libgloss"
6293d8817e4Smiod    # If we are not using a cross compiler, do configure newlib.
6303d8817e4Smiod    # Note however, that newlib will only be configured in this situation
6313d8817e4Smiod    # if the --with-newlib option has been given, because otherwise
6323d8817e4Smiod    # 'target-newlib' will appear in skipdirs.
6333d8817e4Smiod    ;;
6343d8817e4Smiod  i[[3456789]]86-*-mingw32*)
6353d8817e4Smiod    target_configdirs="$target_configdirs target-mingw"
6363d8817e4Smiod    noconfigdirs="$noconfigdirs expect target-libgloss ${libgcj}"
6373d8817e4Smiod
6383d8817e4Smiod    # Can't build gdb for mingw32 if not native.
6393d8817e4Smiod    case "${host}" in
6403d8817e4Smiod      i[[3456789]]86-*-mingw32) ;; # keep gdb tcl tk expect etc.
6413d8817e4Smiod      *) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl gnuserv"
6423d8817e4Smiod         ;;
6433d8817e4Smiod    esac
6443d8817e4Smiod    ;;
6453d8817e4Smiod  *-*-cygwin*)
6463d8817e4Smiod    target_configdirs="$target_configdirs target-libtermcap target-winsup"
6473d8817e4Smiod    noconfigdirs="$noconfigdirs target-gperf target-libgloss ${libgcj}"
6483d8817e4Smiod    # always build newlib if winsup directory is present.
6493d8817e4Smiod    if test -d "$srcdir/winsup"; then
6503d8817e4Smiod      skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
6513d8817e4Smiod    elif test -d "$srcdir/newlib"; then
6523d8817e4Smiod      echo "Warning: winsup is missing so newlib can't be built."
6533d8817e4Smiod    fi
6543d8817e4Smiod
6553d8817e4Smiod    # Can't build gdb for Cygwin if not native.
6563d8817e4Smiod    case "${host}" in
6573d8817e4Smiod      *-*-cygwin*) ;; # keep gdb tcl tk expect etc.
6583d8817e4Smiod      *) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl libgui gnuserv"
6593d8817e4Smiod         ;;
6603d8817e4Smiod    esac
6613d8817e4Smiod    ;;
6623d8817e4Smiod  i[[3456789]]86-moss-msdos | i[[3456789]]86-*-moss* | \
6633d8817e4Smiod  i[[3456789]]86-*-uwin* | i[[3456789]]86-*-interix* )
6643d8817e4Smiod    ;;
6653d8817e4Smiod  i[[3456789]]86-*-pe)
6663d8817e4Smiod    noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libgloss ${libgcj}"
6673d8817e4Smiod    ;;
6683d8817e4Smiod  i[[3456789]]86-*-sco3.2v5*)
6693d8817e4Smiod    # The linker does not yet know about weak symbols in COFF,
6703d8817e4Smiod    # and is not configured to handle mixed ELF and COFF.
6713d8817e4Smiod    noconfigdirs="$noconfigdirs ld target-libgloss ${libgcj}"
6723d8817e4Smiod    ;;
6733d8817e4Smiod  i[[3456789]]86-*-sco*)
6743d8817e4Smiod    noconfigdirs="$noconfigdirs gprof target-libgloss ${libgcj}"
6753d8817e4Smiod    ;;
6763d8817e4Smiod  i[[3456789]]86-*-solaris2*)
6773d8817e4Smiod    noconfigdirs="$noconfigdirs target-libgloss"
6783d8817e4Smiod    ;;
6793d8817e4Smiod  i[[3456789]]86-*-sysv4*)
6803d8817e4Smiod    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
6813d8817e4Smiod    ;;
6823d8817e4Smiod  i[[3456789]]86-*-beos*)
6833d8817e4Smiod    noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss ${libgcj}"
6843d8817e4Smiod    ;;
6853d8817e4Smiod  i[[3456789]]86-*-rdos*)
6863d8817e4Smiod    noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss"
6873d8817e4Smiod    ;;
6883d8817e4Smiod  m32r-*-*)
6893d8817e4Smiod    noconfigdirs="$noconfigdirs ${libgcj}"
6903d8817e4Smiod    ;;
6913d8817e4Smiod  m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)
6923d8817e4Smiod    noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj}"
6933d8817e4Smiod    ;;
6943d8817e4Smiod  m68k-*-elf*)
6953d8817e4Smiod    noconfigdirs="$noconfigdirs ${libgcj}"
6963d8817e4Smiod    ;;
6973d8817e4Smiod  m68k-*-coff*)
6983d8817e4Smiod    noconfigdirs="$noconfigdirs ${libgcj}"
6993d8817e4Smiod    ;;
7003d8817e4Smiod  mcore-*-pe*)
7013d8817e4Smiod  # The EPOC C++ environment does not support exceptions or rtti,
7023d8817e4Smiod  # and so building libstdc++-v3 tends not to always work.
7033d8817e4Smiod    noconfigdirs="$noconfigdirs target-libstdc++-v3"
7043d8817e4Smiod    ;;
7053d8817e4Smiod  mmix-*-*)
7063d8817e4Smiod    noconfigdirs="$noconfigdirs target-libffi target-boehm-gc gdb libgloss"
7073d8817e4Smiod    unsupported_languages="$unsupported_languages fortran java"
7083d8817e4Smiod    ;;
7093d8817e4Smiod  mn10200-*-*)
7103d8817e4Smiod    noconfigdirs="$noconfigdirs ${libgcj}"
7113d8817e4Smiod    ;;
7123d8817e4Smiod  mn10300-*-*)
7133d8817e4Smiod    noconfigdirs="$noconfigdirs ${libgcj}"
7143d8817e4Smiod    ;;
7153d8817e4Smiod  mt-*-*)
7163d8817e4Smiod    noconfigdirs="$noconfigdirs sim"
7173d8817e4Smiod    ;;
7183d8817e4Smiod  powerpc-*-aix*)
7193d8817e4Smiod    # copied from rs6000-*-* entry
7203d8817e4Smiod    noconfigdirs="$noconfigdirs gprof target-libgloss target-libssp ${libgcj}"
7213d8817e4Smiod    ;;
7223d8817e4Smiod  powerpc*-*-winnt* | powerpc*-*-pe* | ppc*-*-pe)
7233d8817e4Smiod    target_configdirs="$target_configdirs target-winsup"
7243d8817e4Smiod    noconfigdirs="$noconfigdirs gdb tcl tk make expect target-libgloss itcl gnuserv ${libgcj}"
7253d8817e4Smiod    # always build newlib.
7263d8817e4Smiod    skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
7273d8817e4Smiod    ;;
7283d8817e4Smiod    # This is temporary until we can link against shared libraries
7293d8817e4Smiod  powerpcle-*-solaris*)
7303d8817e4Smiod    noconfigdirs="$noconfigdirs gdb sim make tcl tk expect itcl gnuserv ${libgcj}"
7313d8817e4Smiod    ;;
7323d8817e4Smiod  powerpc-*-beos*)
7333d8817e4Smiod    noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss ${libgcj}"
7343d8817e4Smiod    ;;
7353d8817e4Smiod  powerpc-*-eabi)
7363d8817e4Smiod    noconfigdirs="$noconfigdirs ${libgcj}"
7373d8817e4Smiod    ;;
7383d8817e4Smiod  powerpc-*-eabi* | powerpcle-*-eabi* | powerpc-*-rtems* )
7393d8817e4Smiod    ;;
7403d8817e4Smiod  rs6000-*-lynxos*)
7413d8817e4Smiod    noconfigdirs="$noconfigdirs target-newlib gprof ${libgcj}"
7423d8817e4Smiod    ;;
7433d8817e4Smiod  rs6000-*-aix*)
7443d8817e4Smiod    noconfigdirs="$noconfigdirs gprof target-libgloss target-libssp ${libgcj}"
7453d8817e4Smiod    ;;
7463d8817e4Smiod  rs6000-*-*)
7473d8817e4Smiod    noconfigdirs="$noconfigdirs gprof ${libgcj}"
7483d8817e4Smiod    ;;
7493d8817e4Smiod  m68k-apollo-*)
7503d8817e4Smiod    noconfigdirs="$noconfigdirs ld binutils gprof target-libgloss ${libgcj}"
7513d8817e4Smiod    ;;
7523d8817e4Smiod  mips*-*-irix5*)
7533d8817e4Smiod    noconfigdirs="$noconfigdirs gprof target-libgloss ${libgcj}"
7543d8817e4Smiod    ;;
7553d8817e4Smiod  mips*-*-irix6*)
7563d8817e4Smiod    # Linking libjava exceeds command-line length limits on at least
7573d8817e4Smiod    # IRIX 6.2, but not on IRIX 6.5.
7583d8817e4Smiod    # Also, boehm-gc won't build on IRIX 6.5, according to Jeffrey Oldham
7593d8817e4Smiod    # <oldham@codesourcery.com>
7603d8817e4Smiod    noconfigdirs="$noconfigdirs gprof target-libgloss ${libgcj}"
7613d8817e4Smiod    ;;
7623d8817e4Smiod  mips*-dec-bsd*)
7633d8817e4Smiod    noconfigdirs="$noconfigdirs gprof target-libgloss ${libgcj}"
7643d8817e4Smiod    ;;
7653d8817e4Smiod  mips*-*-bsd*)
7663d8817e4Smiod    noconfigdirs="$noconfigdirs gprof target-libgloss ${libgcj}"
7673d8817e4Smiod    ;;
7683d8817e4Smiod  mipstx39-*-*)
7693d8817e4Smiod    noconfigdirs="$noconfigdirs gprof ${libgcj}"   # same as generic mips
7703d8817e4Smiod    ;;
7713d8817e4Smiod  mips64*-*-linux*)
7723d8817e4Smiod    noconfigdirs="$noconfigdirs target-newlib ${libgcj}"
7733d8817e4Smiod    ;;
7743d8817e4Smiod  mips*-*-linux*)
7753d8817e4Smiod    noconfigdirs="$noconfigdirs target-newlib target-libgloss"
7763d8817e4Smiod    ;;
7773d8817e4Smiod  mips*-*-*)
7783d8817e4Smiod    noconfigdirs="$noconfigdirs gprof ${libgcj}"
7793d8817e4Smiod    ;;
7803d8817e4Smiod  romp-*-*)
7813d8817e4Smiod    noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
7823d8817e4Smiod    ;;
7833d8817e4Smiod  sh-*-* | sh64-*-*)
7843d8817e4Smiod    case "${host}" in
7853d8817e4Smiod      i[[3456789]]86-*-vsta) ;; # don't add gprof back in
7863d8817e4Smiod      i[[3456789]]86-*-go32*) ;; # don't add gprof back in
7873d8817e4Smiod      i[[3456789]]86-*-msdosdjgpp*) ;; # don't add gprof back in
7883d8817e4Smiod      *) skipdirs=`echo " ${skipdirs} " | sed -e 's/ gprof / /'` ;;
7893d8817e4Smiod    esac
7903d8817e4Smiod    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
7913d8817e4Smiod    ;;
7923d8817e4Smiod  sparc-*-elf*)
7933d8817e4Smiod    noconfigdirs="$noconfigdirs ${libgcj}"
7943d8817e4Smiod    ;;
7953d8817e4Smiod  sparc64-*-elf*)
7963d8817e4Smiod    noconfigdirs="$noconfigdirs ${libgcj}"
7973d8817e4Smiod    ;;
7983d8817e4Smiod  sparclite-*-*)
7993d8817e4Smiod    noconfigdirs="$noconfigdirs ${libgcj}"
8003d8817e4Smiod    ;;
8013d8817e4Smiod  sparc-*-sunos4*)
8023d8817e4Smiod    noconfigdirs="$noconfigdirs ${libgcj}"
8033d8817e4Smiod    if test x${is_cross_compiler} != xno ; then
8043d8817e4Smiod           noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss"
8053d8817e4Smiod    else
8063d8817e4Smiod           use_gnu_ld=no
8073d8817e4Smiod    fi
8083d8817e4Smiod    ;;
8093d8817e4Smiod  sparc-*-solaris2.[[0-6]] | sparc-*-solaris2.[[0-6]].*)
8103d8817e4Smiod    noconfigdirs="$noconfigdirs ${libgcj}"
8113d8817e4Smiod    ;;
8123d8817e4Smiod  sparc-*-solaris* | sparc64-*-solaris* | sparcv9-*-solaris*)
8133d8817e4Smiod    ;;
8143d8817e4Smiod  v810-*-*)
8153d8817e4Smiod    noconfigdirs="$noconfigdirs bfd binutils gas gcc gdb ld target-libstdc++-v3 opcodes target-libgloss ${libgcj}"
8163d8817e4Smiod    ;;
8173d8817e4Smiod  v850-*-*)
8183d8817e4Smiod    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
8193d8817e4Smiod    ;;
8203d8817e4Smiod  v850e-*-*)
8213d8817e4Smiod    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
8223d8817e4Smiod    ;;
8233d8817e4Smiod  v850ea-*-*)
8243d8817e4Smiod    noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
8253d8817e4Smiod    ;;
8263d8817e4Smiod  vax-*-vms)
8273d8817e4Smiod    noconfigdirs="$noconfigdirs bfd binutils gdb ld target-newlib opcodes target-libgloss ${libgcj}"
8283d8817e4Smiod    ;;
8293d8817e4Smiod  vax-*-*)
8303d8817e4Smiod    noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
8313d8817e4Smiod    ;;
8323d8817e4Smiod  xtensa-*-*)
8333d8817e4Smiod    noconfigdirs="$noconfigdirs ${libgcj}"
8343d8817e4Smiod    ;;
8353d8817e4Smiod  ip2k-*-*)
8363d8817e4Smiod    noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj}"
8373d8817e4Smiod    ;;
8383d8817e4Smiod  *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu)
8393d8817e4Smiod    noconfigdirs="$noconfigdirs target-newlib target-libgloss"
8403d8817e4Smiod    ;;
8413d8817e4Smiod  *-*-lynxos*)
8423d8817e4Smiod    noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
8433d8817e4Smiod    ;;
8443d8817e4Smiod  *-*-*)
8453d8817e4Smiod    noconfigdirs="$noconfigdirs ${libgcj}"
8463d8817e4Smiod    ;;
8473d8817e4Smiodesac
8483d8817e4Smiod
8493d8817e4Smiod# If we aren't building newlib, then don't build libgloss, since libgloss
8503d8817e4Smiod# depends upon some newlib header files.
8513d8817e4Smiodcase "${noconfigdirs}" in
8523d8817e4Smiod  *target-libgloss*) ;;
8533d8817e4Smiod  *target-newlib*) noconfigdirs="$noconfigdirs target-libgloss" ;;
8543d8817e4Smiodesac
8553d8817e4Smiod
8563d8817e4Smiod# Work in distributions that contain no compiler tools, like Autoconf.
8573d8817e4Smiodtentative_cc=""
8583d8817e4Smiodhost_makefile_frag=/dev/null
8593d8817e4Smiodif test -d ${srcdir}/config ; then
8603d8817e4Smiodcase "${host}" in
8613d8817e4Smiod  m68k-hp-hpux*)
8623d8817e4Smiod    # Avoid "too much defining" errors from HPUX compiler.
8633d8817e4Smiod    tentative_cc="cc -Wp,-H256000"
8643d8817e4Smiod    # If "ar" in $PATH is GNU ar, the symbol table may need rebuilding.
8653d8817e4Smiod    # If it's HP/UX ar, this should be harmless.
8663d8817e4Smiod    RANLIB="ar ts"
8673d8817e4Smiod    ;;
8683d8817e4Smiod  m68k-apollo-sysv*)
8693d8817e4Smiod    tentative_cc="cc -A ansi -A runtype,any -A systype,any -U__STDC__ -DUSG"
8703d8817e4Smiod    ;;
8713d8817e4Smiod  m68k-apollo-bsd*)
8723d8817e4Smiod    #None of the Apollo compilers can compile gas or binutils.  The preprocessor
8733d8817e4Smiod    # chokes on bfd, the compiler won't let you assign integers to enums, and
8743d8817e4Smiod    # other problems.  Defining CC to gcc is a questionable way to say "don't use
8753d8817e4Smiod    # the apollo compiler" (the preferred version of GCC could be called cc,
8763d8817e4Smiod    # or whatever), but I'm not sure leaving CC as cc is any better...
8773d8817e4Smiod    #CC=cc -A ansi -A runtype,any -A systype,any -U__STDC__ -DNO_STDARG
8783d8817e4Smiod    # Used to have BISON=yacc.
8793d8817e4Smiod    tentative_cc=gcc
8803d8817e4Smiod    ;;
8813d8817e4Smiod  m88k-dg-dgux*)
8823d8817e4Smiod    tentative_cc="gcc -Wall -ansi -D__using_DGUX"
8833d8817e4Smiod    ;;
8843d8817e4Smiod  m88k-harris-cxux*)
8853d8817e4Smiod    # Under CX/UX, we want to tell the compiler to use ANSI mode.
8863d8817e4Smiod    tentative_cc="cc -Xa"
8873d8817e4Smiod    host_makefile_frag="config/mh-cxux"
8883d8817e4Smiod    ;;
8893d8817e4Smiod  m88k-motorola-sysv*)
8903d8817e4Smiod    ;;
8913d8817e4Smiod  mips*-dec-ultrix*)
8923d8817e4Smiod    tentative_cc="cc -Wf,-XNg1000"
8933d8817e4Smiod    host_makefile_frag="config/mh-decstation"
8943d8817e4Smiod    ;;
8953d8817e4Smiod  mips*-nec-sysv4*)
8963d8817e4Smiod    # The C compiler on NEC MIPS SVR4 needs bigger tables.
8973d8817e4Smiod    tentative_cc="cc -ZXNd=5000 -ZXNg=1000"
8983d8817e4Smiod    host_makefile_frag="config/mh-necv4"
8993d8817e4Smiod    ;;
9003d8817e4Smiod  mips*-sgi-irix4*)
9013d8817e4Smiod    # Tell compiler to use K&R C.  We can't compile under the SGI Ansi
9023d8817e4Smiod    # environment.  Also bump switch table size so that cp-parse will
9033d8817e4Smiod    # compile.  Bump string length limit so linker builds.
9043d8817e4Smiod    tentative_cc="cc -cckr -Wf,-XNg1500 -Wf,-XNk1000 -Wf,-XNh2000 -Wf,-XNl8192"
9053d8817e4Smiod    ;;
9063d8817e4Smiod  mips*-*-sysv4*)
9073d8817e4Smiod    host_makefile_frag="config/mh-sysv4"
9083d8817e4Smiod    ;;
9093d8817e4Smiod  mips*-*-sysv*)
9103d8817e4Smiod    # This is for a MIPS running RISC/os 4.52C.
9113d8817e4Smiod
9123d8817e4Smiod    # This is needed for GDB, but needs to be in the top-level make because
9133d8817e4Smiod    # if a library is compiled with the bsd headers and gets linked with the
9143d8817e4Smiod    # sysv system libraries all hell can break loose (e.g. a jmp_buf might be
9153d8817e4Smiod    # a different size).
9163d8817e4Smiod    # ptrace(2) apparently has problems in the BSD environment.  No workaround is
9173d8817e4Smiod    # known except to select the sysv environment.  Could we use /proc instead?
9183d8817e4Smiod    # These "sysv environments" and "bsd environments" often end up being a pain.
9193d8817e4Smiod    #
9203d8817e4Smiod    # This is not part of CFLAGS because perhaps not all C compilers have this
9213d8817e4Smiod    # option.
9223d8817e4Smiod    tentative_cc="cc -systype sysv"
9233d8817e4Smiod    ;;
9243d8817e4Smiod  i370-ibm-opened*)
9253d8817e4Smiod    tentative_cc="c89"
9263d8817e4Smiod    ;;
9273d8817e4Smiod  i[[3456789]]86-*-sysv5*)
9283d8817e4Smiod    host_makefile_frag="config/mh-sysv5"
9293d8817e4Smiod    ;;
9303d8817e4Smiod  i[[3456789]]86-*-dgux*)
9313d8817e4Smiod    tentative_cc="gcc -Wall -ansi -D__using_DGUX"
9323d8817e4Smiod    host_makefile_frag="config/mh-dgux386"
9333d8817e4Smiod    ;;
9343d8817e4Smiod  i[[3456789]]86-ncr-sysv4.3*)
9353d8817e4Smiod    # The MetaWare compiler will generate a copyright message unless you
9363d8817e4Smiod    # turn it off by adding the -Hnocopyr flag.
9373d8817e4Smiod    tentative_cc="cc -Hnocopyr"
9383d8817e4Smiod    ;;
9393d8817e4Smiod  i[[3456789]]86-ncr-sysv4*)
9403d8817e4Smiod    # for an NCR 3000 (i486/SVR4) system.
9413d8817e4Smiod    # The NCR 3000 ships with a MetaWare compiler installed as /bin/cc.
9423d8817e4Smiod    # This compiler not only emits obnoxious copyright messages every time
9433d8817e4Smiod    # you run it, but it chokes and dies on a whole bunch of GNU source
9443d8817e4Smiod    # files.  Default to using the AT&T compiler installed in /usr/ccs/ATT/cc.
9453d8817e4Smiod    tentative_cc="/usr/ccs/ATT/cc"
9463d8817e4Smiod    host_makefile_frag="config/mh-ncr3000"
9473d8817e4Smiod    ;;
9483d8817e4Smiod  i[[3456789]]86-*-sco3.2v5*)
9493d8817e4Smiod    ;;
9503d8817e4Smiod  i[[3456789]]86-*-sco*)
9513d8817e4Smiod    # The native C compiler botches some simple uses of const.  Unfortunately,
9523d8817e4Smiod    # it doesn't defined anything like "__sco__" for us to test for in ansidecl.h.
9533d8817e4Smiod    tentative_cc="cc -Dconst="
9543d8817e4Smiod    host_makefile_frag="config/mh-sco"
9553d8817e4Smiod    ;;
9563d8817e4Smiod  i[[3456789]]86-*-udk*)
9573d8817e4Smiod    host_makefile_frag="config/mh-sysv5"
9583d8817e4Smiod    ;;
9593d8817e4Smiod  i[[3456789]]86-*-solaris2*)
9603d8817e4Smiod    host_makefile_frag="config/mh-sysv4"
9613d8817e4Smiod    ;;
9623d8817e4Smiod  i[[3456789]]86-*-msdosdjgpp*)
9633d8817e4Smiod    host_makefile_frag="config/mh-djgpp"
9643d8817e4Smiod    ;;
9653d8817e4Smiod  *-cygwin*)
9663d8817e4Smiod    host_makefile_frag="config/mh-cygwin"
9673d8817e4Smiod    ;;
9683d8817e4Smiod  *-mingw32*)
9693d8817e4Smiod    ;;
9703d8817e4Smiod  *-interix*)
9713d8817e4Smiod    host_makefile_frag="config/mh-interix"
9723d8817e4Smiod    ;;
9733d8817e4Smiod  vax-*-ultrix2*)
9743d8817e4Smiod    # The old BSD pcc isn't up to compiling parts of gdb so use gcc
9753d8817e4Smiod    tentative_cc=gcc
9763d8817e4Smiod    ;;
9773d8817e4Smiod  *-*-solaris2*)
9783d8817e4Smiod    host_makefile_frag="config/mh-solaris"
9793d8817e4Smiod    ;;
9803d8817e4Smiod  m68k-sun-sunos*)
9813d8817e4Smiod    # Sun's C compiler needs the -J flag to be able to compile cp-parse.c
9823d8817e4Smiod    # without overflowing the jump tables (-J says to use a 32 bit table)
9833d8817e4Smiod    tentative_cc="cc -J"
9843d8817e4Smiod    ;;
9853d8817e4Smiod  *-hp-hpux*)
9863d8817e4Smiod    tentative_cc="cc -Wp,-H256000"
9873d8817e4Smiod    ;;
9883d8817e4Smiod  *-*-hiux*)
9893d8817e4Smiod    tentative_cc="cc -Wp,-H256000"
9903d8817e4Smiod    ;;
9913d8817e4Smiod  rs6000-*-lynxos*)
9923d8817e4Smiod    # /bin/cc is less than useful for our purposes.  Always use GCC
9933d8817e4Smiod    tentative_cc="/usr/cygnus/progressive/bin/gcc"
9943d8817e4Smiod    host_makefile_frag="config/mh-lynxrs6k"
9953d8817e4Smiod    ;;
9963d8817e4Smiod  powerpc-*-darwin*)
9973d8817e4Smiod    host_makefile_frag="config/mh-ppc-darwin"
9983d8817e4Smiod    ;;
9993d8817e4Smiod  powerpc-*-aix*)
10003d8817e4Smiod    host_makefile_frag="config/mh-ppc-aix"
10013d8817e4Smiod    ;;
10023d8817e4Smiod  rs6000-*-aix*)
10033d8817e4Smiod    host_makefile_frag="config/mh-ppc-aix"
10043d8817e4Smiod    ;;
10053d8817e4Smiod  *-*-lynxos*)
10063d8817e4Smiod    # /bin/cc is less than useful for our purposes.  Always use GCC
10073d8817e4Smiod    tentative_cc="/bin/gcc"
10083d8817e4Smiod    ;;
10093d8817e4Smiod  *-*-sysv4*)
10103d8817e4Smiod    host_makefile_frag="config/mh-sysv4"
10113d8817e4Smiod    ;;
10123d8817e4Smiod  # This is placed last to prevent interfering with the cases above.
10133d8817e4Smiod  i[[3456789]]86-*-*)
10143d8817e4Smiod    # Build the stage2 and stage3 compilers with -fomit-frame-pointer.
10153d8817e4Smiod    host_makefile_frag="config/mh-x86omitfp"
10163d8817e4Smiod    ;;
10173d8817e4Smiodesac
10183d8817e4Smiodfi
10193d8817e4Smiod
10203d8817e4Smiod# If we aren't going to be using gcc, see if we can extract a definition
10213d8817e4Smiod# of CC from the fragment.
10223d8817e4Smiod# Actually, use the 'pre-extracted' version above.
10233d8817e4Smiodif test -z "${CC}" && test "${build}" = "${host}" ; then
10243d8817e4Smiod  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}:"
10253d8817e4Smiod  found=
10263d8817e4Smiod  for dir in $PATH; do
10273d8817e4Smiod    test -z "$dir" && dir=.
10283d8817e4Smiod    if test -f $dir/gcc; then
10293d8817e4Smiod      found=yes
10303d8817e4Smiod      break
10313d8817e4Smiod    fi
10323d8817e4Smiod  done
10333d8817e4Smiod  IFS="$save_ifs"
10343d8817e4Smiod  if test -z "${found}" && test -n "${tentative_cc}" ; then
10353d8817e4Smiod    CC=$tentative_cc
10363d8817e4Smiod  fi
10373d8817e4Smiodfi
10383d8817e4Smiod
10393d8817e4Smiodif test "${build}" != "${host}" ; then
10403d8817e4Smiod  # If we are doing a Canadian Cross, in which the host and build systems
10413d8817e4Smiod  # are not the same, we set reasonable default values for the tools.
10423d8817e4Smiod
10433d8817e4Smiod  CC=${CC-${host_alias}-gcc}
10443d8817e4Smiod  CFLAGS=${CFLAGS-"-g -O2"}
10453d8817e4Smiod  CXX=${CXX-${host_alias}-c++}
10463d8817e4Smiod  CXXFLAGS=${CXXFLAGS-"-g -O2"}
10473d8817e4Smiod  CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
10483d8817e4Smiod
10493d8817e4Smiodelse
10503d8817e4Smiod  # Set reasonable default values for some tools even if not Canadian.
10513d8817e4Smiod  # Of course, these are different reasonable default values, originally
10523d8817e4Smiod  # specified directly in the Makefile.
10533d8817e4Smiod  # We don't export, so that autoconf can do its job.
10543d8817e4Smiod  # Note that all these settings are above the fragment inclusion point
10553d8817e4Smiod  # in Makefile.in, so can still be overridden by fragments.
10563d8817e4Smiod  # This is all going to change when we autoconfiscate...
10573d8817e4Smiod
10583d8817e4Smiod  CC_FOR_BUILD="\$(CC)"
10593d8817e4Smiod  AC_PROG_CC
10603d8817e4Smiod
10613d8817e4Smiod  # We must set the default linker to the linker used by gcc for the correct
10623d8817e4Smiod  # operation of libtool.  If LD is not defined and we are using gcc, try to
10633d8817e4Smiod  # set the LD default to the ld used by gcc.
10643d8817e4Smiod  if test -z "$LD"; then
10653d8817e4Smiod    if test "$GCC" = yes; then
10663d8817e4Smiod      case $build in
10673d8817e4Smiod      *-*-mingw*)
10683d8817e4Smiod	gcc_prog_ld=`$CC -print-prog-name=ld 2>&1 | tr -d '\015'` ;;
10693d8817e4Smiod      *)
10703d8817e4Smiod	gcc_prog_ld=`$CC -print-prog-name=ld 2>&1` ;;
10713d8817e4Smiod      esac
10723d8817e4Smiod      case $gcc_prog_ld in
10733d8817e4Smiod      # Accept absolute paths.
10743d8817e4Smiod      [[\\/]* | [A-Za-z]:[\\/]*)]
10753d8817e4Smiod        LD="$gcc_prog_ld" ;;
10763d8817e4Smiod      esac
10773d8817e4Smiod    fi
10783d8817e4Smiod  fi
10793d8817e4Smiod
10803d8817e4Smiod  CXX=${CXX-"c++"}
10813d8817e4Smiod  CFLAGS=${CFLAGS-"-g"}
10823d8817e4Smiod  CXXFLAGS=${CXXFLAGS-"-g -O2"}
10833d8817e4Smiodfi
10843d8817e4Smiod
10853d8817e4SmiodACX_PROG_GNAT
10863d8817e4SmiodACX_PROG_CMP_IGNORE_INITIAL
10873d8817e4Smiod
10883d8817e4Smiod# Check for GMP and MPFR
10893d8817e4Smiodgmplibs=
10903d8817e4Smiodgmpinc=
10913d8817e4Smiodhave_gmp=yes
10923d8817e4Smiod# Specify a location for mpfr
10933d8817e4Smiod# check for this first so it ends up on the link line before gmp.
10943d8817e4SmiodAC_ARG_WITH(mpfr-dir, [  --with-mpfr-dir=PATH    Specify source directory for MPFR library])
10953d8817e4Smiod
10963d8817e4Smiodif test "x$with_mpfr_dir" != x; then
10973d8817e4Smiod  gmpinc="-I$with_mpfr_dir"
10983d8817e4Smiod  gmplibs="$with_mpfr_dir/libmpfr.a"
10993d8817e4Smiodelse
11003d8817e4Smiod  gmplibs="-lmpfr"
11013d8817e4Smiodfi
11023d8817e4Smiod
11033d8817e4SmiodAC_ARG_WITH(mpfr, [  --with-mpfr=PATH        Specify directory for installed MPFR library])
11043d8817e4Smiod
11053d8817e4Smiodif test "x$with_mpfr" != x; then
11063d8817e4Smiod  gmplibs="-L$with_mpfr/lib $gmplibs"
11073d8817e4Smiod  gmpinc="-I$with_mpfr/include"
11083d8817e4Smiodfi
11093d8817e4Smiod
11103d8817e4Smiod# Specify a location for gmp
11113d8817e4SmiodAC_ARG_WITH(gmp-dir, [  --with-gmp-dir=PATH     Specify source directory for GMP library])
11123d8817e4Smiod
11133d8817e4Smiodif test "x$with_gmp_dir" != x; then
11143d8817e4Smiod  gmpinc="$gmpinc -I$with_gmp_dir"
11153d8817e4Smiod  if test -f "$with_gmp_dir/.libs/libgmp.a"; then
11163d8817e4Smiod    gmplibs="$gmplibs $with_gmp_dir/.libs/libgmp.a"
11173d8817e4Smiod  elif test -f "$with_gmp_dir/_libs/libgmp.a"; then
11183d8817e4Smiod    gmplibs="$gmplibs $with_gmp_dir/_libs/libgmp.a"
11193d8817e4Smiod  fi
11203d8817e4Smiod  # One of the later tests will catch the error if neither library is present.
11213d8817e4Smiodelse
11223d8817e4Smiod  gmplibs="$gmplibs -lgmp"
11233d8817e4Smiodfi
11243d8817e4Smiod
11253d8817e4SmiodAC_ARG_WITH(gmp, [  --with-gmp=PATH         Specify directory for installed GMP library])
11263d8817e4Smiod
11273d8817e4Smiodif test "x$with_gmp" != x; then
11283d8817e4Smiod  gmplibs="-L$with_gmp/lib $gmplibs"
11293d8817e4Smiod  gmpinc="-I$with_gmp/include $gmpinc"
11303d8817e4Smiodfi
11313d8817e4Smiod
11323d8817e4Smiodsaved_CFLAGS="$CFLAGS"
11333d8817e4SmiodCFLAGS="$CFLAGS $gmpinc"
11343d8817e4Smiod# Check GMP actually works
11353d8817e4SmiodAC_MSG_CHECKING([for correct version of gmp.h])
11363d8817e4SmiodAC_TRY_COMPILE([#include "gmp.h"],[
11373d8817e4Smiod#if __GNU_MP_VERSION < 3
11383d8817e4Smiodchoke me
11393d8817e4Smiod#endif
11403d8817e4Smiod], [AC_MSG_RESULT([yes])],
11413d8817e4Smiod  [AC_MSG_RESULT([no]); have_gmp=no])
11423d8817e4Smiod
11433d8817e4Smiodif test x"$have_gmp" = xyes; then
11443d8817e4Smiod  AC_MSG_CHECKING([for MPFR])
11453d8817e4Smiod
11463d8817e4Smiod  saved_LIBS="$LIBS"
11473d8817e4Smiod  LIBS="$LIBS $gmplibs"
11483d8817e4Smiod  AC_TRY_LINK([#include <gmp.h>
11493d8817e4Smiod#include <mpfr.h>], [mpfr_t n; mpfr_init(n);],
11503d8817e4Smiod    [AC_MSG_RESULT([yes])],  [AC_MSG_RESULT([no]); have_gmp=no])
11513d8817e4Smiod  LIBS="$saved_LIBS"
11523d8817e4Smiod  CFLAGS="$saved_CFLAGS"
11533d8817e4Smiodfi
11543d8817e4Smiod
11553d8817e4Smiod# Flags needed for both GMP and/or MPFR
11563d8817e4SmiodAC_SUBST(gmplibs)
11573d8817e4SmiodAC_SUBST(gmpinc)
11583d8817e4Smiod
11593d8817e4Smiod# By default, C is the only stage 1 language.
11603d8817e4Smiodstage1_languages=c
11613d8817e4SmiodAC_SUBST(stage1_languages)
11623d8817e4Smiod
11633d8817e4Smiod# Figure out what language subdirectories are present.
11643d8817e4Smiod# Look if the user specified --enable-languages="..."; if not, use
11653d8817e4Smiod# the environment variable $LANGUAGES if defined. $LANGUAGES might
11663d8817e4Smiod# go away some day.
11673d8817e4Smiod# NB:  embedded tabs in this IF block -- do not untabify
11683d8817e4Smiodif test -d ${srcdir}/gcc; then
11693d8817e4Smiod  if test x"${enable_languages+set}" != xset; then
11703d8817e4Smiod    if test x"${LANGUAGES+set}" = xset; then
11713d8817e4Smiod      enable_languages="${LANGUAGES}"
11723d8817e4Smiod        echo configure.in: warning: setting LANGUAGES is deprecated, use --enable-languages instead 1>&2
11733d8817e4Smiod    else
11743d8817e4Smiod      enable_languages=all
11753d8817e4Smiod    fi
11763d8817e4Smiod  else
11773d8817e4Smiod    if test x"${enable_languages}" = x ||
11783d8817e4Smiod       test x"${enable_languages}" = xyes;
11793d8817e4Smiod       then
11803d8817e4Smiod      echo configure.in: --enable-languages needs at least one language argument 1>&2
11813d8817e4Smiod      exit 1
11823d8817e4Smiod    fi
11833d8817e4Smiod  fi
11843d8817e4Smiod  enable_languages=`echo "${enable_languages}" | sed -e 's/[[ 	,]][[ 	,]]*/,/g' -e 's/,$//'`
11853d8817e4Smiod
11863d8817e4Smiod  # 'f95' is the old name for the 'fortran' language. We issue a warning
11873d8817e4Smiod  # and make the substitution.
11883d8817e4Smiod  case ,${enable_languages}, in
11893d8817e4Smiod    *,f95,*)
11903d8817e4Smiod      echo configure.in: warning: 'f95' as language name is deprecated, use 'fortran' instead 1>&2
11913d8817e4Smiod      enable_languages=`echo "${enable_languages}" | sed -e 's/f95/fortran/g'`
11923d8817e4Smiod      ;;
11933d8817e4Smiod  esac
11943d8817e4Smiod
11953d8817e4Smiod  # First scan to see if an enabled language requires some other language.
11963d8817e4Smiod  # We assume that a given config-lang.in will list all the language
11973d8817e4Smiod  # front ends it requires, even if some are required indirectly.
11983d8817e4Smiod  for lang_frag in ${srcdir}/gcc/*/config-lang.in .. ; do
11993d8817e4Smiod    case ${lang_frag} in
12003d8817e4Smiod      ..) ;;
12013d8817e4Smiod      # The odd quoting in the next line works around
12023d8817e4Smiod      # an apparent bug in bash 1.12 on linux.
12033d8817e4Smiod      ${srcdir}/gcc/[[*]]/config-lang.in) ;;
12043d8817e4Smiod      *)
12053d8817e4Smiod        # From the config-lang.in, get $language, $lang_requires
12063d8817e4Smiod        language=
12073d8817e4Smiod        lang_requires=
12083d8817e4Smiod        . ${lang_frag}
12093d8817e4Smiod        for other in ${lang_requires} ; do
12103d8817e4Smiod          case ,${enable_languages}, in
12113d8817e4Smiod	    *,$other,*) ;;
12123d8817e4Smiod	    *,all,*) ;;
12133d8817e4Smiod	    *,$language,*)
12143d8817e4Smiod	      echo " \`$other' language required by \`$language'; enabling" 1>&2
12153d8817e4Smiod	      enable_languages="${enable_languages},${other}"
12163d8817e4Smiod	      ;;
12173d8817e4Smiod	  esac
12183d8817e4Smiod        done
12193d8817e4Smiod        ;;
12203d8817e4Smiod    esac
12213d8817e4Smiod  done
12223d8817e4Smiod
12233d8817e4Smiod  new_enable_languages=c
12243d8817e4Smiod  missing_languages=`echo ",$enable_languages," | sed -e s/,all,/,/ -e s/,c,/,/ `
12253d8817e4Smiod  potential_languages=c
12263d8817e4Smiod
12273d8817e4Smiod  for lang_frag in ${srcdir}/gcc/*/config-lang.in .. ; do
12283d8817e4Smiod    case ${lang_frag} in
12293d8817e4Smiod      ..) ;;
12303d8817e4Smiod      # The odd quoting in the next line works around
12313d8817e4Smiod      # an apparent bug in bash 1.12 on linux.
12323d8817e4Smiod      ${srcdir}/gcc/[[*]]/config-lang.in) ;;
12333d8817e4Smiod      *)
12343d8817e4Smiod        # From the config-lang.in, get $language, $target_libs,
12353d8817e4Smiod        # $lang_dirs, $boot_language, and $build_by_default
12363d8817e4Smiod        language=
12373d8817e4Smiod        target_libs=
12383d8817e4Smiod        lang_dirs=
12393d8817e4Smiod        boot_language=
12403d8817e4Smiod        build_by_default=
12413d8817e4Smiod        need_gmp=
12423d8817e4Smiod        . ${lang_frag}
12433d8817e4Smiod        potential_languages="${potential_languages},${language}"
12443d8817e4Smiod        # This is quite sensitive to the ordering of the case statement arms.
12453d8817e4Smiod        case ,${enable_languages},:${language}:${have_gnat}:${build_by_default} in
12463d8817e4Smiod          *::*:*)
12473d8817e4Smiod            echo "${lang_frag} doesn't set \$language." 1>&2
12483d8817e4Smiod            exit 1
12493d8817e4Smiod            ;;
12503d8817e4Smiod          *:ada:no:*)
12513d8817e4Smiod            # Ada was requested with no preexisting GNAT.  Disable unconditionally.
12523d8817e4Smiod            add_this_lang=no
12533d8817e4Smiod            ;;
12543d8817e4Smiod          *,${language},*:*:*:*)
12553d8817e4Smiod            # Language was explicitly selected; include it.
12563d8817e4Smiod            add_this_lang=yes
12573d8817e4Smiod            ;;
12583d8817e4Smiod          *,all,*:*:*:no)
12593d8817e4Smiod            # 'all' was selected, but this is not a default language
12603d8817e4Smiod            # so do not include it.
12613d8817e4Smiod            add_this_lang=no
12623d8817e4Smiod            ;;
12633d8817e4Smiod          *,all,*:*:*:*)
12643d8817e4Smiod            # 'all' was selected and this is a default language; include it.
12653d8817e4Smiod            add_this_lang=yes
12663d8817e4Smiod            ;;
12673d8817e4Smiod          *)
12683d8817e4Smiod            add_this_lang=no
12693d8817e4Smiod            ;;
12703d8817e4Smiod        esac
12713d8817e4Smiod
12723d8817e4Smiod        # Disable languages that need GMP if it isn't available.
12733d8817e4Smiod        case ,${enable_languages},:${have_gmp}:${need_gmp} in
12743d8817e4Smiod          *,${language},*:no:yes)
12753d8817e4Smiod            # Specifically requested language; tell them.
12763d8817e4Smiod            AC_MSG_ERROR([GMP with MPFR support is required to build $language])
12773d8817e4Smiod            ;;
12783d8817e4Smiod          *:no:yes)
12793d8817e4Smiod            # Silently disable.
12803d8817e4Smiod            add_this_lang=no
12813d8817e4Smiod            ;;
12823d8817e4Smiod        esac
12833d8817e4Smiod
12843d8817e4Smiod	# Disable a language that is unsupported by the target.
12853d8817e4Smiod	case " $unsupported_languages " in
12863d8817e4Smiod	  *" $language "*)
12873d8817e4Smiod	    add_this_lang=no
12883d8817e4Smiod	    ;;
12893d8817e4Smiod	esac
12903d8817e4Smiod
12913d8817e4Smiod	case $add_this_lang in
12923d8817e4Smiod	  no)
12933d8817e4Smiod            # Remove language-dependent dirs.
12943d8817e4Smiod            eval noconfigdirs='"$noconfigdirs "'\"$target_libs $lang_dirs\"
12953d8817e4Smiod	    ;;
12963d8817e4Smiod          *)
12973d8817e4Smiod	    new_enable_languages="$new_enable_languages,$language"
12983d8817e4Smiod	    missing_languages=`echo "$missing_languages" | sed "s/,$language,/,/"`
12993d8817e4Smiod	    case ${boot_language} in
13003d8817e4Smiod	      yes)
13013d8817e4Smiod		# Add to (comma-separated) list of stage 1 languages.
13023d8817e4Smiod		stage1_languages="${stage1_languages},${language}"
13033d8817e4Smiod		;;
13043d8817e4Smiod	    esac
13053d8817e4Smiod	    ;;
13063d8817e4Smiod        esac
13073d8817e4Smiod        ;;
13083d8817e4Smiod    esac
13093d8817e4Smiod  done
13103d8817e4Smiod
13113d8817e4Smiod  missing_languages=`echo "$missing_languages" | sed -e "s/^,//" -e "s/,$//"`
13123d8817e4Smiod  if test "x$missing_languages" != x; then
13133d8817e4Smiod    AC_MSG_ERROR([
13143d8817e4SmiodThe following requested languages could not be built: ${missing_languages}
13153d8817e4SmiodRecognised languages are: ${potential_languages}])
13163d8817e4Smiod  fi
13173d8817e4Smiod
13183d8817e4Smiod  if test "x$new_enable_languages" != "x$enable_languages"; then
13193d8817e4Smiod    echo The following languages will be built: ${new_enable_languages}
13203d8817e4Smiod  fi
13213d8817e4Smiod  enable_languages="$new_enable_languages"
13223d8817e4Smiod  ac_configure_args=`echo " $ac_configure_args" | sed -e 's/ --enable-languages=[[^ ]]*//' -e 's/$/ --enable-languages='"$enable_languages"/ `
13233d8817e4Smiodfi
13243d8817e4Smiod
13253d8817e4Smiod# Handle --disable-<component> generically.
13263d8817e4Smiodfor dir in $configdirs $build_configdirs $target_configdirs ; do
13273d8817e4Smiod  dirname=`echo $dir | sed -e s/target-//g -e s/build-//g -e s/-/_/g`
13283d8817e4Smiod  if eval test x\${enable_${dirname}} "=" xno ; then
13293d8817e4Smiod    noconfigdirs="$noconfigdirs $dir"
13303d8817e4Smiod  fi
13313d8817e4Smioddone
13323d8817e4Smiod
13333d8817e4Smiod# Remove the entries in $skipdirs and $noconfigdirs from $configdirs,
13343d8817e4Smiod# $build_configdirs and $target_configdirs.
13353d8817e4Smiod# If we have the source for $noconfigdirs entries, add them to $notsupp.
13363d8817e4Smiod
13373d8817e4Smiodnotsupp=""
13383d8817e4Smiodfor dir in . $skipdirs $noconfigdirs ; do
13393d8817e4Smiod  dirname=`echo $dir | sed -e s/target-//g -e s/build-//g`
13403d8817e4Smiod  if test $dir != .  && echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
13413d8817e4Smiod    configdirs=`echo " ${configdirs} " | sed -e "s/ ${dir} / /"`
13423d8817e4Smiod    if test -r $srcdir/$dirname/configure ; then
13433d8817e4Smiod      if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
13443d8817e4Smiod	true
13453d8817e4Smiod      else
13463d8817e4Smiod	notsupp="$notsupp $dir"
13473d8817e4Smiod      fi
13483d8817e4Smiod    fi
13493d8817e4Smiod  fi
13503d8817e4Smiod  if test $dir != .  && echo " ${build_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
13513d8817e4Smiod    build_configdirs=`echo " ${build_configdirs} " | sed -e "s/ ${dir} / /"`
13523d8817e4Smiod    if test -r $srcdir/$dirname/configure ; then
13533d8817e4Smiod      if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
13543d8817e4Smiod	true
13553d8817e4Smiod      else
13563d8817e4Smiod	notsupp="$notsupp $dir"
13573d8817e4Smiod      fi
13583d8817e4Smiod    fi
13593d8817e4Smiod  fi
13603d8817e4Smiod  if test $dir != . && echo " ${target_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
13613d8817e4Smiod    target_configdirs=`echo " ${target_configdirs} " | sed -e "s/ ${dir} / /"`
13623d8817e4Smiod    if test -r $srcdir/$dirname/configure ; then
13633d8817e4Smiod      if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
13643d8817e4Smiod	true
13653d8817e4Smiod      else
13663d8817e4Smiod	notsupp="$notsupp $dir"
13673d8817e4Smiod      fi
13683d8817e4Smiod    fi
13693d8817e4Smiod  fi
13703d8817e4Smioddone
13713d8817e4Smiod
13723d8817e4Smiod# Sometimes the tools are distributed with libiberty but with no other
13733d8817e4Smiod# libraries.  In that case, we don't want to build target-libiberty.
13743d8817e4Smiodif test -n "${target_configdirs}" ; then
13753d8817e4Smiod  others=
13763d8817e4Smiod  for i in `echo ${target_configdirs} | sed -e s/target-//g` ; do
13773d8817e4Smiod    if test "$i" != "libiberty" ; then
13783d8817e4Smiod      if test -r $srcdir/$i/configure ; then
13793d8817e4Smiod	others=yes;
13803d8817e4Smiod	break;
13813d8817e4Smiod      fi
13823d8817e4Smiod    fi
13833d8817e4Smiod  done
13843d8817e4Smiod  if test -z "${others}" ; then
13853d8817e4Smiod    target_configdirs=
13863d8817e4Smiod  fi
13873d8817e4Smiodfi
13883d8817e4Smiod
13893d8817e4Smiod# Quietly strip out all directories which aren't configurable in this tree.
13903d8817e4Smiod# This relies on all configurable subdirectories being autoconfiscated, which
13913d8817e4Smiod# is now the case.
13923d8817e4Smiodbuild_configdirs_all="$build_configdirs"
13933d8817e4Smiodbuild_configdirs=
13943d8817e4Smiodfor i in ${build_configdirs_all} ; do
13953d8817e4Smiod  j=`echo $i | sed -e s/build-//g`
13963d8817e4Smiod  if test -f ${srcdir}/$j/configure ; then
13973d8817e4Smiod    build_configdirs="${build_configdirs} $i"
13983d8817e4Smiod  fi
13993d8817e4Smioddone
14003d8817e4Smiod
14013d8817e4Smiodconfigdirs_all="$configdirs"
14023d8817e4Smiodconfigdirs=
14033d8817e4Smiodfor i in ${configdirs_all} ; do
14043d8817e4Smiod  if test -f ${srcdir}/$i/configure ; then
14053d8817e4Smiod    configdirs="${configdirs} $i"
14063d8817e4Smiod  fi
14073d8817e4Smioddone
14083d8817e4Smiod
14093d8817e4Smiodtarget_configdirs_all="$target_configdirs"
14103d8817e4Smiodtarget_configdirs=
14113d8817e4Smiodfor i in ${target_configdirs_all} ; do
14123d8817e4Smiod  j=`echo $i | sed -e s/target-//g`
14133d8817e4Smiod  if test -f ${srcdir}/$j/configure ; then
14143d8817e4Smiod    target_configdirs="${target_configdirs} $i"
14153d8817e4Smiod  fi
14163d8817e4Smioddone
14173d8817e4Smiod
14183d8817e4Smiod# Produce a warning message for the subdirs we can't configure.
14193d8817e4Smiod# This isn't especially interesting in the Cygnus tree, but in the individual
14203d8817e4Smiod# FSF releases, it's important to let people know when their machine isn't
14213d8817e4Smiod# supported by the one or two programs in a package.
14223d8817e4Smiod
14233d8817e4Smiodif test -n "${notsupp}" && test -z "${norecursion}" ; then
14243d8817e4Smiod  # If $appdirs is non-empty, at least one of those directories must still
14253d8817e4Smiod  # be configured, or we error out.  (E.g., if the gas release supports a
14263d8817e4Smiod  # specified target in some subdirs but not the gas subdir, we shouldn't
14273d8817e4Smiod  # pretend that all is well.)
14283d8817e4Smiod  if test -n "$appdirs" ; then
14293d8817e4Smiod    for dir in $appdirs ; do
14303d8817e4Smiod      if test -r $dir/Makefile.in ; then
14313d8817e4Smiod	if echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
14323d8817e4Smiod	  appdirs=""
14333d8817e4Smiod	  break
14343d8817e4Smiod	fi
14353d8817e4Smiod	if echo " ${target_configdirs} " | grep " target-${dir} " >/dev/null 2>&1; then
14363d8817e4Smiod	  appdirs=""
14373d8817e4Smiod	  break
14383d8817e4Smiod	fi
14393d8817e4Smiod      fi
14403d8817e4Smiod    done
14413d8817e4Smiod    if test -n "$appdirs" ; then
14423d8817e4Smiod      echo "*** This configuration is not supported by this package." 1>&2
14433d8817e4Smiod      exit 1
14443d8817e4Smiod    fi
14453d8817e4Smiod  fi
14463d8817e4Smiod  # Okay, some application will build, or we don't care to check.  Still
14473d8817e4Smiod  # notify of subdirs not getting built.
14483d8817e4Smiod  echo "*** This configuration is not supported in the following subdirectories:" 1>&2
14493d8817e4Smiod  echo "    ${notsupp}" 1>&2
14503d8817e4Smiod  echo "    (Any other directories should still work fine.)" 1>&2
14513d8817e4Smiodfi
14523d8817e4Smiod
14533d8817e4Smiodcase "$host" in
14543d8817e4Smiod  *msdosdjgpp*)
14553d8817e4Smiod    enable_gdbtk=no ;;
14563d8817e4Smiodesac
14573d8817e4Smiod
14583d8817e4Smiodcopy_dirs=
14593d8817e4Smiod
14603d8817e4SmiodAC_ARG_WITH([build-sysroot],
14613d8817e4Smiod  [  --with-build-sysroot=sysroot
14623d8817e4Smiod                          use sysroot as the system root during the build],
14633d8817e4Smiod  [if test x"$withval" != x ; then
14643d8817e4Smiod     SYSROOT_CFLAGS_FOR_TARGET="--sysroot=$withval"
14653d8817e4Smiod   fi],
14663d8817e4Smiod  [SYSROOT_CFLAGS_FOR_TARGET=])
14673d8817e4SmiodAC_SUBST(SYSROOT_CFLAGS_FOR_TARGET)
14683d8817e4Smiod
14693d8817e4Smiod# Handle --with-headers=XXX.  If the value is not "yes", the contents of
14703d8817e4Smiod# the named directory are copied to $(tooldir)/sys-include.
14713d8817e4Smiodif test x"${with_headers}" != x && test x"${with_headers}" != xno ; then
14723d8817e4Smiod  if test x${is_cross_compiler} = xno ; then
14733d8817e4Smiod    echo 1>&2 '***' --with-headers is only supported when cross compiling
14743d8817e4Smiod    exit 1
14753d8817e4Smiod  fi
14763d8817e4Smiod  if test x"${with_headers}" != xyes ; then
14773d8817e4Smiod    case "${exec_prefixoption}" in
14783d8817e4Smiod    "") x=${prefix} ;;
14793d8817e4Smiod    *) x=${exec_prefix} ;;
14803d8817e4Smiod    esac
14813d8817e4Smiod    copy_dirs="${copy_dirs} ${with_headers} $x/${target_alias}/sys-include"
14823d8817e4Smiod  fi
14833d8817e4Smiodfi
14843d8817e4Smiod
14853d8817e4Smiod# Handle --with-libs=XXX.  If the value is not "yes", the contents of
14863d8817e4Smiod# the name directories are copied to $(tooldir)/lib.  Multiple directories
14873d8817e4Smiod# are permitted.
14883d8817e4Smiodif test x"${with_libs}" != x && test x"${with_libs}" != xno ; then
14893d8817e4Smiod  if test x${is_cross_compiler} = xno ; then
14903d8817e4Smiod    echo 1>&2 '***' --with-libs is only supported when cross compiling
14913d8817e4Smiod    exit 1
14923d8817e4Smiod  fi
14933d8817e4Smiod  if test x"${with_libs}" != xyes ; then
14943d8817e4Smiod    # Copy the libraries in reverse order, so that files in the first named
14953d8817e4Smiod    # library override files in subsequent libraries.
14963d8817e4Smiod    case "${exec_prefixoption}" in
14973d8817e4Smiod    "") x=${prefix} ;;
14983d8817e4Smiod    *) x=${exec_prefix} ;;
14993d8817e4Smiod    esac
15003d8817e4Smiod    for l in ${with_libs}; do
15013d8817e4Smiod      copy_dirs="$l $x/${target_alias}/lib ${copy_dirs}"
15023d8817e4Smiod    done
15033d8817e4Smiod  fi
15043d8817e4Smiodfi
15053d8817e4Smiod
15063d8817e4Smiod# Set with_gnu_as and with_gnu_ld as appropriate.
15073d8817e4Smiod#
15083d8817e4Smiod# This is done by determining whether or not the appropriate directory
15093d8817e4Smiod# is available, and by checking whether or not specific configurations
15103d8817e4Smiod# have requested that this magic not happen.
15113d8817e4Smiod#
15123d8817e4Smiod# The command line options always override the explicit settings in
15133d8817e4Smiod# configure.in, and the settings in configure.in override this magic.
15143d8817e4Smiod#
15153d8817e4Smiod# If the default for a toolchain is to use GNU as and ld, and you don't
15163d8817e4Smiod# want to do that, then you should use the --without-gnu-as and
15173d8817e4Smiod# --without-gnu-ld options for the configure script.
15183d8817e4Smiod
15193d8817e4Smiodif test x${use_gnu_as} = x &&
15203d8817e4Smiod   echo " ${configdirs} " | grep " gas " > /dev/null 2>&1 ; then
15213d8817e4Smiod  with_gnu_as=yes
15223d8817e4Smiod  extra_host_args="$extra_host_args --with-gnu-as"
15233d8817e4Smiodfi
15243d8817e4Smiod
15253d8817e4Smiodif test x${use_gnu_ld} = x &&
15263d8817e4Smiod   echo " ${configdirs} " | grep " ld " > /dev/null 2>&1 ; then
15273d8817e4Smiod  with_gnu_ld=yes
15283d8817e4Smiod  extra_host_args="$extra_host_args --with-gnu-ld"
15293d8817e4Smiodfi
15303d8817e4Smiod
15313d8817e4Smiod# If using newlib, add --with-newlib to the extra_host_args so that gcc/configure
15323d8817e4Smiod# can detect this case.
15333d8817e4Smiod
15343d8817e4Smiodif test x${with_newlib} != xno && echo " ${target_configdirs} " | grep " target-newlib " > /dev/null 2>&1 ; then
15353d8817e4Smiod  with_newlib=yes
15363d8817e4Smiod  extra_host_args="$extra_host_args --with-newlib"
15373d8817e4Smiodfi
15383d8817e4Smiod
15393d8817e4Smiod# Handle ${copy_dirs}
15403d8817e4Smiodset fnord ${copy_dirs}
15413d8817e4Smiodshift
15423d8817e4Smiodwhile test $# != 0 ; do
15433d8817e4Smiod  if test -f $2/COPIED && test x"`cat $2/COPIED`" = x"$1" ; then
15443d8817e4Smiod    :
15453d8817e4Smiod  else
15463d8817e4Smiod    echo Copying $1 to $2
15473d8817e4Smiod
15483d8817e4Smiod    # Use the install script to create the directory and all required
15493d8817e4Smiod    # parent directories.
15503d8817e4Smiod    if test -d $2 ; then
15513d8817e4Smiod      :
15523d8817e4Smiod    else
15533d8817e4Smiod      echo >config.temp
15543d8817e4Smiod      ${srcdir}/install-sh -c -m 644 config.temp $2/COPIED
15553d8817e4Smiod    fi
15563d8817e4Smiod
15573d8817e4Smiod    # Copy the directory, assuming we have tar.
15583d8817e4Smiod    # FIXME: Should we use B in the second tar?  Not all systems support it.
15593d8817e4Smiod    (cd $1; tar -cf - .) | (cd $2; tar -xpf -)
15603d8817e4Smiod
15613d8817e4Smiod    # It is the responsibility of the user to correctly adjust all
15623d8817e4Smiod    # symlinks.  If somebody can figure out how to handle them correctly
15633d8817e4Smiod    # here, feel free to add the code.
15643d8817e4Smiod
15653d8817e4Smiod    echo $1 > $2/COPIED
15663d8817e4Smiod  fi
15673d8817e4Smiod  shift; shift
15683d8817e4Smioddone
15693d8817e4Smiod
15703d8817e4Smiod# Determine a target-dependent exec_prefix that the installed
15713d8817e4Smiod# gcc will search in.  Keep this list sorted by triplet, with
15723d8817e4Smiod# the *-*-osname triplets last.
15733d8817e4Smiodmd_exec_prefix=
15743d8817e4Smiodcase "${target}" in
15753d8817e4Smiod  alpha*-*-*vms*)
15763d8817e4Smiod    md_exec_prefix=/gnu/lib/gcc-lib
15773d8817e4Smiod    ;;
15783d8817e4Smiod  i[34567]86-pc-msdosdjgpp*)
15793d8817e4Smiod    md_exec_prefix=/dev/env/DJDIR/bin
15803d8817e4Smiod    ;;
15813d8817e4Smiod  i[34567]86-*-sco3.2v5*)
15823d8817e4Smiod    if test $with_gnu_as = yes; then
15833d8817e4Smiod      md_exec_prefix=/usr/gnu/bin
15843d8817e4Smiod    else
15853d8817e4Smiod      md_exec_prefix=/usr/ccs/bin/elf
15863d8817e4Smiod    fi
15873d8817e4Smiod    ;;
15883d8817e4Smiod
15893d8817e4Smiod  mn10300-*-* | \
15903d8817e4Smiod  powerpc-*-chorusos* | \
15913d8817e4Smiod  powerpc*-*-eabi* | \
15923d8817e4Smiod  powerpc*-*-sysv* | \
15933d8817e4Smiod  powerpc*-*-kaos* | \
15943d8817e4Smiod  s390x-ibm-tpf*)
15953d8817e4Smiod    md_exec_prefix=/usr/ccs/bin
15963d8817e4Smiod    ;;
15973d8817e4Smiod  sparc64-*-elf*)
15983d8817e4Smiod    ;;
15993d8817e4Smiod  v850*-*-*)
16003d8817e4Smiod    md_exec_prefix=/usr/ccs/bin
16013d8817e4Smiod    ;;
16023d8817e4Smiod  xtensa-*-elf*)
16033d8817e4Smiod    ;;
16043d8817e4Smiod
16053d8817e4Smiod  *-*-beos* | \
16063d8817e4Smiod  *-*-elf* | \
16073d8817e4Smiod  *-*-hpux* | \
16083d8817e4Smiod  *-*-netware* | \
16093d8817e4Smiod  *-*-nto-qnx* | \
16103d8817e4Smiod  *-*-rtems* | \
16113d8817e4Smiod  *-*-solaris2* | \
16123d8817e4Smiod  *-*-sysv[45]* | \
16133d8817e4Smiod  *-*-vxworks* | \
16143d8817e4Smiod  *-wrs-windiss)
16153d8817e4Smiod    md_exec_prefix=/usr/ccs/bin
16163d8817e4Smiod    ;;
16173d8817e4Smiodesac
16183d8817e4Smiod
16193d8817e4Smiodextra_arflags_for_target=
16203d8817e4Smiodextra_nmflags_for_target=
16213d8817e4Smiodextra_ranlibflags_for_target=
16223d8817e4Smiodtarget_makefile_frag=/dev/null
16233d8817e4Smiodcase "${target}" in
16243d8817e4Smiod  *-*-netware*)
16253d8817e4Smiod    target_makefile_frag="config/mt-netware"
16263d8817e4Smiod    ;;
16273d8817e4Smiod  *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu)
16283d8817e4Smiod    target_makefile_frag="config/mt-gnu"
16293d8817e4Smiod    ;;
16303d8817e4Smiod  *-*-aix4.[[3456789]]* | *-*-aix[[56789]].*)
16313d8817e4Smiod    # nm and ar from AIX 4.3 and above require -X32_64 flag to all ar and nm
16323d8817e4Smiod    # commands to handle both 32-bit and 64-bit objects.  These flags are
16333d8817e4Smiod    # harmless if we're using GNU nm or ar.
16343d8817e4Smiod    extra_arflags_for_target=" -X32_64"
16353d8817e4Smiod    extra_nmflags_for_target=" -B -X32_64"
16363d8817e4Smiod    ;;
16373d8817e4Smiod  *-*-darwin*)
16383d8817e4Smiod    # ranlib from Darwin requires the -c flag to look at common symbols.
16393d8817e4Smiod    extra_ranlibflags_for_target=" -c"
16403d8817e4Smiod    ;;
16413d8817e4Smiod  mips*-*-pe | sh*-*-pe | *arm-wince-pe)
16423d8817e4Smiod    target_makefile_frag="config/mt-wince"
16433d8817e4Smiod    ;;
16443d8817e4Smiodesac
16453d8817e4Smiod
16463d8817e4Smiodalphaieee_frag=/dev/null
16473d8817e4Smiodcase $target in
16483d8817e4Smiod  alpha*-*-*)
16493d8817e4Smiod    # This just makes sure to use the -mieee option to build target libs.
16503d8817e4Smiod    # This should probably be set individually by each library.
16513d8817e4Smiod    alphaieee_frag="config/mt-alphaieee"
16523d8817e4Smiod    ;;
16533d8817e4Smiodesac
16543d8817e4Smiod
16553d8817e4Smiod# If --enable-target-optspace always use -Os instead of -O2 to build
16563d8817e4Smiod# the target libraries, similarly if it is not specified, use -Os
16573d8817e4Smiod# on selected platforms.
16583d8817e4Smiodospace_frag=/dev/null
16593d8817e4Smiodcase "${enable_target_optspace}:${target}" in
16603d8817e4Smiod  yes:*)
16613d8817e4Smiod    ospace_frag="config/mt-ospace"
16623d8817e4Smiod    ;;
16633d8817e4Smiod  :d30v-*)
16643d8817e4Smiod    ospace_frag="config/mt-d30v"
16653d8817e4Smiod    ;;
16663d8817e4Smiod  :m32r-* | :d10v-* | :fr30-*)
16673d8817e4Smiod    ospace_frag="config/mt-ospace"
16683d8817e4Smiod    ;;
16693d8817e4Smiod  no:* | :*)
16703d8817e4Smiod    ;;
16713d8817e4Smiod  *)
16723d8817e4Smiod    echo "*** bad value \"${enable_target_optspace}\" for --enable-target-optspace flag; ignored" 1>&2
16733d8817e4Smiod    ;;
16743d8817e4Smiodesac
16753d8817e4Smiod
16763d8817e4Smiod# Default to using --with-stabs for certain targets.
16773d8817e4Smiodif test x${with_stabs} = x ; then
16783d8817e4Smiod  case "${target}" in
16793d8817e4Smiod  mips*-*-irix[[56]]*)
16803d8817e4Smiod    ;;
16813d8817e4Smiod  mips*-*-* | alpha*-*-osf*)
16823d8817e4Smiod    with_stabs=yes;
16833d8817e4Smiod    extra_host_args="${extra_host_args} --with-stabs"
16843d8817e4Smiod    ;;
16853d8817e4Smiod  esac
16863d8817e4Smiodfi
16873d8817e4Smiod
16883d8817e4Smiod# hpux11 in 64bit mode has libraries in a weird place.  Arrange to find
16893d8817e4Smiod# them automatically.
16903d8817e4Smiodcase "${host}" in
16913d8817e4Smiod  hppa*64*-*-hpux11*)
16923d8817e4Smiod    extra_host_args="$extra_host_args -x-libraries=/usr/lib/pa20_64 -x-includes=/usr/X11R6/include"
16933d8817e4Smiod    ;;
16943d8817e4Smiodesac
16953d8817e4Smiod
16963d8817e4Smiod# Some systems (e.g., one of the i386-aix systems the gas testers are
16973d8817e4Smiod# using) don't handle "\$" correctly, so don't use it here.
16983d8817e4Smiodtooldir='${exec_prefix}'/${target_alias}
16993d8817e4Smiodbuild_tooldir=${tooldir}
17003d8817e4Smiod
17013d8817e4Smiod# Create a .gdbinit file which runs the one in srcdir
17023d8817e4Smiod# and tells GDB to look there for source files.
17033d8817e4Smiod
17043d8817e4Smiodif test -r ${srcdir}/.gdbinit ; then
17053d8817e4Smiod  case ${srcdir} in
17063d8817e4Smiod    .) ;;
17073d8817e4Smiod    *) cat > ./.gdbinit <<EOF
17083d8817e4Smiod# ${NO_EDIT}
17093d8817e4Smioddir ${srcdir}
17103d8817e4Smioddir .
17113d8817e4Smiodsource ${srcdir}/.gdbinit
17123d8817e4SmiodEOF
17133d8817e4Smiod    ;;
17143d8817e4Smiod  esac
17153d8817e4Smiodfi
17163d8817e4Smiod
17173d8817e4Smiod# Make sure that the compiler is able to generate an executable.  If it
17183d8817e4Smiod# can't, we are probably in trouble.  We don't care whether we can run the
17193d8817e4Smiod# executable--we might be using a cross compiler--we only care whether it
17203d8817e4Smiod# can be created.  At this point the main configure script has set CC.
17213d8817e4Smiodwe_are_ok=no
17223d8817e4Smiodecho "int main () { return 0; }" > conftest.c
17233d8817e4Smiod${CC} -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c
17243d8817e4Smiodif test $? = 0 ; then
17253d8817e4Smiod  if test -s conftest || test -s conftest.exe ; then
17263d8817e4Smiod    we_are_ok=yes
17273d8817e4Smiod  fi
17283d8817e4Smiodfi
17293d8817e4Smiodcase $we_are_ok in
17303d8817e4Smiod  no)
17313d8817e4Smiod    echo 1>&2 "*** The command '${CC} -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c' failed."
17323d8817e4Smiod    echo 1>&2 "*** You must set the environment variable CC to a working compiler."
17333d8817e4Smiod    rm -f conftest*
17343d8817e4Smiod    exit 1
17353d8817e4Smiod    ;;
17363d8817e4Smiodesac
17373d8817e4Smiodrm -f conftest*
17383d8817e4Smiod
17393d8817e4Smiod# The Solaris /usr/ucb/cc compiler does not appear to work.
17403d8817e4Smiodcase "${host}" in
17413d8817e4Smiod  sparc-sun-solaris2*)
17423d8817e4Smiod      CCBASE="`echo ${CC-cc} | sed 's/ .*$//'`"
17433d8817e4Smiod      if test "`type $CCBASE | sed 's/^[[^/]]*//'`" = "/usr/ucb/cc" ; then
17443d8817e4Smiod          could_use=
17453d8817e4Smiod          test -d /opt/SUNWspro/bin && could_use="/opt/SUNWspro/bin"
17463d8817e4Smiod          if test -d /opt/cygnus/bin ; then
17473d8817e4Smiod              if test "$could_use" = "" ; then
17483d8817e4Smiod                  could_use="/opt/cygnus/bin"
17493d8817e4Smiod              else
17503d8817e4Smiod                  could_use="$could_use or /opt/cygnus/bin"
17513d8817e4Smiod              fi
17523d8817e4Smiod          fi
17533d8817e4Smiod        if test "$could_use" = "" ; then
17543d8817e4Smiod            echo "Warning: compilation may fail because you're using"
17553d8817e4Smiod            echo "/usr/ucb/cc.  You should change your PATH or CC "
17563d8817e4Smiod            echo "variable and rerun configure."
17573d8817e4Smiod        else
17583d8817e4Smiod            echo "Warning: compilation may fail because you're using"
17593d8817e4Smiod            echo "/usr/ucb/cc, when you should use the C compiler from"
17603d8817e4Smiod            echo "$could_use.  You should change your"
17613d8817e4Smiod            echo "PATH or CC variable and rerun configure."
17623d8817e4Smiod        fi
17633d8817e4Smiod      fi
17643d8817e4Smiod  ;;
17653d8817e4Smiodesac
17663d8817e4Smiod
17673d8817e4Smiodcase "${host}" in
17683d8817e4Smiod  *-*-hpux*) RPATH_ENVVAR=SHLIB_PATH ;;
17693d8817e4Smiod  *-*-darwin* | *-*-rhapsody* ) RPATH_ENVVAR=DYLD_LIBRARY_PATH ;;
17703d8817e4Smiod  *) RPATH_ENVVAR=LD_LIBRARY_PATH ;;
17713d8817e4Smiodesac
17723d8817e4Smiod
17733d8817e4Smiod# Record target_configdirs and the configure arguments for target and
17743d8817e4Smiod# build configuration in Makefile.
17753d8817e4Smiodtarget_configdirs=`echo "${target_configdirs}" | sed -e 's/target-//g'`
17763d8817e4Smiodbuild_configdirs=`echo "${build_configdirs}" | sed -e 's/build-//g'`
17773d8817e4Smiod
17783d8817e4Smiod# Determine whether gdb needs tk/tcl or not.
17793d8817e4Smiod# Use 'maybe' since enable_gdbtk might be true even if tk isn't available
17803d8817e4Smiod# and in that case we want gdb to be built without tk.  Ugh!
17813d8817e4Smiod# In fact I believe gdb is the *only* package directly dependent on tk,
17823d8817e4Smiod# so we should be able to put the 'maybe's in unconditionally and
17833d8817e4Smiod# leave out the maybe dependencies when enable_gdbtk is false.  I'm not
17843d8817e4Smiod# 100% sure that that's safe though.
17853d8817e4Smiod
17863d8817e4Smiodgdb_tk="maybe-all-tcl maybe-all-tk maybe-all-itcl maybe-all-libgui"
17873d8817e4Smiodcase "$enable_gdbtk" in
17883d8817e4Smiod  no)
17893d8817e4Smiod    GDB_TK="" ;;
17903d8817e4Smiod  yes)
17913d8817e4Smiod    GDB_TK="${gdb_tk}" ;;
17923d8817e4Smiod  *)
17933d8817e4Smiod    # Only add the dependency on gdbtk when GDBtk is part of the gdb
17943d8817e4Smiod    # distro.  Eventually someone will fix this and move Insight, nee
17953d8817e4Smiod    # gdbtk to a separate directory.
17963d8817e4Smiod    if test -d ${srcdir}/gdb/gdbtk ; then
17973d8817e4Smiod      GDB_TK="${gdb_tk}"
17983d8817e4Smiod    else
17993d8817e4Smiod      GDB_TK=""
18003d8817e4Smiod    fi
18013d8817e4Smiod    ;;
18023d8817e4Smiodesac
18033d8817e4SmiodCONFIGURE_GDB_TK=`echo ${GDB_TK} | sed s/-all-/-configure-/g`
18043d8817e4SmiodINSTALL_GDB_TK=`echo ${GDB_TK} | sed s/-all-/-install-/g`
18053d8817e4Smiod
18063d8817e4Smiod# Strip out unwanted targets.
18073d8817e4Smiod
18083d8817e4Smiod# While at that, we remove Makefiles if we were started for recursive
18093d8817e4Smiod# configuration, so that the top-level Makefile reconfigures them,
18103d8817e4Smiod# like we used to do when configure itself was recursive.
18113d8817e4Smiod
18123d8817e4Smiod# Loop over modules.  $extrasub must be used with care, limiting as
18133d8817e4Smiod# much as possible the usage of range addresses.  That's because autoconf
18143d8817e4Smiod# splits the sed script to overcome limits in the number of commands,
18153d8817e4Smiod# and relying on carefully-timed sed passes may turn out to be very hard
18163d8817e4Smiod# to maintain later.  In this particular case, you just have to be careful
18173d8817e4Smiod# not to nest @if/@endif pairs, because configure will not warn you at all.
18183d8817e4Smiod
18193d8817e4SmiodAC_ARG_ENABLE([bootstrap],
18203d8817e4Smiod[  --enable-bootstrap           Enable bootstrapping [yes if native build]],,
18213d8817e4Smiodenable_bootstrap=default)
18223d8817e4Smiod
18233d8817e4Smiod# Issue errors and warnings for invalid/strange bootstrap combinations.
18243d8817e4Smiodcase "$configdirs" in
18253d8817e4Smiod  *gcc*) have_compiler=yes ;;
18263d8817e4Smiod  *) have_compiler=no ;;
18273d8817e4Smiodesac
18283d8817e4Smiod
18293d8817e4Smiodcase "$have_compiler:$host:$target:$enable_bootstrap" in
18303d8817e4Smiod  *:*:*:no) ;;
18313d8817e4Smiod
18323d8817e4Smiod  # Default behavior.  Enable bootstrap if we have a compiler
18333d8817e4Smiod  # and we are in a native configuration.
18343d8817e4Smiod  yes:$build:$build:default)
18353d8817e4Smiod    enable_bootstrap=yes ;;
18363d8817e4Smiod
18373d8817e4Smiod  *:*:*:default)
18383d8817e4Smiod    enable_bootstrap=no ;;
18393d8817e4Smiod
18403d8817e4Smiod  # We have a compiler and we are in a native configuration, bootstrap is ok
18413d8817e4Smiod  yes:$build:$build:yes)
18423d8817e4Smiod    ;;
18433d8817e4Smiod
18443d8817e4Smiod  # Other configurations, but we have a compiler.  Assume the user knows
18453d8817e4Smiod  # what he's doing.
18463d8817e4Smiod  yes:*:*:yes)
18473d8817e4Smiod    AC_MSG_WARN([trying to bootstrap a cross compiler])
18483d8817e4Smiod    ;;
18493d8817e4Smiod
18503d8817e4Smiod  # No compiler: if they passed --enable-bootstrap explicitly, fail
18513d8817e4Smiod  no:*:*:yes)
18523d8817e4Smiod    AC_MSG_ERROR([cannot bootstrap without a compiler]) ;;
18533d8817e4Smiod
18543d8817e4Smiod  # Fail if wrong command line
18553d8817e4Smiod  *)
18563d8817e4Smiod    AC_MSG_ERROR([invalid option for --enable-bootstrap])
18573d8817e4Smiod    ;;
18583d8817e4Smiodesac
18593d8817e4Smiod
18603d8817e4Smiod# Adjust the toplevel makefile according to whether bootstrap was selected.
18613d8817e4Smiodcase "$enable_bootstrap" in
18623d8817e4Smiod  yes)
18633d8817e4Smiod    bootstrap_suffix=bootstrap ;;
18643d8817e4Smiod  no)
18653d8817e4Smiod    bootstrap_suffix=no-bootstrap ;;
18663d8817e4Smiodesac
18673d8817e4Smiod
18683d8817e4Smiodfor module in ${build_configdirs} ; do
18693d8817e4Smiod  if test -z "${no_recursion}" \
18703d8817e4Smiod     && test -f ${build_subdir}/${module}/Makefile; then
18713d8817e4Smiod    echo 1>&2 "*** removing ${build_subdir}/${module}/Makefile to force reconfigure"
18723d8817e4Smiod    rm -f ${build_subdir}/${module}/Makefile
18733d8817e4Smiod  fi
18743d8817e4Smiod  extrasub="$extrasub
18753d8817e4Smiod/^@if build-$module\$/d
18763d8817e4Smiod/^@endif build-$module\$/d
18773d8817e4Smiod/^@if build-$module-$bootstrap_suffix\$/d
18783d8817e4Smiod/^@endif build-$module-$bootstrap_suffix\$/d"
18793d8817e4Smioddone
18803d8817e4Smiodfor module in ${configdirs} ; do
18813d8817e4Smiod  if test -z "${no_recursion}"; then
18823d8817e4Smiod    for file in stage*-${module}/Makefile ${module}/Makefile; do
18833d8817e4Smiod      if test -f ${file}; then
18843d8817e4Smiod	echo 1>&2 "*** removing ${file} to force reconfigure"
18853d8817e4Smiod	rm -f ${file}
18863d8817e4Smiod      fi
18873d8817e4Smiod    done
18883d8817e4Smiod  fi
18893d8817e4Smiod  extrasub="$extrasub
18903d8817e4Smiod/^@if $module\$/d
18913d8817e4Smiod/^@endif $module\$/d
18923d8817e4Smiod/^@if $module-$bootstrap_suffix\$/d
18933d8817e4Smiod/^@endif $module-$bootstrap_suffix\$/d"
18943d8817e4Smioddone
18953d8817e4Smiodfor module in ${target_configdirs} ; do
18963d8817e4Smiod  if test -z "${no_recursion}" \
18973d8817e4Smiod     && test -f ${target_subdir}/${module}/Makefile; then
18983d8817e4Smiod    echo 1>&2 "*** removing ${target_subdir}/${module}/Makefile to force reconfigure"
18993d8817e4Smiod    rm -f ${target_subdir}/${module}/Makefile
19003d8817e4Smiod  fi
19013d8817e4Smiod  extrasub="$extrasub
19023d8817e4Smiod/^@if target-$module\$/d
19033d8817e4Smiod/^@endif target-$module\$/d
19043d8817e4Smiod/^@if target-$module-$bootstrap_suffix\$/d
19053d8817e4Smiod/^@endif target-$module-$bootstrap_suffix\$/d"
19063d8817e4Smioddone
19073d8817e4Smiod
19083d8817e4Smiodextrasub="$extrasub
19093d8817e4Smiod/^@if /,/^@endif /d"
19103d8817e4Smiod
19113d8817e4Smiod# Create the serialization dependencies.  This uses a temporary file.
19123d8817e4Smiod
19133d8817e4SmiodAC_ARG_ENABLE([serial-configure],
19143d8817e4Smiod[  --enable-serial-[{host,target,build}-]configure
19153d8817e4Smiod                          Force sequential configuration of
19163d8817e4Smiod                          sub-packages for the host, target or build
19173d8817e4Smiod			  machine, or all sub-packages])
19183d8817e4Smiod
19193d8817e4Smiodcase ${enable_serial_configure} in
19203d8817e4Smiod  yes)
19213d8817e4Smiod    enable_serial_build_configure=yes
19223d8817e4Smiod    enable_serial_host_configure=yes
19233d8817e4Smiod    enable_serial_target_configure=yes
19243d8817e4Smiod    ;;
19253d8817e4Smiodesac
19263d8817e4Smiod
19273d8817e4Smiod# These force 'configure's to be done one at a time, to avoid problems
19283d8817e4Smiod# with contention over a shared config.cache.
19293d8817e4Smiodrm -f serdep.tmp
19303d8817e4Smiodecho '# serdep.tmp' > serdep.tmp
19313d8817e4Smiodolditem=
19323d8817e4Smiodtest "x${enable_serial_build_configure}" = xyes &&
19333d8817e4Smiodfor item in ${build_configdirs} ; do
19343d8817e4Smiod  case ${olditem} in
19353d8817e4Smiod    "") ;;
19363d8817e4Smiod    *) echo "configure-build-${item}: configure-build-${olditem}" >> serdep.tmp ;;
19373d8817e4Smiod  esac
19383d8817e4Smiod  olditem=${item}
19393d8817e4Smioddone
19403d8817e4Smiodolditem=
19413d8817e4Smiodtest "x${enable_serial_host_configure}" = xyes &&
19423d8817e4Smiodfor item in ${configdirs} ; do
19433d8817e4Smiod  case ${olditem} in
19443d8817e4Smiod    "") ;;
19453d8817e4Smiod    *) echo "configure-${item}: configure-${olditem}" >> serdep.tmp ;;
19463d8817e4Smiod  esac
19473d8817e4Smiod  olditem=${item}
19483d8817e4Smioddone
19493d8817e4Smiodolditem=
19503d8817e4Smiodtest "x${enable_serial_target_configure}" = xyes &&
19513d8817e4Smiodfor item in ${target_configdirs} ; do
19523d8817e4Smiod  case ${olditem} in
19533d8817e4Smiod    "") ;;
19543d8817e4Smiod    *) echo "configure-target-${item}: configure-target-${olditem}" >> serdep.tmp ;;
19553d8817e4Smiod  esac
19563d8817e4Smiod  olditem=${item}
19573d8817e4Smioddone
19583d8817e4Smiodserialization_dependencies=serdep.tmp
1959d2386abeSmiod# override on OpenBSD
1960d2386abeSmiodserialization_dependencies=/dev/null
19613d8817e4SmiodAC_SUBST_FILE(serialization_dependencies)
19623d8817e4Smiod
19633d8817e4Smiod# Base args.  Strip norecursion, cache-file, srcdir, host, build,
19643d8817e4Smiod# target and nonopt.  These are the ones we might not want to pass
19653d8817e4Smiod# down to subconfigures.  Also strip program-prefix, program-suffix,
19663d8817e4Smiod# and program-transform-name, so that we can pass down a consistent
19673d8817e4Smiod# program-transform-name.  If autoconf has put single quotes around
19683d8817e4Smiod# any of these arguments (because they contain shell metacharacters)
19693d8817e4Smiod# then this will fail; in practice this only happens for
19703d8817e4Smiod# --program-transform-name, so be sure to override --program-transform-name
19713d8817e4Smiod# at the end of the argument list.
19723d8817e4Smiod# These will be expanded by make, so quote '$'.
19733d8817e4Smiodcat <<\EOF_SED > conftestsed
19743d8817e4Smiods/ --no[[^ ]]*/ /g
19753d8817e4Smiods/ --c[[a-z-]]*[[= ]][[^ ]]*//g
19763d8817e4Smiods/ --sr[[a-z-]]*[[= ]][[^ ]]*//g
19773d8817e4Smiods/ --ho[[a-z-]]*[[= ]][[^ ]]*//g
19783d8817e4Smiods/ --bu[[a-z-]]*[[= ]][[^ ]]*//g
19793d8817e4Smiods/ --t[[a-z-]]*[[= ]][[^ ]]*//g
19803d8817e4Smiods/ --program-[[pst]][[a-z-]]*[[= ]][[^ ]]*//g
19813d8817e4Smiods/ -cache-file[[= ]][[^ ]]*//g
19823d8817e4Smiods/ -srcdir[[= ]][[^ ]]*//g
19833d8817e4Smiods/ -host[[= ]][[^ ]]*//g
19843d8817e4Smiods/ -build[[= ]][[^ ]]*//g
19853d8817e4Smiods/ -target[[= ]][[^ ]]*//g
19863d8817e4Smiods/ -program-prefix[[= ]][[^ ]]*//g
19873d8817e4Smiods/ -program-suffix[[= ]][[^ ]]*//g
19883d8817e4Smiods/ -program-transform-name[[= ]][[^ ]]*//g
19893d8817e4Smiods/ [[^' -][^ ]*] / /
19903d8817e4Smiods/^ *//;s/ *$//
19913d8817e4Smiods,\$,$$,g
19923d8817e4SmiodEOF_SED
19933d8817e4Smiodsed -f conftestsed <<EOF_SED > conftestsed.out
19943d8817e4Smiod ${ac_configure_args}
19953d8817e4SmiodEOF_SED
19963d8817e4Smiodbaseargs=`cat conftestsed.out`
19973d8817e4Smiodrm -f conftestsed conftestsed.out
19983d8817e4Smiod
19993d8817e4Smiod# Add in --program-transform-name, after --program-prefix and
20003d8817e4Smiod# --program-suffix have been applied to it.  Autoconf has already
20013d8817e4Smiod# doubled dollar signs and backslashes in program_transform_name; we want
20023d8817e4Smiod# the backslashes un-doubled, and then the entire thing wrapped in single
20033d8817e4Smiod# quotes, because this will be expanded first by make and then by the shell.
20043d8817e4Smiod# Also, because we want to override the logic in subdir configure scripts to
20053d8817e4Smiod# choose program_transform_name, replace any s,x,x, with s,y,y,.
20063d8817e4Smiodsed -e "s,\\\\\\\\,\\\\,g; s,','\\\\'',g; s/s,x,x,/s,y,y,/" <<EOF_SED > conftestsed.out
20073d8817e4Smiod${program_transform_name}
20083d8817e4SmiodEOF_SED
20093d8817e4Smiodgcc_transform_name=`cat conftestsed.out`
20103d8817e4Smiodrm -f conftestsed.out
20113d8817e4Smiodbaseargs="$baseargs --program-transform-name='${gcc_transform_name}'"
20123d8817e4Smiod
20133d8817e4Smiod# For the build-side libraries, we just need to pretend we're native,
20143d8817e4Smiod# and not use the same cache file.  Multilibs are neither needed nor
20153d8817e4Smiod# desired.
20163d8817e4Smiodbuild_configargs="--cache-file=../config.cache --build=${build_alias} --host=${build_alias} --target=${target_alias} ${baseargs}"
20173d8817e4Smiod
20183d8817e4Smiod# For host modules, accept cache file option, or specification as blank.
20193d8817e4Smiodcase "${cache_file}" in
20203d8817e4Smiod"") # empty
20213d8817e4Smiod  cache_file_option="" ;;
20223d8817e4Smiod/* | [[A-Za-z]]:[[\\/]]* ) # absolute path
20233d8817e4Smiod  cache_file_option="--cache-file=${cache_file}" ;;
20243d8817e4Smiod*) # relative path
20253d8817e4Smiod  cache_file_option="--cache-file=../${cache_file}" ;;
20263d8817e4Smiodesac
20273d8817e4Smiod
20283d8817e4Smiod# Host dirs don't like to share a cache file either, horribly enough.
20293d8817e4Smiod# This seems to be due to autoconf 2.5x stupidity.
20303d8817e4Smiodhost_configargs="--cache-file=./config.cache --build=${build_alias} --host=${host_alias} --target=${target_alias} ${extra_host_args} ${baseargs}"
20313d8817e4Smiod
20323d8817e4Smiodtarget_configargs=${baseargs}
20333d8817e4Smiod
20343d8817e4Smiod# Passing a --with-cross-host argument lets the target libraries know
20353d8817e4Smiod# whether they are being built with a cross-compiler or being built
20363d8817e4Smiod# native.  However, it would be better to use other mechanisms to make the
20373d8817e4Smiod# sorts of decisions they want to make on this basis.  Please consider
20383d8817e4Smiod# this option to be deprecated.  FIXME.
20393d8817e4Smiodif test x${is_cross_compiler} = xyes ; then
20403d8817e4Smiod  target_configargs="--with-cross-host=${host_alias} ${target_configargs}"
20413d8817e4Smiodfi
20423d8817e4Smiod
20433d8817e4Smiod# Default to --enable-multilib.
20443d8817e4Smiodif test x${enable_multilib} = x ; then
20453d8817e4Smiod  target_configargs="--enable-multilib ${target_configargs}"
20463d8817e4Smiodfi
20473d8817e4Smiod
20483d8817e4Smiod# Pass --with-newlib if appropriate.  Note that target_configdirs has
20493d8817e4Smiod# changed from the earlier setting of with_newlib.
20503d8817e4Smiodif test x${with_newlib} != xno && echo " ${target_configdirs} " | grep " newlib " > /dev/null 2>&1 && test -d ${srcdir}/newlib ; then
20513d8817e4Smiod  target_configargs="--with-newlib ${target_configargs}"
20523d8817e4Smiodfi
20533d8817e4Smiod
20543d8817e4Smiod# Different target subdirs use different values of certain variables
20553d8817e4Smiod# (notably CXX).  Worse, multilibs use *lots* of different values.
20563d8817e4Smiod# Worse yet, autoconf 2.5x makes some of these 'precious', meaning that
20573d8817e4Smiod# it doesn't automatically accept command-line overrides of them.
20583d8817e4Smiod# This means it's not safe for target subdirs to share a cache file,
20593d8817e4Smiod# which is disgusting, but there you have it.  Hopefully this can be
20603d8817e4Smiod# fixed in future.  It's still worthwhile to use a cache file for each
20613d8817e4Smiod# directory.  I think.
20623d8817e4Smiod
20633d8817e4Smiod# Pass the appropriate --build, --host, --target and --cache-file arguments.
20643d8817e4Smiod# We need to pass --target, as newer autoconf's requires consistency
20653d8817e4Smiod# for target_alias and gcc doesn't manage it consistently.
20663d8817e4Smiodtarget_configargs="--cache-file=./config.cache --build=${build_alias} --host=${target_alias} --target=${target_alias} ${target_configargs}"
20673d8817e4Smiod
20683d8817e4SmiodFLAGS_FOR_TARGET=
20693d8817e4Smiodcase " $target_configdirs " in
20703d8817e4Smiod *" newlib "*)
20713d8817e4Smiod  case " $target_configargs " in
20723d8817e4Smiod  *" --with-newlib "*)
20733d8817e4Smiod   case "$target" in
20743d8817e4Smiod   *-cygwin*)
20753d8817e4Smiod     FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(TARGET_SUBDIR)/winsup -L$$r/$(TARGET_SUBDIR)/winsup/cygwin -L$$r/$(TARGET_SUBDIR)/winsup/w32api/lib -isystem $$s/winsup/include -isystem $$s/winsup/cygwin/include -isystem $$s/winsup/w32api/include' ;;
20763d8817e4Smiod   esac
20773d8817e4Smiod
20783d8817e4Smiod   # If we're not building GCC, don't discard standard headers.
20793d8817e4Smiod   if test -d ${srcdir}/gcc; then
20803d8817e4Smiod     FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -nostdinc'
20813d8817e4Smiod
20823d8817e4Smiod     if test "${build}" != "${host}"; then
20833d8817e4Smiod       # On Canadian crosses, CC_FOR_TARGET will have already been set
20843d8817e4Smiod       # by `configure', so we won't have an opportunity to add -Bgcc/
20853d8817e4Smiod       # to it.  This is right: we don't want to search that directory
20863d8817e4Smiod       # for binaries, but we want the header files in there, so add
20873d8817e4Smiod       # them explicitly.
20883d8817e4Smiod       FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -isystem $$r/$(HOST_SUBDIR)/gcc/include'
20893d8817e4Smiod
20903d8817e4Smiod       # Someone might think of using the pre-installed headers on
20913d8817e4Smiod       # Canadian crosses, in case the installed compiler is not fully
20923d8817e4Smiod       # compatible with the compiler being built.  In this case, it
20933d8817e4Smiod       # would be better to flag an error than risking having
20943d8817e4Smiod       # incompatible object files being constructed.  We can't
20953d8817e4Smiod       # guarantee that an error will be flagged, but let's hope the
20963d8817e4Smiod       # compiler will do it, when presented with incompatible header
20973d8817e4Smiod       # files.
20983d8817e4Smiod     fi
20993d8817e4Smiod   fi
21003d8817e4Smiod
21013d8817e4Smiod   case "${target}-${is_cross_compiler}" in
21023d8817e4Smiod   i[[3456789]]86-*-linux*-no)
21033d8817e4Smiod      # Here host == target, so we don't need to build gcc,
21043d8817e4Smiod      # so we don't want to discard standard headers.
21053d8817e4Smiod      FLAGS_FOR_TARGET=`echo " $FLAGS_FOR_TARGET " | sed -e 's/ -nostdinc / /'`
21063d8817e4Smiod      ;;
21073d8817e4Smiod   *)
21083d8817e4Smiod      # If we're building newlib, use its generic headers last, but search
21093d8817e4Smiod      # for any libc-related directories first (so make it the last -B
21103d8817e4Smiod      # switch).
21113d8817e4Smiod      FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$$r/$(TARGET_SUBDIR)/newlib/ -isystem $$r/$(TARGET_SUBDIR)/newlib/targ-include -isystem $$s/newlib/libc/include'
21123d8817e4Smiod      ;;
21133d8817e4Smiod   esac
21143d8817e4Smiod   ;;
21153d8817e4Smiod  esac
21163d8817e4Smiod  ;;
21173d8817e4Smiodesac
21183d8817e4Smiod
21193d8817e4Smiod# Allow the user to override the flags for
21203d8817e4Smiod# our build compiler if desired.
21213d8817e4SmiodCFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
21223d8817e4Smiod
21233d8817e4Smiod# On Canadian crosses, we'll be searching the right directories for
21243d8817e4Smiod# the previously-installed cross compiler, so don't bother to add
21253d8817e4Smiod# flags for directories within the install tree of the compiler
21263d8817e4Smiod# being built; programs in there won't even run.
21273d8817e4Smiodif test "${build}" = "${host}" && test -d ${srcdir}/gcc; then
21283d8817e4Smiod  # Search for pre-installed headers if nothing else fits.
21293d8817e4Smiod  FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$(build_tooldir)/bin/ -B$(build_tooldir)/lib/ -isystem $(build_tooldir)/include -isystem $(build_tooldir)/sys-include'
21303d8817e4Smiodfi
21313d8817e4Smiod
21323d8817e4Smiodif test "x${use_gnu_ld}" = x &&
21333d8817e4Smiod   echo " ${configdirs} " | grep " ld " > /dev/null ; then
21343d8817e4Smiod  # Arrange for us to find uninstalled linker scripts.
21353d8817e4Smiod  FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(HOST_SUBDIR)/ld'
21363d8817e4Smiodfi
21373d8817e4Smiod
21383d8817e4Smiod# Makefile fragments.
21393d8817e4Smiodfor frag in host_makefile_frag target_makefile_frag alphaieee_frag ospace_frag;
21403d8817e4Smioddo
21413d8817e4Smiod  eval fragval=\$$frag
21423d8817e4Smiod  if test $fragval != /dev/null; then
21433d8817e4Smiod    eval $frag=${srcdir}/$fragval
21443d8817e4Smiod  fi
21453d8817e4Smioddone
21463d8817e4SmiodAC_SUBST_FILE(host_makefile_frag)
21473d8817e4SmiodAC_SUBST_FILE(target_makefile_frag)
21483d8817e4SmiodAC_SUBST_FILE(alphaieee_frag)
21493d8817e4SmiodAC_SUBST_FILE(ospace_frag)
21503d8817e4Smiod
21513d8817e4Smiod# Miscellanea: directories, flags, etc.
21523d8817e4SmiodAC_SUBST(RPATH_ENVVAR)
21533d8817e4SmiodAC_SUBST(tooldir)
21543d8817e4SmiodAC_SUBST(build_tooldir)
21553d8817e4SmiodAC_SUBST(CONFIGURE_GDB_TK)
21563d8817e4SmiodAC_SUBST(GDB_TK)
21573d8817e4SmiodAC_SUBST(INSTALL_GDB_TK)
21583d8817e4Smiod
21593d8817e4Smiod# Build module lists & subconfigure args.
21603d8817e4SmiodAC_SUBST(build_configargs)
21613d8817e4SmiodAC_SUBST(build_configdirs)
21623d8817e4Smiod
21633d8817e4Smiod# Host module lists & subconfigure args.
21643d8817e4SmiodAC_SUBST(host_configargs)
21653d8817e4SmiodAC_SUBST(configdirs)
21663d8817e4Smiod
21673d8817e4Smiod# Target module lists & subconfigure args.
21683d8817e4SmiodAC_SUBST(target_configargs)
21693d8817e4Smiod
21703d8817e4Smiod
21713d8817e4Smiod# Build tools.
21723d8817e4SmiodAC_SUBST(CC_FOR_BUILD)
21733d8817e4SmiodAC_SUBST(config_shell)
21743d8817e4Smiod
21753d8817e4Smiod# Generate default definitions for YACC, M4, LEX and other programs that run
21763d8817e4Smiod# on the build machine.  These are used if the Makefile can't locate these
21773d8817e4Smiod# programs in objdir.
21783d8817e4SmiodMISSING=`cd $ac_aux_dir && ${PWDCMD-pwd}`/missing
21793d8817e4Smiod
21803d8817e4SmiodAC_CHECK_PROGS([YACC], ['bison -y' byacc yacc], [$MISSING bison -y])
21813d8817e4Smiodcase " $build_configdirs " in
21823d8817e4Smiod  *" bison "*) YACC='$$r/$(BUILD_SUBDIR)/bison/tests/bison -y' ;;
21833d8817e4Smiod  *" byacc "*) YACC='$$r/$(BUILD_SUBDIR)/byacc/byacc' ;;
21843d8817e4Smiodesac
21853d8817e4Smiod
21863d8817e4SmiodAC_CHECK_PROGS([BISON], [bison], [$MISSING bison])
21873d8817e4Smiodcase " $build_configdirs " in
21883d8817e4Smiod  *" bison "*) BISON='$$r/$(BUILD_SUBDIR)/bison/tests/bison' ;;
21893d8817e4Smiodesac
21903d8817e4Smiod
21913d8817e4SmiodAC_CHECK_PROGS([M4], [gm4 gnum4 m4], [$MISSING m4])
21923d8817e4Smiodcase " $build_configdirs " in
21933d8817e4Smiod  *" m4 "*) M4='$$r/$(BUILD_SUBDIR)/m4/m4' ;;
21943d8817e4Smiodesac
21953d8817e4Smiod
21963d8817e4SmiodAC_CHECK_PROGS([LEX], [flex lex], [$MISSING flex])
21973d8817e4Smiodcase " $build_configdirs " in
21983d8817e4Smiod  *" flex "*) LEX='$$r/$(BUILD_SUBDIR)/flex/flex' ;;
21993d8817e4Smiod  *" lex "*) LEX='$$r/$(BUILD_SUBDIR)/lex/lex' ;;
22003d8817e4Smiodesac
22013d8817e4Smiod
22023d8817e4SmiodAC_CHECK_PROGS([FLEX], [flex], [$MISSING flex])
22033d8817e4Smiodcase " $build_configdirs " in
22043d8817e4Smiod  *" flex "*) FLEX='$$r/$(BUILD_SUBDIR)/flex/flex' ;;
22053d8817e4Smiodesac
22063d8817e4Smiod
22073d8817e4SmiodAC_CHECK_PROGS([MAKEINFO], makeinfo, [$MISSING makeinfo])
22083d8817e4Smiodcase " $build_configdirs " in
22093d8817e4Smiod  *" texinfo "*) MAKEINFO='$$r/$(BUILD_SUBDIR)/texinfo/makeinfo/makeinfo' ;;
22103d8817e4Smiod  *)
22113d8817e4Smiodchangequote(,)
22123d8817e4Smiod    # For an installed makeinfo, we require it to be from texinfo 4.4 or
22133d8817e4Smiod    # higher, else we use the "missing" dummy.
22143d8817e4Smiod    if ${MAKEINFO} --version \
22153d8817e4Smiod       | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[4-9]|[5-9])' >/dev/null 2>&1; then
22163d8817e4Smiod      :
22173d8817e4Smiod    else
22183d8817e4Smiod      MAKEINFO="$MISSING makeinfo"
22193d8817e4Smiod    fi
22203d8817e4Smiod    ;;
22213d8817e4Smiodchangequote([,])
22223d8817e4Smiodesac
22233d8817e4Smiod
22243d8817e4Smiod# FIXME: expect and dejagnu may become build tools?
22253d8817e4Smiod
22263d8817e4SmiodAC_CHECK_PROGS(EXPECT, expect, expect)
22273d8817e4Smiodcase " $configdirs " in
22283d8817e4Smiod  *" expect "*)
22293d8817e4Smiod    test $host = $build && EXPECT='$$r/$(HOST_SUBDIR)/expect/expect'
22303d8817e4Smiod    ;;
22313d8817e4Smiodesac
22323d8817e4Smiod
22333d8817e4SmiodAC_CHECK_PROGS(RUNTEST, runtest, runtest)
22343d8817e4Smiodcase " $configdirs " in
22353d8817e4Smiod  *" dejagnu "*)
22363d8817e4Smiod    test $host = $build && RUNTEST='$$r/$(HOST_SUBDIR)/dejagnu/runtest'
22373d8817e4Smiod    ;;
22383d8817e4Smiodesac
22393d8817e4Smiod
22403d8817e4Smiod
22413d8817e4Smiod# Host tools.
22423d8817e4SmiodNCN_STRICT_CHECK_TOOLS(AR, ar)
22433d8817e4SmiodNCN_STRICT_CHECK_TOOLS(AS, as)
22443d8817e4SmiodNCN_STRICT_CHECK_TOOLS(DLLTOOL, dlltool)
22453d8817e4SmiodNCN_STRICT_CHECK_TOOLS(LD, ld)
22463d8817e4SmiodNCN_STRICT_CHECK_TOOLS(LIPO, lipo)
22473d8817e4SmiodNCN_STRICT_CHECK_TOOLS(NM, nm)
22483d8817e4SmiodNCN_STRICT_CHECK_TOOLS(RANLIB, ranlib, :)
22493d8817e4SmiodNCN_STRICT_CHECK_TOOLS(STRIP, strip, :)
22503d8817e4SmiodNCN_STRICT_CHECK_TOOLS(WINDRES, windres)
22513d8817e4SmiodNCN_STRICT_CHECK_TOOLS(OBJCOPY, objcopy)
22523d8817e4SmiodNCN_STRICT_CHECK_TOOLS(OBJDUMP, objdump)
22533d8817e4SmiodAC_SUBST(CC)
22543d8817e4SmiodAC_SUBST(CXX)
22553d8817e4SmiodAC_SUBST(CFLAGS)
22563d8817e4SmiodAC_SUBST(CFLAGS_FOR_BUILD)
22573d8817e4SmiodAC_SUBST(CXXFLAGS)
22583d8817e4Smiod
22593d8817e4Smiod# Target tools.
22603d8817e4SmiodAC_ARG_WITH([build-time-tools],
22613d8817e4Smiod  [  --with-build-time-tools=path
22623d8817e4Smiod                          use given path to find target tools during the build],
22633d8817e4Smiod  [case x"$withval" in
22643d8817e4Smiod     x/*) ;;
22653d8817e4Smiod     *)
22663d8817e4Smiod       with_build_time_tools=
22673d8817e4Smiod       AC_MSG_WARN([argument to --with-build-time-tools must be an absolute path])
22683d8817e4Smiod       ;;
22693d8817e4Smiod   esac],
22703d8817e4Smiod  [with_build_time_tools=])
22713d8817e4Smiod
22723d8817e4SmiodNCN_STRICT_CHECK_TARGET_TOOLS(CC_FOR_TARGET, cc gcc)
22733d8817e4SmiodNCN_STRICT_CHECK_TARGET_TOOLS(CXX_FOR_TARGET, c++ g++ cxx gxx)
22743d8817e4SmiodNCN_STRICT_CHECK_TARGET_TOOLS(GCC_FOR_TARGET, gcc, ${CC_FOR_TARGET})
22753d8817e4SmiodNCN_STRICT_CHECK_TARGET_TOOLS(GCJ_FOR_TARGET, gcj)
22763d8817e4SmiodNCN_STRICT_CHECK_TARGET_TOOLS(GFORTRAN_FOR_TARGET, gfortran)
22773d8817e4Smiod
22783d8817e4SmiodACX_CHECK_INSTALLED_TARGET_TOOL(AR_FOR_TARGET, ar)
22793d8817e4SmiodACX_CHECK_INSTALLED_TARGET_TOOL(AS_FOR_TARGET, as)
22803d8817e4SmiodACX_CHECK_INSTALLED_TARGET_TOOL(DLLTOOL_FOR_TARGET, dlltool)
22813d8817e4SmiodACX_CHECK_INSTALLED_TARGET_TOOL(LD_FOR_TARGET, ld)
22823d8817e4SmiodACX_CHECK_INSTALLED_TARGET_TOOL(LIPO_FOR_TARGET, lipo)
22833d8817e4SmiodACX_CHECK_INSTALLED_TARGET_TOOL(NM_FOR_TARGET, nm)
22843d8817e4SmiodACX_CHECK_INSTALLED_TARGET_TOOL(OBJDUMP_FOR_TARGET, objdump)
22853d8817e4SmiodACX_CHECK_INSTALLED_TARGET_TOOL(RANLIB_FOR_TARGET, ranlib, :)
22863d8817e4SmiodACX_CHECK_INSTALLED_TARGET_TOOL(STRIP_FOR_TARGET, strip)
22873d8817e4SmiodACX_CHECK_INSTALLED_TARGET_TOOL(WINDRES_FOR_TARGET, windres)
22883d8817e4Smiod
22893d8817e4SmiodRAW_CXX_FOR_TARGET="$CXX_FOR_TARGET"
22903d8817e4Smiod
22913d8817e4SmiodGCC_TARGET_TOOL(ar, AR_FOR_TARGET, AR, [binutils/ar])
22923d8817e4SmiodGCC_TARGET_TOOL(as, AS_FOR_TARGET, AS, [gas/as-new])
22933d8817e4SmiodGCC_TARGET_TOOL(cc, CC_FOR_TARGET, CC, [gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/])
22943d8817e4SmiodGCC_TARGET_TOOL(c++, CXX_FOR_TARGET, CXX,
22953d8817e4Smiod		[gcc/g++ -B$$r/$(HOST_SUBDIR)/gcc/ -nostdinc++ `test ! -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags || $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags --build-includes` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs],
22963d8817e4Smiod		c++)
22973d8817e4SmiodGCC_TARGET_TOOL(c++ for libstdc++, RAW_CXX_FOR_TARGET, CXX,
22983d8817e4Smiod		[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],
22993d8817e4Smiod		c++)
23003d8817e4SmiodGCC_TARGET_TOOL(dlltool, DLLTOOL_FOR_TARGET, DLLTOOL, [binutils/dlltool])
23013d8817e4SmiodGCC_TARGET_TOOL(gcc, GCC_FOR_TARGET, , [gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/])
23023d8817e4SmiodGCC_TARGET_TOOL(gcj, GCJ_FOR_TARGET, GCJ,
23033d8817e4Smiod		[gcc/gcj -B$$r/$(HOST_SUBDIR)/gcc/], java)
23043d8817e4SmiodGCC_TARGET_TOOL(gfortran, GFORTRAN_FOR_TARGET, GFORTRAN,
23053d8817e4Smiod		[gcc/gfortran -B$$r/$(HOST_SUBDIR)/gcc/], fortran)
23063d8817e4SmiodGCC_TARGET_TOOL(ld, LD_FOR_TARGET, LD, [ld/ld-new])
23073d8817e4SmiodGCC_TARGET_TOOL(lipo, LIPO_FOR_TARGET, LIPO)
23083d8817e4SmiodGCC_TARGET_TOOL(nm, NM_FOR_TARGET, NM, [binutils/nm-new])
23093d8817e4SmiodGCC_TARGET_TOOL(objdump, OBJDUMP_FOR_TARGET, OBJDUMP, [binutils/objdump])
23103d8817e4SmiodGCC_TARGET_TOOL(ranlib, RANLIB_FOR_TARGET, RANLIB, [binutils/ranlib])
23113d8817e4SmiodGCC_TARGET_TOOL(strip, STRIP_FOR_TARGET, STRIP, [binutils/strip])
23123d8817e4SmiodGCC_TARGET_TOOL(windres, WINDRES_FOR_TARGET, WINDRES, [binutils/windres])
23133d8817e4Smiod
23143d8817e4SmiodAC_SUBST(FLAGS_FOR_TARGET)
23153d8817e4SmiodAC_SUBST(RAW_CXX_FOR_TARGET)
23163d8817e4Smiod
23173d8817e4Smiod# Certain tools may need extra flags.
23183d8817e4SmiodAR_FOR_TARGET=${AR_FOR_TARGET}${extra_arflags_for_target}
23193d8817e4SmiodRANLIB_FOR_TARGET=${RANLIB_FOR_TARGET}${extra_ranlibflags_for_target}
23203d8817e4SmiodNM_FOR_TARGET=${NM_FOR_TARGET}${extra_nmflags_for_target}
23213d8817e4Smiod
23223d8817e4Smiod# When building target libraries, except in a Canadian cross, we use
23233d8817e4Smiod# the same toolchain as the compiler we just built.
23243d8817e4SmiodCOMPILER_AS_FOR_TARGET='$(AS_FOR_TARGET)'
23253d8817e4SmiodCOMPILER_LD_FOR_TARGET='$(LD_FOR_TARGET)'
23263d8817e4SmiodCOMPILER_NM_FOR_TARGET='$(NM_FOR_TARGET)'
23273d8817e4Smiodif test $host = $build; then
23283d8817e4Smiod  case " $configdirs " in
23293d8817e4Smiod    *" gcc "*)
23303d8817e4Smiod      COMPILER_AS_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/as'
23313d8817e4Smiod      COMPILER_LD_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/collect-ld'
23323d8817e4Smiod      COMPILER_NM_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/nm'${extra_nmflags_for_target}
23333d8817e4Smiod      ;;
23343d8817e4Smiod  esac
23353d8817e4Smiodfi
23363d8817e4Smiod
23373d8817e4SmiodAC_SUBST(COMPILER_AS_FOR_TARGET)
23383d8817e4SmiodAC_SUBST(COMPILER_LD_FOR_TARGET)
23393d8817e4SmiodAC_SUBST(COMPILER_NM_FOR_TARGET)
23403d8817e4Smiod
23413d8817e4SmiodAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
23423d8817e4SmiodAC_ARG_ENABLE(maintainer-mode,
23433d8817e4Smiod[  --enable-maintainer-mode enable make rules and dependencies not useful
23443d8817e4Smiod                          (and sometimes confusing) to the casual installer],
23453d8817e4Smiod      USE_MAINTAINER_MODE=$enableval,
23463d8817e4Smiod      USE_MAINTAINER_MODE=no)
23473d8817e4SmiodAC_MSG_RESULT($USE_MAINTAINER_MODE)
23483d8817e4SmiodAC_SUBST(MAINTAINER_MODE_TRUE)
23493d8817e4SmiodAC_SUBST(MAINTAINER_MODE_FALSE)
23503d8817e4Smiodif test "$USE_MAINTAINER_MODE" = yes; then
23513d8817e4Smiod  MAINTAINER_MODE_TRUE=
23523d8817e4Smiod  MAINTAINER_MODE_FALSE='#'
23533d8817e4Smiodelse
23543d8817e4Smiod  MAINTAINER_MODE_TRUE='#'
23553d8817e4Smiod  MAINTAINER_MODE_FALSE=
23563d8817e4Smiodfi
23573d8817e4SmiodMAINT=$MAINTAINER_MODE_TRUE
23583d8817e4SmiodAC_SUBST(MAINT)dnl
23593d8817e4Smiod
23603d8817e4Smiod# ---------------------
23613d8817e4Smiod# GCC bootstrap support
23623d8817e4Smiod# ---------------------
23633d8817e4Smiod
23643d8817e4Smiod# Stage specific cflags for build.
23653d8817e4Smiodstage1_cflags="-g"
23663d8817e4Smiodcase $build in
2367*295b0b42Smiod  vax-*-openbsd*) ;;
23683d8817e4Smiod  vax-*-*)
23693d8817e4Smiod    case ${GCC} in
23703d8817e4Smiod      yes) stage1_cflags="-g -Wa,-J" ;;
23713d8817e4Smiod      *) stage1_cflags="-g -J" ;;
23723d8817e4Smiod    esac ;;
23733d8817e4Smiod  powerpc-*-darwin*)
23743d8817e4Smiod    # The spiffy cpp-precomp chokes on some legitimate constructs in GCC
23753d8817e4Smiod    # sources; use -no-cpp-precomp to get to GNU cpp.
23763d8817e4Smiod    # Apple's GCC has bugs in designated initializer handling, so disable
23773d8817e4Smiod    # that too.
23783d8817e4Smiod    stage1_cflags="-g -no-cpp-precomp -DHAVE_DESIGNATED_INITIALIZERS=0"
23793d8817e4Smiod    ;;
23803d8817e4Smiodesac
23813d8817e4SmiodAC_SUBST(stage1_cflags)
23823d8817e4Smiod
23833d8817e4Smiod# Enable -Werror in bootstrap stage2 and later.
23843d8817e4Smiod# Change the default to "no" on release branches.
23853d8817e4SmiodAC_ARG_ENABLE(werror,
23863d8817e4Smiod[  --enable-werror         enable -Werror in bootstrap stage2 and later], [],
23873d8817e4Smiod[enable_werror=yes])
23883d8817e4Smiodcase ${enable_werror} in
23893d8817e4Smiod  yes) stage2_werror_flag="--enable-werror-always" ;;
23903d8817e4Smiod  *) stage2_werror_flag="" ;;
23913d8817e4Smiodesac
23923d8817e4SmiodAC_SUBST(stage2_werror_flag)
23933d8817e4Smiod
23943d8817e4Smiod# Flags needed to enable html installing and building
23953d8817e4SmiodAC_ARG_WITH(datarootdir,
23963d8817e4Smiod[  --with-datarootdir	Use datarootdir as the data root directory.],
23973d8817e4Smiod[datarootdir="\${prefix}/${withval}"],
23983d8817e4Smiod[datarootdir="\${prefix}/share"])
23993d8817e4Smiod
24003d8817e4SmiodAC_ARG_WITH(docdir,
24013d8817e4Smiod[  --with-docdir	Install documentation in this directory.],
24023d8817e4Smiod[docdir="\${prefix}/${withval}"],
24033d8817e4Smiod[docdir="\${datarootdir}/doc"])
24043d8817e4Smiod
24053d8817e4SmiodAC_ARG_WITH(htmldir,
24063d8817e4Smiod[  --with-htmldir	Install html in this directory.],
24073d8817e4Smiod[htmldir="\${prefix}/${withval}"],
24083d8817e4Smiod[htmldir="\${docdir}"])
24093d8817e4Smiod
24103d8817e4SmiodAC_SUBST(datarootdir)
24113d8817e4SmiodAC_SUBST(docdir)
24123d8817e4SmiodAC_SUBST(htmldir)
24133d8817e4Smiod
24143d8817e4SmiodAC_OUTPUT(Makefile)
2415