aboutsummaryrefslogtreecommitdiff
path: root/package/connman/0001-configure-check-for-execinfo.h.patch
blob: 384f41bd8b44a74540efd29230e39c19f8a11804 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
From 30642d5b1a3f479987c4d50a237311d84d5f0581 Mon Sep 17 00:00:00 2001
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
Date: Thu, 24 Dec 2015 12:04:57 +0100
Subject: [PATCH] configure: check for execinfo.h

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" <yann.morin.1998@free.fr>
---
 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