diff --git a/configure.ac b/configure.ac index 02d2872b..05c1c482 100644 --- a/configure.ac +++ b/configure.ac @@ -102,6 +102,7 @@ AC_CHECK_HEADERS( bitstring.h \ curses.h \ dirent.h \ + execinfo.h \ fcntl.h \ inttypes.h \ libutil.h \ @@ -121,9 +122,13 @@ AC_CHECK_HEADERS( # Look for library needed for flock. AC_SEARCH_LIBS(flock, bsd) +# Look for library needed for backtrace +AC_SEARCH_LIBS(backtrace, execinfo) + # Check for some functions that are replaced or omitted. AC_CHECK_FUNCS( [ \ + backtrace \ dirfd \ flock \ setproctitle \ diff --git a/tmate-debug.c b/tmate-debug.c index f1fd971f..f58efe0e 100644 --- a/tmate-debug.c +++ b/tmate-debug.c @@ -1,10 +1,19 @@ +#ifdef HAVE_EXECINFO_H #include +#endif #include #include #include #include #include "tmate.h" +#ifndef HAVE_BACKTRACE + +void tmate_print_stack_trace(void) {} +void tmate_catch_sigsegv(void) {} + +#else + #if DEBUG static int print_resolved_stack_frame(const char *frame) @@ -88,3 +97,4 @@ void tmate_catch_sigsegv(void) { signal(SIGSEGV, handle_sigsegv); } +#endif