cxa_demangle check
This commit is contained in:
@@ -33,7 +33,34 @@ AC_DEFUN(SM_FUNC_BACKTRACE_SYMBOLS,
|
||||
AC_MSG_RESULT($have_backtrace_symbols)
|
||||
])
|
||||
|
||||
AC_DEFUN(SM_FUNC_CXA_DEMANGLE,
|
||||
[
|
||||
# Check for abi::__cxa_demangle (gcc 3.1+)
|
||||
AC_MSG_CHECKING(for working cxa_demangle)
|
||||
AC_LANG_PUSH(C++)
|
||||
AC_TRY_RUN(
|
||||
[
|
||||
#include <cxxabi.h>
|
||||
#include <stdlib.h>
|
||||
#include <typeinfo>
|
||||
|
||||
int main()
|
||||
{
|
||||
struct foo { } fum;
|
||||
int status;
|
||||
char *realname = abi::__cxa_demangle(typeid(fum).name(), 0, 0, &status);
|
||||
free( realname );
|
||||
return 0;
|
||||
}
|
||||
], have_cxa_demangle=yes,have_cxa_demangle=no,have_cxa_demangle=no
|
||||
)
|
||||
AC_LANG_POP(C++)
|
||||
AC_MSG_RESULT($have_cxa_demangle)
|
||||
if test "$have_cxa_demangle" = "yes"; then
|
||||
AC_DEFINE(HAVE_CXA_DEMANGLE, 1, [abi::__cxa_demangle available])
|
||||
fi
|
||||
])
|
||||
|
||||
# To support backtraces in the crash handler, we need two things: a call to
|
||||
# get backtrace pointers, and a way to convert them to symbols.
|
||||
AC_DEFUN(SM_CHECK_CRASH_HANDLER,
|
||||
@@ -91,18 +118,31 @@ AC_DEFUN(SM_CHECK_CRASH_HANDLER,
|
||||
# All current symbol lookup methods need this flag.
|
||||
LDFLAGS="$LDFLAGS -rdynamic"
|
||||
|
||||
# Check for libiberty. This makes backtraces much nicer.
|
||||
AC_CHECK_HEADER(libiberty.h, have_iberty_header=yes, have_iberty_header=no)
|
||||
AC_SEARCH_LIBS(cplus_demangle, [iberty], have_iberty_lib=yes, have_iberty_lib=no)
|
||||
SM_FUNC_CXA_DEMANGLE
|
||||
if test "$have_cxa_demangle" = "yes"; then
|
||||
have_demangle=yes
|
||||
AC_DEFINE([BACKTRACE_DEMANGLE_METHOD_TEXT],["cxa_demangle"],[Define demangle type])
|
||||
fi
|
||||
|
||||
if test "$have_demangle" != "yes"; then
|
||||
# Check for libiberty.
|
||||
AC_CHECK_HEADER(libiberty.h, have_iberty_header=yes, have_iberty_header=no)
|
||||
AC_SEARCH_LIBS(cplus_demangle, [iberty], have_iberty_lib=yes, have_iberty_lib=no)
|
||||
|
||||
if test $have_iberty_lib = "yes" -a $have_iberty_header = "yes"; then
|
||||
AC_DEFINE(HAVE_LIBIBERTY, 1, [Liberty available])
|
||||
else
|
||||
if test $have_iberty_lib = "yes" -a $have_iberty_header = "yes"; then
|
||||
AC_DEFINE(HAVE_LIBIBERTY, 1, [Liberty available])
|
||||
have_demangle=yes
|
||||
AC_DEFINE([BACKTRACE_DEMANGLE_METHOD_TEXT],["libiberty"],[Define demangle type])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$have_demangle" != "yes"; then
|
||||
echo
|
||||
echo "*** Backtrace support has been detected, but libiberty is not installed."
|
||||
echo "*** Libiberty will make crash reports for developers much easier to read,"
|
||||
echo "*** and is strongly recommended."
|
||||
echo
|
||||
AC_DEFINE([BACKTRACE_DEMANGLE_METHOD_TEXT],["none"],[Define demangle type])
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user