look for backtrace() in -lexecinfo, fixes #9783

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62657 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Paul Cornett
2009-11-15 04:02:27 +00:00
parent eabe8426cc
commit d9bd1a73ff
2 changed files with 112 additions and 46 deletions

138
configure vendored
View File

@@ -24160,7 +24160,7 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
;;
esac
rm -f -r conftest*
rm -f conftest*
# We used to try defining _XOPEN_SOURCE=500 too, to work around a bug
# in glibc 2.1.3, but that breaks too many other things.
@@ -36823,19 +36823,98 @@ _ACEOF
fi
if test "$wxUSE_STACKWALKER" = "yes" -a "$wxUSE_UNIX" = "yes"; then
{ echo "$as_me:$LINENO: checking for backtrace() in <execinfo.h>" >&5
echo $ECHO_N "checking for backtrace() in <execinfo.h>... $ECHO_C" >&6; }
if test "${wx_cv_func_backtrace+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&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 >conftest.$ac_ext <<_ACEOF
{ echo "$as_me:$LINENO: checking for library containing backtrace" >&5
echo $ECHO_N "checking for library containing backtrace... $ECHO_C" >&6; }
if test "${ac_cv_search_backtrace+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_func_search_save_LIBS=$LIBS
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char backtrace ();
int
main ()
{
return backtrace ();
;
return 0;
}
_ACEOF
for ac_lib in '' execinfo; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
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_link") 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_cxx_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
ac_cv_search_backtrace=$ac_res
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext
if test "${ac_cv_search_backtrace+set}" = set; then
break
fi
done
if test "${ac_cv_search_backtrace+set}" = set; then
:
else
ac_cv_search_backtrace=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ echo "$as_me:$LINENO: result: $ac_cv_search_backtrace" >&5
echo "${ECHO_T}$ac_cv_search_backtrace" >&6; }
ac_res=$ac_cv_search_backtrace
if test "$ac_res" != no; then
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
{ echo "$as_me:$LINENO: checking for backtrace() in <execinfo.h>" >&5
echo $ECHO_N "checking for backtrace() in <execinfo.h>... $ECHO_C" >&6; }
if test "${wx_cv_func_backtrace+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
@@ -36848,7 +36927,6 @@ main ()
void *trace[1];
char **messages;
backtrace(trace, 1);
messages = backtrace_symbols(trace, 1);
@@ -36856,14 +36934,14 @@ main ()
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
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
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
@@ -36872,7 +36950,8 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(exit $ac_status); } && {
test -z "$ac_cxx_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
wx_cv_func_backtrace=yes
else
echo "$as_me: failed program was:" >&5
@@ -36882,18 +36961,15 @@ sed 's/^/| /' conftest.$ac_ext >&5
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
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
fi
{ echo "$as_me:$LINENO: result: $wx_cv_func_backtrace" >&5
echo "${ECHO_T}$wx_cv_func_backtrace" >&6; }
else
wx_cv_func_backtrace=no
fi
if test "$wx_cv_func_backtrace" = "no"; then
@@ -36907,12 +36983,6 @@ if test "${wx_cv_func_cxa_demangle+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&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 >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -36960,12 +37030,6 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext 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
@@ -36979,6 +37043,12 @@ _ACEOF
fi
fi
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
if test "$wxUSE_STACKWALKER" = "yes" -a "$USE_WIN32" != 1 -a "$USE_UNIX" != 1; then

View File

@@ -4435,24 +4435,21 @@ fi
dnl backtrace() and backtrace_symbols() for wxStackWalker
if test "$wxUSE_STACKWALKER" = "yes" -a "$wxUSE_UNIX" = "yes"; then
AC_CACHE_CHECK([for backtrace() in <execinfo.h>], wx_cv_func_backtrace,
[
AC_LANG_PUSH(C++)
AC_TRY_COMPILE([#include <execinfo.h>],
AC_LANG_PUSH(C++)
AC_SEARCH_LIBS(backtrace, execinfo,
[AC_CACHE_CHECK([for backtrace() in <execinfo.h>], wx_cv_func_backtrace,
[AC_TRY_LINK([#include <execinfo.h>],
[
void *trace[1];
char **messages;
backtrace(trace, 1);
messages = backtrace_symbols(trace, 1);
],
wx_cv_func_backtrace=yes,
wx_cv_func_backtrace=no
)
AC_LANG_POP()
]
)
)]
)],
wx_cv_func_backtrace=no)
if test "$wx_cv_func_backtrace" = "no"; then
AC_MSG_WARN([backtrace() is not available, wxStackWalker will not be available])
@@ -4460,7 +4457,6 @@ if test "$wxUSE_STACKWALKER" = "yes" -a "$wxUSE_UNIX" = "yes"; then
else
AC_CACHE_CHECK([for __cxa_demangle() in <cxxabi.h>], wx_cv_func_cxa_demangle,
[
AC_LANG_PUSH(C++)
AC_TRY_LINK([#include <cxxabi.h>],
[
int rc;
@@ -4469,7 +4465,6 @@ if test "$wxUSE_STACKWALKER" = "yes" -a "$wxUSE_UNIX" = "yes"; then
wx_cv_func_cxa_demangle=yes,
wx_cv_func_cxa_demangle=no
)
AC_LANG_POP()
]
)
@@ -4477,6 +4472,7 @@ if test "$wxUSE_STACKWALKER" = "yes" -a "$wxUSE_UNIX" = "yes"; then
AC_DEFINE(HAVE_CXA_DEMANGLE)
fi
fi
AC_LANG_POP()
fi
if test "$wxUSE_STACKWALKER" = "yes" -a "$USE_WIN32" != 1 -a "$USE_UNIX" != 1; then