Skip to content
Snippets Groups Projects
configure.ac 115 KiB
Newer Older
  arm-*-darwin*)
    noconfigdirs="$noconfigdirs ld gas gdb gprof"
    noconfigdirs="$noconfigdirs sim target-rda"
    ;;
    noconfigdirs="$noconfigdirs ld gas gdb gprof"
    noconfigdirs="$noconfigdirs sim target-rda"
  i[[3456789]]86-*-darwin*)
    noconfigdirs="$noconfigdirs ld gprof"
    noconfigdirs="$noconfigdirs sim target-rda"
    ;;
  x86_64-*-darwin[[912]]*)
    noconfigdirs="$noconfigdirs ld gas gprof"
    noconfigdirs="$noconfigdirs sim target-rda"
    ;;
  *-*-darwin*)
    noconfigdirs="$noconfigdirs ld gas gdb gprof"
    noconfigdirs="$noconfigdirs sim target-rda"
    ;;
    if test "x$with_gmp" = x && test "x$with_gmp_dir" = x \
	&& ! test -d ${srcdir}/gmp \
	&& test -f /usr/local/include/gmp.h; then
      with_gmp=/usr/local
    fi
    ;;
  *-*-kaos*)
    # Remove unsupported stuff on all kaOS configurations.
    noconfigdirs="$noconfigdirs target-libgloss"
    ;;
  *-*-netbsd*)
    ;;
Jason Merrill's avatar
Jason Merrill committed
    ;;
  *-*-phoenix*)
    noconfigdirs="$noconfigdirs target-libgloss"
    ;;
    # The tpf target doesn't support gdb yet.
  *-*-tpf*)
    noconfigdirs="$noconfigdirs gdb tcl tk libgui itcl"
    noconfigdirs="$noconfigdirs target-rda"
Jason Merrill's avatar
Jason Merrill committed
  *-*-vxworks*)
    ;;
Richard Henderson's avatar
Richard Henderson committed
  alpha*-dec-osf*)
    # ld works, but does not support shared libraries.
Jason Merrill's avatar
Jason Merrill committed
    # gas doesn't generate exception information.
    noconfigdirs="$noconfigdirs gas ld"
Jason Merrill's avatar
Jason Merrill committed
    ;;
  alpha*-*-*vms*)
    noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss"
Jason Merrill's avatar
Jason Merrill committed
    ;;
  alpha*-*-*)
    # newlib is not 64 bit ready
    noconfigdirs="$noconfigdirs target-newlib target-libgloss"
Jason Merrill's avatar
Jason Merrill committed
    ;;
Jose E. Marchesi's avatar
Jose E. Marchesi committed
  bpf-*-*)
    noconfigdirs="$noconfigdirs target-libobjc target-libbacktrace"
    ;;
  sh*-*-pe|mips*-*-pe|*arm-wince-pe)
    noconfigdirs="$noconfigdirs tcl tk itcl libgui sim"
  arc*-*-*)
    noconfigdirs="$noconfigdirs sim"
    ;;
Jason Merrill's avatar
Jason Merrill committed
  arm-*-pe*)
Jason Merrill's avatar
Jason Merrill committed
    ;;
  arm-*-riscix*)
    noconfigdirs="$noconfigdirs ld target-libgloss"
  avr-*-*)
    if test x${with_avrlibc} != xno; then
      noconfigdirs="$noconfigdirs target-newlib target-libgloss"
    fi
    ;;
  c4x-*-* | tic4x-*-*)
    noconfigdirs="$noconfigdirs target-libgloss"
  tic54x-*-*)
    noconfigdirs="$noconfigdirs target-libgloss gdb"
Jason Merrill's avatar
Jason Merrill committed
  d10v-*-*)
    noconfigdirs="$noconfigdirs target-libgloss"
Jason Merrill's avatar
Jason Merrill committed
    ;;
  d30v-*-*)
    noconfigdirs="$noconfigdirs gdb"
Jason Merrill's avatar
Jason Merrill committed
    ;;
Nick Clifton's avatar
Nick Clifton committed
  fr30-*-elf*)
Nick Clifton's avatar
Nick Clifton committed
    ;;
  ft32-*-*)
    noconfigdirs="$noconfigdirs target-rda gprof"
    ;;
  moxie-*-*)
    noconfigdirs="$noconfigdirs"
  h8300*-*-*)
Jason Merrill's avatar
Jason Merrill committed
  h8500-*-*)
    noconfigdirs="$noconfigdirs target-libgloss"
Jason Merrill's avatar
Jason Merrill committed
    ;;
  hppa*64*-*-hpux*)
    noconfigdirs="$noconfigdirs gdb"
    ;;
  hppa*-*-hpux11*)
    noconfigdirs="$noconfigdirs gdb ld"
    ;;
  hppa*64*-*-linux*)
Jason Merrill's avatar
Jason Merrill committed
  hppa*-*-*elf* | \
  hppa*-*-openbsd* | \
Jason Merrill's avatar
Jason Merrill committed
    ;;
Jason Merrill's avatar
Jason Merrill committed
  hppa*-*-*)
Jason Merrill's avatar
Jason Merrill committed
    ;;
    noconfigdirs="$noconfigdirs gdb"
Jason Merrill's avatar
Jason Merrill committed
  ia64*-*-elf*)
    # No gdb support yet.
    noconfigdirs="$noconfigdirs readline libgui itcl gdb"
