# If yes, only static linking will be used static_link="no" # This is a list of default flags always supplied to configure if [ x"$use_system_libs" = x"no" ]; then default_configure_flags="--with-mpc=$prefix --with-mpfr=$prefix --with-gmp=$prefix" else default_configure_flags="" fi default_configure_flags="$default_configure_flags \ --with-gnu-as \ --with-gnu-ld \ " # top-level flags default_configure_flags="${default_configure_flags} \ --disable-libmudflap \ --enable-lto \ --enable-shared \ --without-included-gettext \ --enable-nls \ --with-system-zlib \ " # gcc flags default_configure_flags="${default_configure_flags} \ --disable-sjlj-exceptions \ --enable-gnu-unique-object \ --enable-linker-build-id \ " # libstdc++ flags # C99 is the latest standard, and has improved numerics support, so we want it # http://en.wikipedia.org/wiki/C99 default_configure_flags="${default_configure_flags} \ --disable-libstdcxx-pch \ --enable-c99 \ --enable-clocale=gnu \ --enable-libstdcxx-debug \ --enable-long-long \ " # Disable the Graphite loop optimizer as it's being deprecated default_configure_flags="${default_configure_flags} --with-cloog=no --with-ppl=no --with-isl=no" # libssp does stack protection #default_configure_flags="${default_configure_flags} --enable-libssp" # Used by fortran # http://gcc.gnu.org/onlinedocs/libquadmath/ # default_configure_flags="${default_configure_flags} --disable-libquadmath" # Transactional Memory, used for threading # http://gcc.gnu.org/wiki/TransactionalMemory #default_configure_flags="${default_configure_flags} --disable-libitm" # Libatomic is a synchronization library # http://www.hpl.hp.com/research/linux/atomic_ops/ #default_configure_flags="${default_configure_flags} --disable-libatomic" # Enable multilib for bare-metal, since newlib supports it. if echo "${gcc_override_configure}" | egrep -q -v 'multilib' ; then case ${target} in arm*-eabi*) default_configure_flags="${default_configure_flags} --enable-multilib --with-multilib-list=${multilib_list}" ;; aarch64*-*elf) default_configure_flags="${default_configure_flags} --enable-multilib" ;; *) default_configure_flags="${default_configure_flags} --disable-multilib" ;; esac fi # Enable errata support aarch64_errata="--enable-fix-cortex-a53-835769 --enable-fix-cortex-a53-843419" case ${target} in aarch64*-mingw32) # FIXME: with fix-cortex-a53-843419 enabled, aarch64-w64-mingw32's # libatomic's configure fails with # "ld: -f may not be used without -shared" # due to "-Wl,-fix-cortex-a53-843419" option. # Disabling cortex-a53 errata should be harmless for mingw, since # the target is much younger than the affected chips. true ;; aarch64*) default_configure_flags="${default_configure_flags} ${aarch64_errata}" ;; esac # Default languages languages="c,c++,fortran,lto" default_makeflags="MAKEINFOFLAGS=--force" # Add target specific flags # We cannot change the defaut cpu/fpu/mode/arch/float settings for # arm*-eabi* because we use --with-multilib-list=[a|rm]profile: the cases # below only apply to *linux* configurations. # floating-point abi/fpu case ${target} in arm*linux-gnueabihf) default_configure_flags="${default_configure_flags} --with-float=hard" # FPU (no --with-fpu for non-hf configurations, nor AArch64) if echo "${gcc_override_configure}" | grep -q -v with-fpu ; then case ${target} in armv8l-*linux-gnueabihf) default_configure_flags="${default_configure_flags} --with-fpu=neon-fp-armv8" ;; arm*-*linux-gnueabihf) default_configure_flags="${default_configure_flags} --with-fpu=vfpv3-d16" ;; esac fi ;; arm*linux-gnueabi) default_configure_flags="${default_configure_flags} --with-float=soft" ;; esac # mode (ARM, Thumb, ...) case ${target} in arm*linux*) if echo "${gcc_override_configure}" | egrep -q -v 'with-mode' ; then default_configure_flags="${default_configure_flags} --with-mode=thumb" fi ;; esac # ARCH/CPU case ${target} in armv8l-*linux-gnueabihf) if echo "${gcc_override_configure}" | egrep -q -v 'with-arch|with-cpu' ; then default_configure_flags="${default_configure_flags} --with-arch=armv8-a" fi ;; arm*-*linux-gnueabi*) if echo "${gcc_override_configure}" | egrep -q -v 'with-cpu|with-tune' ; then default_configure_flags="${default_configure_flags} --with-tune=cortex-a9" fi if echo "${gcc_override_configure}" | egrep -q -v 'with-arch|with-cpu' ; then default_configure_flags="${default_configure_flags} --with-arch=armv7-a" fi ;; aarch64*) if echo "${gcc_override_configure}" | egrep -q -v 'with-arch|with-cpu' ; then default_configure_flags="${default_configure_flags} --with-arch=armv8-a" fi ;; esac # Add target OS specific flags case ${target} in # bare metal targets don't support threads. arm*-eabi*|aarch64*elf) default_configure_flags="${default_configure_flags} --enable-threads=no --disable-multiarch" languages="c,c++,lto" ;; *linux*) # --enable-libstdcxx-time=yes requires a compiler able to link # --without flags such as --specs, which is not the case for # --aarch64-elf. That's why we enable this for *linux* targets # --only. default_configure_flags="${default_configure_flags} --enable-threads=posix --enable-multiarch --enable-libstdcxx-time=yes" # Enable GNU IFUNCs starting with GCC6 toolchains. # Previous toolchains remove this setting from their configurations. # This is only supported by glibc, so assume it's only for linux # targets. (this is not true if one builds a toolchain for *linux* # target and forces newlib as libc) default_configure_flags="${default_configure_flags} --enable-gnu-indirect-function" ;; esac # Other case ${target} in *-mingw32) languages="c,c++" # Cygwin doesn't support GCC plugins default_configure_flags="${default_configure_flags} --disable-plugins" ;; powerpc*-eabi|ppc) default_configure_flags="${default_configure_flags}" languages="c,c++,lto" ;; esac stage1_flags="" stage2_flags="" # When building a cross-compiler, we first build a minimal stage1 # compiler with many features disabled, then a full-featured stage2 # compiler. if test x"${build}" != x"${target}"; then # stage1_flags are used to build the initial C compiler, which is # used to compile the C library. We disable most everything, as the # second GCC build will be able to use the C library built with the # first GCC build. stage1_flags="$stage1_flags --disable-libssp --disable-libquadmath --disable-threads --without-headers --with-newlib --disable-libmudflap --disable-decimal-float --disable-libgomp --disable-libatomic --disable-libsanitizer --disable-plugins --disable-libitm --disable-libvtv --disable-shared" case "$target" in aarch64*-mingw32) # FIXME: aarch64-w64-mingw32 can't build C++ yet. stage1_flags="$stage1_flags --enable-languages=c" ;; *) # Glibc needs C++ compiler to configure ... stage1_flags="$stage1_flags --enable-languages=c,c++" # ... but we can't build libstdc++ yet. stage1_flags="$stage1_flags --disable-libstdcxx" ;; esac case ${clibrary} in glibc|eglibc) stage1_flags="$stage1_flags --with-glibc-version=2.18" # Convention for cross-toolchains is to install Glibc into # libc/ directory inside sysroot. # Set GCC's sysroot flag to $sysroot/libc so that the compiler # can find C library's headers and libraries. GCC will search # $sysroot automatically anyway, since that's where it installs # compiler libraries. stage2_flags="--with-sysroot=${sysroots}/libc" ;; newlib) # bare metal targets don't support threads. stage2_flags="--with-sysroot=${sysroots} --with-headers=yes --with-native-system-header-dir=/include" if [ "$target" != "aarch64-w64-mingw32" ]; then # FIXME: WoA toolchain uses mingw CRT, and this is a quick # fix to make it build. Once the WoA toolchain is in better # shape, we will need to add handling of mingw/cygwin $clibrary. stage2_flags="$stage2_flags --with-newlib" fi ;; *) fixme "\${clibrary} not specified." ;; esac else # Native builds are easy, so build almost everything. languages="c,c++,go,objc,fortran" fi if [ "$with_languages" != "abe_default" ]; then languages="${with_languages}" fi # When building for a mingw host, supply pre-built libiconv and use GCC's # internal zlib (otherwise no zlib to build against). mingw_extraconf="--with-libiconv-prefix=$prefix/usr --with-system-zlib=no" # stage2 flags are used for native builds too if test x"${release}" = x; then stage2_flags="${stage2_flags} --enable-checking=yes" else stage2_flags="${stage2_flags} --enable-checking=release" fi stage1_flags="$stage1_flags --disable-bootstrap" if test x"${bootstrap}" = x"yes"; then stage2_flags="${stage2_flags} --enable-bootstrap" else stage2_flags="${stage2_flags} --disable-bootstrap" fi # Add --with-build-config= if test x"${build_config}" != x; then stage2_flags="${stage2_flags} --with-build-config=${build_config}" fi stage2_flags="${stage2_flags} --enable-languages=${languages}" # Add the overrides default_configure_flags="${default_configure_flags} ${gcc_override_configure}" # This is a list of default flags always supplied to "make check". runtest_flags=""