Skip to content
Snippets Groups Projects
configure.ac 129 KiB
Newer Older
#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
#   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012,
#   2014, 2015, 2016, 2019, 2022 Free Software Foundation, Inc.
Jason Merrill's avatar
Jason Merrill committed
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
Jason Merrill's avatar
Jason Merrill committed
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING3.  If not see
# <http://www.gnu.org/licenses/>.
Jason Merrill's avatar
Jason Merrill committed

##############################################################################
### WARNING: this file contains embedded tabs.  Do not run untabify on this file.

m4_include(config/acx.m4)
m4_include(config/override.m4)
m4_include(config/proginstall.m4)
m4_include(config/ax_cxx_compile_stdcxx.m4)
m4_include(config/gcc-plugin.m4)
m4_include([libtool.m4])
m4_include([ltoptions.m4])
m4_include([ltsugar.m4])
m4_include([ltversion.m4])
m4_include([lt~obsolete.m4])
m4_include([config/isl.m4])
AC_INIT(move-if-change)
progname=$0
# if PWD already has a value, it is probably wrong.
if test -n "$PWD" ; then PWD=`${PWDCMD-pwd}`; fi

# Export original configure arguments for use by sub-configures.
# Quote arguments with shell meta charatcers.
TOPLEVEL_CONFIGURE_ARGUMENTS=
set -- "$progname" "$@"
for ac_arg
do
  case "$ac_arg" in
  *" "*|*"	"*|*[[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\']]*)
    ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"`
    # if the argument is of the form -foo=baz, quote the baz part only
    ac_arg=`echo "'$ac_arg'" | sed "s/^'\([[-a-zA-Z0-9]]*=\)/\\1'/"` ;;
  *) ;;
  esac
  # Add the quoted argument to the list.
  TOPLEVEL_CONFIGURE_ARGUMENTS="$TOPLEVEL_CONFIGURE_ARGUMENTS $ac_arg"
done
if test "$silent" = yes; then
  TOPLEVEL_CONFIGURE_ARGUMENTS="$TOPLEVEL_CONFIGURE_ARGUMENTS --silent"
fi
# Remove the initial space we just introduced and, as these will be
# expanded by make, quote '$'.
TOPLEVEL_CONFIGURE_ARGUMENTS=`echo "x$TOPLEVEL_CONFIGURE_ARGUMENTS" | sed -e 's/^x *//' -e 's,\\$,$$,g'`
AC_SUBST(TOPLEVEL_CONFIGURE_ARGUMENTS)

# Find the build, host, and target systems.
ACX_NONCANONICAL_BUILD
ACX_NONCANONICAL_HOST
ACX_NONCANONICAL_TARGET

dnl Autoconf 2.5x and later will set a default program prefix if
dnl --target was used, even if it was the same as --host.  Disable
dnl that behavior.  This must be done before AC_CANONICAL_SYSTEM
dnl to take effect.
test "$host_noncanonical" = "$target_noncanonical" &&
  test "$program_prefix$program_suffix$program_transform_name" = \
    NONENONEs,x,x, &&
  program_transform_name=s,y,y,

AC_CANONICAL_SYSTEM
AC_ARG_PROGRAM

m4_pattern_allow([^AS_FOR_TARGET$])dnl
m4_pattern_allow([^AS_FOR_BUILD$])dnl
# Get 'install' or 'install-sh' and its variants.
AC_PROG_INSTALL
ACX_PROG_LN
AC_PROG_SED
AC_PROG_AWK
srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`

# We pass INSTALL explicitly to sub-makes.  Make sure that it is not
# a relative path.
if test "$INSTALL" = "${srcdir}/install-sh -c"; then
  INSTALL="${srcpwd}/install-sh -c"
fi

# Set srcdir to "." if that's what it is.
# This is important for multilib support.
pwd=`${PWDCMD-pwd}`
if test "${pwd}" = "${srcpwd}" ; then
  srcdir=.
fi

topsrcdir=$srcpwd
Jason Merrill's avatar
Jason Merrill committed

extra_host_args=
Jason Merrill's avatar
Jason Merrill committed
### To add a new directory to the tree, first choose whether it is a target
### or a host dependent tool.  Then put it into the appropriate list
### (library or tools, host or target), doing a dependency sort.

# Subdirs will be configured in the order listed in build_configdirs, 
# configdirs, or target_configdirs; see the serialization section below.

# Dependency sorting is only needed when *configuration* must be done in 
# a particular order.  In all cases a dependency should be specified in 
# the Makefile, whether or not it's implicitly specified here.
Jason Merrill's avatar
Jason Merrill committed

# Double entries in build_configdirs, configdirs, or target_configdirs may
# cause circular dependencies and break everything horribly.
Jason Merrill's avatar
Jason Merrill committed

# these library is used by various programs built for the build
# environment
#
build_libs="build-libiberty build-libcpp"

# these tools are built for the build environment
build_tools="build-texinfo build-flex build-bison build-m4 build-fixincludes"
Jason Merrill's avatar
Jason Merrill committed
# these libraries are used by various programs built for the host environment
host_libs="gettext libiberty opcodes bfd readline tcl tk itcl libgui zlib libbacktrace libcpp libcody libdecnumber gmp mpfr mpc isl libiconv libctf libsframe libgrust "
Jason Merrill's avatar
Jason Merrill committed

# these tools are built for the host environment
# Note, the powerpc-eabi build depends on sim occurring before gdb in order to
# know that we are building the simulator.
# binutils, gas and ld appear in that order because it makes sense to run
# "make check" in that particular order.
# If --enable-gold is used, "gold" may replace "ld".
host_tools="texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gdbserver gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1 gm2tools gotools c++tools"
Jason Merrill's avatar
Jason Merrill committed
# these libraries are built for the target environment, and are built after
# the host libraries and the host tools (which may be a cross compiler)
target_libraries="target-libgcc \
Ian Lance Taylor's avatar
Ian Lance Taylor committed
		target-libbacktrace \
		target-libgloss \
		target-newlib \
		target-libatomic \
		target-libitm \
		target-libsanitizer \
		target-libvtv \
		target-libssp \
		target-libgfortran \
Arnaud Charlet's avatar
Arnaud Charlet committed
		target-libobjc \
		target-libgm2 \
		target-libphobos \
		target-zlib"
Jason Merrill's avatar
Jason Merrill committed

# these tools are built using the target libraries, and are intended to
# run only in the target environment
Jason Merrill's avatar
Jason Merrill committed
#
# note: any program that *uses* libraries that are in the "target_libraries"
# list belongs in this list.
Jason Merrill's avatar
Jason Merrill committed
#
target_tools="target-rda"
Jason Merrill's avatar
Jason Merrill committed

################################################################################

## All tools belong in one of the four categories, and are assigned above
## We assign ${configdirs} this way to remove all embedded newlines.  This
## is important because configure will choke if they ever get through.
## ${configdirs} is directories we build using the host tools.
## ${target_configdirs} is directories we build using the target tools.
configdirs=`echo ${host_libs} ${host_tools}`
target_configdirs=`echo ${target_libraries} ${target_tools}`
build_configdirs=`echo ${build_libs} ${build_tools}`
Nathanael Nerode's avatar
Nathanael Nerode committed

[case $srcdir in
  *" "*)
m4_pushdef([AS_MESSAGE_LOG_FD], [])dnl
    AC_MSG_ERROR([path to source, $srcdir, contains spaces])
m4_popdef([AS_MESSAGE_LOG_FD])dnl
    ;;
esac
ac_subdirs_all=`cd $srcdir && echo */configure | sed 's,/configure,,g'`
Jason Merrill's avatar
Jason Merrill committed
################################################################################

srcname="gnu development package"

# This gets set non-empty for some net releases of packages.
appdirs=""

# Define is_cross_compiler to save on calls to 'test'.
is_cross_compiler=
if test x"${host}" = x"${target}" ; then
  is_cross_compiler=no
else
  is_cross_compiler=yes
fi	

# Find the build and target subdir names.
Nathanael Nerode's avatar
Nathanael Nerode committed
GCC_TOPLEV_SUBDIRS
# Be sure to cover against remnants of an in-tree build.
if test $srcdir != .  && test -d $srcdir/host-${host_noncanonical}; then
  AC_MSG_ERROR([building out of tree but $srcdir contains host-${host_noncanonical}.
Use a pristine source tree when building in a separate tree])
fi
# Skipdirs are removed silently.
skipdirs=
# Noconfigdirs are removed loudly.
noconfigdirs=""
Jason Merrill's avatar
Jason Merrill committed

use_gnu_ld=
# Make sure we don't let GNU ld be added if we didn't want it.
if test x$with_gnu_ld = xno ; then
  use_gnu_ld=no
  noconfigdirs="$noconfigdirs ld gold"
Jason Merrill's avatar
Jason Merrill committed
fi

use_gnu_as=
# Make sure we don't let GNU as be added if we didn't want it.
if test x$with_gnu_as = xno ; then
  use_gnu_as=no
  noconfigdirs="$noconfigdirs gas"
Jason Merrill's avatar
Jason Merrill committed
fi

use_included_zlib=
AC_ARG_WITH(system-zlib,
[AS_HELP_STRING([--with-system-zlib], [use installed libz])])
# Make sure we don't let ZLIB be added if we didn't want it.
if test x$with_system_zlib = xyes ; then
  use_included_zlib=no
  noconfigdirs="$noconfigdirs zlib"
fi

# Don't compile the bundled readline/libreadline.a if --with-system-readline
# is provided.
if test x$with_system_readline = xyes ; then
  noconfigdirs="$noconfigdirs readline"
fi

AC_ARG_WITH(zstd,
[AS_HELP_STRING([--with-zstd], [Support zstd compressed debug sections (default=auto)])])

# some tools are so dependent upon X11 that if we're not building with X, 
# it's not even worth trying to configure, much less build, that tool.
Jason Merrill's avatar
Jason Merrill committed

case ${with_x} in
  yes | "") ;; # the default value for this tree is that X11 is available
    skipdirs="${skipdirs} tk itcl libgui"
    # We won't be able to build gdbtk without X.
    enable_gdbtk=no 
    ;;
  *)  echo "*** bad value \"${with_x}\" for -with-x flag; ignored" 1>&2 ;;
esac
Jason Merrill's avatar
Jason Merrill committed

# Some are only suitable for cross toolchains.
# Remove these if host=target.
cross_only="target-libgloss target-newlib target-opcodes"
Jason Merrill's avatar
Jason Merrill committed

case $is_cross_compiler in
  no) skipdirs="${skipdirs} ${cross_only}" ;;
esac
Jason Merrill's avatar
Jason Merrill committed

# If both --with-headers and --with-libs are specified, default to
# --without-newlib.
if test x"${with_headers}" != x && test x"${with_headers}" != xno \
   && test x"${with_libs}" != x && test x"${with_libs}" != xno ; then
  if test x"${with_newlib}" = x ; then
    with_newlib=no
  fi
fi

# Recognize --with-newlib/--without-newlib.
case ${with_newlib} in
  no) skipdirs="${skipdirs} target-newlib" ;;
  yes) skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'` ;;
esac

AC_ARG_ENABLE(as-accelerator-for,
[AS_HELP_STRING([--enable-as-accelerator-for=ARG],
		[build as offload target compiler.
		Specify offload host triple by ARG])])

AC_ARG_ENABLE(offload-targets,
[AS_HELP_STRING([--enable-offload-targets=LIST],
		[enable offloading to devices from comma-separated LIST of
		TARGET[=DIR]. Use optional path to find offload target compiler
		during the build])],
[
  if test x"$enable_offload_targets" = x; then
    AC_MSG_ERROR([no offload targets specified])
  fi
], [enable_offload_targets=])

AC_ARG_ENABLE(offload-defaulted,
[AS_HELP_STRING([--enable-offload-defaulted]
		[If enabled, configured but not installed offload compilers and
		libgomp plugins are silently ignored.  Useful for distribution
		compilers where those are in separate optional packages.])],
[enable_offload_defaulted=$enableval],
[enable_offload_defaulted=])

# Handle --enable-gold, --enable-ld.
# --disable-gold [--enable-ld]
#     Build only ld.  Default option.
H.J. Lu's avatar
H.J. Lu committed
# --enable-gold [--enable-ld]
#     Build both gold and ld.  Install gold as "ld.gold", install ld
#     as "ld.bfd" and "ld".
# --enable-gold=default [--enable-ld]
#     Build both gold and ld.  Install gold as "ld.gold" and "ld",
#     install ld as "ld.bfd".
# --enable-gold[=default] --disable-ld
#     Build only gold, which is then installed as both "ld.gold" and "ld".
# --enable-gold --enable-ld=default
H.J. Lu's avatar
H.J. Lu committed
#     Build both gold (installed as "ld.gold") and ld (installed as "ld"
#     and ld.bfd).
#     In other words, ld is default
# --enable-gold=default --enable-ld=default
#     Error.

default_ld=
AC_ARG_ENABLE(gold,
[AS_HELP_STRING([[--enable-gold[=ARG]]],
		[build gold @<:@ARG={default,yes,no}@:>@])],
ENABLE_GOLD=$enableval,
ENABLE_GOLD=no)
    # Check for ELF target.
    is_elf=no
    case "${target}" in
      *-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
      | *-*-linux* | *-*-gnu* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
      | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* \
      | *-*-solaris2* | *-*-nto* | *-*-nacl* | *-*-haiku*)
        case "${target}" in
          *-*-linux*aout* | *-*-linux*oldld*)
            ;;
          *)
            is_elf=yes
            ;;
        esac
    esac

    if test "$is_elf" = "yes"; then
      # Check for target supported by gold.
      case "${target}" in
        i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-* \
        | aarch64*-*-* | tilegx*-*-* | mips*-*-* | s390*-*-*)
	  configdirs="$configdirs gold"
	  if test x${ENABLE_GOLD} = xdefault; then
	    default_ld=gold
	  fi
