+ AC_CHECK_FUNCS(pthread_attr_setstacksize)
+
+ dnl ***********************************
+ dnl *** Checks for working __thread ***
+ dnl ***********************************
+ AC_MSG_CHECKING(for working __thread)
+ AC_TRY_RUN([
+ #include <pthread.h>
+
+ __thread int i;
+ static int res1, res2;
+
+ void thread_main (void *arg)
+ {
+ i = arg;
+ sleep (1);
+ if (arg == 1)
+ res1 = (i == arg);
+ else
+ res2 = (i == arg);
+ }
+
+ int main () {
+ pthread_t t1, t2;
+
+ i = 5;
+
+ pthread_create (&t1, NULL, thread_main, 1);
+ pthread_create (&t2, NULL, thread_main, 2);
+
+ pthread_join (t1, NULL);
+ pthread_join (t2, NULL);
+
+ return !(res1 + res2 == 2);
+ }
+ ], [
+ if test "x$with_nptl" = "x"; then
+ AC_MSG_RESULT(disabled)
+ else
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_KW_THREAD)
+ fi
+ ], [
+ AC_MSG_RESULT(no)
+ ])