summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@qlyoung.net>2021-02-08 07:56:07 +0100
committerQuentin Young <qlyoung@qlyoung.net>2021-02-11 00:35:15 +0100
commit51ab4dbaad5f4abd9db75c74761bebd8524d756c (patch)
tree4f7ddd9878bb0b29cb302dbbb018e22aec5bc0db /configure.ac
parentMerge pull request #8033 from qlyoung/fix-gnu-readline-bracketed-paste (diff)
downloadfrr-51ab4dbaad5f4abd9db75c74761bebd8524d756c.tar.xz
frr-51ab4dbaad5f4abd9db75c74761bebd8524d756c.zip
lib: support mallinfo2()
mallinfo() is deprecated as of glibc 2.33 and emits a warning if used. Support mallinfo2() if available. Signed-off-by: Quentin Young <qlyoung@qlyoung.net>
Diffstat (limited to 'configure.ac')
-rwxr-xr-xconfigure.ac23
1 files changed, 23 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 09ec23ab7..266f37a11 100755
--- a/configure.ac
+++ b/configure.ac
@@ -2366,6 +2366,29 @@ if test "$frr_cv_mallinfo" = "yes"; then
AC_DEFINE([HAVE_MALLINFO], [1], [mallinfo])
fi
+AC_CACHE_CHECK([whether mallinfo2 is available], [frr_cv_mallinfo2], [
+ 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
+]], [[
+struct mallinfo2 ac_x; ac_x = mallinfo2 ();
+]])], [
+ frr_cv_mallinfo2=yes
+ ], [
+ frr_cv_mallinfo2=no
+ ])
+])
+if test "$frr_cv_mallinfo2" = "yes"; then
+ AC_DEFINE([HAVE_MALLINFO2], [1], [mallinfo2])
+fi
+
AC_MSG_CHECKING([whether malloc_usable_size is available])
AC_LINK_IFELSE([AC_LANG_PROGRAM([FRR_INCLUDES [
#ifdef HAVE_MALLOC_H