[AS_HELP_STRING([[--enable-ld[=ARG]]],
		[build ld @<:@ARG={default,yes,no}@:>@])],
ENABLE_LD=$enableval,
ENABLE_LD=yes)

case "${ENABLE_LD}" in
  default)
H.J. Lu's avatar
H.J. Lu committed
    if test x${default_ld} != x; then
      AC_MSG_ERROR([either gold or ld can be the default ld])
    fi
    ;;
  yes)
    ;;
  no)
    if test x${ENABLE_GOLD} != xyes; then
      AC_MSG_WARN([neither ld nor gold are enabled])
    fi
    configdirs=`echo " ${configdirs} " | sed -e 's/ ld / /'`
    ;;
  *)
    AC_MSG_ERROR([invalid --enable-ld argument])
    ;;
esac
AC_ARG_ENABLE(gprofng,
[AS_HELP_STRING([[--disable-gprofng]], [do not build gprofng])],
enable_gprofng=$enableval,
enable_gprofng=yes)
if test "$enable_gprofng" = "yes"; then
  case "${target}" in
    *-musl*)
      ;;
    x86_64-*-linux* | i?86-*-linux* | aarch64-*-linux* | riscv64-*-linux*)
    configdirs="$configdirs gprofng"
    ;;
  esac
fi


