summaryrefslogtreecommitdiffstats
path: root/main/freeradius/fix-tls-test.patch
blob: 237aec4a101dfdc4b5628c49f0d799c4c90f1624 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
TLS test is broken

also include a hunk from 

diff --git a/acinclude.m4 b/acinclude.m4
index 3fd2c89..07480d8 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -330,12 +330,21 @@ m4_pushdef([AC_OUTPUT],
 #
 AC_DEFUN([FR_TLS],
 [
-    AC_MSG_CHECKING(for TLS)
-    AC_RUN_IFELSE([AC_LANG_SOURCE([[ static __thread int val; int main(int argc, char *argv[]) { return val = argc; } ]])],[have_tls=yes],[have_tls=no],[have_tls=no ])
-    AC_MSG_RESULT($have_tls)
-    if test "$have_tls" = "yes"; then
-        AC_DEFINE([HAVE_THREAD_TLS],[1],[Define if the compiler supports __thread])
-    fi
+  AC_MSG_CHECKING(for __thread support in compiler)
+  AC_RUN_IFELSE(
+    [AC_LANG_SOURCE(
+      [[
+        static __thread int val;
+        int main(int argc, char **argv) {
+          val = 0;
+          return val;
+        }
+      ]])
+    ],[have_tls=yes],[have_tls=no],[have_tls=no])
+  AC_MSG_RESULT($have_tls)
+  if test "x$have_tls" = "xyes"; then
+    AC_DEFINE([HAVE_THREAD_TLS],[1],[Define if the compiler supports __thread])
+  fi
 ])
  
  
diff --git a/confifgure.in b/configure.in
index 3fd2c89..07480d8 100644
--- a/configure.in
+++ b/configure.in
@@ -547,6 +561,10 @@ else
    )
 fi
 
+if test "x$WITH_THREADS" = "xyes"; then
+       AC_DEFINE(WITH_THREADS, [1], [define if you want thread support])
+fi
+
 dnl Check if we need -lsocket
 AC_CHECK_LIB(dl, dlopen)