Skip to content

Commit 2910c05

Browse files
borneoaerhankur
authored andcommitted
configure: allow --enable-malloc-logging only with glibc
The feature for 'malloc-logging' uses functionalities that are available only in GNU libc. Detect in 'configure' if OpenOCD is being compiled with glibc. Set the macro '_DEBUG_FREE_SPACE_' only in case of glibc. Change-Id: I43e9b87c7ad47171cfe3e7c1e5f96f11e19f98d0 Signed-off-by: Antonio Borneo <[email protected]> Reviewed-on: https://review.openocd.org/c/openocd/+/8592 Tested-by: jenkins
1 parent 4554d36 commit 2910c05

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

configure.ac

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ AC_CHECK_TYPE([Elf64_Ehdr],
5757
AC_DEFINE([HAVE_ELF64], [1], [Define to 1 if the system has the type 'Elf64_Ehdr'.]),
5858
[], [[#include <elf.h>]])
5959

60+
AC_MSG_CHECKING([for glibc])
61+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <features.h>]], [[int v = __GLIBC__;return 0;]])],
62+
[have_glibc=yes], [have_glibc=no])
63+
AC_MSG_RESULT($have_glibc)
64+
6065
AC_CHECK_HEADERS([dirent.h])
6166
AC_CHECK_HEADERS([fcntl.h])
6267
AC_CHECK_HEADERS([malloc.h])
@@ -265,7 +270,7 @@ AC_ARG_ENABLE([malloc_logging],
265270

266271
AC_MSG_CHECKING([whether to enable malloc free space logging]);
267272
AC_MSG_RESULT([$debug_malloc])
268-
AS_IF([test "x$debug_malloc" = "xyes"], [
273+
AS_IF([test "x$debug_malloc" = "xyes" -a "x$have_glibc" = "xyes"], [
269274
AC_DEFINE([_DEBUG_FREE_SPACE_],[1], [Include malloc free space in logging])
270275
])
271276

0 commit comments

Comments
 (0)