]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
configure: add switch to disable __thread use
authorVictor Julien <victor@inliniac.net>
Tue, 6 Jan 2015 09:18:38 +0000 (10:18 +0100)
committerVictor Julien <victor@inliniac.net>
Tue, 6 Jan 2015 09:18:38 +0000 (10:18 +0100)
Add --disable-threading-tls switch to force the posix thread local
storage code paths even if __thread is available.

Goal is to make it easier to QA the posix code path.

configure.ac

index 6f691bab83d762f4410ccb6c507d69de3153f59e..48fcad47c38b5426a202e76b88f1ec8f2807dd71 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>],
-        [ static __thread int i; i = 1; i++; ],
-        [AC_DEFINE([TLS], [1], [Thread local storage])
-         AC_MSG_RESULT([yes]) ],
-        [AC_MSG_RESULT([no])])
+  # disable TLS on user request
+    AC_ARG_ENABLE(threading-tls,
+           AS_HELP_STRING([--disable-threading-tls], [Disable TLS (thread local storage)])], [enable_tls="$enableval"],[enable_tls=yes])
+    AS_IF([test "x$enable_tls" = "xyes"], [
+        # check if our target supports thread local storage
+        AC_MSG_CHECKING(for thread local storage __thread support)
+        AC_TRY_COMPILE([#include <stdlib.h>],
+            [ 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.