]> git.lyx.org Git - lyx.git/commitdiff
Implement "callstack printing" checking for autotools
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 4 Nov 2014 22:30:53 +0000 (23:30 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 4 Nov 2014 22:48:03 +0000 (23:48 +0100)
Contrary to cmake, we do not rely on platform/compiler check, but on the
availability of the reauired API.

config/lyxinclude.m4
configure.ac

index c781c1e57403a0cc1010669ecc074150bc4f2b3a..6b8d7a5e184d22bbc635f61818fa7ee3c54fd345 100644 (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        be used.
 AC_DEFUN([LYX_USE_INCLUDED_MYTHES],[
index 8539c7cfdb347a206a95f1f04ba2134e4f519956..e05681c49d3ffb7e960d7cec18c3eff1f20bd152 100644 (file)
@@ -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)