summaryrefslogtreecommitdiffstats
path: root/m4/ax_c_mallinfo.m4
blob: af8d0481e5b20b2181d2888c10b4146dce2e7088 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# AC_C_MALLINFO
# -------------
# Define HAVE_C_MALLINFO if mallinfo() works.
AN_IDENTIFIER([mallinfo], [AC_C_MALLINFO])
AC_DEFUN([AC_C_MALLINFO],
[AC_CACHE_CHECK([for mallinfo], ac_cv_c_mallinfo,
[AC_LINK_IFELSE(
  [AC_LANG_PROGRAM(
    [[#include <malloc.h>]],
    [[
      struct mallinfo mi = mallinfo();
      /* make sure that fields exists */
      mi.uordblks = 0;
      mi.hblkhd = 0;
      mi.arena = 0;
    ]]
  )],
  [ac_cv_c_mallinfo=yes],
  [ac_cv_c_mallinfo=no])])
if test $ac_cv_c_mallinfo = yes; then
  AC_DEFINE([HAVE_C_MALLINFO], 1,
           [Define to 1 if glibc mallinfo exists.])
fi
])# AC_C_MALLINFO