Fixes bug #1709, pthread tests fixes for CMake (Thanks Scott Percival!)
authorGabriel Jacobo <gabomdq@gmail.com>
Fri, 19 Apr 2013 13:25:39 -0300
changeset 7078 a2bddc1fb02f
parent 7077 f8e3dcefed59
child 7079 99d6803195fe
Fixes bug #1709, pthread tests fixes for CMake (Thanks Scott Percival!)
cmake/sdlchecks.cmake
--- a/cmake/sdlchecks.cmake	Fri Apr 19 11:58:38 2013 -0400
+++ b/cmake/sdlchecks.cmake	Fri Apr 19 13:25:39 2013 -0300
@@ -551,7 +551,7 @@
   if(PTHREADS)
     if(LINUX)
       set(PTHREAD_CFLAGS "-D_REENTRANT")
-      set(PTHREAD_LDFLAGS "-lpthread")
+      set(PTHREAD_LDFLAGS "-pthread")
     elseif(BSDI)
       set(PTHREAD_CFLAGS "-D_REENTRANT -D_THREAD_SAFE")
       set(PTHREAD_LDFLAGS "")
@@ -607,6 +607,7 @@
         int main(int argc, char **argv) {
           pthread_mutexattr_t attr;
           pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+          return 0;
         }" HAVE_RECURSIVE_MUTEXES)
       if(HAVE_RECURSIVE_MUTEXES)
         set(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1)
@@ -616,6 +617,7 @@
             int main(int argc, char **argv) {
               pthread_mutexattr_t attr;
               pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+              return 0;
             }" HAVE_RECURSIVE_MUTEXES_NP)
         if(HAVE_RECURSIVE_MUTEXES_NP)
           set(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1)
@@ -624,7 +626,8 @@
 
       if(PTHREADS_SEM)
         check_c_source_compiles("#include <pthread.h>
-                                 #include <semaphore.h>" HAVE_PTHREADS_SEM)
+                                 #include <semaphore.h>
+                                 int main(int argc, char **argv) { return 0; }" HAVE_PTHREADS_SEM)
         if(HAVE_PTHREADS_SEM)
           check_c_source_compiles("
               #include <pthread.h>