mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 13:37:17 +02:00
build: rework mallinfo test & find malloc_size
Signed-off-by: David Lamparter <equinox@diac24.net>
This commit is contained in:
parent
09890489cc
commit
fa896a1d80
61
configure.ac
61
configure.ac
|
@ -1811,15 +1811,58 @@ dnl order to check no alternative allocator
|
||||||
dnl has been specified, which might not provide
|
dnl has been specified, which might not provide
|
||||||
dnl mallinfo, e.g. such as Umem on Solaris.
|
dnl mallinfo, e.g. such as Umem on Solaris.
|
||||||
dnl -----------------------------------------
|
dnl -----------------------------------------
|
||||||
AC_CHECK_HEADER([malloc.h],
|
AC_CHECK_HEADERS([malloc.h malloc/malloc.h],,, [FRR_INCLUDES])
|
||||||
[AC_MSG_CHECKING(whether mallinfo is available)
|
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <malloc.h>]],
|
AC_MSG_CHECKING(whether mallinfo is available)
|
||||||
[[struct mallinfo ac_x; ac_x = mallinfo ();]])],
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([FRR_INCLUDES [
|
||||||
[AC_MSG_RESULT(yes)
|
#ifdef HAVE_MALLOC_H
|
||||||
AC_DEFINE(HAVE_MALLINFO,,mallinfo)],
|
#include <malloc.h>
|
||||||
AC_MSG_RESULT(no)
|
#endif
|
||||||
)
|
#ifdef HAVE_MALLOC_MALLOC_H
|
||||||
], [], FRR_INCLUDES)
|
#include <malloc/malloc.h>
|
||||||
|
#endif
|
||||||
|
]], [[
|
||||||
|
struct mallinfo ac_x; ac_x = mallinfo ();
|
||||||
|
]])], [
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_MALLINFO,,mallinfo)
|
||||||
|
], [
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(whether malloc_usable_size is available)
|
||||||
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([FRR_INCLUDES [
|
||||||
|
#ifdef HAVE_MALLOC_H
|
||||||
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_MALLOC_MALLOC_H
|
||||||
|
#include <malloc/malloc.h>
|
||||||
|
#endif
|
||||||
|
]], [[
|
||||||
|
size_t ac_x; ac_x = malloc_usable_size(NULL);
|
||||||
|
]])], [
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_MALLOC_USABLE_SIZE,,malloc_usable_size)
|
||||||
|
], [
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(whether malloc_size is available)
|
||||||
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||||
|
#ifdef HAVE_MALLOC_H
|
||||||
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_MALLOC_MALLOC_H
|
||||||
|
#include <malloc/malloc.h>
|
||||||
|
#endif
|
||||||
|
]], [[
|
||||||
|
size_t ac_x; ac_x = malloc_size(NULL);
|
||||||
|
]])], [
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_MALLOC_SIZE,,malloc_size)
|
||||||
|
], [
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
|
])
|
||||||
|
|
||||||
dnl ------
|
dnl ------
|
||||||
dnl ZeroMQ
|
dnl ZeroMQ
|
||||||
|
|
|
@ -21,9 +21,12 @@
|
||||||
|
|
||||||
#include <zebra.h>
|
#include <zebra.h>
|
||||||
/* malloc.h is generally obsolete, however GNU Libc mallinfo wants it. */
|
/* malloc.h is generally obsolete, however GNU Libc mallinfo wants it. */
|
||||||
#if (defined(GNU_LINUX) && defined(HAVE_MALLINFO))
|
#ifdef HAVE_MALLOC_H
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#endif /* HAVE_MALLINFO */
|
#endif
|
||||||
|
#ifdef HAVE_MALLOC_MALLOC_H
|
||||||
|
#include <malloc/malloc.h>
|
||||||
|
#endif
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <link.h>
|
#include <link.h>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue