Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Check if __thread is available.
authorNavarrop <Pierre.Navarro@imag.fr>
Fri, 22 Apr 2011 14:54:10 +0000 (16:54 +0200)
committerNavarrop <Pierre.Navarro@imag.fr>
Fri, 22 Apr 2011 14:54:10 +0000 (16:54 +0200)
CMakeLists.txt
buildtools/Cmake/CompleteInFiles.cmake
buildtools/Cmake/gras_config.h.in
include/simgrid_config.h.in
include/simix/context.h

index 4991906..9fd7c9c 100644 (file)
@@ -23,7 +23,6 @@ set(GCC_NEED_VERSION "4.0")
 
 ### SET THE LIBRARY EXTENSION AND GCC VERSION
 if(APPLE) #MAC
-    set(GCC_NEED_VERSION "4.5")
        set(LIB_EXE "dylib")
 else(APPLE)
     if(WIN32) #WINDOWS
index 842a2c6..d067965 100644 (file)
@@ -83,6 +83,15 @@ CHECK_FUNCTION_EXISTS(vasprintf HAVE_VASPRINTF)
 CHECK_FUNCTION_EXISTS(makecontext HAVE_MAKECONTEXT)
 CHECK_FUNCTION_EXISTS(mmap HAVE_MMAP)
 
+#Check if __thread is defined
+exec_program("${CMAKE_C_COMPILER} -lpthread ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_thread_storage.c" 
+                       OUTPUT_VARIABLE HAVE_thread_storage_run)
+if(HAVE_thread_storage_run)
+       set(HAVE_THREAD_LOCAL_STORAGE 0)
+else(HAVE_thread_storage_run)
+       set(HAVE_THREAD_LOCAL_STORAGE 1)
+endif(HAVE_thread_storage_run)
+
 # Our usage of mmap is Linux-specific (flag MAP_ANONYMOUS), but kFreeBSD uses a GNU libc
 IF(NOT "${CMAKE_SYSTEM}" MATCHES "Linux" AND NOT "${CMAKE_SYSTEM}" MATCHES "kFreeBSD")
   SET(HAVE_MMAP 0)
index 4777ae1..2443ae7 100644 (file)
@@ -16,6 +16,9 @@
 #cmakedefine SIZEOF_INT @SIZEOF_INT@
 #cmakedefine SIZEOF_VOIDP @SIZEOF_VOIDP@
 
+/* If __thread is available */
+#cmakedefine HAVE_THREAD_LOCAL_STORAGE @HAVE_THREAD_LOCAL_STORAGE@
+
 #ifndef __STRICT_ANSI__
        #cmakedefine __STRICT_ANSI__ @__STRICT_ANSI__@
 #endif
index 8006704..4c1feb7 100644 (file)
@@ -125,5 +125,9 @@ XBT_PUBLIC(char *) bprintf(const char *fmt, ...) _XBT_GNUC_PRINTF(1, 2);
 /* Tracking of latency bound */
 #cmakedefine HAVE_LATENCY_BOUND_TRACKING @HAVE_LATENCY_BOUND_TRACKING@
 
+/* If __thread is available */
+#cmakedefine HAVE_THREAD_LOCAL_STORAGE @HAVE_THREAD_LOCAL_STORAGE@
+
+
 SG_END_DECL()
 #endif /* SIMGRID_PUBLIC_CONFIG_H */
index 712b07a..1cc8dd4 100644 (file)
@@ -60,10 +60,6 @@ extern smx_ctx_factory_initializer_t smx_factory_initializer_to_use;
 extern char* smx_context_factory_name;
 extern int smx_context_stack_size;
 
-#if defined(CONTEXT_THREADS) && !defined(APPLE)
-#define HAVE_THREAD_LOCAL_STORAGE 1
-#endif
-
 #ifdef HAVE_THREAD_LOCAL_STORAGE
 extern __thread smx_context_t smx_current_context;
 #else