4b9a45db687fd3ed5505978e3bf15533a90e7720
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / liblog4c-localtime / 0003-Fix-debug-mode-build-with-uClibc.patch
1 From acbaee34bcb1881db97969dd2c411446f32ca4cc Mon Sep 17 00:00:00 2001
2 From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3 Date: Sat, 25 Oct 2014 19:45:33 +0200
4 Subject: [PATCH 3/5] Fix debug mode build with uClibc
5
6 When --enable-debug is passed, liblog4c-localtime wants to use
7 <mcheck.h>. It takes the precaution of testing if __GLIBC__ is
8 defined. But unfortunately, the uClibc C library pretends to be
9 compatible with glibc by defining __GLIBC__, but it doesn't provide
10 mcheck.h.
11
12 To better support this situation, we add an AC_CHECK_HEADERS() check
13 on mcheck.h, and then use HAVE_MCHECK_H were appropriate.
14
15 Submitted upstream: https://github.com/rcmadruga/log4c-localtime/pull/1
16
17 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
18 ---
19  configure.in     | 2 +-
20  src/log4c/init.c | 6 +++---
21  2 files changed, 4 insertions(+), 4 deletions(-)
22
23 diff --git a/configure.in b/configure.in
24 index 612ccbe..dbf11e9 100644
25 --- a/configure.in
26 +++ b/configure.in
27 @@ -115,7 +115,7 @@ AM_CONDITIONAL(TEST, test x$enable_test = xyes)
28  AC_HEADER_STDC
29  AC_CHECK_HEADERS([fcntl.h inttypes.h langinfo.h limits.h stddef.h stdint.h \
30  stdlib.h string.h sys/time.h syslog.h unistd.h stdarg.h varargs.h getopt.h \
31 -pthread.h])
32 +pthread.h mcheck.h])
33  
34  # Checks for typedefs, structures, and compiler characteristics.
35  AC_C_CONST
36 diff --git a/src/log4c/init.c b/src/log4c/init.c
37 index 7dd9eb4..4b88210 100644
38 --- a/src/log4c/init.c
39 +++ b/src/log4c/init.c
40 @@ -35,7 +35,7 @@ static const char version[] = "$Id$";
41  #include <layout_type_basic_r.h>
42  #include <layout_type_dated_r.h>
43  
44 -#if defined(__LOG4C_DEBUG__) && defined(__GLIBC__)
45 +#if defined(__LOG4C_DEBUG__) && defined(HAVE_MCHECK_H)
46  #include <mcheck.h>
47  #endif
48  
49 @@ -100,7 +100,7 @@ extern int log4c_init(void)
50      sd_debug("log4c_init[");
51    
52      /* activate GLIBC allocation debugging */
53 -#if defined(__LOG4C_DEBUG__) && defined(__GLIBC__)
54 +#if defined(__LOG4C_DEBUG__) && defined(HAVE_MCHECK_H)
55      mtrace();
56  #endif
57    
58 @@ -280,7 +280,7 @@ extern int log4c_fini(void)
59         log4c_dump_all_instances(stderr);
60      }
61  #endif
62 -#if defined(__LOG4C_DEBUG__) && defined(__GLIBC__)
63 +#if defined(__LOG4C_DEBUG__) && defined(HAVE_MCHECK_H)
64      muntrace();
65  #endif
66    
67 -- 
68 2.0.0
69