From e68398dc863a4eb87fcc804d32ab0d6eb3eae9c2 Mon Sep 17 00:00:00 2001 From: Pierre d'Herbemont Date: Sat, 31 May 2008 14:04:33 +0200 Subject: [PATCH] configure: Check for HAVE_BACKTRACE and HAVE_EXECINFO_H. --- configure.ac | 4 ++++ src/misc/objects.c | 4 ++-- src/misc/threads.c | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index e03cac827f..7cfbe1c440 100644 --- a/configure.ac +++ b/configure.ac @@ -1137,6 +1137,10 @@ case "${host_cpu}" in ;; esac +dnl Check for backtrace() support +AC_CHECK_HEADERS(execinfo.h) +AC_CHECK_FUNCS(backtrace) + dnl dnl Enable profiling dnl diff --git a/src/misc/objects.c b/src/misc/objects.c index 4b2e56d3ef..d78c6d518b 100644 --- a/src/misc/objects.c +++ b/src/misc/objects.c @@ -1482,7 +1482,7 @@ static void ListChildren( vlc_list_t *p_list, vlc_object_t *p_this, int i_type ) } #ifndef NDEBUG -# if defined(__GLIBC__) || defined(__APPLE__) +# ifdef (HAVE_EXECINFO_H) # include # endif @@ -1541,7 +1541,7 @@ void vlc_refcheck (vlc_object_t *obj) obj->psz_object_type); fflush (stderr); -#if defined(__GLIBC__) || defined(__APPLE__) +#ifdef HAVE_BACKTRACE void *stack[20]; int stackdepth = backtrace (stack, sizeof (stack) / sizeof (stack[0])); backtrace_symbols_fd (stack, stackdepth, 2); diff --git a/src/misc/threads.c b/src/misc/threads.c index c68dab7c54..57274d6c26 100644 --- a/src/misc/threads.c +++ b/src/misc/threads.c @@ -83,7 +83,7 @@ static inline unsigned long vlc_threadid (void) return v.i; } -#if defined(__GLIBC__) || defined(__APPLE__) +#if HAVE_EXECINFO_H # include #endif @@ -125,7 +125,7 @@ void vlc_pthread_fatal (const char *action, int error, fflush (stderr); #endif -#if defined(__GLIBC__) || defined(__APPLE__) +#ifdef HAVE_BACKTRACE void *stack[20]; int len = backtrace (stack, sizeof (stack) / sizeof (stack[0])); backtrace_symbols_fd (stack, len, 2);