From 324be174d79290281ec42b41636a5303c569a133 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Tue, 4 Sep 2018 12:24:22 +0200 Subject: [PATCH] build: check {malloc,pthread}_np.h for *BSD FreeBSD has malloc_usable_size() in malloc_np.h OpenBSD has pthread_set_name_np() in pthread_np.h Signed-off-by: David Lamparter --- configure.ac | 9 ++++++++- lib/frr_pthread.c | 3 +++ lib/memory.c | 3 +++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index e6ca7d9589..779c7ebb6a 100755 --- a/configure.ac +++ b/configure.ac @@ -815,6 +815,10 @@ int main(int argc, char **argv) { ]) ]) +AC_CHECK_HEADERS([pthread_np.h],,, [ +#include +]) + dnl Utility macro to avoid retyping includes all the time m4_define([FRR_INCLUDES], [#ifdef SUNOS_5 @@ -1784,13 +1788,16 @@ dnl order to check no alternative allocator dnl has been specified, which might not provide dnl mallinfo, e.g. such as Umem on Solaris. dnl ----------------------------------------- -AC_CHECK_HEADERS([malloc.h malloc/malloc.h],,, [FRR_INCLUDES]) +AC_CHECK_HEADERS([malloc.h malloc_np.h malloc/malloc.h],,, [FRR_INCLUDES]) AC_CACHE_CHECK([whether mallinfo is available], [frr_cv_mallinfo], [ AC_LINK_IFELSE([AC_LANG_PROGRAM([FRR_INCLUDES [ #ifdef HAVE_MALLOC_H #include #endif +#ifdef HAVE_MALLOC_NP_H +#include +#endif #ifdef HAVE_MALLOC_MALLOC_H #include #endif diff --git a/lib/frr_pthread.c b/lib/frr_pthread.c index c0aae5e52e..7cae889ca9 100644 --- a/lib/frr_pthread.c +++ b/lib/frr_pthread.c @@ -19,6 +19,9 @@ #include #include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif #include #include "frr_pthread.h" diff --git a/lib/memory.c b/lib/memory.c index 695bbfe115..fee23a75ac 100644 --- a/lib/memory.c +++ b/lib/memory.c @@ -20,6 +20,9 @@ #ifdef HAVE_MALLOC_H #include #endif +#ifdef HAVE_MALLOC_NP_H +#include +#endif #ifdef HAVE_MALLOC_MALLOC_H #include #endif -- 2.39.5