* configure.ac: Turn on C++11 flags.
This commit is contained in:
parent
2c05a9fdb6
commit
f3874e05cc
1 changed files with 47 additions and 0 deletions
47
configure.ac
47
configure.ac
|
|
@ -71,6 +71,53 @@ AX_CHECK_COMPILE_FLAG([-Werror -fvisibility=hidden],
|
|||
[CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"])])
|
||||
CXXFLAGS="$CXXFLAGS -DSPOT_BUILD"
|
||||
|
||||
# Turn on C++11 support
|
||||
AX_CHECK_COMPILE_FLAG([-std=c++11 -stdlib=libc++],
|
||||
[CXXFLAGS="$CXXFLAGS -std=c++11 -stdlib=libc++"
|
||||
stdpass=true])
|
||||
if ! "${stdpass-false}"; then
|
||||
AX_CHECK_COMPILE_FLAG([-std=c++11],
|
||||
[CXXFLAGS="$CXXFLAGS -std=c++11"
|
||||
stdpass=true])
|
||||
fi
|
||||
if ! "${stdpass-false}"; then
|
||||
AX_CHECK_COMPILE_FLAG([-std=c++0x],
|
||||
[CXXFLAGS="$CXXFLAGS -std=c++0x"
|
||||
stdpass=true])
|
||||
fi
|
||||
|
||||
if ! "${stdpass-false}"; then
|
||||
AC_ERROR([unable to turn on C++11 mode with this compiler])
|
||||
fi
|
||||
|
||||
m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [
|
||||
template <typename T>
|
||||
struct check
|
||||
{
|
||||
static_assert(sizeof(int) <= sizeof(T), "not big enough");
|
||||
};
|
||||
|
||||
typedef check<check<bool>> right_angle_brackets;
|
||||
|
||||
int a;
|
||||
decltype(a) b;
|
||||
|
||||
typedef check<int> check_type;
|
||||
check_type c;
|
||||
check_type&& cr = static_cast<check_type&&>(c);
|
||||
|
||||
auto d = a;
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([whether $CXX $CXXFLAGS supports C++11 features],
|
||||
[ax_cv_cxx_compile_cxx11],
|
||||
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
|
||||
[ax_cv_cxx_compile_cxx11=yes],
|
||||
[ax_cv_cxx_compile_cxx11=no])])
|
||||
|
||||
test "x$ax_cv_cxx_compile_cxx11" = xyes ||
|
||||
AC_ERROR([unable to compile C++11 with this compiler])
|
||||
|
||||
AC_HEADER_UNORDERED_MAP
|
||||
AC_HEADER_TR1_UNORDERED_MAP
|
||||
AC_HEADER_EXT_HASH_MAP
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue