mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 01:31:55 +00:00
Fix mallopt configure checks
Some systems do have malloc.h but don't have mallopt.
This commit is contained in:
parent
d373d48377
commit
b67db7c97d
24
aclocal.m4
vendored
24
aclocal.m4
vendored
@ -86,6 +86,30 @@ AC_DEFUN([BIRD_CHECK_PTHREADS],
|
||||
CFLAGS="$bird_tmp_cflags"
|
||||
])
|
||||
|
||||
AC_DEFUN([BIRD_CHECK_MALLOPT],
|
||||
[
|
||||
AC_CACHE_CHECK(
|
||||
[for mallopt],
|
||||
[bird_cv_mallopt],
|
||||
[
|
||||
AC_COMPILE_IFELSE(
|
||||
[
|
||||
AC_LANG_PROGRAM(
|
||||
[
|
||||
#include <malloc.h>
|
||||
],
|
||||
[
|
||||
mallopt(M_ARENA_MAX, 1);
|
||||
]
|
||||
)
|
||||
],
|
||||
[bird_cv_mallopt=yes],
|
||||
[bird_cv_mallopt=no]
|
||||
)
|
||||
]
|
||||
)
|
||||
])
|
||||
|
||||
AC_DEFUN([BIRD_CHECK_MPLS_KERNEL],
|
||||
[
|
||||
AC_CACHE_CHECK(
|
||||
|
10
configure.ac
10
configure.ac
@ -371,13 +371,17 @@ esac
|
||||
AC_CHECK_HEADERS_ONCE([alloca.h syslog.h stdatomic.h])
|
||||
AC_CHECK_HEADER([sys/mman.h], [AC_DEFINE([HAVE_MMAP], [1], [Define to 1 if mmap() is available.])], have_mman=no)
|
||||
AC_CHECK_FUNC([aligned_alloc], [AC_DEFINE([HAVE_ALIGNED_ALLOC], [1], [Define to 1 if aligned_alloc() is available.])], have_aligned_alloc=no)
|
||||
AC_CHECK_HEADER([malloc.h], [AC_DEFINE([HAVE_MALLOC_H], [1], [Define to 1 if malloc.h is available.])], have_malloc_h=no)
|
||||
AC_CHECK_MEMBERS([struct sockaddr.sa_len], [], [], [#include <sys/socket.h>])
|
||||
|
||||
if test "$have_aligned_alloc" = "no" && test "$have_mman" = "no" ; then
|
||||
AC_MSG_ERROR([No means of aligned alloc found. Need mmap() or aligned_alloc().])
|
||||
fi
|
||||
|
||||
BIRD_CHECK_MALLOPT
|
||||
if test "$bird_cv_mallopt" = "yes" ; then
|
||||
AC_DEFINE([HAVE_MALLOPT], [1], [Define to 1 if mallopt() is available.])
|
||||
fi
|
||||
|
||||
AC_CHECK_MEMBERS([struct sockaddr.sa_len], [], [], [#include <sys/socket.h>])
|
||||
|
||||
|
||||
AC_C_BIGENDIAN(
|
||||
[AC_DEFINE([CPU_BIG_ENDIAN], [1], [Define to 1 if cpu is big endian])],
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#ifdef HAVE_MALLOPT
|
||||
# include <malloc.h>
|
||||
#endif
|
||||
|
||||
@ -505,7 +505,7 @@ page_dump(struct dump_request *dreq)
|
||||
void
|
||||
resource_sys_init(void)
|
||||
{
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#ifdef HAVE_MALLOPT
|
||||
if (!mallopt(M_ARENA_MAX, 1))
|
||||
log(L_WARN "Failed to disable multiple malloc arenas, memory consumption may skyrocket.");
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user