summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2010-07-08 11:30:33 +0200
committerDavid Sommerseth <dazo@users.sourceforge.net>2010-07-08 11:30:33 +0200
commit6f8aaceabb37e350765bb1f2f895242cbf3e7521 (patch)
tree9f56a1cb6bb078ae077f0e235bd017574d01b154
parent844328ec655f4bc8169a2df4158f67953b292f50 (diff)
downloadeurephia-6f8aaceabb37e350765bb1f2f895242cbf3e7521.tar.gz
eurephia-6f8aaceabb37e350765bb1f2f895242cbf3e7521.tar.xz
eurephia-6f8aaceabb37e350765bb1f2f895242cbf3e7521.zip
Added extra checks for POSIX semaphore functions
On Fedora 13 and Rawhide, the sem_wait(), sem_timedwait() and sem_post() functions is no longer available in librt, only in libpthread. Added extra CMake checks to check if the functions are in libpthread if not found in librt.
-rw-r--r--plugin/CMakeLists.txt40
1 files changed, 31 insertions, 9 deletions
diff --git a/plugin/CMakeLists.txt b/plugin/CMakeLists.txt
index d644961..0b9381d 100644
--- a/plugin/CMakeLists.txt
+++ b/plugin/CMakeLists.txt
@@ -20,10 +20,37 @@
PROJECT(eurephia-auth C)
cmake_minimum_required(VERSION 2.6)
-# Check for librt functions which we use
-CHECK_LIBRARY_EXISTS(rt sem_wait "" HAVE_RT_SEM_WAIT)
-CHECK_LIBRARY_EXISTS(rt sem_timedwait "" HAVE_RT_SEM_TIMEDWAIT)
-CHECK_LIBRARY_EXISTS(rt sem_post "" HAVE_RT_SEM_POST)
+# Check for POSIX semaphore functions which we use
+CHECK_LIBRARY_EXISTS(rt sem_wait "" HAVE_SEM_WAIT)
+CHECK_LIBRARY_EXISTS(rt sem_timedwait "" HAVE_SEM_TIMEDWAIT)
+CHECK_LIBRARY_EXISTS(rt sem_post "" HAVE_SEM_POST)
+
+# Extra checks if sem_* functions is not found in librt, do not accept failures
+IF(NOT HAVE_SEM_WAIT)
+ message(STATUS "* sem_wait was not found in librt, trying libpthread")
+ CHECK_LIBRARY_EXISTS(pthread sem_wait "" HAVE_SEM_WAIT2)
+ IF(NOT HAVE_SEM_WAIT2)
+ message(FATAL_ERROR "Missing proper pthread semaphore support")
+ ENDIF(NOT HAVE_SEM_WAIT2)
+ENDIF(NOT HAVE_SEM_WAIT)
+
+IF(NOT HAVE_SEM_TIMEDWAIT)
+ message(STATUS "* sem_timedwait was not found in librt, trying libpthread")
+ CHECK_LIBRARY_EXISTS(pthread sem_timedwait "" HAVE_SEM_TIMEDWAIT2)
+ IF(NOT HAVE_SEM_TIMEDWAIT2)
+ message(FATAL_ERROR "Missing proper pthread semaphore support")
+ ENDIF(NOT HAVE_SEM_TIMEDWAIT2)
+ENDIF(NOT HAVE_SEM_TIMEDWAIT)
+
+IF(NOT HAVE_SEM_POST)
+ message(STATUS "* sem_post was not found in librt, trying libpthread")
+ CHECK_LIBRARY_EXISTS(pthread sem_post "" HAVE_SEM_POST2)
+ IF(NOT HAVE_SEM_POST2)
+ message(FATAL_ERROR "Missing proper pthread semaphore support")
+ ENDIF(NOT HAVE_SEM_POST2)
+ENDIF(NOT HAVE_SEM_POST)
+
+# Check for POSIX MQ functions which we use
CHECK_LIBRARY_EXISTS(rt mq_open "" HAVE_RT_MQ_OPEN)
CHECK_LIBRARY_EXISTS(rt mq_close "" HAVE_RT_MQ_CLOSE)
CHECK_LIBRARY_EXISTS(rt mq_unlink "" HAVE_RT_MQ_UNLINK)
@@ -31,11 +58,6 @@ CHECK_LIBRARY_EXISTS(rt mq_send "" HAVE_RT_MQ_SEND)
CHECK_LIBRARY_EXISTS(rt mq_receive "" HAVE_RT_MQ_RECEIVE)
CHECK_LIBRARY_EXISTS(rt mq_getattr "" HAVE_RT_MQ_GETATTR)
-# Fail if we're missing some features - semaphore functions
-IF(NOT HAVE_RT_SEM_WAIT OR NOT HAVE_RT_SEM_TIMEDWAIT OR NOT HAVE_RT_SEM_POST)
- message(FATAL_ERROR "Missing proper pthread semaphore support")
-ENDIF(NOT HAVE_RT_SEM_WAIT OR NOT HAVE_RT_SEM_TIMEDWAIT OR NOT HAVE_RT_SEM_POST)
-
# Fail if we're missing some features - Posix Message Queue functions
IF(NOT HAVE_RT_MQ_OPEN OR NOT HAVE_RT_MQ_CLOSE OR NOT HAVE_RT_MQ_UNLINK OR NOT HAVE_RT_MQ_SEND OR NOT HAVE_RT_MQ_RECEIVE OR NOT HAVE_RT_MQ_GETATTR)
message(FATAL_ERROR "Missing proper pthread message queue support")