Jason Merrill's avatar
Jason Merrill committed
    ;;
  ia64*-**-hpux*)
    noconfigdirs="$noconfigdirs gdb libgui itcl ld"
    # No ld support yet.
    noconfigdirs="$noconfigdirs libgui itcl ld"
  i[[3456789]]86-w64-mingw*)
    ;;
  i[[3456789]]86-*-mingw*)
    target_configdirs="$target_configdirs target-winsup"
Jason Merrill's avatar
Jason Merrill committed
  *-*-cygwin*)
    target_configdirs="$target_configdirs target-libtermcap target-winsup"
    noconfigdirs="$noconfigdirs target-libgloss"
    # always build newlib if winsup directory is present.
    if test -d "$srcdir/winsup/cygwin"; then
      skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
    elif test -d "$srcdir/newlib"; then
      echo "Warning: winsup/cygwin is missing so newlib can't be built."
  i[[3456789]]86-*-pe)
    noconfigdirs="$noconfigdirs target-libgloss"
Jason Merrill's avatar
Jason Merrill committed
    ;;
  i[[3456789]]86-*-sco3.2v5*)
Jason Merrill's avatar
Jason Merrill committed
    # The linker does not yet know about weak symbols in COFF,
    # and is not configured to handle mixed ELF and COFF.
    noconfigdirs="$noconfigdirs ld target-libgloss"
Jason Merrill's avatar
Jason Merrill committed
    ;;
  i[[3456789]]86-*-sco*)
    noconfigdirs="$noconfigdirs gprof target-libgloss"
Jason Merrill's avatar
Jason Merrill committed
    ;;
  i[[3456789]]86-*-solaris2* | x86_64-*-solaris2.1[[0-9]]*)
    noconfigdirs="$noconfigdirs target-libgloss"
Jason Merrill's avatar
Jason Merrill committed
    ;;
  i[[3456789]]86-*-sysv4*)
    noconfigdirs="$noconfigdirs target-libgloss"
Jason Merrill's avatar
Jason Merrill committed
    ;;
  i[[3456789]]86-*-beos*)
    noconfigdirs="$noconfigdirs gdb"
Paolo Bonzini's avatar
Paolo Bonzini committed
  i[[3456789]]86-*-rdos*)
    noconfigdirs="$noconfigdirs gdb"
    noconfigdirs="$noconfigdirs sim"
    ;;
  nfp-*-*)
    noconfigdirs="$noconfigdirs ld gas gdb gprof sim"
    noconfigdirs="$noconfigdirs $target_libraries"
    ;;
  pdp11-*-*)
    noconfigdirs="$noconfigdirs gdb gprof"
    ;;
Jason Merrill's avatar
Jason Merrill committed
  powerpc-*-aix*)
    # copied from rs6000-*-* entry
    noconfigdirs="$noconfigdirs gprof"
Jason Merrill's avatar
Jason Merrill committed
    ;;
  powerpc*-*-winnt* | powerpc*-*-pe*)
Jason Merrill's avatar
Jason Merrill committed
    target_configdirs="$target_configdirs target-winsup"
    noconfigdirs="$noconfigdirs gdb tcl tk target-libgloss itcl"
Jason Merrill's avatar
Jason Merrill committed
    # always build newlib.
    skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
    ;;
    # This is temporary until we can link against shared libraries
  powerpcle-*-solaris*)
    noconfigdirs="$noconfigdirs gdb sim tcl tk itcl"
Jason Merrill's avatar
Jason Merrill committed
    ;;
    noconfigdirs="$noconfigdirs gdb"
Jason Merrill's avatar
Jason Merrill committed
    ;;
Jason Merrill's avatar
Jason Merrill committed
  rs6000-*-lynxos*)
    noconfigdirs="$noconfigdirs gprof"
Jason Merrill's avatar
Jason Merrill committed
    ;;
  rs6000-*-aix*)
    noconfigdirs="$noconfigdirs gprof"
Jason Merrill's avatar
Jason Merrill committed
    ;;
  rs6000-*-*)
Jason Merrill's avatar
Jason Merrill committed
    ;;
  m68k-apollo-*)
    noconfigdirs="$noconfigdirs ld binutils gprof target-libgloss"
Jason Merrill's avatar
Jason Merrill committed
    ;;
  microblaze*)
  mips*-sde-elf* | mips*-mti-elf* | mips*-img-elf*)
    if test x$with_newlib = xyes; then
      noconfigdirs="$noconfigdirs gprof"
    fi
    ;;
Jason Merrill's avatar
Jason Merrill committed
  mips*-*-irix5*)
    noconfigdirs="$noconfigdirs gprof target-libgloss"
Jason Merrill's avatar
Jason Merrill committed
    ;;
  mips*-*-irix6*)
    noconfigdirs="$noconfigdirs gprof target-libgloss"
Jason Merrill's avatar
Jason Merrill committed
    ;;
  mips*-*-bsd*)
    noconfigdirs="$noconfigdirs ld gas gprof target-libgloss"
Jason Merrill's avatar
Jason Merrill committed
    ;;
  mips*-*-ultrix* | mips*-*-osf* | mips*-*-ecoff* | mips*-*-pe* \
  | mips*-*-irix* | mips*-*-lnews* | mips*-*-riscos*)
    noconfigdirs="$noconfigdirs ld gas gprof"
    ;;
Jason Merrill's avatar
Jason Merrill committed
  mips*-*-*)
Jason Merrill's avatar
Jason Merrill committed
    ;;
Bernd Schmidt's avatar
Bernd Schmidt committed
  nvptx*-*-*)
    noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc"
    ;;
    case "${target}" in
      sh*-*-elf)
