]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Check for execinfo.h before use
authorAndreas Öman <andreas@lonelycoder.com>
Tue, 4 Jan 2011 20:34:02 +0000 (21:34 +0100)
committerAndreas Öman <andreas@lonelycoder.com>
Tue, 4 Jan 2011 20:34:02 +0000 (21:34 +0100)
configure
src/trap.c
support/configure.inc

index f70c0c976ab2c1c1ed66118cf3bf64db15b27d6d..4556379276c099765e1b9c51307f990d96dc2c2c 100755 (executable)
--- a/configure
+++ b/configure
@@ -110,6 +110,19 @@ if checkccarg "-msse2"; then
    enable sse2
 fi
 
+check_header_c() {
+    cat >$TMPDIR/1.c <<EOF
+#include <$1>
+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 
 
 #
index 0908bd4bbe82ab2988f394da8d219c33d8a2553e..13c2d8f4b8f927b66afc4f9bb95863d476dcc1f5 100644 (file)
@@ -30,7 +30,9 @@ char tvh_binshasum[20];
 #include <string.h>
 #include <signal.h>
 #include <ucontext.h>
+#if ENABLE_EXECINFO
 #include <execinfo.h>
+#endif
 #include <stdio.h>
 #include <stdarg.h>
 
@@ -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
 }
 
 
index d93c38507a41a5453859ad1dd3a01fa1fbecd3b1..bf821f7bf3ac4a143a0c439363362ebb60caa164 100644 (file)
@@ -26,6 +26,7 @@ CONFIG_LIST="
  sse2
  linuxdvb
  v4l
+ execinfo
 "
 
 die() {