From dc7ef3c81ff6e906c41da5ad40117ab87ac214da Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Tue, 4 Nov 2014 23:30:53 +0100 Subject: [PATCH] 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. --- config/lyxinclude.m4 | 23 +++++++++++++++++++++++ configure.ac | 3 +++ 2 files changed, 26 insertions(+) diff --git a/config/lyxinclude.m4 b/config/lyxinclude.m4 index c781c1e574..6b8d7a5e18 100644 --- a/config/lyxinclude.m4 +++ b/config/lyxinclude.m4 @@ -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 +#include +], [ + 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 be used. AC_DEFUN([LYX_USE_INCLUDED_MYTHES],[ diff --git a/configure.ac b/configure.ac index 8539c7cfdb..e05681c49d 100644 --- a/configure.ac +++ b/configure.ac @@ -104,6 +104,9 @@ LYX_USE_INCLUDED_MYTHES ### we need to know the byte order for unicode conversions AC_C_BIGENDIAN +# Nice to have when an assertion triggers +LYX_CHECK_CALLSTACK_PRINTING + # Needed for our char_type AC_CHECK_SIZEOF(wchar_t)