Jason Merrill's avatar
Jason Merrill committed
    ;;
  sparc-*-sunos4*)
    if test x${is_cross_compiler} = xno ; then
Jason Merrill's avatar
Jason Merrill committed
           use_gnu_ld=no
    fi
    ;;
  tic6x-*-*)
    noconfigdirs="$noconfigdirs sim"
Walter Lee's avatar
Walter Lee committed
  tilepro*-*-* | tilegx*-*-*)
    noconfigdirs="$noconfigdirs sim"
    ;;
Jason Merrill's avatar
Jason Merrill committed
  v810-*-*)
    noconfigdirs="$noconfigdirs bfd binutils gas gdb ld opcodes target-libgloss"
Jason Merrill's avatar
Jason Merrill committed
    ;;
  vax-*-*)
    noconfigdirs="$noconfigdirs target-newlib target-libgloss"
Jason Merrill's avatar
Jason Merrill committed
    ;;
  wasm32-*-*)
    noconfigdirs="$noconfigdirs ld"
    ;;
Jason Merrill's avatar
Jason Merrill committed
esac

# If we aren't building newlib, then don't build libgloss, since libgloss
# depends upon some newlib header files.
case "${noconfigdirs}" in
  *target-libgloss*) ;;
  *target-newlib*) noconfigdirs="$noconfigdirs target-libgloss" ;;
Jason Merrill's avatar
Jason Merrill committed

# Work in distributions that contain no compiler tools, like Autoconf.
host_makefile_frag=/dev/null
if test -d ${srcdir}/config ; then
case "${host}" in
  i[[3456789]]86-*-msdosdjgpp*)
    host_makefile_frag="config/mh-djgpp"
    ;;
  *-cygwin*)
    host_makefile_frag="config/mh-cygwin"
    ;;
    host_makefile_frag="config/mh-mingw"
    host_makefile_frag="config/mh-alpha-linux"
    ;;
  hppa*-hp-hpux10*)
    host_makefile_frag="config/mh-pa-hpux10"
    host_makefile_frag="config/mh-pa"
    ;;
  hppa*-*)	
    host_makefile_frag="config/mh-pa"
    ;;
  i?86-*-darwin[[89]]* | i?86-*-darwin1[[0-7]]* | powerpc*-*-darwin*)
    host_makefile_frag="config/mh-darwin"
  powerpc-*-aix*)
    host_makefile_frag="config/mh-ppc-aix"
    ;;
  rs6000-*-aix*)
    host_makefile_frag="config/mh-ppc-aix"
    ;;
Paolo Bonzini's avatar
Paolo Bonzini committed
if test "${build}" != "${host}" ; then
  AR_FOR_BUILD=${AR_FOR_BUILD-ar}
  AS_FOR_BUILD=${AS_FOR_BUILD-as}
Paolo Bonzini's avatar
Paolo Bonzini committed
  CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
  CPP_FOR_BUILD="${CPP_FOR_BUILD-\$(CPP)}"
  CXX_FOR_BUILD=${CXX_FOR_BUILD-g++}
  DSYMUTIL_FOR_BUILD=${DSYMUTIL_FOR_BUILD-dsymutil}
  GFORTRAN_FOR_BUILD=${GFORTRAN_FOR_BUILD-gfortran}
  GOC_FOR_BUILD=${GOC_FOR_BUILD-gccgo}
  GDC_FOR_BUILD=${GDC_FOR_BUILD-gdc}
  DLLTOOL_FOR_BUILD=${DLLTOOL_FOR_BUILD-dlltool}
  LD_FOR_BUILD=${LD_FOR_BUILD-ld}
  NM_FOR_BUILD=${NM_FOR_BUILD-nm}
  RANLIB_FOR_BUILD=${RANLIB_FOR_BUILD-ranlib}
  WINDRES_FOR_BUILD=${WINDRES_FOR_BUILD-windres}
  WINDMC_FOR_BUILD=${WINDMC_FOR_BUILD-windmc}
Paolo Bonzini's avatar
Paolo Bonzini committed
else
  AR_FOR_BUILD="\$(AR)"
  AS_FOR_BUILD="\$(AS)"
Paolo Bonzini's avatar
Paolo Bonzini committed
  CC_FOR_BUILD="\$(CC)"
  GFORTRAN_FOR_BUILD="\$(GFORTRAN)"
  GOC_FOR_BUILD="\$(GOC)"
  GDC_FOR_BUILD="\$(GDC)"
  DLLTOOL_FOR_BUILD="\$(DLLTOOL)"
  LD_FOR_BUILD="\$(LD)"
  NM_FOR_BUILD="\$(NM)"
  RANLIB_FOR_BUILD="\$(RANLIB)"
  WINDRES_FOR_BUILD="\$(WINDRES)"
  WINDMC_FOR_BUILD="\$(WINDMC)"
Paolo Bonzini's avatar
Paolo Bonzini committed

AC_PROG_CXX

# We must set the default linker to the linker used by gcc for the correct
# operation of libtool.  If LD is not defined and we are using gcc, try to
# set the LD default to the ld used by gcc.
if test -z "$LD"; then
  if test "$GCC" = yes; then
    case $build in
    *-*-mingw*)
      gcc_prog_ld=`$CC -print-prog-name=ld 2>&1 | tr -d '\015'` ;;
    *)
      gcc_prog_ld=`$CC -print-prog-name=ld 2>&1` ;;
    esac
    case $gcc_prog_ld in
    # Accept absolute paths.
    [[\\/]* | [A-Za-z]:[\\/]*)]
      LD="$gcc_prog_ld" ;;
    esac
  fi
