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

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73333 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Paul Cornett 2013-01-02 18:11:30 +00:00
parent efcdfeafce
commit b873ba78fd
2 changed files with 83 additions and 21 deletions

81
configure vendored
View file

@ -30433,49 +30433,108 @@ if ${wx_cv_func_backtrace+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_ext=cpp
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing backtrace" >&5
$as_echo_n "checking for library containing backtrace... " >&6; }
if ${ac_cv_search_backtrace+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* 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
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_backtrace=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_backtrace+:} false; then :
break
fi
done
if ${ac_cv_search_backtrace+:} false; then :
else
ac_cv_search_backtrace=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_backtrace" >&5
$as_echo "$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"
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 <execinfo.h>
int
main ()
{
void *trace[1];
char **messages;
backtrace(trace, 1);
messages = backtrace_symbols(trace, 1);
void *trace[1];
char **messages;
backtrace(trace, 1);
messages = backtrace_symbols(trace, 1);
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
if ac_fn_cxx_try_link "$LINENO"; then :
wx_cv_func_backtrace=yes
else
wx_cv_func_backtrace=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
rm -f core conftest.err conftest.$ac_objext \
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
else
wx_cv_func_backtrace=no
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $wx_cv_func_backtrace" >&5
$as_echo "$wx_cv_func_backtrace" >&6; }
if test "$wx_cv_func_backtrace" = "no"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: backtrace() is not available, wxStackWalker will not be available" >&5
$as_echo "$as_me: WARNING: backtrace() is not available, wxStackWalker will not be available" >&2;}

View file

@ -4366,23 +4366,26 @@ 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_SEARCH_LIBS(backtrace, execinfo,
[
void *trace[1];
char **messages;
backtrace(trace, 1);
messages = backtrace_symbols(trace, 1);
AC_LANG_PUSH(C++)
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=yes,
wx_cv_func_backtrace=no
)
AC_LANG_POP()
]
)
if test "$wx_cv_func_backtrace" = "no"; then
AC_MSG_WARN([backtrace() is not available, wxStackWalker will not be available])
wxUSE_STACKWALKER=no