0003-Fix-debug-mode-build-with-uClibc.patch 2.2 KB

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