Paolo Bonzini's avatar
Paolo Bonzini committed
fi

# Check whether -static-libstdc++ -static-libgcc is supported.
have_static_libs=no
if test "$GCC" = yes; then
  saved_LDFLAGS="$LDFLAGS"

  LDFLAGS="$LDFLAGS -static-libstdc++ -static-libgcc"
  AC_MSG_CHECKING([whether g++ accepts -static-libstdc++ -static-libgcc])
  AC_LANG_PUSH(C++)
  AC_LINK_IFELSE([AC_LANG_SOURCE([
#if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
#error -static-libstdc++ not implemented
#endif
    [AC_MSG_RESULT([yes]); have_static_libs=yes],
    [AC_MSG_RESULT([no])])
  AC_LANG_POP(C++)

  LDFLAGS="$saved_LDFLAGS"
fi

Paolo Bonzini's avatar
Paolo Bonzini committed
ACX_PROG_GNAT
ACX_PROG_CMP_IGNORE_INITIAL
Paolo Bonzini's avatar
Paolo Bonzini committed

AC_ARG_ENABLE([bootstrap],
[AS_HELP_STRING([--enable-bootstrap],
		[enable bootstrapping @<:@yes if native build@:>@])],,
enable_bootstrap=default)

# Issue errors and warnings for invalid/strange bootstrap combinations.
if test -r $srcdir/gcc/configure; then
  have_compiler=yes
else
  have_compiler=no
fi

case "$have_compiler:$host:$target:$enable_bootstrap" in
  *:*:*:no) ;;

  # Default behavior.  Enable bootstrap if we have a compiler
  # and we are in a native configuration.
  yes:$build:$build:default)
    enable_bootstrap=yes ;;

  *:*:*:default)
    enable_bootstrap=no ;;

  # We have a compiler and we are in a native configuration, bootstrap is ok
  yes:$build:$build:yes)
    ;;

  # Other configurations, but we have a compiler.  Assume the user knows
  # what he's doing.
  yes:*:*:yes)
    AC_MSG_WARN([trying to bootstrap a cross compiler])
    ;;

  # No compiler: if they passed --enable-bootstrap explicitly, fail
  no:*:*:yes)
    AC_MSG_ERROR([cannot bootstrap without a compiler]) ;;

  # Fail if wrong command line
  *)
    AC_MSG_ERROR([invalid option for --enable-bootstrap])
    ;;
esac

# When bootstrapping with GCC, build stage 1 in C++11 mode to ensure that a
# C++11 compiler can still start the bootstrap.  Otherwise, if building GCC,
# require C++11 (or higher).
if test "$enable_bootstrap:$GXX" = "yes:yes"; then
  CXX="$CXX -std=c++11"
elif test "$have_compiler" = yes; then
  AX_CXX_COMPILE_STDCXX(11)

  if test "${build}" != "${host}"; then
    AX_CXX_COMPILE_STDCXX(11, [], [], [_FOR_BUILD])
  fi
# Used for setting $lt_cv_objdir
_LT_CHECK_OBJDIR

# Check for GMP, MPFR and MPC
Paolo Bonzini's avatar
Paolo Bonzini committed
have_gmp=no

# Specify a location for mpc
# check for this first so it ends up on the link line before mpfr.
AC_ARG_WITH(mpc,
[AS_HELP_STRING([--with-mpc=PATH],
		[specify prefix directory for installed MPC package.
		 Equivalent to --with-mpc-include=PATH/include
		 plus --with-mpc-lib=PATH/lib])])
AC_ARG_WITH(mpc-include,
[AS_HELP_STRING([--with-mpc-include=PATH],
		[specify directory for installed MPC include files])])
AC_ARG_WITH(mpc-lib,
[AS_HELP_STRING([--with-mpc-lib=PATH],
		[specify directory for the installed MPC library])])

if test "x$with_mpc" != x; then
  gmplibs="-L$with_mpc/lib $gmplibs"
  gmpinc="-I$with_mpc/include $gmpinc"
fi
if test "x$with_mpc_include" != x; then
  gmpinc="-I$with_mpc_include $gmpinc"
fi
if test "x$with_mpc_lib" != x; then
fi
if test "x$with_mpc$with_mpc_include$with_mpc_lib" = x && test -d ${srcdir}/mpc; then
  gmplibs='-L$$r/$(HOST_SUBDIR)/mpc/src/'"$lt_cv_objdir $gmplibs"
  # Do not test the mpc version.  Assume that it is sufficient, since
  # it is in the source tree, and the library has not been built yet
  # but it would be included on the link line in the version check below
  # hence making the test fail.
Paolo Bonzini's avatar
Paolo Bonzini committed

# Specify a location for mpfr
# check for this first so it ends up on the link line before gmp.
AC_ARG_WITH(mpfr-dir,
[AS_HELP_STRING([--with-mpfr-dir=PATH], [this option has been REMOVED])],
[AC_MSG_ERROR([The --with-mpfr-dir=PATH option has been removed.
Use --with-mpfr=PATH or --with-mpfr-include=PATH plus --with-mpfr-lib=PATH])])

AC_ARG_WITH(mpfr,
[AS_HELP_STRING([--with-mpfr=PATH],
		[specify prefix directory for installed MPFR package.
		 Equivalent to --with-mpfr-include=PATH/include
		 plus --with-mpfr-lib=PATH/lib])])
AC_ARG_WITH(mpfr-include,
[AS_HELP_STRING([--with-mpfr-include=PATH],
		[specify directory for installed MPFR include files])])
