diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-06-14 16:37:49 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-06-14 16:37:49 +0200 |
commit | 10919e4074ca5c90925988917f3edf730c4267e5 (patch) | |
tree | 68b23844fdf0cfe2e3b607ebe6f353995c28eabb /configure.ac | |
parent | 38a8b6da3bae314f4a49ec6489e81e31f6cfb24d (diff) |
Better approximation of HAVE_THREADSAFE_STATICS for Clang
Change-Id: Ie29aa2e970f06a4a5bef672afe17b085600e7b88
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac index b1e910ec143c..673f774b4eea 100644 --- a/configure.ac +++ b/configure.ac @@ -5445,13 +5445,31 @@ if test "$GCC" = "yes"; then dnl GNU/Linux" machine); see the definition of __cxa_guard_acquire in GCC's dnl libstdc++-v3/libsupc++/guard.cc for what #ifdefs actually make a dnl difference there. Conservative advice from Jakub Jelinek is to assume - dnl it working in GCC >= 4.3: - if test "$_os" = "Darwin" -o $_os = Android -o "${GCCVER?}" -lt 040300; then - AC_MSG_RESULT([broken (i.e., no)]) - else - HAVE_THREADSAFE_STATICS=TRUE + dnl it working in GCC >= 4.3, so conservative way to check here is to use + dnl GCCVER for GCC but resort to __GLIBCXX__ corresponding to libstdc++ + dnl shipped with GCC 4.3.0 (cf. <http://gcc.gnu.org/onlinedocs/libstdc++/ + dnl manual/abi.html#abi.versioning.history>; 4.3.0 is 20080306, 4.2.4 is + dnl 20080519, 4.3.1 is 20080606) for Clang (for which GCCVER is notoriously + dnl "too old"): + if test "$_os" != Darwin -a "$_os" != Android; then + if test "$COM_GCC_IS_CLANG" = TRUE; then + AC_LANG_PUSH([C++]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include <list> +#if !defined __GLIBCXX__ ||(__GLIBCXX__ < 20080606 && __GLIBCXX__ != 20080306) +#error +#endif + ]])],[HAVE_THREADSAFE_STATICS=TRUE],[]) + AC_LANG_POP([C++]) + elif test "${GCCVER?}" -ge 040300; then + HAVE_THREADSAFE_STATICS=TRUE + fi + fi + if test "$HAVE_THREADSAFE_STATICS" = TRUE; then AC_DEFINE(HAVE_THREADSAFE_STATICS) AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([broken (i.e., no)]) fi else AC_MSG_RESULT([unknown (assuming no)]) |