configure: add checks for used c++11 features

This commit is contained in:
Andrzej Rybczak
2012-09-02 21:29:47 +02:00
parent 594f73c626
commit 3b0756eb2f

View File

@@ -50,10 +50,40 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]])],
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
std_cpp0x="-std=c++0x", std_cpp0x="-std=c++0x",
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
AC_MSG_ERROR([[Your compiler doesn't seem to support C++0x, please upgrade (GCC >= 4.4)]]) AC_MSG_ERROR([[Your compiler doesn't seem to support C++0x, please upgrade (GCC >= 4.5)]])
) )
CXXFLAGS="$old_CXXFLAGS $std_cpp0x" CXXFLAGS="$old_CXXFLAGS $std_cpp0x"
dnl ==========================================
dnl = checking for initializer lists support =
dnl ==========================================
AC_MSG_CHECKING([whether compiler supports initializer lists])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <vector>], [[std::vector<int> test = { 1, 2, 3 }; test.push_back(4);]])],
AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no])
AC_MSG_ERROR([[Your compiler doesn't seem to support initializer lists, please upgrade (GCC >= 4.5)]])
)
dnl =====================================
dnl = checking for auto keyword support =
dnl =====================================
AC_MSG_CHECKING([whether compiler supports auto keyword])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[auto test = new int; *test = 1;]])],
AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no])
AC_MSG_ERROR([[Your compiler doesn't seem to support auto keyword, please upgrade (GCC >= 4.5)]])
)
dnl =========================================
dnl = checking for lambda functions support =
dnl =========================================
AC_MSG_CHECKING([whether compiler supports lambda functions])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <functional>], [[int a = 5; std::function<int(int)> f = [&a](int b) { return a + b; }; f(8);]])],
AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no])
AC_MSG_ERROR([[Your compiler doesn't seem to support lambda functions, please upgrade (GCC >= 4.5)]])
)
dnl ============================== dnl ==============================
dnl = checking for regex (win32) = dnl = checking for regex (win32) =
dnl ============================== dnl ==============================