From cb6ecb6818a0c4c4cb0fd946ce5be3f5aa965e09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Wed, 6 Mar 2024 23:09:00 +0100 Subject: [PATCH] core: check if malloc.h is present, independently of function malloc_trim --- CMakeLists.txt | 2 ++ config.h.cmake | 1 + src/core/wee-command.c | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 76dbd39dd..5ab265408 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -192,7 +192,9 @@ include(CheckSymbolExists) check_include_files("langinfo.h" HAVE_LANGINFO_CODESET) check_include_files("sys/resource.h" HAVE_SYS_RESOURCE_H) +check_include_files("malloc.h" HAVE_MALLOC_H) check_symbol_exists("malloc_trim" "malloc.h" HAVE_MALLOC_TRIM) + check_function_exists(mallinfo HAVE_MALLINFO) check_function_exists(mallinfo2 HAVE_MALLINFO2) diff --git a/config.h.cmake b/config.h.cmake index edd876469..9f6b2c3f3 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -5,6 +5,7 @@ #cmakedefine ICONV_2ARG_IS_CONST 1 #cmakedefine HAVE_MALLINFO #cmakedefine HAVE_MALLINFO2 +#cmakedefine HAVE_MALLOC_H #cmakedefine HAVE_MALLOC_TRIM #cmakedefine HAVE_EAT_NEWLINE_GLITCH #cmakedefine HAVE_ASPELL_VERSION_STRING diff --git a/src/core/wee-command.c b/src/core/wee-command.c index d94ef9a46..3f4f631f2 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -40,7 +40,7 @@ #include #include #include -#ifdef HAVE_MALLOC_TRIM +#ifdef HAVE_MALLOC_H #include #endif