Bug 1667008 [wpt PR 25754] - [css-flex] Change some test expectations for image flex...
[gecko.git] / build / autoconf / alloc.m4
blob4972013b6295b65fd1996a0e1f5f2ab05ad71a24
1 dnl This Source Code Form is subject to the terms of the Mozilla Public
2 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
3 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 dnl Check for the existence of various allocation headers/functions
6 AC_DEFUN([MOZ_CHECK_ALLOCATOR],[
8 MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
9 MALLOC_H=
11 for file in $MALLOC_HEADERS; do
12   MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
13   if test "$MALLOC_H" != ""; then
14     AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
15     break
16   fi
17 done
19 AC_CHECK_FUNCS(strndup posix_memalign memalign)
21 AC_CHECK_FUNCS(malloc_usable_size)
22 MALLOC_USABLE_SIZE_CONST_PTR=const
23 if test -n "$HAVE_MALLOC_H"; then
24   AC_MSG_CHECKING([whether malloc_usable_size definition can use const argument])
25   AC_TRY_COMPILE([#include <malloc.h>
26                   #include <stddef.h>
27                   size_t malloc_usable_size(const void *ptr);],
28                   [return malloc_usable_size(0);],
29                   AC_MSG_RESULT([yes]),
30                   AC_MSG_RESULT([no])
31                   MALLOC_USABLE_SIZE_CONST_PTR=)
33 AC_DEFINE_UNQUOTED([MALLOC_USABLE_SIZE_CONST_PTR],[$MALLOC_USABLE_SIZE_CONST_PTR])
36 dnl In newer bionic headers, valloc is built but not defined,
37 dnl so we check more carefully here.
38 AC_MSG_CHECKING([for valloc in malloc.h])
39 AC_EGREP_HEADER(valloc, malloc.h,
40                 AC_DEFINE(HAVE_VALLOC)
41                 AC_MSG_RESULT([yes]),
42                 AC_MSG_RESULT([no]))
44 AC_MSG_CHECKING([for valloc in unistd.h])
45 AC_EGREP_HEADER(valloc, unistd.h,
46                 AC_DEFINE(HAVE_VALLOC)
47                 AC_MSG_RESULT([yes]),
48                 AC_MSG_RESULT([no]))
50 AC_MSG_CHECKING([for _aligned_malloc in malloc.h])
51 AC_EGREP_HEADER(_aligned_malloc, malloc.h,
52                 AC_DEFINE(HAVE_ALIGNED_MALLOC)
53                 AC_MSG_RESULT([yes]),
54                 AC_MSG_RESULT([no]))