cmake/sdlchecks.cmake
changeset 7078 a2bddc1fb02f
parent 6674 45a21e50ba5e
child 7182 1089a8a701c3
equal deleted inserted replaced
7077:f8e3dcefed59 7078:a2bddc1fb02f
   549 # PTHREAD_LIBS
   549 # PTHREAD_LIBS
   550 macro(CheckPTHREAD)
   550 macro(CheckPTHREAD)
   551   if(PTHREADS)
   551   if(PTHREADS)
   552     if(LINUX)
   552     if(LINUX)
   553       set(PTHREAD_CFLAGS "-D_REENTRANT")
   553       set(PTHREAD_CFLAGS "-D_REENTRANT")
   554       set(PTHREAD_LDFLAGS "-lpthread")
   554       set(PTHREAD_LDFLAGS "-pthread")
   555     elseif(BSDI)
   555     elseif(BSDI)
   556       set(PTHREAD_CFLAGS "-D_REENTRANT -D_THREAD_SAFE")
   556       set(PTHREAD_CFLAGS "-D_REENTRANT -D_THREAD_SAFE")
   557       set(PTHREAD_LDFLAGS "")
   557       set(PTHREAD_LDFLAGS "")
   558     elseif(DARWIN)
   558     elseif(DARWIN)
   559       set(PTHREAD_CFLAGS "-D_THREAD_SAFE")
   559       set(PTHREAD_CFLAGS "-D_THREAD_SAFE")
   605       check_c_source_compiles("
   605       check_c_source_compiles("
   606         #include <pthread.h>
   606         #include <pthread.h>
   607         int main(int argc, char **argv) {
   607         int main(int argc, char **argv) {
   608           pthread_mutexattr_t attr;
   608           pthread_mutexattr_t attr;
   609           pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
   609           pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
       
   610           return 0;
   610         }" HAVE_RECURSIVE_MUTEXES)
   611         }" HAVE_RECURSIVE_MUTEXES)
   611       if(HAVE_RECURSIVE_MUTEXES)
   612       if(HAVE_RECURSIVE_MUTEXES)
   612         set(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1)
   613         set(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1)
   613       else(HAVE_RECURSIVE_MUTEXES)
   614       else(HAVE_RECURSIVE_MUTEXES)
   614         check_c_source_compiles("
   615         check_c_source_compiles("
   615             #include <pthread.h>
   616             #include <pthread.h>
   616             int main(int argc, char **argv) {
   617             int main(int argc, char **argv) {
   617               pthread_mutexattr_t attr;
   618               pthread_mutexattr_t attr;
   618               pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
   619               pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
       
   620               return 0;
   619             }" HAVE_RECURSIVE_MUTEXES_NP)
   621             }" HAVE_RECURSIVE_MUTEXES_NP)
   620         if(HAVE_RECURSIVE_MUTEXES_NP)
   622         if(HAVE_RECURSIVE_MUTEXES_NP)
   621           set(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1)
   623           set(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1)
   622         endif(HAVE_RECURSIVE_MUTEXES_NP)
   624         endif(HAVE_RECURSIVE_MUTEXES_NP)
   623       endif(HAVE_RECURSIVE_MUTEXES)
   625       endif(HAVE_RECURSIVE_MUTEXES)
   624 
   626 
   625       if(PTHREADS_SEM)
   627       if(PTHREADS_SEM)
   626         check_c_source_compiles("#include <pthread.h>
   628         check_c_source_compiles("#include <pthread.h>
   627                                  #include <semaphore.h>" HAVE_PTHREADS_SEM)
   629                                  #include <semaphore.h>
       
   630                                  int main(int argc, char **argv) { return 0; }" HAVE_PTHREADS_SEM)
   628         if(HAVE_PTHREADS_SEM)
   631         if(HAVE_PTHREADS_SEM)
   629           check_c_source_compiles("
   632           check_c_source_compiles("
   630               #include <pthread.h>
   633               #include <pthread.h>
   631               #include <semaphore.h>
   634               #include <semaphore.h>
   632               int main(int argc, char **argv) {
   635               int main(int argc, char **argv) {