Skip to content
Snippets Groups Projects
Commit e08afee7 authored by Jö Fahlke's avatar Jö Fahlke
Browse files

[buildsystem] Check for std::thread.

parent db500f83
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,7 @@
# HAVE_VARIADIC_TEMPLATES True if variadic templates are supprt
# HAVE_VARIADIC_CONSTRUCTOR_SFINAE True if variadic constructor sfinae is supported
# HAVE_RVALUE_REFERENCES True if rvalue references are supported
# HAVE_STD_THREAD True if std::thread is supported
include(CMakePushCheckState)
cmake_push_check_state()
......@@ -311,4 +312,21 @@ CHECK_CXX_SOURCE_COMPILES("
" HAVE_INITIALIZER_LIST
)
# std::thread
CHECK_CXX_SOURCE_COMPILES("
#include <thread>
void f()
{
// do nothing
}
int main()
{
std::thread t(f);
t.join();
}
" HAVE_STD_THREAD
)
cmake_pop_check_state()
......@@ -27,6 +27,7 @@ install(PROGRAMS
dune_docu.m4
dune_linkcxx.m4
dune_mpi.m4
dune_std_thread.m4
dune_streams.m4
dune_tr1_headers.m4
dune_unused.m4
......
......@@ -31,6 +31,7 @@ ALLM4S = \
dune_docu.m4 \
dune_linkcxx.m4 \
dune_mpi.m4 \
dune_std_thread.m4 \
dune_streams.m4 \
dune_tr1_headers.m4 \
dune_unused.m4 \
......
# tests for C++11 class std::thread
# the associated macro is called HAVE_STD_THREAD
# the automake conditional is STD_THREAD
AC_DEFUN([DUNE_STD_THREAD],[
AC_REQUIRE([GXX0X])
AC_CACHE_CHECK([whether std::thread is supported], [dune_cv_std_thread_supported], [
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#include <thread>
void f()
{
// do nothing
}
]],
[[
std::thread t(f);
t.join();
]])],
[dune_cv_std_thread_supported=yes],
[dune_cv_std_thread_supported=no])
AC_LANG_POP([C++])
])
if test "x$dune_cv_std_thread_supported" = xyes; then
AC_DEFINE([HAVE_STD_THREAD], [1], [Define to 1 if std::thread is supported])
fi
AM_CONDITIONAL([STD_THREAD], [test "x$dune_cv_std_thread_supported" = xyes])
])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment