]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Bug #948: detect thread local storage support
authorVictor Julien <victor@inliniac.net>
Tue, 10 Sep 2013 08:57:24 +0000 (10:57 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 10 Sep 2013 08:57:24 +0000 (10:57 +0200)
configure.ac
src/util-time.c

index 7d0a3f94b3a5164994e2ba3817a21978d11424bf..e1956c2992344ce6555bbfa942a9a9c23ef8af4f 100644 (file)
     esac
     AC_MSG_RESULT(ok)
 
+    # check if our target supports thread local storage
+    AC_MSG_CHECKING(for thread local storage __thread support)
+    AC_TRY_COMPILE([#include <stdlib.h>],
+        [ void somefunc (void) { static __thread int i; i = 1; i++; } ],
+        [AC_DEFINE([TLS], [1], [Thread local storage])
+         AC_MSG_RESULT([yes]) ],
+        [AC_MSG_RESULT([no])])
+
     #Enable support for gcc compile time security options. There is no great way to do detection of valid cflags that I have found
     #AX_CFLAGS_GCC_OPTION don't seem to do a better job than the code below and are a pain because of extra m4 files etc.
     #These flags seem to be supported on CentOS 5+, Ubuntu 8.04+, and FedoreCore 11+
index f040dfaca610a21af3ca3a9ec08ad64612a5f6e3..b0d6cc92458e6d198c8249597d6c031ebe708bc2 100644 (file)
@@ -124,7 +124,7 @@ void TimeSetIncrementTime(uint32_t tv_sec)
  * Time Caching code
  */
 
-#if defined(__OpenBSD__)
+#ifndef TLS
 /* OpenBSD does not support __thread, so don't use time caching on BSD
  */
 struct tm *SCLocalTime(time_t timep, struct tm *result)