Merge configure.ac from gcc project

To merge with gcc's copy of configure.ac we need to revert changes to
configure.ac in the following gcc commits:
dc832fb39fc0 2022-08-25
fc259b522c0f 2022-06-25
Then reapply configure.ac changes in binutils from these binutils
commits:
50ad1254d503 2021-01-09
bb368aad297f 2022-03-11
e5f2f7d901ee 2022-07-26
2cac01e3ffff 2022-09-26
Plus copy over gcc's config/ax_cxx_compile_stdcxx.m4, then regenerate
configure.
This commit is contained in:
Alan Modra 2022-10-10 11:08:40 +10:30
parent bbcf4de018
commit 228cf97dd3
3 changed files with 4481 additions and 174 deletions

View File

@ -0,0 +1,979 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional])
#
# DESCRIPTION
#
# Check for baseline language coverage in the compiler for the specified
# version of the C++ standard. If necessary, add switches to CXX and
# CXXCPP to enable support. VERSION may be '11' (for the C++11 standard)
# or '14' (for the C++14 standard).
#
# The second argument, if specified, indicates whether you insist on an
# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
# -std=c++11). If neither is specified, you get whatever works, with
# preference for no added switch, and then for an extended mode.
#
# The third argument, if specified 'mandatory' or if left unspecified,
# indicates that baseline support for the specified C++ standard is
# required and that the macro should error out if no mode with that
# support is found. If specified 'optional', then configuration proceeds
# regardless, after defining HAVE_CXX${VERSION} if and only if a
# supporting mode is found.
#
# If the fourth argument is an optional CXX/CXXFLAG/CPPFLAG suffix, e.g.
# "_FOR_BUILD" or "_FOR_TARGET".
#
#
# LICENSE
#
# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
# Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu>
# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com>
# Copyright (c) 2015 Paul Norman <penorman@mac.com>
# Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu>
# Copyright (c) 2016, 2018 Krzesimir Nowak <qdlacz@gmail.com>
# Copyright (c) 2019 Enji Cooper <yaneurabeya@gmail.com>
# Copyright (c) 2020 Jason Merrill <jason@redhat.com>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 12
dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
dnl (serial version number 13).
AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"],
[$1], [14], [ax_cxx_compile_alternatives="14 1y"],
[$1], [17], [ax_cxx_compile_alternatives="17 1z"],
[m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl
m4_if([$2], [], [],
[$2], [ext], [],
[$2], [noext], [],
[m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl
m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true],
[$3], [mandatory], [ax_cxx_compile_cxx$1_required=true],
[$3], [optional], [ax_cxx_compile_cxx$1_required=false],
[m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])])
AC_LANG_PUSH([C++])dnl
ac_success=no
m4_ifnblank([$4], [dnl
ax_cv_cxx_compile_cxx$1_orig_cxx="$CXX"
ax_cv_cxx_compile_cxx$1_orig_cxxflags="$CXXFLAGS"
ax_cv_cxx_compile_cxx$1_orig_cppflags="$CPPFLAGS"
CXX="$CXX$4"
CXXFLAGS="$CXXFLAGS$4"
CPPFLAGS="$CPPFLAGS$4"])
m4_if([$2], [], [dnl
AC_CACHE_CHECK(whether $CXX supports C++$1 features by default,
ax_cv_cxx_compile_cxx$1$4,
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
[ax_cv_cxx_compile_cxx$1$4=yes],
[ax_cv_cxx_compile_cxx$1$4=no])])
if test x$ax_cv_cxx_compile_cxx$1$4 = xyes; then
ac_success=yes
fi])
m4_if([$2], [noext], [], [dnl
if test x$ac_success = xno; then
for alternative in ${ax_cxx_compile_alternatives}; do
switch="-std=gnu++${alternative}"
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1$4_$switch])
AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
$cachevar,
[ac_save_CXX="$CXX"
CXX="$CXX $switch"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
[eval $cachevar=yes],
[eval $cachevar=no])
CXX="$ac_save_CXX"])
if eval test x\$$cachevar = xyes; then
CXX="$CXX $switch"
if test -n "$CXXCPP" ; then
CXXCPP="$CXXCPP $switch"
fi
ac_success=yes
break
fi
done
fi])
m4_if([$2], [ext], [], [dnl
if test x$ac_success = xno; then
dnl HP's aCC needs +std=c++11 according to:
dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf
dnl Cray's crayCC needs "-h std=c++11"
for alternative in ${ax_cxx_compile_alternatives}; do
for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1$4_$switch])
AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
$cachevar,
[ac_save_CXX="$CXX"
CXX="$CXX $switch"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
[eval $cachevar=yes],
[eval $cachevar=no])
CXX="$ac_save_CXX"])
if eval test x\$$cachevar = xyes; then
CXX="$CXX $switch"
if test -n "$CXXCPP" ; then
CXXCPP="$CXXCPP $switch"
fi
ac_success=yes
break
fi
done
if test x$ac_success = xyes; then
break
fi
done
fi])
m4_ifnblank([$4], [dnl
CXX$4="$CXX"
CXXFLAGS$4="$CXXFLAGS"
CPPFLAGS$4="$CPPFLAGS"
CXX="$ax_cv_cxx_compile_cxx$1_orig_cxx"
CXXFLAGS="$ax_cv_cxx_compile_cxx$1_orig_cxxflags"
CPPFLAGS="$ax_cv_cxx_compile_cxx$1_orig_cppflags"])
AC_LANG_POP([C++])
if test x$ax_cxx_compile_cxx$1_required = xtrue; then
if test x$ac_success = xno; then
AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.])
fi
fi
if test x$ac_success = xno; then
HAVE_CXX$1$4=0
AC_MSG_NOTICE([No compiler with C++$1 support was found])
else
HAVE_CXX$1$4=1
AC_DEFINE(HAVE_CXX$1$4,1,
[define if the compiler supports basic C++$1 syntax])
fi
AC_SUBST(HAVE_CXX$1$4)
])
dnl Test body for checking C++11 support
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11],
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
)
dnl Test body for checking C++14 support
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14],
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14
)
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17],
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14
_AX_CXX_COMPILE_STDCXX_testbody_new_in_17
)
dnl Tests for new features in C++11
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[
// If the compiler admits that it is not ready for C++11, why torture it?
// Hopefully, this will speed up the test.
#ifndef __cplusplus
#error "This is not a C++ compiler"
#elif __cplusplus < 201103L
#error "This is not a C++11 compiler"
#else
namespace cxx11
{
namespace test_static_assert
{
template <typename T>
struct check
{
static_assert(sizeof(int) <= sizeof(T), "not big enough");
};
}
namespace test_final_override
{
struct Base
{
virtual ~Base() {}
virtual void f() {}
};
struct Derived : public Base
{
virtual ~Derived() override {}
virtual void f() override {}
};
}
namespace test_double_right_angle_brackets
{
template < typename T >
struct check {};
typedef check<void> single_type;
typedef check<check<void>> double_type;
typedef check<check<check<void>>> triple_type;
typedef check<check<check<check<void>>>> quadruple_type;
}
namespace test_decltype
{
int
f()
{
int a = 1;
decltype(a) b = 2;
return a + b;
}
}
namespace test_type_deduction
{
template < typename T1, typename T2 >
struct is_same
{
static const bool value = false;
};
template < typename T >
struct is_same<T, T>
{
static const bool value = true;
};
template < typename T1, typename T2 >
auto
add(T1 a1, T2 a2) -> decltype(a1 + a2)
{
return a1 + a2;
}
int
test(const int c, volatile int v)
{
static_assert(is_same<int, decltype(0)>::value == true, "");
static_assert(is_same<int, decltype(c)>::value == false, "");
static_assert(is_same<int, decltype(v)>::value == false, "");
auto ac = c;
auto av = v;
auto sumi = ac + av + 'x';
auto sumf = ac + av + 1.0;
static_assert(is_same<int, decltype(ac)>::value == true, "");
static_assert(is_same<int, decltype(av)>::value == true, "");
static_assert(is_same<int, decltype(sumi)>::value == true, "");
static_assert(is_same<int, decltype(sumf)>::value == false, "");
static_assert(is_same<int, decltype(add(c, v))>::value == true, "");
return (sumf > 0.0) ? sumi : add(c, v);
}
}
namespace test_noexcept
{
int f() { return 0; }
int g() noexcept { return 0; }
static_assert(noexcept(f()) == false, "");
static_assert(noexcept(g()) == true, "");
}
namespace test_constexpr
{
template < typename CharT >
unsigned long constexpr
strlen_c_r(const CharT *const s, const unsigned long acc) noexcept
{
return *s ? strlen_c_r(s + 1, acc + 1) : acc;
}
template < typename CharT >
unsigned long constexpr
strlen_c(const CharT *const s) noexcept
{
return strlen_c_r(s, 0UL);
}
static_assert(strlen_c("") == 0UL, "");
static_assert(strlen_c("1") == 1UL, "");
static_assert(strlen_c("example") == 7UL, "");
static_assert(strlen_c("another\0example") == 7UL, "");
}
namespace test_rvalue_references
{
template < int N >
struct answer
{
static constexpr int value = N;
};
answer<1> f(int&) { return answer<1>(); }
answer<2> f(const int&) { return answer<2>(); }
answer<3> f(int&&) { return answer<3>(); }
void
test()
{
int i = 0;
const int c = 0;
static_assert(decltype(f(i))::value == 1, "");
static_assert(decltype(f(c))::value == 2, "");
static_assert(decltype(f(0))::value == 3, "");
}
}
namespace test_uniform_initialization
{
struct test
{
static const int zero {};
static const int one {1};
};
static_assert(test::zero == 0, "");
static_assert(test::one == 1, "");
}
namespace test_lambdas
{
void
test1()
{
auto lambda1 = [](){};
auto lambda2 = lambda1;
lambda1();
lambda2();
}
int
test2()
{
auto a = [](int i, int j){ return i + j; }(1, 2);
auto b = []() -> int { return '0'; }();
auto c = [=](){ return a + b; }();
auto d = [&](){ return c; }();
auto e = [a, &b](int x) mutable {
const auto identity = [](int y){ return y; };
for (auto i = 0; i < a; ++i)
a += b--;
return x + identity(a + b);
}(0);
return a + b + c + d + e;
}
int
test3()
{
const auto nullary = [](){ return 0; };
const auto unary = [](int x){ return x; };
using nullary_t = decltype(nullary);
using unary_t = decltype(unary);
const auto higher1st = [](nullary_t f){ return f(); };
const auto higher2nd = [unary](nullary_t f1){
return [unary, f1](unary_t f2){ return f2(unary(f1())); };
};
return higher1st(nullary) + higher2nd(nullary)(unary);
}
}
namespace test_variadic_templates
{
template <int...>
struct sum;
template <int N0, int... N1toN>
struct sum<N0, N1toN...>
{
static constexpr auto value = N0 + sum<N1toN...>::value;
};
template <>
struct sum<>
{
static constexpr auto value = 0;
};
static_assert(sum<>::value == 0, "");
static_assert(sum<1>::value == 1, "");
static_assert(sum<23>::value == 23, "");
static_assert(sum<1, 2>::value == 3, "");
static_assert(sum<5, 5, 11>::value == 21, "");
static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, "");
}
// http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae
// Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function
// because of this.
namespace test_template_alias_sfinae
{
struct foo {};
template<typename T>
using member = typename T::member_type;
template<typename T>
void func(...) {}
template<typename T>
void func(member<T>*) {}
void test();
void test() { func<foo>(0); }
}
} // namespace cxx11
#endif // __cplusplus >= 201103L
]])
dnl Tests for new features in C++14
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[
// If the compiler admits that it is not ready for C++14, why torture it?
// Hopefully, this will speed up the test.
#ifndef __cplusplus
#error "This is not a C++ compiler"
#elif __cplusplus < 201402L
#error "This is not a C++14 compiler"
#else
namespace cxx14
{
namespace test_polymorphic_lambdas
{
int
test()
{
const auto lambda = [](auto&&... args){
const auto istiny = [](auto x){
return (sizeof(x) == 1UL) ? 1 : 0;
};
const int aretiny[] = { istiny(args)... };
return aretiny[0];
};
return lambda(1, 1L, 1.0f, '1');
}
}
namespace test_binary_literals
{
constexpr auto ivii = 0b0000000000101010;
static_assert(ivii == 42, "wrong value");
}
namespace test_generalized_constexpr
{
template < typename CharT >
constexpr unsigned long
strlen_c(const CharT *const s) noexcept
{
auto length = 0UL;
for (auto p = s; *p; ++p)
++length;
return length;
}
static_assert(strlen_c("") == 0UL, "");
static_assert(strlen_c("x") == 1UL, "");
static_assert(strlen_c("test") == 4UL, "");
static_assert(strlen_c("another\0test") == 7UL, "");
}
namespace test_lambda_init_capture
{
int
test()
{
auto x = 0;
const auto lambda1 = [a = x](int b){ return a + b; };
const auto lambda2 = [a = lambda1(x)](){ return a; };
return lambda2();
}
}
namespace test_digit_separators
{
constexpr auto ten_million = 100'000'000;
static_assert(ten_million == 100000000, "");
}
namespace test_return_type_deduction
{
auto f(int& x) { return x; }
decltype(auto) g(int& x) { return x; }
template < typename T1, typename T2 >
struct is_same
{
static constexpr auto value = false;
};
template < typename T >
struct is_same<T, T>
{
static constexpr auto value = true;
};
int
test()
{
auto x = 0;
static_assert(is_same<int, decltype(f(x))>::value, "");
static_assert(is_same<int&, decltype(g(x))>::value, "");
return x;
}
}
} // namespace cxx14
#endif // __cplusplus >= 201402L
]])
dnl Tests for new features in C++17
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[
// If the compiler admits that it is not ready for C++17, why torture it?
// Hopefully, this will speed up the test.
#ifndef __cplusplus
#error "This is not a C++ compiler"
#elif __cplusplus < 201703L
#error "This is not a C++17 compiler"
#else
#include <initializer_list>
#include <utility>
#include <type_traits>
namespace cxx17
{
namespace test_constexpr_lambdas
{
constexpr int foo = [](){return 42;}();
}
namespace test::nested_namespace::definitions
{
}
namespace test_fold_expression
{
template<typename... Args>
int multiply(Args... args)
{
return (args * ... * 1);
}
template<typename... Args>
bool all(Args... args)
{
return (args && ...);
}
}
namespace test_extended_static_assert
{
static_assert (true);
}
namespace test_auto_brace_init_list
{
auto foo = {5};
auto bar {5};
static_assert(std::is_same<std::initializer_list<int>, decltype(foo)>::value);
static_assert(std::is_same<int, decltype(bar)>::value);
}
namespace test_typename_in_template_template_parameter
{
template<template<typename> typename X> struct D;
}
namespace test_fallthrough_nodiscard_maybe_unused_attributes
{
int f1()
{
return 42;
}
[[nodiscard]] int f2()
{
[[maybe_unused]] auto unused = f1();
switch (f1())
{
case 17:
f1();
[[fallthrough]];
case 42:
f1();
}
return f1();
}
}
namespace test_extended_aggregate_initialization
{
struct base1
{
int b1, b2 = 42;
};
struct base2
{
base2() {
b3 = 42;
}
int b3;
};
struct derived : base1, base2
{
int d;
};
derived d1 {{1, 2}, {}, 4}; // full initialization
derived d2 {{}, {}, 4}; // value-initialized bases
}
namespace test_general_range_based_for_loop
{
struct iter
{
int i;
int& operator* ()
{
return i;
}
const int& operator* () const
{
return i;
}
iter& operator++()
{
++i;
return *this;
}
};
struct sentinel
{
int i;
};
bool operator== (const iter& i, const sentinel& s)
{
return i.i == s.i;
}
bool operator!= (const iter& i, const sentinel& s)
{
return !(i == s);
}
struct range
{
iter begin() const
{
return {0};
}
sentinel end() const
{
return {5};
}
};
void f()
{
range r {};
for (auto i : r)
{
[[maybe_unused]] auto v = i;
}
}
}
namespace test_lambda_capture_asterisk_this_by_value
{
struct t
{
int i;
int foo()
{
return [*this]()
{
return i;
}();
}
};
}
namespace test_enum_class_construction
{
enum class byte : unsigned char
{};
byte foo {42};
}
namespace test_constexpr_if
{
template <bool cond>
int f ()
{
if constexpr(cond)
{
return 13;
}
else
{
return 42;
}
}
}
namespace test_selection_statement_with_initializer
{
int f()
{
return 13;
}
int f2()
{
if (auto i = f(); i > 0)
{
return 3;
}
switch (auto i = f(); i + 4)
{
case 17:
return 2;
default:
return 1;
}
}
}
namespace test_template_argument_deduction_for_class_templates
{
template <typename T1, typename T2>
struct pair
{
pair (T1 p1, T2 p2)
: m1 {p1},
m2 {p2}
{}
T1 m1;
T2 m2;
};
void f()
{
[[maybe_unused]] auto p = pair{13, 42u};
}
}
namespace test_non_type_auto_template_parameters
{
template <auto n>
struct B
{};
B<5> b1;
B<'a'> b2;
}
namespace test_structured_bindings
{
int arr[2] = { 1, 2 };
std::pair<int, int> pr = { 1, 2 };
auto f1() -> int(&)[2]
{
return arr;
}
auto f2() -> std::pair<int, int>&
{
return pr;
}
struct S
{
int x1 : 2;
volatile double y1;
};
S f3()
{
return {};
}
auto [ x1, y1 ] = f1();
auto& [ xr1, yr1 ] = f1();
auto [ x2, y2 ] = f2();
auto& [ xr2, yr2 ] = f2();
const auto [ x3, y3 ] = f3();
}
namespace test_exception_spec_type_system
{
struct Good {};
struct Bad {};
void g1() noexcept;
void g2();
template<typename T>
Bad
f(T*, T*);
template<typename T1, typename T2>
Good
f(T1*, T2*);
static_assert (std::is_same_v<Good, decltype(f(g1, g2))>);
}
namespace test_inline_variables
{
template<class T> void f(T)
{}
template<class T> inline T g(T)
{
return T{};
}
template<> inline void f<>(int)
{}
template<> int g<>(int)
{
return 5;
}
}
} // namespace cxx17
#endif // __cplusplus < 201703L
]])

