From: Andreas Ă–man Date: Tue, 4 Jan 2011 20:34:02 +0000 (+0100) Subject: Check for execinfo.h before use X-Git-Tag: 2.99~122 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=641269999afe679f5c83058be83821755588998b;p=thirdparty%2Ftvheadend.git Check for execinfo.h before use --- diff --git a/configure b/configure index f70c0c976..455637927 100755 --- a/configure +++ b/configure @@ -110,6 +110,19 @@ if checkccarg "-msse2"; then enable sse2 fi +check_header_c() { + cat >$TMPDIR/1.c < +int main() { + return 0; +} +EOF + $CC 2>/dev/null $TMPDIR/1.c -o $TMPDIR/1.bin +} + +check_header_c "execinfo.h" && enable execinfo + + echo >>${CONFIG_MAK} $CC_CONFIG_MAK # diff --git a/src/trap.c b/src/trap.c index 0908bd4bb..13c2d8f4b 100644 --- a/src/trap.c +++ b/src/trap.c @@ -30,7 +30,9 @@ char tvh_binshasum[20]; #include #include #include +#if ENABLE_EXECINFO #include +#endif #include #include @@ -64,9 +66,11 @@ static void traphandler(int sig, siginfo_t *si, void *UC) { ucontext_t *uc = UC; +#if ENABLE_EXECINFO static void *frames[MAXFRAMES]; int nframes = backtrace(frames, MAXFRAMES); Dl_info dli; +#endif int i; const char *reason = NULL; @@ -102,6 +106,7 @@ traphandler(int sig, siginfo_t *si, void *UC) } tvhlog_spawn(LOG_ALERT, "CRASH", "%s", tmpbuf); +#if ENABLE_EXECINFO tvhlog_spawn(LOG_ALERT, "CRASH", "STACKTRACE"); for(i = 0; i < nframes; i++) { @@ -128,6 +133,7 @@ traphandler(int sig, siginfo_t *si, void *UC) tvhlog_spawn(LOG_ALERT, "CRASH", "%p", frames[i]); } } +#endif } diff --git a/support/configure.inc b/support/configure.inc index d93c38507..bf821f7bf 100644 --- a/support/configure.inc +++ b/support/configure.inc @@ -26,6 +26,7 @@ CONFIG_LIST=" sse2 linuxdvb v4l + execinfo " die() {