summaryrefslogtreecommitdiff
path: root/source3/configure.in
diff options
context:
space:
mode:
authorJames Peach <jpeach@samba.org>2006-05-04 00:35:05 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:16:42 -0500
commit4ab90ea08c9337128a75a34662c27a3d6bf88d32 (patch)
tree2a9e008af2e82cb0106dfc4f92a67b97b5eccc34 /source3/configure.in
parent7fbc91995e2d3330daed6353ec417a0b08408ed4 (diff)
downloadsamba-4ab90ea08c9337128a75a34662c27a3d6bf88d32.tar.gz
samba-4ab90ea08c9337128a75a34662c27a3d6bf88d32.tar.bz2
samba-4ab90ea08c9337128a75a34662c27a3d6bf88d32.zip
r15424: Implement a "stacktrace" smbcontrol option using libunwind's remote
stack tracing support. This provides an easy way for users to provide stack traces (hopefully it will be implemented on something other than ia64). (This used to be commit 0b5e07e12daa98095dae27e0a6d53fe8ec3f3700)
Diffstat (limited to 'source3/configure.in')
-rw-r--r--source3/configure.in49
1 files changed, 49 insertions, 0 deletions
diff --git a/source3/configure.in b/source3/configure.in
index bb4cf82f35..fc5bad6dab 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -1280,12 +1280,61 @@ AC_TRY_LINK(
[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_LIBUNWIND, 1, [Whether libunwind is available])
+
+ # If we have libunwind, test whether we also have libunwind-ptrace
+ # which would let us unwind arbitrary processes.
+ save_LIBS=$LIBS
+ AC_CHECK_HEADERS(libunwind-ptrace.h)
+ AC_CHECK_LIB(unwind-ptrace, _UPT_create,
+ [
+ LIBUNWIND_PTRACE="-lunwind-ptrace";
+ AC_DEFINE(HAVE_LIBUNWIND_PTRACE, 1,
+ [Whether libunwind-ptrace.a is available.])
+ ],
+ [ LIBUNWIND_PTRACE="" ])
+
+ LIBS=$save_LIBS
],
[
AC_MSG_RESULT(no)
LIBS=$save_LIBS
])
+# To use libunwind-ptrace, we also need to make some ptrace system calls.
+if test x"$LIBUNWIND_PTRACE" != x"" ; then
+ AC_CHECK_HEADERS(sys/ptrace.h)
+ AC_MSG_CHECKING([for the Linux ptrace(2) interface])
+ AC_TRY_LINK(
+ [
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#if HAVE_SYS_PTRACE_H
+#include <sys/ptrace.h>
+#endif
+ ],
+ [
+ int main(int argc, const char ** argv)
+ {
+ pid_t me = (pid_t)-1;
+ ptrace(PTRACE_ATTACH, me, 0, 0);
+ ptrace(PTRACE_DETACH, me, 0, 0);
+ return 0;
+ }
+ ],
+ [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_LINUX_PTRACE, 1,
+ [Whether the Linux ptrace(2) interface is available.])
+ ],
+ [
+ AC_MSG_RESULT(no)
+ LIBUNWIND_PTRACE=""
+ ])
+fi
+
+AC_SUBST(LIBUNWIND_PTRACE)
+
# syscall() is needed for smbwrapper.
AC_CHECK_FUNCS(syscall)