summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2021-05-16 20:45:09 +0200
committerBenBE <BenBE@geshi.org>2021-09-21 09:06:30 +0200
commit29e1fcfa0517a7c5770b2a95fe7fbc0bc197c360 (patch)
tree2a927ead2f563394123c8d9b239b07e5af9a4614 /configure.ac
parent29983ff83a7f2c900fadb10e6cb570d167df2d80 (diff)
Use libunwind for printing backtrace
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac36
1 files changed, 33 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index e93afbd9..b6361ead 100644
--- a/configure.ac
+++ b/configure.ac
@@ -253,6 +253,7 @@ AC_SEARCH_LIBS([clock_gettime], [rt])
AC_CHECK_FUNCS([ \
clock_gettime \
+ dladdr \
faccessat \
fstatat \
host_get_clock_service \
@@ -261,9 +262,6 @@ AC_CHECK_FUNCS([ \
readlinkat \
])
-# Add -lexecinfo if needed
-AC_SEARCH_LIBS([backtrace], [execinfo])
-
if test "$my_htop_platform" = darwin; then
AC_CHECK_FUNCS([mach_timebase_info])
fi
@@ -409,6 +407,36 @@ if test "x$enable_affinity" = xyes; then
fi
+AC_ARG_ENABLE([unwind],
+ [AS_HELP_STRING([--enable-unwind],
+ [enable unwind support for printing backtraces; requires libunwind @<:@default=check@:>@])],
+ [],
+ [enable_unwind=check])
+case "$enable_unwind" in
+ check)
+ enable_unwind=yes
+ if test "$enable_static" = yes; then
+ AC_CHECK_LIB([lzma], [lzma_index_buffer_decode])
+ fi
+ AC_CHECK_LIB([unwind], [backtrace], [], [enable_unwind=no])
+ AC_CHECK_HEADERS([libunwind.h], [], [enable_unwind=no])
+ ;;
+ no)
+ ;;
+ yes)
+ AC_CHECK_LIB([unwind], [backtrace], [], [AC_MSG_ERROR([can not find required library libunwind])])
+ AC_CHECK_HEADERS([libunwind.h], [], [AC_MSG_ERROR([can not find require header file libunwind.h])])
+ ;;
+ *)
+ AC_MSG_ERROR([bad value '$enable_unwind' for --enable-unwind])
+ ;;
+esac
+if test "x$enable_unwind" = xno; then
+ # Fall back to backtrace(3) and add -lexecinfo if needed
+ AC_SEARCH_LIBS([backtrace], [execinfo])
+fi
+
+
AC_ARG_ENABLE([hwloc],
[AS_HELP_STRING([--enable-hwloc],
[enable hwloc support for CPU affinity; disables affinity support; requires libhwloc @<:@default=no@:>@])],
@@ -426,6 +454,7 @@ case "$enable_hwloc" in
;;
esac
+
AC_ARG_WITH([os-release],
[AS_HELP_STRING([--with-os-release=FILE],
[location of an os-release file @<:@default=/etc/os-release@:>@])],
@@ -715,6 +744,7 @@ AC_MSG_RESULT([
(Linux) capabilities: $enable_capabilities
unicode: $enable_unicode
affinity: $enable_affinity
+ unwind: $enable_unwind
hwloc: $enable_hwloc
debug: $enable_debug
static: $enable_static

© 2014-2024 Faster IT GmbH | imprint | privacy policy