From 36ef1a93be59addbb1d2ecf57083f74a3d2f9fe4 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Sun, 5 Dec 2010 15:43:56 +0000 Subject: [PATCH] make htop friendly to uclibc (thanks to Matt for the report) --- CRT.c | 10 +++++++--- CRT.h | 2 ++ configure.ac | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CRT.c b/CRT.c index 14af4208..bf6afec2 100644 --- a/CRT.c +++ b/CRT.c @@ -11,7 +11,9 @@ in the source distribution for its full text. #include #include #include +#ifdef HAVE_EXECINFO_H #include +#endif #include "String.h" @@ -125,12 +127,14 @@ static void CRT_handleSIGSEGV(int sgn) { CRT_done(); #if __linux fprintf(stderr, "\n\nhtop " VERSION " aborting. Please report bug at http://htop.sf.net\n"); - #else - fprintf(stderr, "\n\nhtop " VERSION " aborting. Unsupported platform.\n"); - #endif + #ifdef HAVE_EXECINFO_H size_t size = backtrace(backtraceArray, sizeof(backtraceArray)); fprintf(stderr, "Backtrace: \n"); backtrace_symbols_fd(backtraceArray, size, 2); + #endif + #else + fprintf(stderr, "\n\nhtop " VERSION " aborting. Unsupported platform.\n"); + #endif abort(); } diff --git a/CRT.h b/CRT.h index dcc902f6..438d4ae2 100644 --- a/CRT.h +++ b/CRT.h @@ -14,7 +14,9 @@ in the source distribution for its full text. #include #include #include +#ifdef HAVE_EXECINFO_H #include +#endif #include "String.h" diff --git a/configure.ac b/configure.ac index ba95b19e..6eac18da 100644 --- a/configure.ac +++ b/configure.ac @@ -25,6 +25,7 @@ AC_HEADER_STDC AC_CHECK_HEADERS([stdlib.h string.h strings.h sys/param.h sys/time.h unistd.h curses.h],[:],[ missing_headers="$missing_headers $ac_header" ]) +AC_CHECK_HEADERS([execinfo.h],[:],[:]) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL