]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[918-check-c-11-thread-support-in-configure] Added checks for C++11 thread, mutex...
authorFrancis Dupont <fdupont@isc.org>
Sat, 21 Sep 2019 13:50:29 +0000 (15:50 +0200)
committerFrancis Dupont <fdupont@isc.org>
Fri, 27 Sep 2019 08:23:34 +0000 (10:23 +0200)
m4macros/ax_cpp11.m4

index 17fbda1809df1a836889db02ae2227afb795ac31..aae1668d429609903519ce2b176be473a59662ac 100644 (file)
@@ -173,10 +173,45 @@ for retry in "none" "--std=c++11" "--std=c++0x" "--std=c++1x" "fail"; do
                [AC_LANG_PROGRAM(
                        [],
                        [auto myincr = [[]](int x) { return x + 1; };])],
-               [AC_MSG_RESULT([yes])
-                break],
+               [AC_MSG_RESULT([yes])],
                [AC_MSG_RESULT([no])
                 continue])
+
+       AC_MSG_CHECKING(thread support)
+       feature="thread"
+       AC_COMPILE_IFELSE(
+               [AC_LANG_PROGRAM(
+                       [#include <thread>
+                        std::shared_ptr<std::thread> th;],
+                       [th.reset(new std::thread([[]]() { return; }));
+                        th->join();])],
+               [AC_MSG_RESULT([yes])],
+                [AC_MSG_RESULT([no])
+                 continue])
+
+       AC_MSG_CHECKING(mutex support)
+       feature="mutex"
+       AC_COMPILE_IFELSE(
+               [AC_LANG_PROGRAM(
+                       [#include <mutex>
+                        std::mutex mtx;],
+                       [std::lock_guard<std::mutex> lock(mtx);])],
+               [AC_MSG_RESULT([yes])],
+                [AC_MSG_RESULT([no])
+                 continue])
+                        
+       AC_MSG_CHECKING(atomic support)
+       feature="atomic"
+       AC_COMPILE_IFELSE(
+               [AC_LANG_PROGRAM(
+                       [#include <atomic>
+                        std::atomic_flag flag;],
+                       [])],
+               [AC_MSG_RESULT([yes])
+                 break],
+               [AC_MSG_RESULT([no])
+                 continue])
+
 done
 
 ])dnl AX_ISC_RPATH