# PR gas/19109
# Decide the default method for compressing debug sections.
# Provide a configure time option to override our default.
AC_ARG_ENABLE(compressed_debug_sections,
[AS_HELP_STRING([--enable-compressed-debug-sections={all,gas,gold,ld,none}],
		[Enable compressed debug sections for gas, gold or ld by
		 default])],
[
  if test x"$enable_compressed_debug_sections" = xyes; then
    AC_MSG_ERROR([no program with compressed debug sections specified])
  fi
], [enable_compressed_debug_sections=])

# Select default compression algorithm.
AC_ARG_ENABLE(default_compressed_debug_sections_algorithm,
[AS_HELP_STRING([--enable-default-compressed-debug-sections-algorithm={zlib,zstd}],
		[Default compression algorithm for --enable-compressed-debug-sections.])],
[], [default_compressed_debug_sections_algorithm=])

Jason Merrill's avatar
Jason Merrill committed
# Configure extra directories which are host specific

case "${host}" in
    configdirs="$configdirs libtermcap" ;;
Jason Merrill's avatar
Jason Merrill committed
esac

# A target can indicate whether a language isn't supported for some reason.
# Only spaces may be used in this macro; not newlines or tabs.
unsupported_languages=

Jason Merrill's avatar
Jason Merrill committed
# Remove more programs from consideration, based on the host or 
# target this usually means that a port of the program doesn't
# exist yet.

