Bug 1747970 - Move AC_CHECK_FUNC{,S} to python configure. r=firefox-build-system-reviewers,andi

- AC_HAVE_FUNCS is an alias to AC_CHECK_FUNCS, so it is covered.
- Nothing uses HAVE___CXA_DEMANGLE, so we don't explictly set it,
  although we do need the result of whether __cxa_demangle is supported.
- No moz.build uses MOZ_DEMANGLE_SYMBOLS, so we only `set_define` it.
- We leave dladdr in old-configure because it needs to move along other
  dl* things.
- The hotfix for AC_CHECK_FUNC is however not needed for dladdr, so we
  remove it.
- We replace the forced HAVE_LOCALECONV on Windows with a check shared
  with all platforms.

Differential Revision: https://phabricator.services.mozilla.com/D134858
This commit is contained in:
Mike Hommey 2022-01-20 21:01:20 +00:00
Родитель f5caad47e9
Коммит d4919a8c5f
10 изменённых файлов: 58 добавлений и 103 удалений

1
aclocal.m4 поставляемый
Просмотреть файл

@ -3,7 +3,6 @@ dnl Local autoconf macros used with mozilla
dnl The contents of this file are under the Public Domain.
dnl
builtin(include, build/autoconf/hotfixes.m4)dnl
builtin(include, build/autoconf/hooks.m4)dnl
builtin(include, build/autoconf/config.status.m4)dnl
builtin(include, build/autoconf/toolchain.m4)dnl

Просмотреть файл

@ -16,9 +16,6 @@ for file in $MALLOC_HEADERS; do
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])

Просмотреть файл

@ -1,23 +0,0 @@
dnl This Source Code Form is subject to the terms of the Mozilla Public
dnl dnl License, v. 2.0. If a copy of the MPL was not distributed with this
dnl dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
dnl Set of hotfixes to address issues in autoconf 2.13
dnl Divert AC_CHECK_FUNC so that the #includes it uses can't interfere
dnl with the function it tests.
dnl So, when testing e.g. posix_memalign, any #include that AC_CHECK_FUNC
dnl prints is replaced with:
dnl #define posix_memalign innocuous_posix_memalign
dnl #include "theinclude"
dnl #undef posix_memalign
dnl This avoids double declaration of that function when the header normally
dnl declares it, while the test itself is just expecting the function not to be
dnl declared at all, and declares it differently (which doesn't matter for the
dnl test itself).
dnl More recent versions of autoconf are essentially doing this.
define([_AC_CHECK_FUNC],defn([AC_CHECK_FUNC]))dnl
define([AC_CHECK_FUNC], [dnl
patsubst(_AC_CHECK_FUNC($@), [#include.*$], [#define $1 innocuous_$1
\&
#undef $1])])dnl

Просмотреть файл

@ -97,3 +97,9 @@ imply_option("--enable-frame-pointers", True, when="--enable-phc")
set_config("MOZ_PHC", True, when="--enable-phc")
with only_when(depends(target.os)(lambda os: os != "WINNT")):
set_define("HAVE_STRNDUP", check_symbol("strndup"))
set_define("HAVE_POSIX_MEMALIGN", check_symbol("posix_memalign"))
set_define("HAVE_MEMALIGN", check_symbol("memalign"))
set_define("HAVE_MALLOC_USABLE_SIZE", check_symbol("malloc_usable_size"))

Просмотреть файл

@ -1270,3 +1270,35 @@ with only_when(compile_environment):
check_msg="for tm_zone and tm_gmtoff in struct tm",
),
)
#
# Checks for library functions
# ==============================================================
with only_when(compile_environment & depends(target.os)(lambda os: os != "WINNT")):
set_define("HAVE_GETPAGESIZE", check_symbol("getpagesize"))
set_define("HAVE_GMTIME_R", check_symbol("gmtime_r"))
set_define("HAVE_LOCALTIME_R", check_symbol("localtime_r"))
set_define("HAVE_GETTID", check_symbol("gettid"))
set_define("HAVE_SETPRIORITY", check_symbol("setpriority"))
set_define("HAVE_SYSCALL", check_symbol("syscall"))
set_define("HAVE_GETC_UNLOCKED", check_symbol("getc_unlocked"))
set_define("HAVE_PTHREAD_GETNAME_NP", check_symbol("pthread_getname_np"))
set_define("HAVE_PTHREAD_GET_NAME_NP", check_symbol("pthread_get_name_np"))
set_define("HAVE_STRERROR", check_symbol("strerror"))
@depends(check_symbol("__cxa_demangle", language="C++"), moz_debug, dmd)
def demangle_symbols(cxa_demangle, moz_debug, dmd):
# Demangle only for debug or DMD builds
if cxa_demangle and (moz_debug or dmd):
return True
set_define("MOZ_DEMANGLE_SYMBOLS", demangle_symbols)
set_define(
"HAVE__UNWIND_BACKTRACE",
check_symbol("_Unwind_Backtrace", when=check_header("unwind.h")),
)
with only_when(compile_environment):
set_define("HAVE__GETC_NOLOCK", check_symbol("_getc_nolock"))
set_define("HAVE_LOCALECONV", check_symbol("localeconv"))

1
js/src/aclocal.m4 поставляемый
Просмотреть файл

@ -3,7 +3,6 @@ dnl Local autoconf macros used with mozilla
dnl The contents of this file are under the Public Domain.
dnl
builtin(include, ../../build/autoconf/hotfixes.m4)dnl
builtin(include, ../../build/autoconf/hooks.m4)dnl
builtin(include, ../../build/autoconf/config.status.m4)dnl
builtin(include, ../../build/autoconf/toolchain.m4)dnl

Просмотреть файл

@ -171,14 +171,6 @@ if test -n "$_WIN32_MSVC"; then
SKIP_PATH_CHECKS=1
SKIP_COMPILER_CHECKS=1
SKIP_LIBRARY_CHECKS=1
# Since we're skipping compiler and library checks, hard-code
# some facts here.
# Common to all MSVC environments:
AC_DEFINE(HAVE_LOCALECONV)
AC_CHECK_FUNCS([_getc_nolock])
fi
fi # COMPILE_ENVIRONMENT
@ -795,7 +787,6 @@ fi
dnl Checks for library functions.
dnl ========================================================
AC_CHECK_FUNCS([getc_unlocked _getc_nolock gmtime_r localtime_r pthread_getname_np pthread_get_name_np])
dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
@ -926,15 +917,6 @@ fi
dnl End of C++ language/feature checks
AC_LANG_C
dnl ========================================================
dnl = Internationalization checks
dnl ========================================================
dnl
dnl Internationalization and Locale support is different
dnl on various UNIX platforms. Checks for specific i18n
dnl features go here.
AC_HAVE_FUNCS(localeconv)
fi # ! SKIP_COMPILER_CHECKS
TARGET_XPCOM_ABI=
@ -949,7 +931,6 @@ 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_LOCALECONV)
fi # SKIP_COMPILER_CHECKS
dnl Mozilla specific options
@ -1052,16 +1033,6 @@ if test -n "$COMPILE_ENVIRONMENT"; then
MOZ_CONFIG_CLANG_PLUGIN
fi # COMPILE_ENVIRONMENT
dnl ========================================================
dnl = Support for demangling undefined symbols
dnl ========================================================
if test -z "$SKIP_LIBRARY_CHECKS"; then
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
AC_LANG_RESTORE
fi
if test -z "$SKIP_COMPILER_CHECKS"; then
dnl ========================================================
@ -1159,8 +1130,6 @@ AC_SUBST(USE_N32)
AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
dnl Set various defines and substitutions
dnl ========================================================

Просмотреть файл

@ -348,6 +348,8 @@ js_shared = dependable(False)
moz_linker = dependable(False)
# Same for fold_libs
fold_libs = dependable(False)
# And dmd
dmd = dependable(False)
include(include_project_configure)

Просмотреть файл

@ -872,7 +872,6 @@ fi
dnl Checks for library functions.
dnl ========================================================
AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid setpriority strerror syscall lutimes)
dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
@ -1010,16 +1009,6 @@ fi
dnl End of C++ language/feature checks
AC_LANG_C
dnl ========================================================
dnl = Internationalization checks
dnl ========================================================
dnl
dnl Internationalization and Locale support is different
dnl on various UNIX platforms. Checks for specific i18n
dnl features go here.
AC_HAVE_FUNCS(localeconv)
fi # ! SKIP_COMPILER_CHECKS
if test -n "${COMPILE_ENVIRONMENT}"; then
@ -1039,7 +1028,6 @@ 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_LOCALECONV)
fi # SKIP_COMPILER_CHECKS
dnl Mozilla specific options
@ -1206,34 +1194,6 @@ if test -n "$COMPILE_ENVIRONMENT"; then
MOZ_CONFIG_CLANG_PLUGIN
fi # COMPILE_ENVIRONMENT
dnl ========================================================
dnl = Support for demangling undefined symbols
dnl ========================================================
if test -z "$SKIP_LIBRARY_CHECKS"; then
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
AC_LANG_RESTORE
fi
# Demangle only for debug or DMD builds
MOZ_DEMANGLE_SYMBOLS=
if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
MOZ_DEMANGLE_SYMBOLS=1
AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
fi
AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
dnl ========================================================
dnl = Support for gcc stack unwinding (from gcc 3.3)
dnl ========================================================
if test -z "$SKIP_LIBRARY_CHECKS"; then
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
AC_LANG_RESTORE
fi
if test -z "$SKIP_COMPILER_CHECKS"; then
dnl ========================================================
dnl Check for gcc -pipe support
@ -1519,10 +1479,6 @@ AC_SUBST(JS_BINARY)
AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
if test -n "$COMPILE_ENVIRONMENT"; then
AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
fi # COMPILE_ENVIRONMENT
dnl Set various defines and substitutions
dnl ========================================================

Просмотреть файл

@ -3035,3 +3035,21 @@ def disable_smart_cards(build_project):
set_config("MOZ_NO_SMART_CARDS", True, when=disable_smart_cards)
set_define("MOZ_NO_SMART_CARDS", True, when=disable_smart_cards)
# Checks for library functions
# ==============================================================
with only_when(compile_environment & depends(target.os)(lambda os: os != "WINNT")):
set_define("HAVE_STAT64", check_symbol("stat64"))
set_define("HAVE_LSTAT64", check_symbol("lstat64"))
set_define("HAVE_TRUNCATE64", check_symbol("truncate64"))
set_define("HAVE_STATVFS64", check_symbol("statvfs64"))
set_define("HAVE_STATVFS", check_symbol("statvfs"))
set_define("HAVE_STATFS64", check_symbol("statfs64"))
set_define("HAVE_STATFS", check_symbol("statfs"))
set_define("HAVE_LUTIMES", check_symbol("lutimes"))
set_define("HAVE_POSIX_FADVISE", check_symbol("posix_fadvise"))
set_define("HAVE_POSIX_FALLOCATE", check_symbol("posix_fallocate"))
set_define("HAVE_ARC4RANDOM", check_symbol("arc4random"))
set_define("HAVE_ARC4RANDOM_BUF", check_symbol("arc4random_buf"))
set_define("HAVE_MALLINFO", check_symbol("mallinfo"))