Skip to content

Commit

Permalink
Bug 1747970 - Move AC_CHECK_FUNC{,S} to python configure. r=firefox-b…
Browse files Browse the repository at this point in the history
…uild-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
  • Loading branch information
glandium committed Jan 18, 2022
1 parent 851e7b4 commit f789d33
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 103 deletions.
1 change: 0 additions & 1 deletion aclocal.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions build/autoconf/alloc.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
23 changes: 0 additions & 23 deletions build/autoconf/hotfixes.m4

This file was deleted.

6 changes: 6 additions & 0 deletions build/moz.configure/memory.configure
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
32 changes: 32 additions & 0 deletions js/moz.configure
Original file line number Diff line number Diff line change
Expand Up @@ -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 change: 0 additions & 1 deletion js/src/aclocal.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 0 additions & 31 deletions js/src/old-configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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=
Expand All @@ -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
Expand Down Expand Up @@ -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 ========================================================
Expand Down Expand Up @@ -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 ========================================================

Expand Down
2 changes: 2 additions & 0 deletions moz.configure
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
44 changes: 0 additions & 44 deletions old-configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 ========================================================

Expand Down
18 changes: 18 additions & 0 deletions toolkit/moz.configure
Original file line number Diff line number Diff line change
Expand Up @@ -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"))

0 comments on commit f789d33

Please sign in to comment.