From: Vadim Zeitlin Date: Sun, 23 Nov 2008 12:33:32 +0000 (+0000) Subject: don't assume that __thread is available just because we use g++ 4, it doesn't support... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/d3dcef0170f330d675b172fa36b28fd88eb3edcd don't assume that __thread is available just because we use g++ 4, it doesn't support it under all platforms, notably not under OS X git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56932 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/configure b/configure index 5f6f566b7f..3a6cdf673a 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Id: configure.in 56792 2008-11-16 14:24:13Z VZ . +# From configure.in Id: configure.in 56928 2008-11-23 01:53:24Z VZ . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for wxWidgets 2.9.0. # @@ -40262,6 +40262,64 @@ echo "$as_me: WARNING: wxMutex won't be recursive on this platform" >&2;} fi fi + { echo "$as_me:$LINENO: checking for __thread keyword" >&5 +echo $ECHO_N "checking for __thread keyword... $ECHO_C" >&6; } +if test "${wx_cv_cc___thread+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ + + static __thread int n = 0; + static __thread int *p = 0; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + wx_cv_cc___thread=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + wx_cv_cc___thread=no + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ echo "$as_me:$LINENO: result: $wx_cv_cc___thread" >&5 +echo "${ECHO_T}$wx_cv_cc___thread" >&6; } + + if test "$wx_cv_cc___thread" = "yes"; then GXX_VERSION="" @@ -40361,82 +40419,21 @@ fi - if test -n "$ax_cv_gxx_version"; then - { echo "$as_me:$LINENO: checking for __thread support in g++" >&5 -echo $ECHO_N "checking for __thread support in g++... $ECHO_C" >&6; } - case "$ax_cv_gxx_version" in - 1.* | 2.* ) - { echo "$as_me:$LINENO: result: doesn't exist" >&5 -echo "${ECHO_T}doesn't exist" >&6; } - wx_cv_cc___thread=no - ;; - 3.*) - { echo "$as_me:$LINENO: result: broken" >&5 -echo "${ECHO_T}broken" >&6; } - wx_cv_cc___thread=no - ;; - *) - { echo "$as_me:$LINENO: result: works" >&5 -echo "${ECHO_T}works" >&6; } - wx_cv_cc___thread=yes - ;; - esac - else - { echo "$as_me:$LINENO: checking for __thread keyword" >&5 -echo $ECHO_N "checking for __thread keyword... $ECHO_C" >&6; } -if test "${wx_cv_cc___thread+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -int -main () -{ - - static __thread int n = 0; - static __thread int *p = 0; - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - wx_cv_cc___thread=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - wx_cv_cc___thread=no - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ echo "$as_me:$LINENO: result: $wx_cv_cc___thread" >&5 -echo "${ECHO_T}$wx_cv_cc___thread" >&6; } + if test -n "$ax_cv_gxx_version"; then + { echo "$as_me:$LINENO: checking whether __thread support in g++ is usable" >&5 +echo $ECHO_N "checking whether __thread support in g++ is usable... $ECHO_C" >&6; } + case "$ax_cv_gxx_version" in + 1.* | 2.* | 3.* ) + { echo "$as_me:$LINENO: result: no, it's broken" >&5 +echo "${ECHO_T}no, it's broken" >&6; } + wx_cv_cc___thread=no + ;; + *) + { echo "$as_me:$LINENO: result: yes, it works" >&5 +echo "${ECHO_T}yes, it works" >&6; } + ;; + esac + fi fi if test "$wx_cv_cc___thread" = "yes"; then diff --git a/configure.in b/configure.in index ed22d24091..9c13d6a5d0 100644 --- a/configure.in +++ b/configure.in @@ -4998,31 +4998,10 @@ if test "$TOOLKIT" != "MSW" -a "$USE_OS2" != 1; then AC_MSG_WARN([wxMutex won't be recursive on this platform]) fi fi - + dnl test for compiler thread-specific variables support - AX_GXX_VERSION - if test -n "$ax_cv_gxx_version"; then - dnl g++ supports __thread since at least version 3.3 but its support - dnl seems to be broken until 4.1, see - dnl http://thread.gmane.org/gmane.comp.lib.wxwidgets.devel/108388 - AC_MSG_CHECKING([for __thread support in g++]) - case "$ax_cv_gxx_version" in - 1.* | 2.* ) - AC_MSG_RESULT([doesn't exist]) - wx_cv_cc___thread=no - ;; - 3.*) - AC_MSG_RESULT([broken]) - wx_cv_cc___thread=no - ;; - *) - AC_MSG_RESULT([works]) - wx_cv_cc___thread=yes - ;; - esac - else - AC_CACHE_CHECK([for __thread keyword], - wx_cv_cc___thread, + AC_CACHE_CHECK([for __thread keyword], + wx_cv_cc___thread, [ AC_TRY_COMPILE([#include ], [ @@ -5032,7 +5011,31 @@ if test "$TOOLKIT" != "MSW" -a "$USE_OS2" != 1; then wx_cv_cc___thread=yes, wx_cv_cc___thread=no ) - ]) + ] + ) + + if test "$wx_cv_cc___thread" = "yes"; then + AX_GXX_VERSION + if test -n "$ax_cv_gxx_version"; then + dnl g++ supports __thread since at least version 3.3 but its support + dnl seems to be broken until 4.1, see + dnl http://thread.gmane.org/gmane.comp.lib.wxwidgets.devel/108388 + dnl + dnl NB: we still need to test __thread support with + dnl AC_TRY_COMPILE above even for g++ 4 as it doesn't + dnl support it for all architectures (e.g. it doesn't + dnl work under OS X) + AC_MSG_CHECKING([whether __thread support in g++ is usable]) + case "$ax_cv_gxx_version" in + 1.* | 2.* | 3.* ) + AC_MSG_RESULT([no, it's broken]) + wx_cv_cc___thread=no + ;; + *) + AC_MSG_RESULT([yes, it works]) + ;; + esac + fi fi if test "$wx_cv_cc___thread" = "yes"; then