aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-02-09 10:04:37 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-02-09 10:04:37 +0000
commit896a33677ab75df338ed107c55a602e7cfa043fa (patch)
tree870ceee1b323bed930111c182e3ee0ad1cb650de /CMakeLists.txt
parent36193952d085c70eee36444a300eb3111ee9e22e (diff)
downloadrspamd-896a33677ab75df338ed107c55a602e7cfa043fa.tar.gz
rspamd-896a33677ab75df338ed107c55a602e7cfa043fa.zip
More precise detection of pthread_mutexattr_setpshared.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt20
1 files changed, 19 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e6e11fd9d..6ca788594 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -754,7 +754,25 @@ CHECK_SYMBOL_EXISTS(_SC_NPROCESSORS_ONLN unistd.h HAVE_SC_NPROCESSORS_ONLN)
CHECK_SYMBOL_EXISTS(setbit sys/param.h PARAM_H_HAS_BITSET)
CHECK_SYMBOL_EXISTS(getaddrinfo "sys/types.h;sys/socket.h;netdb.h" HAVE_GETADDRINFO)
CHECK_SYMBOL_EXISTS(sched_yield "sched.h" HAVE_SCHED_YIELD)
-CHECK_SYMBOL_EXISTS(pthread_mutexattr_setpshared "pthread.h" HAVE_PTHREAD_PROCESS_SHARED)
+
+FILE(WRITE ${CMAKE_BINARY_DIR}/pthread_setpshared.c "
+#include <pthread.h>
+#include <stdlib.h>
+int main (void)
+{
+ pthread_mutex_attr_t mattr;
+ if (pthread_mutexattr_init(&mattr) != 0) return 0;
+ if (pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED) != 0) return 0;
+ return 1;
+}
+")
+TRY_RUN(HAVE_PTHREAD_PROCESS_SHARED _CAN_COMPILE
+ "${CMAKE_BINARY_DIR}" "${CMAKE_BINARY_DIR}/pthread_setpshared.c")
+IF(HAVE_PTHREAD_PROCESS_SHARED)
+ MESSAGE(STATUS "pthread_mutexattr_setpshared is supported")
+ELSE(HAVE_PTHREAD_PROCESS_SHARED)
+ MESSAGE(STATUS "pthread_mutexattr_setpshared is -NOT- supported")
+ENDIF(HAVE_PTHREAD_PROCESS_SHARED)
IF(NOT HAVE_GETADDRINFO)
MESSAGE(FATAL_ERROR "Your system does not support getaddrinfo call, please consider upgrading it to run rspamd")