summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac9
-rw-r--r--thread_pthread.h2
2 files changed, 8 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 7a820dabd6..bddb5a4f40 100644
--- a/configure.ac
+++ b/configure.ac
@@ -340,16 +340,21 @@ AS_CASE(["$host_os:$build_os"],
AS_CASE(["$target_os"],
[darwin*], [
AC_MSG_CHECKING(if minimum required OS X version is supported)
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([[@%:@include <AvailabilityMacros.h>
+ AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include <AvailabilityMacros.h>
@%:@if MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_5
@%:@error pre OS X 10.5
[!<===== pre OS X 10.5 =====>]
@%:@endif
- int __thread conftest;
]])],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
AC_MSG_ERROR([Unsupported OS X version is required])])
+ AC_CACHE_CHECK([if thread-local storage is supported], [rb_cv_tls_supported],
+ [AC_LINK_IFELSE([AC_LANG_PROGRAM([[int __thread conftest;]])],
+ [rb_cv_tls_supported=yes],
+ [rb_cv_tls_supported=no])])
+ AS_IF([test x"$rb_cv_tls_supported" != xyes],
+ [AC_DEFINE(RB_THREAD_LOCAL_SPECIFIER_IS_UNSUPPORTED)])
])
RUBY_MINGW32
diff --git a/thread_pthread.h b/thread_pthread.h
index cc1675b77c..b5314082d5 100644
--- a/thread_pthread.h
+++ b/thread_pthread.h
@@ -92,7 +92,7 @@ struct rb_thread_sched {
#if __STDC_VERSION__ >= 201112
#define RB_THREAD_LOCAL_SPECIFIER _Thread_local
-#elif defined(__GNUC__)
+#elif defined(__GNUC__) && !defined(RB_THREAD_LOCAL_SPECIFIER_IS_UNSUPPORTED)
/* note that ICC (linux) and Clang are covered by __GNUC__ */
#define RB_THREAD_LOCAL_SPECIFIER __thread
#else