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 <equinox@diac24.net>
This commit is contained in:
David Lamparter 2018-09-04 12:24:22 +02:00
parent 0718b5624c
commit 324be174d7
3 changed files with 14 additions and 1 deletions

View file

@ -815,6 +815,10 @@ int main(int argc, char **argv) {
])
])
AC_CHECK_HEADERS([pthread_np.h],,, [
#include <pthread.h>
])
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 <malloc.h>
#endif
#ifdef HAVE_MALLOC_NP_H
#include <malloc_np.h>
#endif
#ifdef HAVE_MALLOC_MALLOC_H
#include <malloc/malloc.h>
#endif

View file

@ -19,6 +19,9 @@
#include <zebra.h>
#include <pthread.h>
#ifdef HAVE_PTHREAD_NP_H
#include <pthread_np.h>
#endif
#include <sched.h>
#include "frr_pthread.h"

View file

@ -20,6 +20,9 @@
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
#ifdef HAVE_MALLOC_NP_H
#include <malloc_np.h>
#endif
#ifdef HAVE_MALLOC_MALLOC_H
#include <malloc/malloc.h>
#endif