From: Vadim Zeitlin Date: Thu, 20 Sep 2012 23:12:28 +0000 (+0000) Subject: Fix wrong configure test for abi::__forced_unwind in previous commit. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/89b3361ec25cf1e6d255b14c7633d8375646e4fb Fix wrong configure test for abi::__forced_unwind in previous commit. The previous commit was accidental and contained an initial version of the patch which didn't test for NPTL abi::__forced_unwind correctly and just tested whether cxxabi.h header was available. Tighten the check to work on the other systems and check for __forced_unwind existence itself. Also check for cxxabi.h before testing for __cxa_demangle as there is no need to try to compile another test program if we already know that this entire header is unavailable anyhow. See #14626. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72532 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/configure b/configure index 82e9bfec5a..fe703cb26f 100755 --- a/configure +++ b/configure @@ -30474,27 +30474,28 @@ $as_echo "$wx_cv_func_backtrace" >&6; } $as_echo "$as_me: WARNING: backtrace() is not available, wxStackWalker will not be available" >&2;} wxUSE_STACKWALKER=no else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __cxa_demangle() in " >&5 + if test "$ac_cv_header_cxxabi_h" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __cxa_demangle() in " >&5 $as_echo_n "checking for __cxa_demangle() in ... " >&6; } if ${wx_cv_func_cxa_demangle+:} false; then : $as_echo_n "(cached) " >&6 else - ac_ext=cpp + ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { - int rc; - __cxxabiv1::__cxa_demangle("foo", 0, 0, &rc); + int rc; + __cxxabiv1::__cxa_demangle("foo", 0, 0, &rc); ; return 0; @@ -30508,7 +30509,7 @@ else fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - ac_ext=c + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' @@ -30519,6 +30520,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $wx_cv_func_cxa_demangle" >&5 $as_echo "$wx_cv_func_cxa_demangle" >&6; } + else + wx_cv_func_cxa_demangle=no + fi if test "$wx_cv_func_cxa_demangle" = "yes"; then $as_echo "#define HAVE_CXA_DEMANGLE 1" >>confdefs.h @@ -32385,6 +32389,59 @@ $as_echo "yes, it works" >&6; } fi fi + + if test "$ac_cv_header_cxxabi_h" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for abi::__forced_unwind() in " >&5 +$as_echo_n "checking for abi::__forced_unwind() in ... " >&6; } +if ${wx_cv_type_abi_forced_unwind+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + + void foo(abi::__forced_unwind&); + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + wx_cv_type_abi_forced_unwind=yes +else + wx_cv_type_abi_forced_unwind=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $wx_cv_type_abi_forced_unwind" >&5 +$as_echo "$wx_cv_type_abi_forced_unwind" >&6; } + else + wx_cv_type_abi_forced_unwind=no + fi + + if test "$wx_cv_type_abi_forced_unwind" = "yes"; then + $as_echo "#define HAVE_ABI_FORCEDUNWIND 1" >>confdefs.h + + fi fi else diff --git a/configure.in b/configure.in index c2e00d2cce..c40f89616a 100644 --- a/configure.in +++ b/configure.in @@ -4387,20 +4387,24 @@ if test "$wxUSE_STACKWALKER" = "yes" -a "$wxUSE_UNIX" = "yes"; then AC_MSG_WARN([backtrace() is not available, wxStackWalker will not be available]) wxUSE_STACKWALKER=no else - AC_CACHE_CHECK([for __cxa_demangle() in ], wx_cv_func_cxa_demangle, - [ - AC_LANG_PUSH(C++) - AC_TRY_LINK([#include ], - [ - int rc; - __cxxabiv1::__cxa_demangle("foo", 0, 0, &rc); - ], - wx_cv_func_cxa_demangle=yes, - wx_cv_func_cxa_demangle=no - ) - AC_LANG_POP() - ] - ) + if test "$ac_cv_header_cxxabi_h" = "yes"; then + AC_CACHE_CHECK([for __cxa_demangle() in ], wx_cv_func_cxa_demangle, + [ + AC_LANG_PUSH(C++) + AC_TRY_LINK([#include ], + [ + int rc; + __cxxabiv1::__cxa_demangle("foo", 0, 0, &rc); + ], + wx_cv_func_cxa_demangle=yes, + wx_cv_func_cxa_demangle=no + ) + AC_LANG_POP() + ] + ) + else + wx_cv_func_cxa_demangle=no + fi if test "$wx_cv_func_cxa_demangle" = "yes"; then AC_DEFINE(HAVE_CXA_DEMANGLE) @@ -5095,6 +5099,29 @@ if test "$TOOLKIT" != "MSW" -a "$USE_OS2" != 1; then AC_DEFINE(HAVE___THREAD_KEYWORD) fi fi + + if test "$ac_cv_header_cxxabi_h" = "yes"; then + AC_CACHE_CHECK([for abi::__forced_unwind() in ], + wx_cv_type_abi_forced_unwind, + [ + AC_LANG_PUSH(C++) + AC_TRY_COMPILE([#include ], + [ + void foo(abi::__forced_unwind&); + ], + wx_cv_type_abi_forced_unwind=yes, + wx_cv_type_abi_forced_unwind=no + ) + AC_LANG_POP() + ] + ) + else + wx_cv_type_abi_forced_unwind=no + fi + + if test "$wx_cv_type_abi_forced_unwind" = "yes"; then + AC_DEFINE(HAVE_ABI_FORCEDUNWIND) + fi fi dnl from if !MSW diff --git a/setup.h.in b/setup.h.in index 5f93e50dbf..4f6412de9e 100644 --- a/setup.h.in +++ b/setup.h.in @@ -1225,8 +1225,8 @@ /* Define if you have the header file. */ #undef HAVE_SYS_SELECT_H -/* Define if you have header file. */ -#undef HAVE_CXXABI_H +/* Define if you have abi::__forced_unwind in your . */ +#undef HAVE_ABI_FORCEDUNWIND /* Define if fdopen is available. */ #undef HAVE_FDOPEN diff --git a/src/unix/threadpsx.cpp b/src/unix/threadpsx.cpp index 1bd5936523..de36955cda 100644 --- a/src/unix/threadpsx.cpp +++ b/src/unix/threadpsx.cpp @@ -54,7 +54,7 @@ #include #endif -#ifdef HAVE_CXXABI_H +#ifdef HAVE_ABI_FORCEDUNWIND #include #endif @@ -861,7 +861,7 @@ void *wxThreadInternal::PthreadStart(wxThread *thread) wxT("Thread %p Entry() returned %lu."), THR_ID(pthread), wxPtrToUInt(pthread->m_exitcode)); } -#ifdef HAVE_CXXABI_H +#ifdef HAVE_ABI_FORCEDUNWIND // When using common C++ ABI under Linux we must always rethrow this // special exception used to unwind the stack when the thread was // cancelled, otherwise the thread library would simply terminate the @@ -872,7 +872,7 @@ void *wxThreadInternal::PthreadStart(wxThread *thread) pthread->SetState(STATE_EXITED); throw; } -#endif // HAVE_CXXABI_H +#endif // HAVE_ABI_FORCEDUNWIND wxCATCH_ALL( wxTheApp->OnUnhandledException(); ) {