summaryrefslogtreecommitdiffstats
path: root/m4/tls.m4
blob: 3808f06edba829efc12d098b01e82fa037945056 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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])
])