cmake: Add configure checks for thread local storage.
authorAndreas Schneider <asn@cryptomilk.org>
Thu, 11 Sep 2014 15:07:50 +0000 (17:07 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Sun, 8 Feb 2015 08:41:04 +0000 (09:41 +0100)
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
ConfigureChecks.cmake
config.h.cmake

index 0d62529..5540b53 100644 (file)
@@ -91,6 +91,21 @@ endif (WIN32)
 set(CMOCKA_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CACHE INTERNAL "cmocka required system libraries")
 
 # OPTIONS
+check_c_source_compiles("
+__thread int tls;
+
+int main(void) {
+    return 0;
+}" HAVE_GCC_THREAD_LOCAL_STORAGE)
+
+if (WIN32)
+check_c_source_compiles("
+__declspec(thread) int tls;
+
+int main(void) {
+    return 0;
+}" HAVE_MSVC_THREAD_LOCAL_STORAGE)
+endif(WIN32)
 
 # ENDIAN
 if (NOT WIN32)
index 1550ff9..3c47a7d 100644 (file)
 
 /**************************** OPTIONS ****************************/
 
+/* Check if we have TLS support with GCC */
+#cmakedefine HAVE_GCC_THREAD_LOCAL_STORAGE 1
+
+/* Check if we have TLS support with MSVC */
+#cmakedefine HAVE_MSVC_THREAD_LOCAL_STORAGE 1
+
 /*************************** ENDIAN *****************************/
 
 #cmakedefine WORDS_SIZEOF_VOID_P ${WORDS_SIZEOF_VOID_P}