# Checks for header libraries functions.
CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_DLOPEN_IN_LIBDL)
CHECK_LIBRARY_EXISTS(execinfo backtrace "" HAVE_BACKTRACE_IN_LIBEXECINFO)
-CHECK_LIBRARY_EXISTS(pthread pthread_create "" pthread)
+CHECK_LIBRARY_EXISTS(pthread pthread_create "" HAVE_PTHREAD)
CHECK_LIBRARY_EXISTS(pthread sem_init "" HAVE_SEM_INIT_LIB)
CHECK_LIBRARY_EXISTS(pthread sem_open "" HAVE_SEM_OPEN_LIB)
CHECK_LIBRARY_EXISTS(pthread sem_timedwait "" HAVE_SEM_TIMEDWAIT_LIB)
#--------------------------------------------------------------------------------------------------
### Initialize of CONTEXT THREADS
-if(pthread)
+if(HAVE_PTHREAD)
set(pthread 1)
elseif(pthread)
set(pthread 0)
endif()
-if(pthread)
+if(HAVE_PTHREAD)
### Test that we have a way to create semaphores
if(HAVE_SEM_OPEN_LIB)
message("-- Support for ucontext factory")
endif()
-if(pthread)
+if(HAVE_PTHREAD)
set(CONTEXT_THREADS 1)
message("-- Support for thread context factory")
endif()