case "${host}" in
  i[[3456789]]86-*-msdosdjgpp*)
    noconfigdirs="$noconfigdirs tcl tk itcl"
Jason Merrill's avatar
Jason Merrill committed
esac

# Default to --disable-year2038 until we can handle differences between
# projects that use gnulib (which understands year 2038) and projects that
# do not (like BFD).
AC_ARG_ENABLE(year2038,
AS_HELP_STRING([--enable-year2038],
  [enable support for timestamps past the year 2038]),
ENABLE_YEAR2038=$enableval,
ENABLE_YEAR2038=no)
enable_year2038=
if test "${ENABLE_YEAR2038}" = "no" ; then
  enable_year2038=no
fi
AC_ARG_ENABLE(libquadmath,
AS_HELP_STRING([--disable-libquadmath],
  [do not build libquadmath directory]),
ENABLE_LIBQUADMATH=$enableval,
ENABLE_LIBQUADMATH=yes)
if test "${ENABLE_LIBQUADMATH}" = "no" ; then
  noconfigdirs="$noconfigdirs target-libquadmath"
fi


AC_ARG_ENABLE(libquadmath-support,
AS_HELP_STRING([--disable-libquadmath-support],
  [disable libquadmath support for Fortran]),
ENABLE_LIBQUADMATH_SUPPORT=$enableval,
ENABLE_LIBQUADMATH_SUPPORT=yes)
enable_libquadmath_support=
if test "${ENABLE_LIBQUADMATH_SUPPORT}" = "no" ; then
  enable_libquadmath_support=no
