forked from mirrors/gecko-dev
Bug 1894951 - Move MOZ_CHECK_ALLOCATOR to moz.configure r=glandium
MOZ_CHECK_ALLOCATOR was defining HAVE_VALLOC and HAVE_ALIGNED_MALLOC which are unused, so get rid of these checks. Differential Revision: https://phabricator.services.mozilla.com/D210278
This commit is contained in:
parent
e447c37ac7
commit
53c408f3bc
7 changed files with 38 additions and 73 deletions
1
aclocal.m4
vendored
1
aclocal.m4
vendored
|
|
@ -13,7 +13,6 @@ builtin(include, build/autoconf/compiler-opts.m4)dnl
|
||||||
builtin(include, build/autoconf/arch.m4)dnl
|
builtin(include, build/autoconf/arch.m4)dnl
|
||||||
builtin(include, build/autoconf/android.m4)dnl
|
builtin(include, build/autoconf/android.m4)dnl
|
||||||
builtin(include, build/autoconf/clang-plugin.m4)dnl
|
builtin(include, build/autoconf/clang-plugin.m4)dnl
|
||||||
builtin(include, build/autoconf/alloc.m4)dnl
|
|
||||||
builtin(include, build/autoconf/sanitize.m4)dnl
|
builtin(include, build/autoconf/sanitize.m4)dnl
|
||||||
|
|
||||||
MOZ_PROG_CHECKMSYS()
|
MOZ_PROG_CHECKMSYS()
|
||||||
|
|
|
||||||
|
|
@ -1,57 +0,0 @@
|
||||||
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
|
|
||||||
|
|
||||||
MALLOC_USABLE_SIZE_CONST_PTR=const
|
|
||||||
if test -n "$HAVE_MALLOC_H"; then
|
|
||||||
AC_CACHE_CHECK([whether malloc_usable_size definition can use const argument],
|
|
||||||
moz_cv_malloc_usable_size_constness,
|
|
||||||
[AC_TRY_COMPILE([#include <malloc.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
size_t malloc_usable_size(const void *ptr);],
|
|
||||||
[return malloc_usable_size(0);],
|
|
||||||
[moz_cv_malloc_usable_size_constness=yes],
|
|
||||||
[moz_cv_malloc_usable_size_constness=no])])
|
|
||||||
if test "$moz_cv_malloc_usable_size_constness" = no ; then
|
|
||||||
MALLOC_USABLE_SIZE_CONST_PTR=
|
|
||||||
fi
|
|
||||||
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]))
|
|
||||||
|
|
||||||
|
|
||||||
])
|
|
||||||
|
|
@ -16,12 +16,9 @@ set_config("HAVE_INTTYPES_H", have_inttypes)
|
||||||
|
|
||||||
building_linux = depends(target)(lambda target: target.kernel == "Linux")
|
building_linux = depends(target)(lambda target: target.kernel == "Linux")
|
||||||
|
|
||||||
have_malloc = check_header("malloc.h")
|
|
||||||
|
|
||||||
check_header("alloca.h")
|
check_header("alloca.h")
|
||||||
|
|
||||||
add_old_configure_assignment("HAVE_MALLOC_H", have_malloc)
|
|
||||||
|
|
||||||
check_headers(
|
check_headers(
|
||||||
"sys/byteorder.h",
|
"sys/byteorder.h",
|
||||||
"getopt.h",
|
"getopt.h",
|
||||||
|
|
|
||||||
|
|
@ -136,4 +136,41 @@ with only_when(depends(target.os)(lambda os: os != "WINNT")):
|
||||||
set_define("HAVE_STRNDUP", check_symbol("strndup"))
|
set_define("HAVE_STRNDUP", check_symbol("strndup"))
|
||||||
set_define("HAVE_POSIX_MEMALIGN", check_symbol("posix_memalign"))
|
set_define("HAVE_POSIX_MEMALIGN", check_symbol("posix_memalign"))
|
||||||
set_define("HAVE_MEMALIGN", check_symbol("memalign"))
|
set_define("HAVE_MEMALIGN", check_symbol("memalign"))
|
||||||
set_define("HAVE_MALLOC_USABLE_SIZE", check_symbol("malloc_usable_size"))
|
|
||||||
|
have_malloc_usable_size = check_symbol("malloc_usable_size")
|
||||||
|
set_define("HAVE_MALLOC_USABLE_SIZE", have_malloc_usable_size)
|
||||||
|
|
||||||
|
|
||||||
|
@template
|
||||||
|
def check_malloc_header():
|
||||||
|
found_header = dependable(None)
|
||||||
|
malloc_headers = ("malloc.h", "malloc_np.h", "malloc/malloc.h", "sys/malloc.h")
|
||||||
|
for malloc_h in malloc_headers:
|
||||||
|
have_malloc_h = check_header(malloc_h, when=~found_header)
|
||||||
|
found_header = depends(have_malloc_h, found_header)(
|
||||||
|
lambda h, f: malloc_h if h else f
|
||||||
|
)
|
||||||
|
return found_header
|
||||||
|
|
||||||
|
|
||||||
|
malloc_h = check_malloc_header()
|
||||||
|
have_malloc_h = depends(malloc_h)(lambda h: h == "malloc.h")
|
||||||
|
|
||||||
|
set_define("MALLOC_H", depends_if(malloc_h)(lambda h: f"<{h}>"))
|
||||||
|
|
||||||
|
usable_size_constness = c_compiler.try_compile(
|
||||||
|
includes=depends(malloc_h)(lambda h: [h, "stddef.h"]),
|
||||||
|
body="""
|
||||||
|
extern size_t malloc_usable_size(const void *ptr);
|
||||||
|
return malloc_usable_size(0);
|
||||||
|
""",
|
||||||
|
check_msg="whether malloc_usable_size definition can use const argument",
|
||||||
|
when=have_malloc_usable_size,
|
||||||
|
)
|
||||||
|
|
||||||
|
set_define(
|
||||||
|
"MALLOC_USABLE_SIZE_CONST_PTR",
|
||||||
|
depends(usable_size_constness, have_malloc_h)(
|
||||||
|
lambda u, h: "const" if (u or not h) else ""
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
|
||||||
1
js/src/aclocal.m4
vendored
1
js/src/aclocal.m4
vendored
|
|
@ -13,7 +13,6 @@ builtin(include, ../../build/autoconf/compiler-opts.m4)dnl
|
||||||
builtin(include, ../../build/autoconf/arch.m4)dnl
|
builtin(include, ../../build/autoconf/arch.m4)dnl
|
||||||
builtin(include, ../../build/autoconf/android.m4)dnl
|
builtin(include, ../../build/autoconf/android.m4)dnl
|
||||||
builtin(include, ../../build/autoconf/clang-plugin.m4)dnl
|
builtin(include, ../../build/autoconf/clang-plugin.m4)dnl
|
||||||
builtin(include, ../../build/autoconf/alloc.m4)dnl
|
|
||||||
builtin(include, ../../build/autoconf/sanitize.m4)dnl
|
builtin(include, ../../build/autoconf/sanitize.m4)dnl
|
||||||
|
|
||||||
define([__MOZ_AC_INIT_PREPARE], defn([AC_INIT_PREPARE]))
|
define([__MOZ_AC_INIT_PREPARE], defn([AC_INIT_PREPARE]))
|
||||||
|
|
|
||||||
|
|
@ -475,8 +475,6 @@ dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
|
||||||
dnl features that Windows actually does support.
|
dnl features that Windows actually does support.
|
||||||
|
|
||||||
if test -n "$SKIP_COMPILER_CHECKS"; then
|
if test -n "$SKIP_COMPILER_CHECKS"; then
|
||||||
dnl Windows has malloc.h
|
|
||||||
AC_DEFINE(MALLOC_H, [<malloc.h>])
|
|
||||||
AC_DEFINE(HAVE_FORCEINLINE)
|
AC_DEFINE(HAVE_FORCEINLINE)
|
||||||
fi # SKIP_COMPILER_CHECKS
|
fi # SKIP_COMPILER_CHECKS
|
||||||
|
|
||||||
|
|
@ -661,8 +659,6 @@ dnl ========================================================
|
||||||
dnl JavaScript shell
|
dnl JavaScript shell
|
||||||
dnl ========================================================
|
dnl ========================================================
|
||||||
|
|
||||||
MOZ_CHECK_ALLOCATOR
|
|
||||||
|
|
||||||
if test -n "$JS_STANDALONE"; then
|
if test -n "$JS_STANDALONE"; then
|
||||||
JS_LIBRARY_NAME="mozjs-$MOZILLA_SYMBOLVERSION"
|
JS_LIBRARY_NAME="mozjs-$MOZILLA_SYMBOLVERSION"
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -490,10 +490,6 @@ AC_LANG_C
|
||||||
|
|
||||||
fi # ! SKIP_COMPILER_CHECKS
|
fi # ! SKIP_COMPILER_CHECKS
|
||||||
|
|
||||||
if test -n "${COMPILE_ENVIRONMENT}"; then
|
|
||||||
MOZ_CHECK_ALLOCATOR
|
|
||||||
fi
|
|
||||||
|
|
||||||
TARGET_XPCOM_ABI=
|
TARGET_XPCOM_ABI=
|
||||||
if test -n "${TARGET_CPU}" -a -n "${TARGET_COMPILER_ABI}"; then
|
if test -n "${TARGET_CPU}" -a -n "${TARGET_COMPILER_ABI}"; then
|
||||||
TARGET_XPCOM_ABI="${TARGET_CPU}-${TARGET_COMPILER_ABI}"
|
TARGET_XPCOM_ABI="${TARGET_CPU}-${TARGET_COMPILER_ABI}"
|
||||||
|
|
@ -504,8 +500,6 @@ dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
|
||||||
dnl features that Windows actually does support.
|
dnl features that Windows actually does support.
|
||||||
|
|
||||||
if test -n "$SKIP_COMPILER_CHECKS"; then
|
if test -n "$SKIP_COMPILER_CHECKS"; then
|
||||||
dnl Windows has malloc.h
|
|
||||||
AC_DEFINE(MALLOC_H, [<malloc.h>])
|
|
||||||
AC_DEFINE(HAVE_FORCEINLINE)
|
AC_DEFINE(HAVE_FORCEINLINE)
|
||||||
fi # SKIP_COMPILER_CHECKS
|
fi # SKIP_COMPILER_CHECKS
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue