Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
store the VMs by their interface, not by their implementation
[simgrid.git] / CMakeLists.txt
index 1bcfc59..dba5f6c 100644 (file)
@@ -121,7 +121,7 @@ string(REGEX MATCH "[0-9].[0-9]*" LINKER_VERSION "${LINKER_VERSION}")
 
 ### Set the library providing dlopen
 if("${CMAKE_SYSTEM}" MATCHES "Linux")
-  find_library(dl DL_LIBRARY)
+  find_library(DL_LIBRARY dl)
 endif("${CMAKE_SYSTEM}" MATCHES "Linux")
 
 ### Find programs and paths
@@ -305,6 +305,7 @@ CHECK_INCLUDE_FILE("ucontext.h" HAVE_UCONTEXT_H)
 CHECK_INCLUDE_FILE("linux/futex.h" HAVE_FUTEX_H)
 
 CHECK_FUNCTION_EXISTS(backtrace HAVE_BACKTRACE)
+CHECK_FUNCTION_EXISTS(dlfunc HAVE_DLFUNC)
 CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
 CHECK_FUNCTION_EXISTS(nanosleep HAVE_NANOSLEEP)
 CHECK_FUNCTION_EXISTS(getdtablesize HAVE_GETDTABLESIZE)
@@ -334,6 +335,11 @@ else()
   set(HAVE_THREAD_LOCAL_STORAGE 0)
 endif()
 
+if(enable_model-checking AND NOT "${CMAKE_SYSTEM}" MATCHES "Linux")
+  message(WARNING "Support for model-checking has not been enabled on ${CMAKE_SYSTEM}: disabling it")
+  set(enable_model-checking FALSE)
+endif()
+
 if(HAVE_MMAP AND HAVE_THREAD_LOCAL_STORAGE)
   SET(HAVE_MMALLOC 1)
 else()
@@ -358,13 +364,22 @@ endif()
 
 include(FindLibunwind)
 if(HAVE_LIBUNWIND)
-  SET(SIMGRID_DEP "${SIMGRID_DEP} -lunwind -lunwind-ptrace")
-  # This supposes that the host machine is either an AMD or a X86.
-  # This is deeply wrong, and should be fixed by manually loading -lunwind-PLAT (FIXME)
-  if(PROCESSOR_x86_64)
-    SET(SIMGRID_DEP "${SIMGRID_DEP} -lunwind-x86_64")
+  if(NOT APPLE)
+    SET(SIMGRID_DEP "${SIMGRID_DEP} -lunwind")
   else()
-    SET(SIMGRID_DEP "${SIMGRID_DEP} -lunwind-x86")
+    # Apple forbids to link directly against its libunwind implementation
+    # So let's comply and link against the System framework
+    SET(SIMGRID_DEP "${SIMGRID_DEP} -lSystem")
+  endif()
+  if("${CMAKE_SYSTEM}" MATCHES "Linux")
+    set(SIMGRID_DEP "${SIMGRID_DEP} -lunwind-ptrace")
+    # This supposes that the host machine is either an AMD or a X86.
+    # This is deeply wrong, and should be fixed by manually loading -lunwind-PLAT (FIXME)
+    if(PROCESSOR_x86_64)
+      SET(SIMGRID_DEP "${SIMGRID_DEP} -lunwind-x86_64")
+    else()
+      SET(SIMGRID_DEP "${SIMGRID_DEP} -lunwind-x86")
+    endif()
   endif()
 else()
   if(enable_model-checking)
@@ -372,11 +387,6 @@ else()
   endif()
 endif()
 
-if(enable_model-checking AND NOT "${CMAKE_SYSTEM}" MATCHES "Linux")
-  message(WARNING "Support for model-checking has not been enabled on ${CMAKE_SYSTEM}: disabling it")
-  set(enable_model-checking FALSE)
-endif()
-
 if(enable_model-checking)
   SET(HAVE_MC 1)
   
@@ -652,7 +662,7 @@ endif()
 # So we have to make sure that everything got a decent value before generating the files.
 foreach(var HAVE_BACKTRACE HAVE_EXECINFO_H HAVE_FUTEX_H HAVE_GETDTABLESIZE HAVE_GETTIMEOFDAY HAVE_MMAP HAVE_NANOSLEEP HAVE_POPEN
             HAVE_POSIX_GETTIME HAVE_PROCESS_VM_READV HAVE_SIGNAL_H HAVE_SYS_PARAM_H HAVE_SYS_SYSCTL_H HAVE_SYSCONF 
-            HAVE_UCONTEXT_H HAVE_UNISTD_H HAVE_VALGRIND_H HAVE_VASPRINTF)
+            HAVE_UCONTEXT_H HAVE_UNISTD_H HAVE_VALGRIND_H HAVE_VASPRINTF HAVE_MREMAP HAVE_DLFUNC)
   if(${var})
     set(${var} 1)
   else()