fi


Arnaud Charlet's avatar
Arnaud Charlet committed
AC_ARG_ENABLE(libada,
[AS_HELP_STRING([--enable-libada], [build libada directory])],
Arnaud Charlet's avatar
Arnaud Charlet committed
ENABLE_LIBADA=$enableval,
ENABLE_LIBADA=yes)
if test "${ENABLE_LIBADA}" != "yes" ; then
Nathanael Nerode's avatar
Nathanael Nerode committed
  noconfigdirs="$noconfigdirs gnattools"
AC_ARG_ENABLE(libgm2,
[AS_HELP_STRING([--enable-libgm2], [build libgm2 directory])],
ENABLE_LIBGM2=$enableval,
ENABLE_LIBGM2=no)
if test "${ENABLE_LIBGM2}" != "yes" ; then
  noconfigdirs="$noconfigdirs gm2tools"
fi

[AS_HELP_STRING([--enable-libssp], [build libssp directory])],
ENABLE_LIBSSP=$enableval,
ENABLE_LIBSSP=yes)

AC_ARG_ENABLE(libstdcxx,
AS_HELP_STRING([--disable-libstdcxx],
  [do not build libstdc++-v3 directory]),
ENABLE_LIBSTDCXX=$enableval,
ENABLE_LIBSTDCXX=default)
[if test "${ENABLE_LIBSTDCXX}" = "no" ; then
  noconfigdirs="$noconfigdirs target-libstdc++-v3"
# Enable libgomp by default on hosted POSIX systems, and a few others.
if test x$enable_libgomp = x ; then
Diego Novillo's avatar
Diego Novillo committed
    case "${target}" in
    *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
Diego Novillo's avatar
Diego Novillo committed
	;;
    *-*-netbsd* | *-*-freebsd* | *-*-openbsd* | *-*-dragonfly*)
Diego Novillo's avatar
Diego Novillo committed
	;;
    *-*-solaris2* | *-*-hpux11*)
Diego Novillo's avatar
Diego Novillo committed
	;;
    *-*-darwin* | *-*-aix*)
Diego Novillo's avatar
Diego Novillo committed
	;;
    nvptx*-*-* | amdgcn*-*-*)
Diego Novillo's avatar
Diego Novillo committed
    *)
	noconfigdirs="$noconfigdirs target-libgomp"
	;;
    esac
Diego Novillo's avatar
Diego Novillo committed

# Disable libatomic on unsupported systems.
if test -d ${srcdir}/libatomic; then
    if test x$enable_libatomic = x; then
	AC_MSG_CHECKING([for libatomic support])
	if (srcdir=${srcdir}/libatomic; \
		. ${srcdir}/configure.tgt; \
		test -n "$UNSUPPORTED")
	then
	    AC_MSG_RESULT([no])
	    noconfigdirs="$noconfigdirs target-libatomic"
	else
	    AC_MSG_RESULT([yes])
	fi
    fi
fi

# Disable libitm on unsupported systems.
if test -d ${srcdir}/libitm; then
    if test x$enable_libitm = x; then
	AC_MSG_CHECKING([for libitm support])
	if (srcdir=${srcdir}/libitm; \
		. ${srcdir}/configure.tgt; \
		test -n "$UNSUPPORTED")
	then
	    AC_MSG_RESULT([no])
	    noconfigdirs="$noconfigdirs target-libitm"
	else
	    AC_MSG_RESULT([yes])
	fi
    fi
# Disable libsanitizer on unsupported systems.
if test -d ${srcdir}/libsanitizer; then
    if test x$enable_libsanitizer = x; then
	AC_MSG_CHECKING([for libsanitizer support])
	if (srcdir=${srcdir}/libsanitizer; \
		. ${srcdir}/configure.tgt; \
		test -n "$UNSUPPORTED")
	then
	    AC_MSG_RESULT([no])
	    noconfigdirs="$noconfigdirs target-libsanitizer"
	else
	    AC_MSG_RESULT([yes])
	fi
    fi
fi

