summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2008-08-08 14:03:54 +0200
committerDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2008-08-08 15:09:38 +0200
commitdaf3e8b97d09d85d51eac34b9d5acf4545d03a2d (patch)
tree80f422f11a8764611eb311b12504e00130be4484 /m4
parent81969a73a494a36356e764cf3576aa48c101bffb (diff)
Create a new macro for checking compiler support for TLS.
Create a new macro that can be shared between projects to check for __thread support by the compiler. This macro might come useful for xine-lib too so I want to keep it separate for easier importing it over. Name the defined macro SUPPORT_TLS___THREAD to follow the same style as the checks from attributes.m4.
Diffstat (limited to 'm4')
-rw-r--r--m4/tls.m417
1 files changed, 17 insertions, 0 deletions
diff --git a/m4/tls.m4 b/m4/tls.m4
new file mode 100644
index 00000000..3808f06e
--- /dev/null
+++ b/m4/tls.m4
@@ -0,0 +1,17 @@
+AC_DEFUN([CC_CHECK_TLS], [
+ AC_CACHE_CHECK([whether $CC knows __thread for Thread-Local Storage],
+ cc_cv_tls___thread,
+ [AC_COMPILE_IFELSE(
+ AC_LANG_PROGRAM(
+ [[static __thread int a = 6;]],
+ [[a = 5;]]),
+ [cc_cv_tls___thread=yes],
+ [cc_cv_tls___thread=no])
+ ])
+
+ AS_IF([test "x$cc_cv_tls___thread" = "xyes"],
+ [AC_DEFINE([SUPPORT_TLS___THREAD], 1,
+ [Define this if the compiler supports __thread for Thread-Local Storage])
+ $1],
+ [$2])
+])