Revision: 55024
          http://brlcad.svn.sourceforge.net/brlcad/?rev=55024&view=rev
Author:   brlcad
Date:     2013-04-03 06:24:23 +0000 (Wed, 03 Apr 2013)
Log Message:
-----------
BRLCAD_TYPE_SIZE() and the built-in CMAKE_CHECK_TYPE() macros are no good for 
this purpose since they try to sizeof().  instead, just try compiling a small 
custom snippet.

Modified Paths:
--------------
    brlcad/trunk/CMakeLists.txt

Modified: brlcad/trunk/CMakeLists.txt
===================================================================
--- brlcad/trunk/CMakeLists.txt 2013-04-03 06:04:18 UTC (rev 55023)
+++ brlcad/trunk/CMakeLists.txt 2013-04-03 06:24:23 UTC (rev 55024)
@@ -1624,14 +1624,23 @@
 BRLCAD_TYPE_SIZE("uintptr_t" "")
 BRLCAD_TYPE_SIZE("sig_t" "signal.h")
 
-# see if we have a TLS intrinsic
-BRLCAD_TYPE_SIZE("thread_local int" "") # C++11
-if (NOT HAVE_THREAD_LOCAL_INT)
-  BRLCAD_TYPE_SIZE("__thread int" "") # GCC except Mac OS X
-  if (NOT HAVE___THREAD_INT)
-    BRLCAD_TYPE_SIZE("__declspec(thread) int" "") # Windows
-  endif (NOT HAVE___THREAD_INT)
-endif (NOT HAVE_THREAD_LOCAL_INT)
+# see if we have a TLS intrinsic, first check C++11 compliance
+check_cxx_source_compiles("static thread_local int i = 0; int main() { return 
i; }" HAVE_THREAD_LOCAL)
+if (HAVE_THREAD_LOCAL)
+  CONFIG_H_APPEND(BRLCAD "#define HAVE_THREAD_LOCAL 1\n")
+else (HAVE_THREAD_LOCAL)
+  # try GCC except Mac OS X
+  check_cxx_source_compiles("static __thread int i = 0; int main() { return i; 
}" HAVE___THREAD)
+  if (HAVE___THREAD)
+    CONFIG_H_APPEND(BRLCAD "#define HAVE___THREAD 1\n")
+  else (HAVE___THREAD)
+    # try Windows
+    check_cxx_source_compiles("static __declspec(thread) int i = 0; int main() 
{ return i; }" HAVE___DECLSPEC_THREAD)
+    if (HAVE___DECLSPEC_THREAD)
+      CONFIG_H_APPEND(BRLCAD "#define HAVE___DECLSPEC_THREAD 1\n")
+    endif (HAVE___DECLSPEC_THREAD)
+  endif (HAVE___THREAD)
+endif (HAVE_THREAD_LOCAL)
 
 # see if the compiler supports %z as a size_t print width specifier
 BRLCAD_CHECK_C99_FORMAT_SPECIFIERS()

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to