Implement "callstack printing" checking for autotools

Contrary to cmake, we do not rely on platform/compiler check, but on the
availability of the reauired API.
This commit is contained in:
Jean-Marc Lasgouttes 2014-11-04 23:30:53 +01:00
parent af8ba5e069
commit dc7ef3c81f
2 changed files with 26 additions and 0 deletions

View File

@ -358,6 +358,29 @@ AC_DEFUN([LYX_USE_INCLUDED_BOOST],[
]) ])
dnl Usage: LYX_CHECK_CALLSTACK_PRINTING: define LYX_CALLSTACK_PRINTING if the
dnl necessary APIs are available to print callstacks.
AC_DEFUN([LYX_CHECK_CALLSTACK_PRINTING],
[AC_CACHE_CHECK([whether printing callstack is possible],
[lyx_cv_callstack_printing],
[AC_TRY_COMPILE([
#include <execinfo.h>
#include <cxxabi.h>
], [
void* array[200];
size_t size = backtrace(array, 200);
backtrace_symbols(array, size);
int status = 0;
abi::__cxa_demangle("abcd", 0, 0, &status);
],
[lyx_cv_callstack_printing=yes], [lyx_cv_callstack_printing=no])])
if test x"$lyx_cv_callstack_printing" = xyes; then
AC_DEFINE([LYX_CALLSTACK_PRINTING], 1,
[Define if callstack can be printed])
fi
])
dnl Usage: LYX_USE_INCLUDED_MYTHES : select if the included MyThes should dnl Usage: LYX_USE_INCLUDED_MYTHES : select if the included MyThes should
dnl be used. dnl be used.
AC_DEFUN([LYX_USE_INCLUDED_MYTHES],[ AC_DEFUN([LYX_USE_INCLUDED_MYTHES],[

View File

@ -104,6 +104,9 @@ LYX_USE_INCLUDED_MYTHES
### we need to know the byte order for unicode conversions ### we need to know the byte order for unicode conversions
AC_C_BIGENDIAN AC_C_BIGENDIAN
# Nice to have when an assertion triggers
LYX_CHECK_CALLSTACK_PRINTING
# Needed for our char_type # Needed for our char_type
AC_CHECK_SIZEOF(wchar_t) AC_CHECK_SIZEOF(wchar_t)