AC_ARG_WITH(mpfr-lib,
[AS_HELP_STRING([--with-mpfr-lib=PATH],
		[specify directory for the installed MPFR library])])

if test "x$with_mpfr" != x; then
  gmplibs="-L$with_mpfr/lib $gmplibs"
  gmpinc="-I$with_mpfr/include $gmpinc"
if test "x$with_mpfr_include" != x; then
  gmpinc="-I$with_mpfr_include $gmpinc"
fi
if test "x$with_mpfr_lib" != x; then
  gmplibs="-L$with_mpfr_lib $gmplibs"
fi
Paolo Bonzini's avatar
Paolo Bonzini committed
if test "x$with_mpfr$with_mpfr_include$with_mpfr_lib" = x && test -d ${srcdir}/mpfr; then
  # MPFR v3.1.0 moved the sources into a src sub-directory.
  if ! test -d ${srcdir}/mpfr/src; then
    AC_MSG_ERROR([dnl
Building GCC with MPFR in the source tree is only handled for MPFR 3.1.0+.])
  fi
  gmplibs='-L$$r/$(HOST_SUBDIR)/mpfr/src/'"$lt_cv_objdir $gmplibs"
  gmpinc='-I$$r/$(HOST_SUBDIR)/mpfr/src -I$$s/mpfr/src '"$gmpinc"
  extra_mpc_mpfr_configure_flags='--with-mpfr-include=$$s/mpfr/src --with-mpfr-lib=$$r/$(HOST_SUBDIR)/mpfr/src/'"$lt_cv_objdir"
Paolo Bonzini's avatar
Paolo Bonzini committed
  # Do not test the mpfr version.  Assume that it is sufficient, since
  # it is in the source tree, and the library has not been built yet
  # but it would be included on the link line in the version check below
  # hence making the test fail.
  have_gmp=yes
fi
# Specify a location for gmp
AC_ARG_WITH(gmp-dir,
[AS_HELP_STRING([--with-gmp-dir=PATH], [this option has been REMOVED])],
[AC_MSG_ERROR([The --with-gmp-dir=PATH option has been removed.
Use --with-gmp=PATH or --with-gmp-include=PATH plus --with-gmp-lib=PATH])])

AC_ARG_WITH(gmp,
[AS_HELP_STRING([--with-gmp=PATH],
		[specify prefix directory for the installed GMP package.
		 Equivalent to --with-gmp-include=PATH/include
		 plus --with-gmp-lib=PATH/lib])])
AC_ARG_WITH(gmp-include,
[AS_HELP_STRING([--with-gmp-include=PATH],
		[specify directory for installed GMP include files])])
AC_ARG_WITH(gmp-lib,
[AS_HELP_STRING([--with-gmp-lib=PATH],
		[specify directory for the installed GMP library])])
if test "x$with_gmp" != x; then
  gmplibs="-L$with_gmp/lib $gmplibs"
  gmpinc="-I$with_gmp/include $gmpinc"
if test "x$with_gmp_include" != x; then
  gmpinc="-I$with_gmp_include $gmpinc"
fi
if test "x$with_gmp_lib" != x; then
  gmplibs="-L$with_gmp_lib $gmplibs"
fi
Paolo Bonzini's avatar
Paolo Bonzini committed
if test "x$with_gmp$with_gmp_include$with_gmp_lib" = x && test -d ${srcdir}/gmp; then
  gmplibs='-L$$r/$(HOST_SUBDIR)/gmp/'"$lt_cv_objdir $gmplibs"
Paolo Bonzini's avatar
Paolo Bonzini committed
  gmpinc='-I$$r/$(HOST_SUBDIR)/gmp -I$$s/gmp '"$gmpinc"
  extra_mpfr_configure_flags='--with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-gmp-lib=$$r/$(HOST_SUBDIR)/gmp/'"$lt_cv_objdir"
  extra_mpc_gmp_configure_flags='--with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-gmp-lib=$$r/$(HOST_SUBDIR)/gmp/'"$lt_cv_objdir"
  extra_isl_gmp_configure_flags='--with-gmp-builddir=$$r/$(HOST_SUBDIR)/gmp'
Paolo Bonzini's avatar
Paolo Bonzini committed
  # Do not test the gmp version.  Assume that it is sufficient, since
  # it is in the source tree, and the library has not been built yet
  # but it would be included on the link line in the version check below
  # hence making the test fail.
  have_gmp=yes
fi
if test -d ${srcdir}/gcc && test "x$have_gmp" = xno; then
Paolo Bonzini's avatar
Paolo Bonzini committed
  have_gmp=yes
  saved_CFLAGS="$CFLAGS"
  CFLAGS="$CFLAGS $gmpinc"
  # Check for the recommended and required versions of GMP.
  AC_MSG_CHECKING([for the correct version of gmp.h])
Paolo Bonzini's avatar
Paolo Bonzini committed
  AC_TRY_COMPILE([#include "gmp.h"],[
  #define GCC_GMP_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
  #define GCC_GMP_VERSION GCC_GMP_VERSION_NUM(__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR,__GNU_MP_VERSION_PATCHLEVEL)
  #if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4,2,3)
Paolo Bonzini's avatar
Paolo Bonzini committed
  #endif
  ], [AC_TRY_COMPILE([#include <gmp.h>],[
  #define GCC_GMP_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
  #define GCC_GMP_VERSION GCC_GMP_VERSION_NUM(__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR,__GNU_MP_VERSION_PATCHLEVEL)
  #if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4,3,2)
  choke me
  #endif
  ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])])],
   [AC_MSG_RESULT([no]); have_gmp=no])
