diff --git a/aclocal.m4 b/aclocal.m4 index ae7325e6e6b49..00e3e55e8ba7c 100644 --- a/aclocal.m4 +++ b/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 diff --git a/build/autoconf/alloc.m4 b/build/autoconf/alloc.m4 index 4972013b6295b..fe4a2ffec7517 100644 --- a/build/autoconf/alloc.m4 +++ b/build/autoconf/alloc.m4 @@ -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]) diff --git a/build/autoconf/hotfixes.m4 b/build/autoconf/hotfixes.m4 deleted file mode 100644 index 9c8362041fecc..0000000000000 --- a/build/autoconf/hotfixes.m4 +++ /dev/null @@ -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 diff --git a/build/moz.configure/memory.configure b/build/moz.configure/memory.configure index 0776d29a43f9a..3a321bfb95606 100644 --- a/build/moz.configure/memory.configure +++ b/build/moz.configure/memory.configure @@ -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")) diff --git a/js/moz.configure b/js/moz.configure index 2c091b79262ba..2967e70787bf9 100644 --- a/js/moz.configure +++ b/js/moz.configure @@ -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")) diff --git a/js/src/aclocal.m4 b/js/src/aclocal.m4 index b8ce748e4c58b..6f641abda9193 100644 --- a/js/src/aclocal.m4 +++ b/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 diff --git a/js/src/old-configure.in b/js/src/old-configure.in index 6ab5e7b9b2be7..948e691a09ce8 100644 --- a/js/src/old-configure.in +++ b/js/src/old-configure.in @@ -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, []) 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 ======================================================== diff --git a/moz.configure b/moz.configure index e9488a6790af9..af6272a4276bb 100755 --- a/moz.configure +++ b/moz.configure @@ -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) diff --git a/old-configure.in b/old-configure.in index c69654af66646..6c4502ac68ef2 100644 --- a/old-configure.in +++ b/old-configure.in @@ -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, []) 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 ======================================================== diff --git a/toolkit/moz.configure b/toolkit/moz.configure index 539433a6ef886..6f539d83ec214 100644 --- a/toolkit/moz.configure +++ b/toolkit/moz.configure @@ -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"))