commit dc7ef3c81ff6e906c41da5ad40117ab87ac214da
Author: Jean-Marc Lasgouttes <[email protected]>
Date: Tue Nov 4 23:30:53 2014 +0100
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.
diff --git a/config/lyxinclude.m4 b/config/lyxinclude.m4
index c781c1e..6b8d7a5 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 <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 be used.
AC_DEFUN([LYX_USE_INCLUDED_MYTHES],[
diff --git a/configure.ac b/configure.ac
index 8539c7c..e05681c 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)