2 dnl Checks for libunwind, which usually does a better job than backtrace() when
3 dnl resolving symbols in the stack backtrace. Newer versions have support for
4 dnl getting info about the object file the function came from, so we look for
5 dnl that too and use it if found.
7 AC_DEFUN([ZFS_AC_CONFIG_USER_LIBUNWIND], [
8 AC_ARG_WITH([libunwind],
9 AS_HELP_STRING([--with-libunwind],
10 [use libunwind for backtraces in userspace assertions]),
12 [with_libunwind=auto])
14 AS_IF([test "x$with_libunwind" != "xno"], [
15 ZFS_AC_FIND_SYSTEM_LIBRARY(LIBUNWIND, [libunwind], [libunwind.h], [], [unwind], [], [
16 dnl unw_get_elf_filename() is sometimes a macro, other
17 dnl times a proper symbol, so we can't just do a link
18 dnl check; we need to include the header properly.
20 CFLAGS="$CFLAGS $LIBUNWIND_CFLAGS"
21 LIBS="$LIBS $LIBUNWIND_LIBS"
22 AC_MSG_CHECKING([for unw_get_elf_filename in libunwind])
25 #define UNW_LOCAL_ONLY
26 #include <libunwind.h>
28 unw_get_elf_filename(0, 0, 0, 0);
32 AC_DEFINE(HAVE_LIBUNWIND_ELF, 1,
33 [libunwind has unw_get_elf_filename])
39 AS_IF([test "x$with_libunwind" = "xyes"], [
40 AC_MSG_FAILURE([--with-libunwind was given, but libunwind is not available, try installing libunwind-devel])