# Disable libvtv on unsupported systems.
if test -d ${srcdir}/libvtv; then
    if test x$enable_libvtv = x; then
	AC_MSG_CHECKING([for libvtv support])
	if (srcdir=${srcdir}/libvtv; \
		. ${srcdir}/configure.tgt; \
		test "$VTV_SUPPORTED" != "yes")
	then
	    AC_MSG_RESULT([no])
	    noconfigdirs="$noconfigdirs target-libvtv"
	else
	    AC_MSG_RESULT([yes])
	fi
    fi
fi

# Disable libquadmath for some systems.
case "${target}" in
  avr-*-*)
    noconfigdirs="$noconfigdirs target-libquadmath"
    ;;
  # libquadmath is unused on AIX and libquadmath build process use of
  # LD_LIBRARY_PATH can break AIX bootstrap.
  powerpc-*-aix* | rs6000-*-aix*)
    noconfigdirs="$noconfigdirs target-libquadmath"
    ;;
esac

# Disable libssp for some systems.
case "${target}" in
  avr-*-*)
    noconfigdirs="$noconfigdirs target-libssp"
    ;;
Jose E. Marchesi's avatar
Jose E. Marchesi committed
  bpf-*-*)
    noconfigdirs="$noconfigdirs target-libssp"
    ;;
  powerpc-*-aix* | rs6000-*-aix*)
    noconfigdirs="$noconfigdirs target-libssp"
    ;;
  pru-*-*)
    # No hosted I/O support.
    noconfigdirs="$noconfigdirs target-libssp"
    ;;
DJ Delorie's avatar
.  
DJ Delorie committed
  rl78-*-*)
    # libssp uses a misaligned load to trigger a fault, but the RL78
    # doesn't fault for those - instead, it gives a build-time error
    # for explicit misaligned loads.
    noconfigdirs="$noconfigdirs target-libssp"
    ;;
  visium-*-*)
    # No hosted I/O support.
    noconfigdirs="$noconfigdirs target-libssp"
    ;;
esac

# Disable libstdc++-v3 for some systems.
# Allow user to override this if they pass --enable-libstdcxx
if test "${ENABLE_LIBSTDCXX}" = "default" ; then
  case "${target}" in
    *-*-vxworks*)
      # VxWorks uses the Dinkumware C++ library.
      noconfigdirs="$noconfigdirs target-libstdc++-v3"
      ;;
    amdgcn*-*-*)
      # Not ported/fails to build when using newlib.
      noconfigdirs="$noconfigdirs target-libstdc++-v3"
      ;;
    arm*-wince-pe*)
      # the C++ libraries don't build on top of CE's C libraries
      noconfigdirs="$noconfigdirs target-libstdc++-v3"
      ;;
    avr-*-*)
      noconfigdirs="$noconfigdirs target-libstdc++-v3"
      ;;
Jose E. Marchesi's avatar
Jose E. Marchesi committed
    bpf-*-*)
      noconfigdirs="$noconfigdirs target-libstdc++-v3"
      ;;
    ft32-*-*)
      noconfigdirs="$noconfigdirs target-libstdc++-v3"
      ;;
# Disable Ada/GNAT on systems where it is known to not work.
# For testing, you can override this with --enable-languages=ada.
case ,${enable_languages}, in
  *,ada,*)
    ;;
  *)
      case "${target}" in
        amdgcn*-*-* \
        | nvptx*-*-* )
          unsupported_languages="$unsupported_languages ada"
          ;;
      esac
      ;;
esac

Jose E. Marchesi's avatar
Jose E. Marchesi committed
# Disable C++ on systems where it is known to not work.
# For testing, you can override this with --enable-languages=c++.
case ,${enable_languages}, in
  *,c++,*)
    ;;
  *)
      case "${target}" in
        bpf-*-*)
          unsupported_languages="$unsupported_languages c++"
          ;;
      esac
      ;;
esac

# Disable Objc on systems where it is known to not work.
# For testing, you can override this with --enable-languages=objc.
case ,${enable_languages}, in
  *,objc,*)
    ;;
  *)
      case "${target}" in
        bpf-*-*)
          unsupported_languages="$unsupported_languages objc"
          ;;
      esac
      ;;
esac

# Disable libobjc for some systems where it is known to not work.
case "${target}" in
  amdgcn*-*-*)
    noconfigdirs="$noconfigdirs target-libobjc"
    ;;
  nvptx*-*-*)
    noconfigdirs="$noconfigdirs target-libobjc"
    ;;
esac

