| 1 |
# =========================================================================== |
| 2 |
# http://www.gnu.org/software/autoconf-archive/ax_cxx_have_thread.html |
| 3 |
# =========================================================================== |
| 4 |
# |
| 5 |
# SYNOPSIS |
| 6 |
# |
| 7 |
# AX_CXX_HAVE_THREAD() |
| 8 |
# |
| 9 |
# DESCRIPTION |
| 10 |
# |
| 11 |
# This macro checks if std::thread, added in C++11, is defined in the |
| 12 |
# <thread> header. |
| 13 |
# |
| 14 |
# If it is, define the ax_cv_cxx_have_thread environment variable to "yes" |
| 15 |
# and define HAVE_CXX_THREAD. |
| 16 |
# |
| 17 |
# CONTRIBUTING |
| 18 |
# |
| 19 |
# You can contribute changes on GitHub by forking this repository: |
| 20 |
# |
| 21 |
# https://github.com/emcrisostomo/CXX-Autoconf-Macros.git |
| 22 |
# |
| 23 |
# LICENSE |
| 24 |
# |
| 25 |
# Copyright (c) 2014 Enrico M. Crisostomo <[email protected]> |
| 26 |
# |
| 27 |
# Copying and distribution of this file, with or without modification, are |
| 28 |
# permitted in any medium without royalty provided the copyright notice |
| 29 |
# and this notice are preserved. This file is offered as-is, without any |
| 30 |
# warranty. |
| 31 |
|
| 32 |
#serial 1 |
| 33 |
|
| 34 |
AC_DEFUN([AX_CXX_HAVE_THREAD], |
| 35 |
[AC_CACHE_CHECK( |
| 36 |
[for std::thread in thread], |
| 37 |
ax_cv_cxx_have_thread, |
| 38 |
[dnl |
| 39 |
AC_LANG_PUSH([C++]) |
| 40 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
| 41 |
[ |
| 42 |
[#include <thread>] |
| 43 |
[using namespace std;] |
| 44 |
[thread t;] |
| 45 |
], |
| 46 |
[] |
| 47 |
)], |
| 48 |
[ax_cv_cxx_have_thread=yes], |
| 49 |
[ax_cv_cxx_have_thread=no] |
| 50 |
) |
| 51 |
AC_LANG_POP([C++])]) |
| 52 |
if test x"$ax_cv_cxx_have_thread" = "xyes" |
| 53 |
then |
| 54 |
AC_DEFINE(HAVE_CXX_THREAD, |
| 55 |
1, |
| 56 |
[Define if thread defines the std::thread class.]) |
| 57 |
fi |
| 58 |
]) |