Paolo Bonzini's avatar
Paolo Bonzini committed

  # If we have GMP, check the MPFR version.
Paolo Bonzini's avatar
Paolo Bonzini committed
  if test x"$have_gmp" = xyes; then
    # Check for the recommended and required versions of MPFR.
    AC_MSG_CHECKING([for the correct version of mpfr.h])
    AC_TRY_COMPILE([#include <gmp.h>
Paolo Bonzini's avatar
Paolo Bonzini committed
    #include <mpfr.h>],[
    #if MPFR_VERSION < MPFR_VERSION_NUM(3,1,0)
Paolo Bonzini's avatar
Paolo Bonzini committed
    choke me
    #endif
    ], [AC_TRY_COMPILE([#include <gmp.h>
    #include <mpfr.h>],[
    #if MPFR_VERSION < MPFR_VERSION_NUM(3,1,6)
    ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])])],
     [AC_MSG_RESULT([no]); have_gmp=no])
  fi

  # Check for the MPC header version.
    # Check for the recommended and required versions of MPC.
    AC_MSG_CHECKING([for the correct version of mpc.h])
    AC_TRY_COMPILE([#include <mpc.h>],[
    #if MPC_VERSION < MPC_VERSION_NUM(0,8,0)
    ], [AC_TRY_COMPILE([#include <mpc.h>],[
    #if MPC_VERSION < MPC_VERSION_NUM(0,8,1)
    choke me
    #endif
    ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])])],
     [AC_MSG_RESULT([no]); have_gmp=no])
  fi

  # Now check the MPFR library.
  if test x"$have_gmp" = xyes; then
    saved_LIBS="$LIBS"
    LIBS="$LIBS $gmplibs"
    AC_MSG_CHECKING([for the correct version of the gmp/mpfr/mpc libraries])
    AC_TRY_LINK([#include <mpc.h>],[
Matt Kraai's avatar
Matt Kraai committed
    mpfr_t n;
    mpfr_t x;
Paolo Bonzini's avatar
Paolo Bonzini committed
    int t;
Matt Kraai's avatar
Matt Kraai committed
    mpfr_init (n);
    mpfr_init (x);
    mpfr_atan2 (n, n, x, MPFR_RNDN);
    mpfr_erfc (n, x, MPFR_RNDN);
    mpfr_subnormalize (x, t, MPFR_RNDN);
    mpfr_clear(n);
    mpfr_clear(x);
    mpc_init2 (c, 53);
    mpc_set_ui_ui (c, 1, 1, MPC_RNDNN);
    mpc_cosh (c, c, MPC_RNDNN);
    mpc_pow (c, c, c, MPC_RNDNN);
    mpc_acosh (c, c, MPC_RNDNN);
    mpc_clear (c);
    ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); have_gmp=no])
    LIBS="$saved_LIBS"
Paolo Bonzini's avatar
Paolo Bonzini committed
  fi
Paolo Bonzini's avatar
Paolo Bonzini committed
  CFLAGS="$saved_CFLAGS"
# The library versions listed in the error message below should match
# the HARD-minimums enforced above.
Paolo Bonzini's avatar
Paolo Bonzini committed
  if test x$have_gmp != xyes; then
    AC_MSG_ERROR([Building GCC requires GMP 4.2+, MPFR 3.1.0+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
their locations.  Source code for these libraries can be found at
their respective hosting sites as well as at
https://gcc.gnu.org/pub/gcc/infrastructure/.  See also
http://gcc.gnu.org/install/prerequisites.html for additional info.  If
you obtained GMP, MPFR and/or MPC from a vendor distribution package,
make sure that you have installed both the libraries and the header
files.  They may be located in separate packages.])
Paolo Bonzini's avatar
Paolo Bonzini committed
  fi
# Flags needed for both GMP, MPFR and/or MPC.
AC_SUBST(gmplibs)
AC_SUBST(gmpinc)
AC_SUBST(extra_mpc_gmp_configure_flags)
AC_SUBST(extra_mpc_mpfr_configure_flags)
AC_SUBST(extra_isl_gmp_configure_flags)
# Libraries to use for stage1 or when not bootstrapping.
AC_ARG_WITH(stage1-libs,
[AS_HELP_STRING([--with-stage1-libs=LIBS], [libraries for stage1])],
[if test "$withval" = "no" -o "$withval" = "yes"; then
   stage1_libs=
 else
   stage1_libs=$withval
 fi],
[stage1_libs=])
# Whether or not to use -static-libstdc++ and -static-libgcc.  The
# default is yes if gcc is being built; no otherwise.  The reason for
# this default is that gdb is sometimes linked against GNU Source
# Highlight, which is a shared library that uses C++ exceptions.  In
# this case, -static-libstdc++ will cause crashes.
AC_ARG_WITH(static-standard-libraries,
[AS_HELP_STRING([--with-static-standard-libraries],
                [use -static-libstdc++ and -static-libgcc (default=auto)])],
[], [with_static_standard_libraries=auto])
if test "$with_static_standard_libraries" = auto; then
  with_static_standard_libraries=$have_compiler
fi

# Linker flags to use for stage1 or when not bootstrapping.
AC_ARG_WITH(stage1-ldflags,
[AS_HELP_STRING([--with-stage1-ldflags=FLAGS], [linker flags for stage1])],
[if test "$withval" = "no" -o "$withval" = "yes"; then
   stage1_ldflags=
 else
   stage1_ldflags=$withval
 fi],
[stage1_ldflags=
 # In stage 1, default to linking libstdc++ and libgcc statically with GCC
 # if supported.  But if the user explicitly specified the libraries to use,
 # trust that they are doing what they want.
 if test "$with_static_standard_libraries" = yes -a "$stage1_libs" = "" \
     -a "$have_static_libs" = yes; then
   stage1_ldflags="-static-libstdc++ -static-libgcc"
 fi])
AC_SUBST(stage1_ldflags)

# Libraries to use for stage2 and later builds.
AC_ARG_WITH(boot-libs,
[AS_HELP_STRING([--with-boot-libs=LIBS], [libraries for stage2 and later])],
[if test "$withval" = "no" -o "$withval" = "yes"; then
   poststage1_libs=
 else
[poststage1_libs=])
AC_SUBST(poststage1_libs)

# Linker flags to use for stage2 and later builds.
AC_ARG_WITH(boot-ldflags,
[AS_HELP_STRING([--with-boot-ldflags=FLAGS],
		[linker flags for stage2 and later])],
[if test "$withval" = "no" -o "$withval" = "yes"; then
   poststage1_ldflags=
 else
   poststage1_ldflags=$withval
 fi],
[poststage1_ldflags=
 # In stages 2 and 3, default to linking libstdc++ and libgcc
 # statically.  But if the user explicitly specified the libraries to
 # use, trust that they are doing what they want.
 if test "$poststage1_libs" = ""; then
   poststage1_ldflags="-static-libstdc++ -static-libgcc"
 fi])
AC_SUBST(poststage1_ldflags)

Sebastian Pop's avatar
Sebastian Pop committed
# GCC GRAPHITE dependency isl.
Tobias Burnus's avatar
Tobias Burnus committed
# Basic setup is inlined here, actual checks are in config/isl.m4
Sebastian Pop's avatar
Sebastian Pop committed
   [Specify prefix directory for the installed isl package.
    Equivalent to --with-isl-include=PATH/include
    plus --with-isl-lib=PATH/lib])])

# Treat --without-isl as a request to disable
if test "x$with_isl" != "xno"; then
Sebastian Pop's avatar
Sebastian Pop committed
  # Check for isl
  dnl Provide configure switches and initialize islinc & isllibs
  dnl with user input.
  ISL_INIT_FLAGS
Sebastian Pop's avatar
Sebastian Pop committed
  dnl The versions of isl that work for Graphite
  ISL_CHECK_VERSION()
Sebastian Pop's avatar
Sebastian Pop committed
  dnl Only execute fail-action, if isl has been requested.
Sebastian Pop's avatar
Sebastian Pop committed
    AC_MSG_ERROR([Unable to find a usable isl.  See config.log for details.])])
Sebastian Pop's avatar
Sebastian Pop committed
# If the isl check failed, disable builds of in-tree variant of isl
if test "x$with_isl" = xno ||
   test "x$gcc_cv_isl" = xno; then
Tobias Burnus's avatar
Tobias Burnus committed
  noconfigdirs="$noconfigdirs isl"
# Check for LTO support.
AC_ARG_ENABLE(lto,
[AS_HELP_STRING([--enable-lto], [enable link time optimization support])],
enable_lto=$enableval,
enable_lto=yes; default_enable_lto=yes)

ACX_ELF_TARGET_IFELSE([# ELF platforms build the lto-plugin always.
  build_lto_plugin=yes
],[if test x"$default_enable_lto" = x"yes" ; then
      *-apple-darwin[[912]]* | *-cygwin* | *-mingw* | *djgpp*) ;;
      # On other non-ELF platforms, LTO has yet to be validated.
      *) enable_lto=no ;;
    esac
  # Apart from ELF platforms, only Windows and Darwin support LTO so far.
  # It would also be nice to check the binutils support, but we don't
  # have gcc_GAS_CHECK_FEATURE available here.  For now, we'll just
  # warn during gcc/ subconfigure; unless you're bootstrapping with
  # -flto it won't be needed until after installation anyway.
    case $target in
Andris Pavenis's avatar
Andris Pavenis committed
      *-cygwin* | *-mingw* | *-apple-darwin* | *djgpp*) ;;
      *) if test x"$enable_lto" = x"yes"; then
	AC_MSG_ERROR([LTO support is not enabled for this target.])
        fi
      ;;
    esac
  fi
  # Among non-ELF, only Windows platforms support the lto-plugin so far.
  # Build it unless LTO was explicitly disabled.
    *-cygwin* | *-mingw*) build_lto_plugin=$enable_lto ;;
AC_ARG_ENABLE(linker-plugin-configure-flags,
  [AS_HELP_STRING([[--enable-linker-plugin-configure-flags=FLAGS]],
    [additional flags for configuring linker plugins @<:@none@:>@])],
  extra_linker_plugin_configure_flags=$enableval,
  extra_linker_plugin_configure_flags=)
AC_SUBST(extra_linker_plugin_configure_flags)
AC_ARG_ENABLE(linker-plugin-flags,
  [AS_HELP_STRING([[--enable-linker-plugin-flags=FLAGS]],
    [additional flags for configuring and building linker plugins @<:@none@:>@])],
  extra_linker_plugin_flags=$enableval,
  extra_linker_plugin_flags=)
AC_SUBST(extra_linker_plugin_flags)

