Send connman mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.01.org/mailman/listinfo/connman
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of connman digest..."


Today's Topics:

   1. [PATCH] configure: check for execinfo.h (Yann E. MORIN)


----------------------------------------------------------------------

Message: 1
Date: Thu, 24 Dec 2015 13:55:25 +0100
From: "Yann E. MORIN" <[email protected]>
To: [email protected]
Subject: [PATCH] configure: check for execinfo.h
Message-ID:
        <[email protected]>

Not all toolchains have execinfo.h. For example, support for it is
optional in uClibc, while it is entirely missing from musl.

Add a check in configure to look for it.

Since execinfo.h is /only/ used to dump a backtrace in case of failure,
just do nothing when execinfo.h is missing.

Signed-off-by: "Yann E. MORIN" <[email protected]>
---
 configure.ac | 2 ++
 src/log.c    | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/configure.ac b/configure.ac
index b51d6b3..28e657b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -182,6 +182,8 @@ AC_CHECK_LIB(resolv, ns_initparse, dummy=yes, [
                AC_MSG_ERROR(resolver library support is required))
 ])
 
+AC_CHECK_HEADERS([execinfo.h])
+
 AC_CHECK_FUNC(signalfd, dummy=yes,
                        AC_MSG_ERROR(signalfd support is required))
 
diff --git a/src/log.c b/src/log.c
index a693bd0..76e10e7 100644
--- a/src/log.c
+++ b/src/log.c
@@ -30,7 +30,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <syslog.h>
+#if defined(HAVE_EXECINFO_H)
 #include <execinfo.h>
+#endif
 #include <dlfcn.h>
 
 #include "connman.h"
@@ -112,6 +114,7 @@ void connman_debug(const char *format, ...)
 
 static void print_backtrace(unsigned int offset)
 {
+#if defined(HAVE_EXECINFO_H)
        void *frames[99];
        size_t n_ptrs;
        unsigned int i;
@@ -210,6 +213,7 @@ static void print_backtrace(unsigned int offset)
 
        close(outfd[1]);
        close(infd[0]);
+#endif /* HAVE_EXECINFO_H */
 }
 
 static void signal_handler(int signo)
-- 
1.9.1



------------------------------

Subject: Digest Footer

_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman


------------------------------

End of connman Digest, Vol 2, Issue 23
**************************************

Reply via email to