# Disable D on systems where it is known to not work.
# For testing, you can override this with --enable-languages=d.
case ,${enable_languages}, in
  *,d,*)
    ;;
  *)
    case "${target}" in
Jose E. Marchesi's avatar
Jose E. Marchesi committed
      bpf-*-*)
	unsupported_languages="$unsupported_languages d"
	;;
    esac
    ;;
esac

# Disable libphobos on unsupported systems.
# For testing, you can override this with --enable-libphobos.
if test -d ${srcdir}/libphobos; then
    if test x$enable_libphobos = x; then
	AC_MSG_CHECKING([for libphobos support])
	if (srcdir=${srcdir}/libphobos; \
		. ${srcdir}/configure.tgt; \
		test "$LIBPHOBOS_SUPPORTED" != "yes")
	then
	    AC_MSG_RESULT([no])
	    noconfigdirs="$noconfigdirs target-libphobos"
	else
	    AC_MSG_RESULT([yes])
	fi
    fi
fi

# Disable Fortran for some systems.
case "${target}" in
  mmix-*-*)
    # See <http://gcc.gnu.org/ml/gcc-patches/2004-11/msg00572.html>.
    unsupported_languages="$unsupported_languages fortran"
    ;;
Jose E. Marchesi's avatar
Jose E. Marchesi committed
  bpf-*-*)
    unsupported_languages="$unsupported_languages fortran"
    ;;
# Disable libffi for some systems.
case "${target}" in
  powerpc-*-darwin*)
    ;;
  i[[3456789]]86-*-darwin*)
    ;;
  x86_64-*-darwin[[912]]*)
    ;;
  *-*-darwin*)
    noconfigdirs="$noconfigdirs target-libffi"
    ;;
  *-*-netware*)
    noconfigdirs="$noconfigdirs target-libffi"
    ;;
  *-*-phoenix*)
    noconfigdirs="$noconfigdirs target-libffi"
    ;;
  *-*-rtems*)
    noconfigdirs="$noconfigdirs target-libffi"
    ;;
  *-*-tpf*)
    noconfigdirs="$noconfigdirs target-libffi"
    ;;
  *-*-uclinux*)
    noconfigdirs="$noconfigdirs target-libffi"
    ;;
  *-*-vxworks*)
    noconfigdirs="$noconfigdirs target-libffi"
    ;;
  aarch64*-*-freebsd*)
    noconfigdirs="$noconfigdirs target-libffi"
    ;;
  alpha*-*-*vms*)
    noconfigdirs="$noconfigdirs target-libffi"
    ;;
  amdgcn*-*-*)
    noconfigdirs="$noconfigdirs target-libffi"
    ;;
  arm*-*-freebsd*)
    noconfigdirs="$noconfigdirs target-libffi"
    ;;
  arm-wince-pe)
    noconfigdirs="$noconfigdirs target-libffi"
    ;;
  arm*-*-symbianelf*)
    noconfigdirs="$noconfigdirs target-libffi"
    ;;
Jose E. Marchesi's avatar
Jose E. Marchesi committed
  bpf-*-*)
    noconfigdirs="$noconfigdirs target-libffi"
    ;;
  cris-*-* | crisv32-*-*)
    case "${target}" in
      *-*-linux*)
	;;
      *) # See PR46792 regarding target-libffi.
	noconfigdirs="$noconfigdirs target-libffi";;
    esac
    ;;
  hppa*64*-*-hpux*)
    noconfigdirs="$noconfigdirs target-libffi"
    ;;
  hppa*-hp-hpux11*)
    ;;
  hppa*-*-hpux*)
    noconfigdirs="$noconfigdirs target-libffi"
    ;;
  ia64*-*-*vms*)
    noconfigdirs="$noconfigdirs target-libffi"
    ;;
  i[[3456789]]86-w64-mingw*)
    noconfigdirs="$noconfigdirs target-libffi"
    ;;
  i[[3456789]]86-*-mingw*)
    noconfigdirs="$noconfigdirs target-libffi"
    ;;
  x86_64-*-mingw*)
    noconfigdirs="$noconfigdirs target-libffi"
    ;;
  mmix-*-*)
    noconfigdirs="$noconfigdirs target-libffi"
    ;;
  nvptx*-*-*)
    noconfigdirs="$noconfigdirs target-libffi"
    ;;
  powerpc-*-aix*)
    ;;
  rs6000-*-aix*)
    ;;
  ft32-*-*)
    noconfigdirs="$noconfigdirs target-libffi"
    ;;
  *-*-lynxos*)
    noconfigdirs="$noconfigdirs target-libffi"
    ;;
