diff --git a/configure.ac b/configure.ac index b0c7e08..11adbca 100644 --- a/configure.ac +++ b/configure.ac @@ -39,8 +39,10 @@ AC_ENABLE_CXXMPH if test x$cxxmph = xtrue; then AC_COMPILE_STDCXX_0X if test x$ac_cv_cxx_compile_cxx0x_native = "xno"; then - if test x$ac_cv_cxx_compile_cxx0x_cxx = "xyes"; then + if test x$ac_cv_cxx_compile_cxx11_cxx = "xyes"; then CXXFLAGS="$CXXFLAGS -std=c++11" + elif test x$ac_cv_cxx_compile_cxx0x_cxx = "xyes"; then + CXXFLAGS="$CXXFLAGS -std=c++0x" elif test x$ac_cv_cxx_compile_cxx0x_gxx = "xyes"; then CXXFLAGS="$CXXFLAGS -std=gnu++0x" else diff --git a/m4/cxx0x.m4 b/m4/cxx0x.m4 index 27a33d1..3726854 100644 --- a/m4/cxx0x.m4 +++ b/m4/cxx0x.m4 @@ -23,6 +23,30 @@ AC_DEFUN([AC_COMPILE_STDCXX_0X], [ AC_LANG_RESTORE ]) + AC_CACHE_CHECK(if compiler supports C++0x features with -std=c++11, + ac_cv_cxx_compile_cxx11_cxx, + [AC_LANG_SAVE + AC_LANG_CPLUSPLUS + ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS -std=c++11" + AC_TRY_COMPILE([ + #include + template + struct check + { + static_assert(sizeof(int) <= sizeof(T), "not big enough"); + }; + + typedef check> right_angle_brackets; + + int a; + decltype(a) b;],, + ac_cv_cxx_compile_cxx11_cxx=yes, ac_cv_cxx_compile_cxx11_cxx=no) + CXXFLAGS="$ac_save_CXXFLAGS" + AC_LANG_RESTORE + ]) + + AC_CACHE_CHECK(if compiler supports C++0x features with -std=c++0x, ac_cv_cxx_compile_cxx0x_cxx, [AC_LANG_SAVE