Signed-off-by: Petr Vorel <petr.vorel(a)gmail.com>
---
configure.ac | 4 ++++
src/log.c | 8 ++++----
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index b8d42c8..b6183a1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -245,3 +245,7 @@ AC_DEFINE_UNQUOTED(CONFIGDIR, "${configdir}",
AC_OUTPUT(Makefile include/version.h src/ofono.service ofono.pc \
dundee/dundee.service)
+
+dnl Check for backtrace() support
+AC_CHECK_HEADERS(execinfo.h)
+AC_CHECK_FUNCS(backtrace)
diff --git a/src/log.c b/src/log.c
index 6331b0d..0d55d6e 100644
--- a/src/log.c
+++ b/src/log.c
@@ -30,7 +30,7 @@
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
-#ifdef __GLIBC__
+#ifdef HAVE_EXECINFO_H
#include <execinfo.h>
#endif
#include <dlfcn.h>
@@ -115,7 +115,7 @@ void ofono_debug(const char *format, ...)
va_end(ap);
}
-#ifdef __GLIBC__
+#ifdef HAVE_BACKTRACE
static void print_backtrace(unsigned int offset)
{
void *frames[99];
@@ -309,7 +309,7 @@ int __ofono_log_init(const char *program, const char *debug,
if (detach == FALSE)
option |= LOG_PERROR;
-#ifdef __GLIBC__
+#ifdef HAVE_BACKTRACE
signal_setup(signal_handler);
#endif
@@ -326,7 +326,7 @@ void __ofono_log_cleanup(void)
closelog();
-#ifdef __GLIBC__
+#ifdef HAVE_BACKTRACE
signal_setup(SIG_DFL);
#endif
--
2.6.2