esac

# Disable the go frontend on systems where it is known to not work. Please keep
# this in sync with contrib/config-list.mk.
case "${target}" in
Jose E. Marchesi's avatar
Jose E. Marchesi committed
*-*-darwin* | *-*-cygwin* | *-*-mingw* | bpf-* )
    unsupported_languages="$unsupported_languages go"
    ;;
esac

# Only allow gdbserver on some systems.
if test -d ${srcdir}/gdbserver; then
    if test x$enable_gdbserver = x; then
	AC_MSG_CHECKING([for gdbserver support])
	if (srcdir=${srcdir}/gdbserver; \
		. ${srcdir}/configure.srv; \
		test -n "$UNSUPPORTED")
	then
	    AC_MSG_RESULT([no])
	    noconfigdirs="$noconfigdirs gdbserver"
	else
	    AC_MSG_RESULT([yes])
	fi
    fi
fi

# Disable libgo for some systems where it is known to not work.
# For testing, you can easily override this with --enable-libgo.
if test x$enable_libgo = x; then
    case "${target}" in
    *-*-darwin*)
	# PR 46986
	noconfigdirs="$noconfigdirs target-libgo"
	;;
    *-*-cygwin* | *-*-mingw*)
	noconfigdirs="$noconfigdirs target-libgo"
	;;
    amdgcn*-*-*)
	noconfigdirs="$noconfigdirs target-libgo"
	;;
Jose E. Marchesi's avatar
Jose E. Marchesi committed
    bpf-*-*)
        noconfigdirs="$noconfigdirs target-libgo"
        ;;
    nvptx*-*-*)
	noconfigdirs="$noconfigdirs target-libgo"
	;;
# Default libgloss CPU subdirectory.
libgloss_dir="$target_cpu"
case "${target}" in
  sh*-*-pe|mips*-*-pe|*arm-wince-pe)
    libgloss_dir=wince
    ;;
  aarch64*-*-* )
    libgloss_dir=aarch64
    ;;
  arm*-*-*)
    libgloss_dir=arm
    ;;
  cris-*-* | crisv32-*-*)
    libgloss_dir=cris
    ;;
  kvx-*-elf)
    libgloss_dir=kvx-elf
    ;;
  kvx-*-mbr)
    libgloss_dir=kvx-mbr
    ;;
  kvx-*-cos)
    libgloss_dir=kvx-cos
    ;;
  hppa*-*-*)
    libgloss_dir=pa
    ;;
  i[[3456789]]86-*-*)
    libgloss_dir=i386
    ;;
  loongarch*-*-*)
    libgloss_dir=loongarch
    ;;
  m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)
    libgloss_dir=m68hc11
    ;;
  m68*-*-* | fido-*-*)
    libgloss_dir=m68k
    ;;
  mips*-*-*)
    libgloss_dir=mips
    ;;
  powerpc*-*-*)
    libgloss_dir=rs6000
    ;;
  pru-*-*)
    libgloss_dir=pru
    ;;
# Disable newlib and libgloss for various target OSes.
Jason Merrill's avatar
Jason Merrill committed
case "${target}" in
  alpha*-dec-osf*)
    noconfigdirs="$noconfigdirs target-newlib target-libgloss"
    ;;
  i[[3456789]]86-*-linux*)
    # This section makes it possible to build newlib natively on linux.
    # If we are using a cross compiler then don't configure newlib.
    if test x${is_cross_compiler} != xno ; then
      noconfigdirs="$noconfigdirs target-newlib"
    fi
    noconfigdirs="$noconfigdirs target-libgloss"
    # If we are not using a cross compiler, do configure newlib.
    # Note however, that newlib will only be configured in this situation
    # if the --with-newlib option has been given, because otherwise
    # 'target-newlib' will appear in skipdirs.
    ;;
  i[[3456789]]86-*-rdos*)
    noconfigdirs="$noconfigdirs target-newlib target-libgloss"
    ;;
  sh*-*-pe|mips*-*-pe|arm-wince-pe)
    noconfigdirs="$noconfigdirs target-newlib target-libgloss"
    ;;
  sparc-*-sunos4*)
    noconfigdirs="$noconfigdirs target-newlib target-libgloss"
    ;;
Jose E. Marchesi's avatar
Jose E. Marchesi committed
  bpf-*-*)
    noconfigdirs="$noconfigdirs target-newlib target-libgloss"
    ;;