3356
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
# 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, # 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012,
# 2014, 2015, 2016, 2019, 2020 Free Software Foundation, Inc. # 2014, 2015, 2016, 2019, 2022 Free Software Foundation, Inc.
# #
# This file is free software; you can redistribute it and/or modify it # 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 # under the terms of the GNU General Public License as published by
@ -24,6 +24,7 @@ m4_include(config/override.m4)
m4_include(config/proginstall.m4) m4_include(config/proginstall.m4)
m4_include(config/elf.m4) m4_include(config/elf.m4)
m4_include(config/gcc-plugin.m4) m4_include(config/gcc-plugin.m4)
m4_include(config/ax_cxx_compile_stdcxx.m4)
m4_include([libtool.m4]) m4_include([libtool.m4])
m4_include([ltoptions.m4]) m4_include([ltoptions.m4])
m4_include([ltsugar.m4]) m4_include([ltsugar.m4])
@ -132,7 +133,7 @@ build_tools="build-texinfo build-flex build-bison build-m4 build-fixincludes"
# these libraries are used by various programs built for the host environment # these libraries are used by various programs built for the host environment
#f #f
host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libbacktrace libcpp libdecnumber gmp mpfr mpc isl libelf libiconv libctf" host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libbacktrace libcpp libcody libdecnumber gmp mpfr mpc isl libiconv libctf"
# these tools are built for the host environment # these tools are built for the host environment
# Note, the powerpc-eabi build depends on sim occurring before gdb in order to # Note, the powerpc-eabi build depends on sim occurring before gdb in order to
@ -140,7 +141,7 @@ host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libbacktr
# binutils, gas and ld appear in that order because it makes sense to run # binutils, gas and ld appear in that order because it makes sense to run
# "make check" in that particular order. # "make check" in that particular order.
# If --enable-gold is used, "gold" may replace "ld". # 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 gotools" 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 gotools c++tools"
# these libraries are built for the target environment, and are built after # 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) # the host libraries and the host tools (which may be a cross compiler)
@ -151,7 +152,6 @@ target_libraries="target-libgcc \
target-newlib \ target-newlib \
target-libgomp \ target-libgomp \
target-liboffloadmic \ target-liboffloadmic \
target-libhsail-rt \
target-libatomic \ target-libatomic \
target-libitm \ target-libitm \
target-libstdc++-v3 \ target-libstdc++-v3 \
@ -163,7 +163,9 @@ target_libraries="target-libgcc \
target-libffi \ target-libffi \
target-libobjc \ target-libobjc \
target-libada \ target-libada \
target-libgo" target-libgo \
target-libphobos \
target-zlib"
# these tools are built using the target libraries, and are intended to # these tools are built using the target libraries, and are intended to
# run only in the target environment # run only in the target environment
@ -249,12 +251,6 @@ fi
AC_ARG_WITH(zstd, AC_ARG_WITH(zstd,
[AS_HELP_STRING([--with-zstd], [Support zstd compressed debug sections (default=auto)])]) [AS_HELP_STRING([--with-zstd], [Support zstd compressed debug sections (default=auto)])])
# 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
# some tools are so dependent upon X11 that if we're not building with X, # 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. # it's not even worth trying to configure, much less build, that tool.
@ -307,6 +303,14 @@ AC_ARG_ENABLE(offload-targets,
fi fi
], [enable_offload_targets=]) ], [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. # Handle --enable-gold, --enable-ld.
# --disable-gold [--enable-ld] # --disable-gold [--enable-ld]
# Build only ld. Default option. # Build only ld. Default option.
@ -339,7 +343,7 @@ case "${ENABLE_GOLD}" in
*-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \ *-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
| *-*-linux* | *-*-gnu* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \ | *-*-linux* | *-*-gnu* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
| *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* \ | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* \
| *-*-solaris2* | *-*-nto* | *-*-nacl* | *-*-haiku*) | *-*-solaris2* | *-*-nto* | *-*-nacl*)
case "${target}" in case "${target}" in
*-*-linux*aout* | *-*-linux*oldld*) *-*-linux*aout* | *-*-linux*oldld*)
;; ;;
@ -353,7 +357,7 @@ case "${ENABLE_GOLD}" in
# Check for target supported by gold. # Check for target supported by gold.
case "${target}" in case "${target}" in
i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-* \ i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-* \
| aarch64*-*-* | tilegx*-*-* | mips*-*-* | s390*-*-*) | aarch64*-*-* | tilegx*-*-* | mips*-*-* | s390*-*-* | loongarch*-*-*)
configdirs="$configdirs gold" configdirs="$configdirs gold"
if test x${ENABLE_GOLD} = xdefault; then if test x${ENABLE_GOLD} = xdefault; then
default_ld=gold default_ld=gold
@ -546,7 +550,7 @@ if test x$enable_libgomp = x ; then
;; ;;
*-*-darwin* | *-*-aix*) *-*-darwin* | *-*-aix*)
;; ;;
nvptx*-*-*) nvptx*-*-* | amdgcn*-*-*)
;; ;;
*) *)
noconfigdirs="$noconfigdirs target-libgomp" noconfigdirs="$noconfigdirs target-libgomp"
@ -634,26 +638,6 @@ if test -d ${srcdir}/libvtv; then
fi fi
fi fi
# Disable libhsail-rt on unsupported systems.
if test -d ${srcdir}/libhsail-rt; then
if test x$enable_libhsail_rt = x; then
AC_MSG_CHECKING([for libhsail-rt support])
if (srcdir=${srcdir}/libhsail-rt; \
. ${srcdir}/configure.tgt; \
test -n "$UNSUPPORTED")
then
AC_MSG_RESULT([no])
unsupported_languages="$unsupported_languages brig"
# This implicitly disables also target-libhsail-rt as it won't
# get added to the build without BRIG FE.
else
AC_MSG_RESULT([yes])
fi
fi
fi
# Disable libquadmath for some systems. # Disable libquadmath for some systems.
case "${target}" in case "${target}" in
avr-*-*) avr-*-*)
@ -672,9 +656,16 @@ case "${target}" in
# No hosted I/O support. # No hosted I/O support.
noconfigdirs="$noconfigdirs target-libssp" noconfigdirs="$noconfigdirs target-libssp"
;; ;;
bpf-*-*)
noconfigdirs="$noconfigdirs target-libssp"
;;
powerpc-*-aix* | rs6000-*-aix*) powerpc-*-aix* | rs6000-*-aix*)
noconfigdirs="$noconfigdirs target-libssp" noconfigdirs="$noconfigdirs target-libssp"
;; ;;
pru-*-*)
# No hosted I/O support.
noconfigdirs="$noconfigdirs target-libssp"
;;
rl78-*-*) rl78-*-*)
# libssp uses a misaligned load to trigger a fault, but the 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 # doesn't fault for those - instead, it gives a build-time error
@ -688,13 +679,17 @@ case "${target}" in
esac esac
# Disable libstdc++-v3 for some systems. # Disable libstdc++-v3 for some systems.
# Allow user to override this if they pass --enable-libstdc++-v3 # Allow user to override this if they pass --enable-libstdcxx
if test "${ENABLE_LIBSTDCXX}" = "default" ; then if test "${ENABLE_LIBSTDCXX}" = "default" ; then
case "${target}" in case "${target}" in
*-*-vxworks*) *-*-vxworks*)
# VxWorks uses the Dinkumware C++ library. # VxWorks uses the Dinkumware C++ library.
noconfigdirs="$noconfigdirs target-libstdc++-v3" noconfigdirs="$noconfigdirs target-libstdc++-v3"
;; ;;
amdgcn*-*-*)
# Not ported/fails to build when using newlib.
noconfigdirs="$noconfigdirs target-libstdc++-v3"
;;
arm*-wince-pe*) arm*-wince-pe*)
# the C++ libraries don't build on top of CE's C libraries # the C++ libraries don't build on top of CE's C libraries
noconfigdirs="$noconfigdirs target-libstdc++-v3" noconfigdirs="$noconfigdirs target-libstdc++-v3"
@ -702,18 +697,83 @@ if test "${ENABLE_LIBSTDCXX}" = "default" ; then
avr-*-*) avr-*-*)
noconfigdirs="$noconfigdirs target-libstdc++-v3" noconfigdirs="$noconfigdirs target-libstdc++-v3"
;; ;;
bpf-*-*)
noconfigdirs="$noconfigdirs target-libstdc++-v3"
;;
ft32-*-*) ft32-*-*)
noconfigdirs="$noconfigdirs target-libstdc++-v3" noconfigdirs="$noconfigdirs target-libstdc++-v3"
;; ;;
esac esac
fi fi
# 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 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
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. # Disable Fortran for some systems.
case "${target}" in case "${target}" in
mmix-*-*) mmix-*-*)
# See <http://gcc.gnu.org/ml/gcc-patches/2004-11/msg00572.html>. # See <http://gcc.gnu.org/ml/gcc-patches/2004-11/msg00572.html>.
unsupported_languages="$unsupported_languages fortran" unsupported_languages="$unsupported_languages fortran"
;; ;;
bpf-*-*)
unsupported_languages="$unsupported_languages fortran"
;;
esac esac
# Disable libffi for some systems. # Disable libffi for some systems.
@ -757,6 +817,12 @@ case "${target}" in
arm-wince-pe) arm-wince-pe)
noconfigdirs="$noconfigdirs target-libffi" noconfigdirs="$noconfigdirs target-libffi"
;; ;;
arm*-*-symbianelf*)
noconfigdirs="$noconfigdirs target-libffi"
;;
bpf-*-*)
noconfigdirs="$noconfigdirs target-libffi"
;;
cris-*-* | crisv32-*-*) cris-*-* | crisv32-*-*)
case "${target}" in case "${target}" in
*-*-linux*) *-*-linux*)
@ -803,7 +869,7 @@ esac
# Disable the go frontend on systems where it is known to not work. Please keep # Disable the go frontend on systems where it is known to not work. Please keep
# this in sync with contrib/config-list.mk. # this in sync with contrib/config-list.mk.
case "${target}" in case "${target}" in
*-*-darwin* | *-*-cygwin* | *-*-mingw*) *-*-darwin* | *-*-cygwin* | *-*-mingw* | bpf-* )
unsupported_languages="$unsupported_languages go" unsupported_languages="$unsupported_languages go"
;; ;;
esac esac
@ -835,6 +901,9 @@ if test x$enable_libgo = x; then
*-*-cygwin* | *-*-mingw*) *-*-cygwin* | *-*-mingw*)
noconfigdirs="$noconfigdirs target-libgo" noconfigdirs="$noconfigdirs target-libgo"
;; ;;
bpf-*-*)
noconfigdirs="$noconfigdirs target-libgo"
;;
esac esac
fi fi
@ -860,6 +929,9 @@ case "${target}" in
i[[3456789]]86-*-*) i[[3456789]]86-*-*)
libgloss_dir=i386 libgloss_dir=i386
;; ;;
loongarch*-*-*)
libgloss_dir=loongarch
;;
m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*) m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)
libgloss_dir=m68hc11 libgloss_dir=m68hc11
;; ;;
@ -872,6 +944,9 @@ case "${target}" in
powerpc*-*-*) powerpc*-*-*)
libgloss_dir=rs6000 libgloss_dir=rs6000
;; ;;
pru-*-*)
libgloss_dir=pru
;;
sparc*-*-*) sparc*-*-*)
libgloss_dir=sparc libgloss_dir=sparc
;; ;;
@ -903,6 +978,9 @@ case "${target}" in
sparc-*-sunos4*) sparc-*-sunos4*)
noconfigdirs="$noconfigdirs target-newlib target-libgloss" noconfigdirs="$noconfigdirs target-newlib target-libgloss"
;; ;;
bpf-*-*)
noconfigdirs="$noconfigdirs target-newlib target-libgloss"
;;
*-*-aix*) *-*-aix*)
noconfigdirs="$noconfigdirs target-newlib target-libgloss" noconfigdirs="$noconfigdirs target-newlib target-libgloss"
;; ;;
@ -951,6 +1029,8 @@ case "${target}" in
noconfigdirs="$noconfigdirs ld gas gdb gprof" noconfigdirs="$noconfigdirs ld gas gdb gprof"
noconfigdirs="$noconfigdirs sim target-rda" noconfigdirs="$noconfigdirs sim target-rda"
;; ;;
amdgcn*-*-*)
;;
arm-*-darwin*) arm-*-darwin*)
noconfigdirs="$noconfigdirs ld gas gdb gprof" noconfigdirs="$noconfigdirs ld gas gdb gprof"
noconfigdirs="$noconfigdirs sim target-rda" noconfigdirs="$noconfigdirs sim target-rda"
@ -974,7 +1054,8 @@ case "${target}" in
*-*-dragonfly*) *-*-dragonfly*)
;; ;;
*-*-freebsd*) *-*-freebsd*)
if test "x$with_gmp" = x && test "x$with_gmp_dir" = x \ if test "x$with_gmp" = x \
&& ! test -d ${srcdir}/gmp \
&& test -f /usr/local/include/gmp.h; then && test -f /usr/local/include/gmp.h; then
with_gmp=/usr/local with_gmp=/usr/local
fi fi
@ -1014,6 +1095,9 @@ case "${target}" in
# newlib is not 64 bit ready # newlib is not 64 bit ready
noconfigdirs="$noconfigdirs target-newlib target-libgloss" noconfigdirs="$noconfigdirs target-newlib target-libgloss"
;; ;;
bpf-*-*)
noconfigdirs="$noconfigdirs target-libobjc target-libbacktrace"
;;
sh*-*-pe|mips*-*-pe|*arm-wince-pe) sh*-*-pe|mips*-*-pe|*arm-wince-pe)
noconfigdirs="$noconfigdirs tcl tk itcl libgui sim" noconfigdirs="$noconfigdirs tcl tk itcl libgui sim"
;; ;;
@ -1232,6 +1316,11 @@ case "${target}" in
wasm32-*-*) wasm32-*-*)
noconfigdirs="$noconfigdirs ld" noconfigdirs="$noconfigdirs ld"
;; ;;
loongarch*-*-linux*)
;;
loongarch*-*-*)
noconfigdirs="$noconfigdirs gprof"
;;
esac esac
# If we aren't building newlib, then don't build libgloss, since libgloss # If we aren't building newlib, then don't build libgloss, since libgloss
@ -1267,7 +1356,7 @@ case "${host}" in
hppa*-*) hppa*-*)
host_makefile_frag="config/mh-pa" host_makefile_frag="config/mh-pa"
;; ;;
*-*-darwin*) i?86-*-darwin[[89]]* | i?86-*-darwin1[[0-7]]* | powerpc*-*-darwin*)
host_makefile_frag="config/mh-darwin" host_makefile_frag="config/mh-darwin"
;; ;;
powerpc-*-aix*) powerpc-*-aix*)
@ -1283,9 +1372,12 @@ if test "${build}" != "${host}" ; then
AR_FOR_BUILD=${AR_FOR_BUILD-ar} AR_FOR_BUILD=${AR_FOR_BUILD-ar}
AS_FOR_BUILD=${AS_FOR_BUILD-as} AS_FOR_BUILD=${AS_FOR_BUILD-as}
CC_FOR_BUILD=${CC_FOR_BUILD-gcc} CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
CPP_FOR_BUILD="${CPP_FOR_BUILD-\$(CC_FOR_BUILD) -E}"
CXX_FOR_BUILD=${CXX_FOR_BUILD-g++} CXX_FOR_BUILD=${CXX_FOR_BUILD-g++}
DSYMUTIL_FOR_BUILD=${DSYMUTIL_FOR_BUILD-dsymutil}
GFORTRAN_FOR_BUILD=${GFORTRAN_FOR_BUILD-gfortran} GFORTRAN_FOR_BUILD=${GFORTRAN_FOR_BUILD-gfortran}
GOC_FOR_BUILD=${GOC_FOR_BUILD-gccgo} GOC_FOR_BUILD=${GOC_FOR_BUILD-gccgo}
GDC_FOR_BUILD=${GDC_FOR_BUILD-gdc}
DLLTOOL_FOR_BUILD=${DLLTOOL_FOR_BUILD-dlltool} DLLTOOL_FOR_BUILD=${DLLTOOL_FOR_BUILD-dlltool}
LD_FOR_BUILD=${LD_FOR_BUILD-ld} LD_FOR_BUILD=${LD_FOR_BUILD-ld}
NM_FOR_BUILD=${NM_FOR_BUILD-nm} NM_FOR_BUILD=${NM_FOR_BUILD-nm}
@ -1297,8 +1389,10 @@ else
AS_FOR_BUILD="\$(AS)" AS_FOR_BUILD="\$(AS)"
CC_FOR_BUILD="\$(CC)" CC_FOR_BUILD="\$(CC)"
CXX_FOR_BUILD="\$(CXX)" CXX_FOR_BUILD="\$(CXX)"
DSYMUTIL_FOR_BUILD="\$(DSYMUTIL)"
GFORTRAN_FOR_BUILD="\$(GFORTRAN)" GFORTRAN_FOR_BUILD="\$(GFORTRAN)"
GOC_FOR_BUILD="\$(GOC)" GOC_FOR_BUILD="\$(GOC)"
GDC_FOR_BUILD="\$(GDC)"
DLLTOOL_FOR_BUILD="\$(DLLTOOL)" DLLTOOL_FOR_BUILD="\$(DLLTOOL)"
LD_FOR_BUILD="\$(LD)" LD_FOR_BUILD="\$(LD)"
NM_FOR_BUILD="\$(NM)" NM_FOR_BUILD="\$(NM)"
@ -1350,6 +1444,7 @@ int main() {}])],
fi fi
ACX_PROG_GNAT ACX_PROG_GNAT
ACX_PROG_GDC
ACX_PROG_CMP_IGNORE_INITIAL ACX_PROG_CMP_IGNORE_INITIAL
AC_ARG_ENABLE([bootstrap], AC_ARG_ENABLE([bootstrap],
@ -1395,10 +1490,17 @@ case "$have_compiler:$host:$target:$enable_bootstrap" in
;; ;;
esac esac
# When bootstrapping with GCC, build stage 1 in C++98 mode to ensure that a # When bootstrapping with GCC, build stage 1 in C++11 mode to ensure that a
# C++98 compiler can still start the bootstrap. # 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 if test "$enable_bootstrap:$GXX" = "yes:yes"; then
CXX="$CXX -std=gnu++98" 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
fi fi
AC_ARG_ENABLE([pgo-build], AC_ARG_ENABLE([pgo-build],
@ -1504,11 +1606,6 @@ fi
# Specify a location for mpfr # Specify a location for mpfr
# check for this first so it ends up on the link line before gmp. # 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, AC_ARG_WITH(mpfr,
[AS_HELP_STRING([--with-mpfr=PATH], [AS_HELP_STRING([--with-mpfr=PATH],
[specify prefix directory for installed MPFR package. [specify prefix directory for installed MPFR package.
@ -1548,11 +1645,6 @@ Building GCC with MPFR in the source tree is only handled for MPFR 3.1.0+.])
fi fi
# Specify a location for gmp # 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, AC_ARG_WITH(gmp,
[AS_HELP_STRING([--with-gmp=PATH], [AS_HELP_STRING([--with-gmp=PATH],
[specify prefix directory for the installed GMP package. [specify prefix directory for the installed GMP package.
@ -1616,12 +1708,12 @@ if test -d ${srcdir}/gcc && test "x$have_gmp" = xno; then
AC_MSG_CHECKING([for the correct version of mpfr.h]) AC_MSG_CHECKING([for the correct version of mpfr.h])
AC_TRY_COMPILE([#include <gmp.h> AC_TRY_COMPILE([#include <gmp.h>
#include <mpfr.h>],[ #include <mpfr.h>],[
#if MPFR_VERSION < MPFR_VERSION_NUM(2,4,0) #if MPFR_VERSION < MPFR_VERSION_NUM(3,1,0)
choke me choke me
#endif #endif
], [AC_TRY_COMPILE([#include <gmp.h> ], [AC_TRY_COMPILE([#include <gmp.h>
#include <mpfr.h>],[ #include <mpfr.h>],[
#if MPFR_VERSION < MPFR_VERSION_NUM(2,4,2) #if MPFR_VERSION < MPFR_VERSION_NUM(3,1,6)
choke me choke me
#endif #endif
], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])])], ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])])],
@ -1656,9 +1748,9 @@ if test -d ${srcdir}/gcc && test "x$have_gmp" = xno; then
int t; int t;
mpfr_init (n); mpfr_init (n);
mpfr_init (x); mpfr_init (x);
mpfr_atan2 (n, n, x, GMP_RNDN); mpfr_atan2 (n, n, x, MPFR_RNDN);
mpfr_erfc (n, x, GMP_RNDN); mpfr_erfc (n, x, MPFR_RNDN);
mpfr_subnormalize (x, t, GMP_RNDN); mpfr_subnormalize (x, t, MPFR_RNDN);
mpfr_clear(n); mpfr_clear(n);
mpfr_clear(x); mpfr_clear(x);
mpc_init2 (c, 53); mpc_init2 (c, 53);
@ -1676,11 +1768,11 @@ if test -d ${srcdir}/gcc && test "x$have_gmp" = xno; then
# The library versions listed in the error message below should match # The library versions listed in the error message below should match
# the HARD-minimums enforced above. # the HARD-minimums enforced above.
if test x$have_gmp != xyes; then if test x$have_gmp != xyes; then
AC_MSG_ERROR([Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+. 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 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 locations. Source code for these libraries can be found at
their respective hosting sites as well as at their respective hosting sites as well as at
ftp://gcc.gnu.org/pub/gcc/infrastructure/. See also https://gcc.gnu.org/pub/gcc/infrastructure/. See also
http://gcc.gnu.org/install/prerequisites.html for additional info. If http://gcc.gnu.org/install/prerequisites.html for additional info. If
you obtained GMP, MPFR and/or MPC from a vendor distribution package, you obtained GMP, MPFR and/or MPC from a vendor distribution package,
make sure that you have installed both the libraries and the header make sure that you have installed both the libraries and the header
@ -1855,7 +1947,20 @@ AC_SUBST(extra_linker_plugin_flags)
AC_ARG_ENABLE(host-shared, AC_ARG_ENABLE(host-shared,
[AS_HELP_STRING([--enable-host-shared], [AS_HELP_STRING([--enable-host-shared],
[build host code as shared libraries])], [build host code as shared libraries])],
[host_shared=$enableval], [host_shared=no]) [host_shared=$enableval
case $host in
x86_64-*-darwin* | aarch64-*-darwin*)
if test x$host_shared != xyes ; then
# PIC is the default, and actually cannot be switched off.
echo configure.ac: warning: PIC code is required for the configured target, host-shared setting ignored. 1>&2
host_shared=yes
fi ;;
*) ;;
esac],
[case $host in
x86_64-*-darwin* | aarch64-*-darwin*) host_shared=yes ;;
*) host_shared=no ;;
esac])
AC_SUBST(host_shared) AC_SUBST(host_shared)
# By default, C and C++ are the only stage 1 languages. # By default, C and C++ are the only stage 1 languages.
@ -2070,10 +2175,31 @@ if test -d ${srcdir}/gcc; then
;; ;;
esac esac
# Disable D if no preexisting GDC is available.
case ${add_this_lang}:${language}:${have_gdc} in
yes:d:no)
# Specifically requested language; tell them.
AC_MSG_ERROR([GDC is required to build $language])
;;
all:d:no)
AC_MSG_WARN([GDC is required to build $language])
add_this_lang=unsupported
;;
*:d:no)
# Silently disable.
add_this_lang=unsupported
;;
esac
# Disable jit if -enable-host-shared not specified # Disable jit if -enable-host-shared not specified
case ${add_this_lang}:${language}:${host_shared} in # but not if building for Mingw. All code in Windows
yes:jit:no) # is position independent code (PIC).
# PR jit/64780: explicitly specify --enable-host-shared case $target in
*mingw*) ;;
*)
case ${add_this_lang}:${language}:${host_shared} in
yes:jit:no)
# PR jit/64780: explicitly specify --enable-host-shared
AC_MSG_ERROR([ AC_MSG_ERROR([
Enabling language "jit" requires --enable-host-shared. Enabling language "jit" requires --enable-host-shared.
@ -2084,16 +2210,18 @@ If you want to build both the jit and the regular compiler, it is often
best to do this via two separate configure/builds, in separate best to do this via two separate configure/builds, in separate
directories, to avoid imposing the performance cost of directories, to avoid imposing the performance cost of
--enable-host-shared on the regular compiler.]) --enable-host-shared on the regular compiler.])
;; ;;
all:jit:no) all:jit:no)
AC_MSG_WARN([--enable-host-shared required to build $language]) AC_MSG_WARN([--enable-host-shared required to build $language])
add_this_lang=unsupported add_this_lang=unsupported
;; ;;
*:jit:no) *:jit:no)
# Silently disable. # Silently disable.
add_this_lang=unsupported add_this_lang=unsupported
;; ;;
esac esac
;;
esac
# Disable a language that is unsupported by the target. # Disable a language that is unsupported by the target.
case "${add_this_lang}: $unsupported_languages " in case "${add_this_lang}: $unsupported_languages " in
@ -2130,7 +2258,7 @@ directories, to avoid imposing the performance cost of
*) stage1_languages="${stage1_languages}${language}," ;; *) stage1_languages="${stage1_languages}${language}," ;;
esac esac
# We need to bootstrap any supporting libraries. # We need to bootstrap any supporting libraries.
bootstrap_target_libs="${bootstrap_target_libs}${target_libs}," bootstrap_target_libs=`echo "${bootstrap_target_libs}${target_libs}," | sed "s/ /,/g"`
;; ;;
esac esac
;; ;;
@ -2804,7 +2932,7 @@ fi
# or bootstrap-ubsan, bootstrap it. # or bootstrap-ubsan, bootstrap it.
if echo " ${target_configdirs} " | grep " libsanitizer " > /dev/null 2>&1; then if echo " ${target_configdirs} " | grep " libsanitizer " > /dev/null 2>&1; then
case "$BUILD_CONFIG" in case "$BUILD_CONFIG" in
*bootstrap-asan* | *bootstrap-ubsan* ) *bootstrap-hwasan* | *bootstrap-asan* | *bootstrap-ubsan* )
bootstrap_target_libs=${bootstrap_target_libs}target-libsanitizer, bootstrap_target_libs=${bootstrap_target_libs}target-libsanitizer,
bootstrap_fixincludes=yes bootstrap_fixincludes=yes
;; ;;
@ -2817,6 +2945,16 @@ if echo " ${target_configdirs} " | grep " libvtv " > /dev/null 2>&1 &&
bootstrap_target_libs=${bootstrap_target_libs}target-libvtv, bootstrap_target_libs=${bootstrap_target_libs}target-libvtv,
fi fi
# If we are building libatomic and the list of enabled languages includes the
# D frontend, bootstrap it.
if echo " ${target_configdirs} " | grep " libatomic " > /dev/null 2>&1; then
case ,${enable_languages}, in
*,d,*)
bootstrap_target_libs=${bootstrap_target_libs}target-libatomic,
;;
esac
fi
# Determine whether gdb needs tk/tcl or not. # Determine whether gdb needs tk/tcl or not.
# Use 'maybe' since enable_gdbtk might be true even if tk isn't available # Use 'maybe' since enable_gdbtk might be true even if tk isn't available
# and in that case we want gdb to be built without tk. Ugh! # and in that case we want gdb to be built without tk. Ugh!
@ -3354,6 +3492,17 @@ case "${target}" in
mep*) mep*)
FLAGS_FOR_TARGET="$FLAGS_FOR_TARGET -mlibrary" FLAGS_FOR_TARGET="$FLAGS_FOR_TARGET -mlibrary"
;; ;;
# The VxWorks support for shared libraries is getting in
# incrementally. Make sure it doesn't get activated implicitly:
*vxworks*)
if test "${enable_shared-unset}" = unset ; then
enable_shared=no
# So the build of libraries knows ...
target_configargs="${target_configargs} --disable-shared"
# So gcc knows ...
host_configargs="${host_configargs} --disable-shared"
fi
;;
esac esac
# Makefile fragments. # Makefile fragments.
@ -3396,12 +3545,15 @@ AC_SUBST(AR_FOR_BUILD)
AC_SUBST(AS_FOR_BUILD) AC_SUBST(AS_FOR_BUILD)
AC_SUBST(CC_FOR_BUILD) AC_SUBST(CC_FOR_BUILD)
AC_SUBST(CFLAGS_FOR_BUILD) AC_SUBST(CFLAGS_FOR_BUILD)
AC_SUBST(CPP_FOR_BUILD)
AC_SUBST(CPPFLAGS_FOR_BUILD) AC_SUBST(CPPFLAGS_FOR_BUILD)
AC_SUBST(CXXFLAGS_FOR_BUILD) AC_SUBST(CXXFLAGS_FOR_BUILD)
AC_SUBST(CXX_FOR_BUILD) AC_SUBST(CXX_FOR_BUILD)
AC_SUBST(DLLTOOL_FOR_BUILD) AC_SUBST(DLLTOOL_FOR_BUILD)
AC_SUBST(DSYMUTIL_FOR_BUILD)
AC_SUBST(GFORTRAN_FOR_BUILD) AC_SUBST(GFORTRAN_FOR_BUILD)
AC_SUBST(GOC_FOR_BUILD) AC_SUBST(GOC_FOR_BUILD)
AC_SUBST(GDC_FOR_BUILD)
AC_SUBST(LDFLAGS_FOR_BUILD) AC_SUBST(LDFLAGS_FOR_BUILD)
AC_SUBST(LD_FOR_BUILD) AC_SUBST(LD_FOR_BUILD)
AC_SUBST(NM_FOR_BUILD) AC_SUBST(NM_FOR_BUILD)
@ -3478,6 +3630,7 @@ esac
NCN_STRICT_CHECK_TOOLS(AR, ar) NCN_STRICT_CHECK_TOOLS(AR, ar)
NCN_STRICT_CHECK_TOOLS(AS, as) NCN_STRICT_CHECK_TOOLS(AS, as)
NCN_STRICT_CHECK_TOOLS(DLLTOOL, dlltool) NCN_STRICT_CHECK_TOOLS(DLLTOOL, dlltool)
NCN_STRICT_CHECK_TOOLS(DSYMUTIL, dsymutil)
NCN_STRICT_CHECK_TOOLS(LD, ld) NCN_STRICT_CHECK_TOOLS(LD, ld)
NCN_STRICT_CHECK_TOOLS(LIPO, lipo) NCN_STRICT_CHECK_TOOLS(LIPO, lipo)
NCN_STRICT_CHECK_TOOLS(NM, nm) NCN_STRICT_CHECK_TOOLS(NM, nm)
@ -3487,12 +3640,14 @@ NCN_STRICT_CHECK_TOOLS(WINDRES, windres)
NCN_STRICT_CHECK_TOOLS(WINDMC, windmc) NCN_STRICT_CHECK_TOOLS(WINDMC, windmc)
NCN_STRICT_CHECK_TOOLS(OBJCOPY, objcopy) NCN_STRICT_CHECK_TOOLS(OBJCOPY, objcopy)
NCN_STRICT_CHECK_TOOLS(OBJDUMP, objdump) NCN_STRICT_CHECK_TOOLS(OBJDUMP, objdump)
NCN_STRICT_CHECK_TOOLS(OTOOL, otool)
NCN_STRICT_CHECK_TOOLS(READELF, readelf) NCN_STRICT_CHECK_TOOLS(READELF, readelf)
AC_SUBST(CC) AC_SUBST(CC)
AC_SUBST(CXX) AC_SUBST(CXX)
AC_SUBST(CFLAGS) AC_SUBST(CFLAGS)
AC_SUBST(CXXFLAGS) AC_SUBST(CXXFLAGS)
AC_SUBST(PKG_CONFIG_PATH) AC_SUBST(GDC)
AC_SUBST(GDCFLAGS)
GCC_PLUGIN_OPTION(PLUGIN_OPTION) GCC_PLUGIN_OPTION(PLUGIN_OPTION)
AR_PLUGIN_OPTION= AR_PLUGIN_OPTION=
@ -3504,10 +3659,6 @@ if test -n "$PLUGIN_OPTION"; then
if $RANLIB --help 2>&1 | grep -q "\--plugin"; then if $RANLIB --help 2>&1 | grep -q "\--plugin"; then
RANLIB_PLUGIN_OPTION="$PLUGIN_OPTION" RANLIB_PLUGIN_OPTION="$PLUGIN_OPTION"
fi fi
else
if test "$enable_pgo_build" != "no"; then
AC_MSG_ERROR([AR with --plugin and rc is required for LTO build])
fi
fi fi
AC_SUBST(AR_PLUGIN_OPTION) AC_SUBST(AR_PLUGIN_OPTION)
AC_SUBST(RANLIB_PLUGIN_OPTION) AC_SUBST(RANLIB_PLUGIN_OPTION)
@ -3530,15 +3681,18 @@ NCN_STRICT_CHECK_TARGET_TOOLS(CXX_FOR_TARGET, c++ g++ cxx gxx)
NCN_STRICT_CHECK_TARGET_TOOLS(GCC_FOR_TARGET, gcc, ${CC_FOR_TARGET}) NCN_STRICT_CHECK_TARGET_TOOLS(GCC_FOR_TARGET, gcc, ${CC_FOR_TARGET})
NCN_STRICT_CHECK_TARGET_TOOLS(GFORTRAN_FOR_TARGET, gfortran) NCN_STRICT_CHECK_TARGET_TOOLS(GFORTRAN_FOR_TARGET, gfortran)
NCN_STRICT_CHECK_TARGET_TOOLS(GOC_FOR_TARGET, gccgo) NCN_STRICT_CHECK_TARGET_TOOLS(GOC_FOR_TARGET, gccgo)
NCN_STRICT_CHECK_TARGET_TOOLS(GDC_FOR_TARGET, gdc)
ACX_CHECK_INSTALLED_TARGET_TOOL(AR_FOR_TARGET, ar) ACX_CHECK_INSTALLED_TARGET_TOOL(AR_FOR_TARGET, ar)
ACX_CHECK_INSTALLED_TARGET_TOOL(AS_FOR_TARGET, as) ACX_CHECK_INSTALLED_TARGET_TOOL(AS_FOR_TARGET, as)
ACX_CHECK_INSTALLED_TARGET_TOOL(DLLTOOL_FOR_TARGET, dlltool) ACX_CHECK_INSTALLED_TARGET_TOOL(DLLTOOL_FOR_TARGET, dlltool)
ACX_CHECK_INSTALLED_TARGET_TOOL(DSYMUTIL_FOR_TARGET, dsymutil)
ACX_CHECK_INSTALLED_TARGET_TOOL(LD_FOR_TARGET, ld) ACX_CHECK_INSTALLED_TARGET_TOOL(LD_FOR_TARGET, ld)
ACX_CHECK_INSTALLED_TARGET_TOOL(LIPO_FOR_TARGET, lipo) ACX_CHECK_INSTALLED_TARGET_TOOL(LIPO_FOR_TARGET, lipo)
ACX_CHECK_INSTALLED_TARGET_TOOL(NM_FOR_TARGET, nm) ACX_CHECK_INSTALLED_TARGET_TOOL(NM_FOR_TARGET, nm)
ACX_CHECK_INSTALLED_TARGET_TOOL(OBJCOPY_FOR_TARGET, objcopy) ACX_CHECK_INSTALLED_TARGET_TOOL(OBJCOPY_FOR_TARGET, objcopy)
ACX_CHECK_INSTALLED_TARGET_TOOL(OBJDUMP_FOR_TARGET, objdump) ACX_CHECK_INSTALLED_TARGET_TOOL(OBJDUMP_FOR_TARGET, objdump)
ACX_CHECK_INSTALLED_TARGET_TOOL(OTOOL_FOR_TARGET, otool)
ACX_CHECK_INSTALLED_TARGET_TOOL(RANLIB_FOR_TARGET, ranlib) ACX_CHECK_INSTALLED_TARGET_TOOL(RANLIB_FOR_TARGET, ranlib)
ACX_CHECK_INSTALLED_TARGET_TOOL(READELF_FOR_TARGET, readelf) ACX_CHECK_INSTALLED_TARGET_TOOL(READELF_FOR_TARGET, readelf)
ACX_CHECK_INSTALLED_TARGET_TOOL(STRIP_FOR_TARGET, strip) ACX_CHECK_INSTALLED_TARGET_TOOL(STRIP_FOR_TARGET, strip)
@ -3558,16 +3712,20 @@ GCC_TARGET_TOOL(c++ for libstdc++, RAW_CXX_FOR_TARGET, CXX,
[gcc/xgcc -shared-libgcc -B$$r/$(HOST_SUBDIR)/gcc -nostdinc++ -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs], [gcc/xgcc -shared-libgcc -B$$r/$(HOST_SUBDIR)/gcc -nostdinc++ -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs],
c++) c++)
GCC_TARGET_TOOL(dlltool, DLLTOOL_FOR_TARGET, DLLTOOL, [binutils/dlltool]) GCC_TARGET_TOOL(dlltool, DLLTOOL_FOR_TARGET, DLLTOOL, [binutils/dlltool])
GCC_TARGET_TOOL(dsymutil, DSYMUTIL_FOR_TARGET, DSYMUTIL)
GCC_TARGET_TOOL(gcc, GCC_FOR_TARGET, , [gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/]) GCC_TARGET_TOOL(gcc, GCC_FOR_TARGET, , [gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/])
GCC_TARGET_TOOL(gfortran, GFORTRAN_FOR_TARGET, GFORTRAN, GCC_TARGET_TOOL(gfortran, GFORTRAN_FOR_TARGET, GFORTRAN,
[gcc/gfortran -B$$r/$(HOST_SUBDIR)/gcc/], fortran) [gcc/gfortran -B$$r/$(HOST_SUBDIR)/gcc/], fortran)
GCC_TARGET_TOOL(gccgo, GOC_FOR_TARGET, GOC, GCC_TARGET_TOOL(gccgo, GOC_FOR_TARGET, GOC,
[gcc/gccgo -B$$r/$(HOST_SUBDIR)/gcc/], go) [gcc/gccgo -B$$r/$(HOST_SUBDIR)/gcc/], go)
GCC_TARGET_TOOL(gdc, GDC_FOR_TARGET, GDC,
[gcc/gdc -B$$r/$(HOST_SUBDIR)/gcc/], d)
GCC_TARGET_TOOL(ld, LD_FOR_TARGET, LD, [ld/ld-new]) GCC_TARGET_TOOL(ld, LD_FOR_TARGET, LD, [ld/ld-new])
GCC_TARGET_TOOL(lipo, LIPO_FOR_TARGET, LIPO) GCC_TARGET_TOOL(lipo, LIPO_FOR_TARGET, LIPO)
GCC_TARGET_TOOL(nm, NM_FOR_TARGET, NM, [binutils/nm-new]) GCC_TARGET_TOOL(nm, NM_FOR_TARGET, NM, [binutils/nm-new])
GCC_TARGET_TOOL(objcopy, OBJCOPY_FOR_TARGET, OBJCOPY, [binutils/objcopy]) GCC_TARGET_TOOL(objcopy, OBJCOPY_FOR_TARGET, OBJCOPY, [binutils/objcopy])
GCC_TARGET_TOOL(objdump, OBJDUMP_FOR_TARGET, OBJDUMP, [binutils/objdump]) GCC_TARGET_TOOL(objdump, OBJDUMP_FOR_TARGET, OBJDUMP, [binutils/objdump])
GCC_TARGET_TOOL(otool, OTOOL_FOR_TARGET, OTOOL)
GCC_TARGET_TOOL(ranlib, RANLIB_FOR_TARGET, RANLIB, [binutils/ranlib]) GCC_TARGET_TOOL(ranlib, RANLIB_FOR_TARGET, RANLIB, [binutils/ranlib])
GCC_TARGET_TOOL(readelf, READELF_FOR_TARGET, READELF, [binutils/readelf]) GCC_TARGET_TOOL(readelf, READELF_FOR_TARGET, READELF, [binutils/readelf])
GCC_TARGET_TOOL(strip, STRIP_FOR_TARGET, STRIP, [binutils/strip-new]) GCC_TARGET_TOOL(strip, STRIP_FOR_TARGET, STRIP, [binutils/strip-new])
@ -3690,8 +3848,8 @@ AC_SUBST(stage2_werror_flag)
compare_exclusions="gcc/cc*-checksum\$(objext) | gcc/ada/*tools/*" compare_exclusions="gcc/cc*-checksum\$(objext) | gcc/ada/*tools/*"
case "$target" in case "$target" in
hppa*64*-*-hpux*) ;; hppa*64*-*-hpux*) ;;
hppa*-*-hpux*) compare_exclusions="gcc/cc*-checksum\$(objext) | */libgcc/lib2funcs* | gcc/ada/*tools/* | gcc/function-tests.o" ;; hppa*-*-hpux*) compare_exclusions="$compare_exclusions | */libgcc/lib2funcs* | gcc/function-tests.o" ;;
powerpc*-ibm-aix*) compare_exclusions="gcc/cc*-checksum\$(objext) | gcc/ada/*tools/* | *libgomp*\$(objext)" ;; powerpc*-ibm-aix*) compare_exclusions="$compare_exclusions | *libgomp*\$(objext)" ;;
esac esac
AC_SUBST(compare_exclusions) AC_SUBST(compare_exclusions)