From: Francis Dupont Date: Thu, 8 Mar 2018 14:09:37 +0000 (+0100) Subject: [5560] Added enum class and range-for tests X-Git-Tag: trac5631_base~13^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d37958badff741dfaa376c30ac9281eb33d9b44a;p=thirdparty%2Fkea.git [5560] Added enum class and range-for tests --- diff --git a/m4macros/ax_cpp11.m4 b/m4macros/ax_cpp11.m4 index 9f3025ebff..17fbda1809 100644 --- a/m4macros/ax_cpp11.m4 +++ b/m4macros/ax_cpp11.m4 @@ -138,6 +138,35 @@ for retry in "none" "--std=c++11" "--std=c++0x" "--std=c++1x" "fail"; do [AC_MSG_RESULT([no]) continue]) + AC_MSG_CHECKING(enum class support) + feature="enum class" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [enum class FooBar { + FOO = 1, + BAR = 2 + };], + [FooBar f = FooBar::FOO; + return (f == FooBar::FOO ? 1 : 2);])], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + continue]) + + AC_MSG_CHECKING(range-for support) + feature="constexpr" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [#include + std::vector v = { 1, 2, 3, 4 };], + [int sum = 0; + for (auto i : v) { + sum += i; + } + return sum;])], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + continue]) + AC_MSG_CHECKING(lambda support) feature="lambda" AC_COMPILE_IFELSE(