# Enable --enable-host-shared.
# Checked early to determine whether jit is an 'all' language
AC_ARG_ENABLE(host-shared,
[AS_HELP_STRING([--enable-host-shared],
		[build host code as shared libraries])],
[host_shared=$enableval], [host_shared=no])
AC_SUBST(host_shared)
# By default, C and C++ are the only stage 1 languages.
# Target libraries that we bootstrap.
bootstrap_target_libs=,target-libgcc,
Paolo Bonzini's avatar
Paolo Bonzini committed
# Figure out what language subdirectories are present.
# Look if the user specified --enable-languages="..."; if not, use
# the environment variable $LANGUAGES if defined. $LANGUAGES might
# go away some day.
# NB:  embedded tabs in this IF block -- do not untabify
if test -d ${srcdir}/gcc; then
  if test x"${enable_languages+set}" != xset; then
    if test x"${LANGUAGES+set}" = xset; then
      enable_languages="${LANGUAGES}"
        echo configure.ac: warning: setting LANGUAGES is deprecated, use --enable-languages instead 1>&2
Paolo Bonzini's avatar
Paolo Bonzini committed
    else
Paolo Bonzini's avatar
Paolo Bonzini committed
    fi
  else
    if test x"${enable_languages}" = x ||
       test x"${enable_languages}" = xyes;
       then
      echo configure.ac: --enable-languages needs at least one language argument 1>&2
Paolo Bonzini's avatar
Paolo Bonzini committed
      exit 1
    fi
  fi
  enable_languages=`echo "${enable_languages}" | sed -e 's/[[ 	,]][[ 	,]]*/,/g' -e 's/,$//'`

  # 'f95' is the old name for the 'fortran' language. We issue a warning
  # and make the substitution.
  case ,${enable_languages}, in
    *,f95,*)
      echo configure.ac: warning: 'f95' as language name is deprecated, use 'fortran' instead 1>&2
      enable_languages=`echo "${enable_languages}" | sed -e 's/f95/fortran/g'`
      ;;
  esac

  # If bootstrapping, C++ must be enabled.
  case ",$enable_languages,:$enable_bootstrap" in
    *,c++,*:*) ;;
    *:yes)
      if test -f ${srcdir}/gcc/cp/config-lang.in; then
        enable_languages="${enable_languages},c++"
      else
        AC_MSG_ERROR([bootstrapping requires c++ sources])
Paolo Bonzini's avatar
Paolo Bonzini committed
  # First scan to see if an enabled language requires some other language.
  # We assume that a given config-lang.in will list all the language
  # front ends it requires, even if some are required indirectly.
  for lang_frag in ${srcdir}/gcc/*/config-lang.in .. ; do
    case ${lang_frag} in
      ..) ;;
      # The odd quoting in the next line works around
      # an apparent bug in bash 1.12 on linux.
      ${srcdir}/gcc/[[*]]/config-lang.in) ;;
      *)
        # From the config-lang.in, get $language, $lang_requires, and
        # $lang_requires_boot_languages.
Paolo Bonzini's avatar
Paolo Bonzini committed
        language=
        lang_requires=
        # set srcdir during sourcing lang_frag to the gcc dir.
        # Sadly overriding srcdir on the . line doesn't work in plain sh as it
        # polutes this shell
        saved_srcdir=${srcdir}
        srcdir=${srcdir}/gcc . ${lang_frag}
        srcdir=${saved_srcdir}
        for other in ${lang_requires} ${lang_requires_boot_languages}; do
Paolo Bonzini's avatar
Paolo Bonzini committed
          case ,${enable_languages}, in
	    *,$other,*) ;;
Paolo Bonzini's avatar
Paolo Bonzini committed
	    *,all,*) ;;
	    *,$language,*)
	      echo " \`$other' language required by \`$language'; enabling" 1>&2
	      enable_languages="${enable_languages},${other}"
	      ;;
	  esac
        done
	for other in ${lang_requires_boot_languages} ; do
	  if test "$other" != "c"; then
	    case ,${enable_stage1_languages}, in
	      *,$other,*) ;;
	      *,all,*) ;;
	      *)
		case ,${enable_languages}, in
		  *,$language,*)
		    echo " '$other' language required by '$language' in stage 1; enabling" 1>&2
		    enable_stage1_languages="$enable_stage1_languages,${other}"
		    ;;
		esac
		;;
	    esac
          fi
        done
Paolo Bonzini's avatar
Paolo Bonzini committed
        ;;
    esac
  done

  new_enable_languages=,c,

  # If LTO is enabled, add the LTO front end.
  if test "$enable_lto" = "yes" ; then
    case ,${enable_languages}, in
      *,lto,*) ;;
      *) enable_languages="${enable_languages},lto" ;;
    esac
    if test "${build_lto_plugin}" = "yes" ; then
      configdirs="$configdirs lto-plugin"
    fi
  fi

  # If we're building an offloading compiler, add the LTO front end.
  if test x"$enable_as_accelerator_for" != x ; then
    case ,${enable_languages}, in
      *,lto,*) ;;
      *) enable_languages="${enable_languages},lto" ;;
    esac
  fi

  missing_languages=`echo ",$enable_languages," | sed -e s/,default,/,/ -e s/,all,/,/ -e s/,c,/,/ `
  potential_languages=,c,
Paolo Bonzini's avatar
Paolo Bonzini committed

Paolo Bonzini's avatar
Paolo Bonzini committed
  for lang_frag in ${srcdir}/gcc/*/config-lang.in .. ; do
    case ${lang_frag} in
      ..) ;;
      # The odd quoting in the next line works around
      # an apparent bug in bash 1.12 on linux.
      ${srcdir}/gcc/[[*]]/config-lang.in) ;;