Commit f3874e05 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

* configure.ac: Turn on C++11 flags.

parent 2c05a9fd
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment