summaryrefslogtreecommitdiffstats
path: root/build/autoconf/alloc.m4
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /build/autoconf/alloc.m4
parentInitial commit. (diff)
downloadfirefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz
firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'build/autoconf/alloc.m4')
-rw-r--r--build/autoconf/alloc.m457
1 files changed, 57 insertions, 0 deletions
diff --git a/build/autoconf/alloc.m4 b/build/autoconf/alloc.m4
new file mode 100644
index 0000000000..4972013b62
--- /dev/null
+++ b/build/autoconf/alloc.m4
@@ -0,0 +1,57 @@
+dnl This Source Code Form is subject to the terms of the Mozilla Public
+dnl License, v. 2.0. If a copy of the MPL was not distributed with this
+dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+dnl Check for the existence of various allocation headers/functions
+AC_DEFUN([MOZ_CHECK_ALLOCATOR],[
+
+MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
+MALLOC_H=
+
+for file in $MALLOC_HEADERS; do
+ MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
+ if test "$MALLOC_H" != ""; then
+ AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
+ break
+ fi
+done
+
+AC_CHECK_FUNCS(strndup posix_memalign memalign)
+
+AC_CHECK_FUNCS(malloc_usable_size)
+MALLOC_USABLE_SIZE_CONST_PTR=const
+if test -n "$HAVE_MALLOC_H"; then
+ AC_MSG_CHECKING([whether malloc_usable_size definition can use const argument])
+ AC_TRY_COMPILE([#include <malloc.h>
+ #include <stddef.h>
+ size_t malloc_usable_size(const void *ptr);],
+ [return malloc_usable_size(0);],
+ AC_MSG_RESULT([yes]),
+ AC_MSG_RESULT([no])
+ MALLOC_USABLE_SIZE_CONST_PTR=)
+fi
+AC_DEFINE_UNQUOTED([MALLOC_USABLE_SIZE_CONST_PTR],[$MALLOC_USABLE_SIZE_CONST_PTR])
+
+
+dnl In newer bionic headers, valloc is built but not defined,
+dnl so we check more carefully here.
+AC_MSG_CHECKING([for valloc in malloc.h])
+AC_EGREP_HEADER(valloc, malloc.h,
+ AC_DEFINE(HAVE_VALLOC)
+ AC_MSG_RESULT([yes]),
+ AC_MSG_RESULT([no]))
+
+AC_MSG_CHECKING([for valloc in unistd.h])
+AC_EGREP_HEADER(valloc, unistd.h,
+ AC_DEFINE(HAVE_VALLOC)
+ AC_MSG_RESULT([yes]),
+ AC_MSG_RESULT([no]))
+
+AC_MSG_CHECKING([for _aligned_malloc in malloc.h])
+AC_EGREP_HEADER(_aligned_malloc, malloc.h,
+ AC_DEFINE(HAVE_ALIGNED_MALLOC)
+ AC_MSG_RESULT([yes]),
+ AC_MSG_RESULT([no]))
+
+
+])