summaryrefslogtreecommitdiff
path: root/source3/configure.in
diff options
context:
space:
mode:
authorJames Peach <jpeach@samba.org>2006-04-12 00:07:40 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:16:00 -0500
commit7a5ff0885d08f9e32dc9939e5fd676a987b881d9 (patch)
treede8abf7e0c7a49284d2730dd0c6cae614a8016a7 /source3/configure.in
parenta407405438beb1f71e186d7e5b2145b303ccfdaf (diff)
downloadsamba-7a5ff0885d08f9e32dc9939e5fd676a987b881d9.tar.gz
samba-7a5ff0885d08f9e32dc9939e5fd676a987b881d9.tar.bz2
samba-7a5ff0885d08f9e32dc9939e5fd676a987b881d9.zip
r15047: Add support for using libunwind to generate a backtrace. This is
primarily intended for ia64 systems where libunwind knows more about the different ways of walking the stack that just about anything else. (This used to be commit 256a19d722f360dac3c8e83f5bfac453fa70db96)
Diffstat (limited to 'source3/configure.in')
-rw-r--r--source3/configure.in44
1 files changed, 41 insertions, 3 deletions
diff --git a/source3/configure.in b/source3/configure.in
index b6a7556166..386f83172a 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -827,7 +827,7 @@ AC_CHECK_HEADERS(sys/un.h)
AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h)
AC_CHECK_HEADERS(sys/termio.h sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
AC_CHECK_HEADERS(sys/sysmacros.h security/_pam_macros.h dlfcn.h)
-AC_CHECK_HEADERS(sys/syslog.h syslog.h execinfo.h)
+AC_CHECK_HEADERS(sys/syslog.h syslog.h)
AC_CHECK_HEADERS(langinfo.h locale.h)
AC_CHECK_HEADERS(sys/dmi.h xfs/dmapi.h sys/jfsdmapi.h sys/dmapi.h)
@@ -1243,10 +1243,48 @@ AC_CHECK_FUNCS(syslog vsyslog timegm)
AC_CHECK_FUNCS(setlocale nl_langinfo)
AC_CHECK_FUNCS(nanosleep)
# setbuffer, shmget, shm_open are needed for smbtorture
-AC_CHECK_FUNCS(setbuffer shmget shm_open backtrace_symbols)
-AC_CHECK_HEADERS(libexc.h)
+AC_CHECK_FUNCS(setbuffer shmget shm_open)
+
+# Find a method of generating a stack trace
+AC_CHECK_HEADERS(execinfo.h libexc.h libunwind.h)
+AC_CHECK_FUNCS(backtrace_symbols)
AC_CHECK_LIB(exc, trace_back_stack)
+# Note that all the libunwind symbols in the API are defined to internal
+# platform-specific version, so we must include libunwind.h before checking
+# any of them.
+AC_MSG_CHECKING([for libunwind])
+save_LIBS=$LIBS
+if test x"$UNAME_P" != xunknown ; then
+ # This probably won't link without the platform-specific libunwind.
+ LIBS="$LIBS -lunwind"
+else
+ # Add the platform-specific libunwind module. uname -p seems the most
+ # plausible option and works for ia64, where libunwind is most useful.
+ LIBS="$LIBS -lunwind -lunwind-$UNAME_P"
+fi
+
+AC_TRY_LINK(
+ [
+#ifdef HAVE_LIBUNWIND_H
+#include <libunwind.h>
+#endif
+ ],
+ [
+ unw_context_t ctx; unw_cursor_t cur;
+ char buf[256]; unw_word_t off;
+ unw_getcontext(&ctx); unw_init_local(&cur, &ctx);
+ unw_get_proc_name(&cur, buf, sizeof(buf), &off);
+ ],
+ [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_LIBUNWIND, 1, [Whether libunwind is available])
+ ],
+ [
+ AC_MSG_RESULT(no)
+ LIBS=$save_LIBS
+ ])
+
# syscall() is needed for smbwrapper.
AC_CHECK_FUNCS(syscall)