Skip to content

Commit 05b7ae8

Browse files
committed
Add unwind-ptrace library
1 parent eb86bdf commit 05b7ae8

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

configure.ac

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,40 @@ if test "x$enable_unwind" = xno; then
499499
AC_SEARCH_LIBS([backtrace], [execinfo])
500500
fi
501501

502+
AC_ARG_ENABLE([unwind-ptrace],
503+
[AS_HELP_STRING([--enable-unwind-ptrace],
504+
[enable unwind-ptrace support for printing backtraces through ptrace(2); requires libunwind-ptrace @<:@default=check@:>@])],
505+
[],
506+
[enable_unwind_ptrace=check])
507+
case "$enable_unwind_ptrace" in
508+
check)
509+
enable_unwind_ptrace=yes
510+
if test "$enable_static" = yes; then
511+
AC_CHECK_LIB([lzma], [lzma_index_buffer_decode])
512+
fi
513+
AC_CHECK_HEADERS([libunwind-ptrace.h], [], [
514+
old_CFLAGS="$CFLAGS"
515+
CFLAGS="$CFLAGS -I/usr/include/libunwind"
516+
AC_CHECK_HEADERS([libunwind/libunwind-ptrace.h], [], [
517+
enable_unwind_ptrace=no
518+
CFLAGS="$old_CFLAGS"
519+
])
520+
])
521+
;;
522+
no)
523+
;;
524+
yes)
525+
AC_CHECK_LIB([unwind-ptrace], [_UPT_create], [], [AC_MSG_ERROR([can not find required library libunwind-ptrace])], [-lunwind-generic])
526+
AC_CHECK_LIB([unwind-generic], [_UPT_create], [], [AC_MSG_ERROR([can not find required library libunwind-generic])])
527+
AC_CHECK_HEADERS([libunwind-ptrace.h], [], [
528+
CFLAGS="$CFLAGS -I/usr/include/libunwind"
529+
AC_CHECK_HEADERS([libunwind/libunwind-ptrace.h], [], [AC_MSG_ERROR([can not find required header file libunwind-ptrace.h])])
530+
])
531+
;;
532+
*)
533+
AC_MSG_ERROR([bad value '$enable_unwind_ptrace' for --enable-unwind_ptrace])
534+
;;
535+
esac
502536

503537
AC_ARG_ENABLE([hwloc],
504538
[AS_HELP_STRING([--enable-hwloc],
@@ -833,6 +867,7 @@ AC_MSG_RESULT([
833867
unicode: $enable_unicode
834868
affinity: $enable_affinity
835869
unwind: $enable_unwind
870+
unwind-ptrace: $enable_unwind_ptrace
836871
hwloc: $enable_hwloc
837872
debug: $enable_debug
838873
static: $enable_static

0 commit comments

Comments
 (0)