Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
try to not specify any calling convention on windows
[simgrid.git] / CMakeLists.txt
index 6365434..18f50ca 100644 (file)
@@ -268,14 +268,12 @@ CHECK_LIBRARY_EXISTS(rt      clock_gettime           "" HAVE_POSIX_GETTIME)
 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)
-CHECK_LIBRARY_EXISTS(pthread pthread_mutex_timedlock "" HAVE_MUTEX_TIMEDLOCK_LIB)
-
+CHECK_LIBRARY_EXISTS(pthread pthread_setaffinity_np  "" HAVE_PTHREAD_SETAFFINITY)
 
 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
   set(CMAKE_REQUIRED_DEFINITIONS "-D_XOPEN_SOURCE=700 -D_DARWIN_C_SOURCE")
 elseif(MINGW)
-  # Use the GNU version of unusual modifiers like PRIx64
+  # Use the GNU version of unusual modifiers like PRIx64
   add_definitions(-D__USE_MINGW_ANSI_STDIO=1)
   set(CMAKE_REQUIRED_DEFINITIONS "-D__USE_MINGW_ANSI_STDIO=1")
 else()
@@ -285,7 +283,6 @@ endif()
 CHECK_INCLUDE_FILES("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS)
 CHECK_INCLUDE_FILE("valgrind/valgrind.h" HAVE_VALGRIND_VALGRIND_H)
 CHECK_INCLUDE_FILE("sys/ptrace.h" HAVE_SYS_PTRACE_H)
-CHECK_INCLUDE_FILE("windows.h" HAVE_WINDOWS_H)
 CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
 CHECK_INCLUDE_FILE("execinfo.h" HAVE_EXECINFO_H)
 CHECK_INCLUDE_FILE("signal.h" HAVE_SIGNAL_H)
@@ -309,9 +306,7 @@ if(MINGW)
   set(HAVE_VASPRINTF 1)
 endif()
 
-CHECK_FUNCTION_EXISTS(makecontext HAVE_MAKECONTEXT)
 CHECK_FUNCTION_EXISTS(process_vm_readv HAVE_PROCESS_VM_READV)
-
 CHECK_FUNCTION_EXISTS(mmap HAVE_MMAP)
 
 #Check if __thread is defined
@@ -513,43 +508,6 @@ if(HAVE_PTHREAD)
     message(FATAL_ERROR "Semaphores are not usable (neither sem_open nor sem_init is both compilable and executable), but they are mandatory to threads (you may need to mount /dev).")
   endif()
 
-  ### Test that we have a way to timewait for semaphores
-
-  if(HAVE_SEM_TIMEDWAIT_LIB)
-
-    execute_process(
-      COMMAND "${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_sem_timedwait.c -lpthread"
-      WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
-      OUTPUT_VARIABLE HAVE_SEM_TIMEDWAIT_run
-      )
-
-    if(HAVE_SEM_TIMEDWAIT_run)
-      set(HAVE_SEM_TIMEDWAIT 0)
-      message(STATUS "timedwait not compilable")
-    else()
-      set(HAVE_SEM_TIMEDWAIT 1)
-      message(STATUS "timedwait is compilable")
-    endif()
-  endif()
-
-  ### HAVE_MUTEX_TIMEDLOCK
-
-  if(HAVE_MUTEX_TIMEDLOCK_LIB)
-
-    execute_process(
-      COMMAND "${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_mutex_timedlock.c -lpthread"
-      WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
-      OUTPUT_VARIABLE HAVE_MUTEX_TIMEDLOCK_run
-      )
-
-    if(HAVE_MUTEX_TIMEDLOCK_run)
-      set(HAVE_MUTEX_TIMEDLOCK 0)
-      message(STATUS "timedlock not compilable")
-    else()
-      message(STATUS "timedlock is compilable")
-      set(HAVE_MUTEX_TIMEDLOCK 1)
-    endif()
-  endif()
 endif()
 
 # This is needed for ucontext on MacOS X:
@@ -640,7 +598,7 @@ endif()
 #--------------------------------------------------------------------------------------------------
 
 set(makecontext_CPPFLAGS_2 "")
-if(HAVE_MAKECONTEXT OR WIN32)
+if(HAVE_UCONTEXT_H)
   set(makecontext_CPPFLAGS "-DTEST_makecontext")
   if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
     set(makecontext_CPPFLAGS_2 "-D_XOPEN_SOURCE=700")
@@ -989,13 +947,10 @@ message("HAVE_UCONTEXT ...............: ${HAVE_UCONTEXT}")
 message("")
 message("HAVE_PTHREAD ................: ${HAVE_PTHREAD}")
 message("HAVE_SEM_INIT ...............: ${HAVE_SEM_INIT_LIB}")
-message("HAVE_SEM_TIMEDWAIT ..........: ${HAVE_SEM_TIMEDWAIT_LIB}")
-message("HAVE_MUTEX_TIMEDLOCK ........: ${HAVE_MUTEX_TIMEDLOCK_LIB}")
 message("HAVE_POSIX_GETTIME ..........: ${HAVE_POSIX_GETTIME}")
 message("")
 message("STDC_HEADERS ................: ${STDC_HEADERS}")
 message("HAVE_VALGRIND_VALGRIND_H ....: ${HAVE_VALGRIND_VALGRIND_H}")
-message("HAVE_WINDOWS_H ..............: ${HAVE_WINDOWS_H}")
 message("HAVE_UNISTD_H ...............: ${HAVE_UNISTD_H}")
 message("HAVE_EXECINFO_H .............: ${HAVE_EXECINFO_H}")
 message("HAVE_SIGNAL_H ...............: ${HAVE_SIGNAL_H}")
@@ -1008,7 +963,6 @@ message("HAVE_NANOSLEEP ..............: ${HAVE_NANOSLEEP}")
 message("HAVE_GETDTABLESIZE ..........: ${HAVE_GETDTABLESIZE}")
 message("HAVE_SYSCONF ................: ${HAVE_SYSCONF}")
 message("HAVE_POPEN ..................: ${HAVE_POPEN}")
-message("HAVE_MAKECONTEXT ............: ${HAVE_MAKECONTEXT}")
 message("HAVE_VASPRINTF ..............: ${HAVE_VASPRINTF}")
 message("HAVE_MMAP ...................: ${HAVE_MMAP}")
 message("HAVE_PRIVATIZATION ..........: ${HAVE_PRIVATIZATION}")