forked from mirrors/gecko-dev
Bug 1883940 - Replace MOZ_CXX11 autoconf macro by a moz.configure check r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D203781
This commit is contained in:
parent
e09c4cd6a4
commit
ae07881baa
10 changed files with 38 additions and 61 deletions
|
|
@ -81,37 +81,3 @@ AC_PROG_CXX
|
|||
|
||||
PATH=$_SAVE_PATH
|
||||
])
|
||||
|
||||
AC_DEFUN([MOZ_CXX11],
|
||||
[
|
||||
dnl Updates to the test below should be duplicated further below for the
|
||||
dnl cross-compiling case.
|
||||
AC_LANG_CPLUSPLUS
|
||||
if test "$GNU_CXX"; then
|
||||
AC_CACHE_CHECK([whether 64-bits std::atomic requires -latomic],
|
||||
ac_cv_needs_atomic,
|
||||
AC_TRY_LINK(
|
||||
[#include <cstdint>
|
||||
#include <atomic>],
|
||||
[ std::atomic<uint64_t> foo; foo = 1; ],
|
||||
ac_cv_needs_atomic=no,
|
||||
_SAVE_LIBS="$LIBS"
|
||||
LIBS="$LIBS -latomic"
|
||||
AC_TRY_LINK(
|
||||
[#include <cstdint>
|
||||
#include <atomic>],
|
||||
[ std::atomic<uint64_t> foo; foo = 1; ],
|
||||
ac_cv_needs_atomic=yes,
|
||||
ac_cv_needs_atomic="do not know; assuming no")
|
||||
LIBS="$_SAVE_LIBS"
|
||||
)
|
||||
)
|
||||
if test "$ac_cv_needs_atomic" = yes; then
|
||||
MOZ_NEEDS_LIBATOMIC=1
|
||||
else
|
||||
MOZ_NEEDS_LIBATOMIC=
|
||||
fi
|
||||
AC_SUBST(MOZ_NEEDS_LIBATOMIC)
|
||||
fi
|
||||
AC_LANG_C
|
||||
])
|
||||
|
|
|
|||
|
|
@ -114,3 +114,35 @@ with only_when(moz_use_pthreads):
|
|||
compilation_flags.cxxflags.extend(pthread_flags.cflags)
|
||||
|
||||
set_config("MOZ_USE_PTHREADS", True)
|
||||
|
||||
|
||||
with only_when(building_with_gnu_cc):
|
||||
|
||||
@template
|
||||
def check_std_atomic_requirements(flag=None, when=None):
|
||||
return try_link(
|
||||
includes=["cstdint", "atomic"],
|
||||
body="std::atomic<uint64_t> foo; foo = 1;",
|
||||
flags=flag or [],
|
||||
when=when,
|
||||
)
|
||||
|
||||
is_libatomic_optional = check_std_atomic_requirements()
|
||||
is_libatomic_required = check_std_atomic_requirements(
|
||||
flag="-latomic", when=~is_libatomic_optional
|
||||
)
|
||||
|
||||
@depends(is_libatomic_optional, is_libatomic_required)
|
||||
@checking("whether 64-bits std::atomic requires -latomic")
|
||||
def checking_needs_libatomic(is_libatomic_optional, is_libatomic_required):
|
||||
if is_libatomic_optional:
|
||||
return False
|
||||
if is_libatomic_required:
|
||||
return True
|
||||
return "do not know; assuming no"
|
||||
|
||||
set_config(
|
||||
"LIBATOMIC_LIBS",
|
||||
["-latomic"],
|
||||
when=depends(checking_needs_libatomic)(lambda c: c is True),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -90,8 +90,7 @@ if CONFIG["OS_ARCH"] == "WINNT":
|
|||
"synchronization",
|
||||
]
|
||||
|
||||
if CONFIG["MOZ_NEEDS_LIBATOMIC"]:
|
||||
OS_LIBS += ["atomic"]
|
||||
OS_LIBS += CONFIG["LIBATOMIC_LIBS"]
|
||||
|
||||
if CONFIG["TARGET_OS"] == "iOS":
|
||||
OS_LIBS += ["-framework BrowserEngineCore"]
|
||||
|
|
|
|||
|
|
@ -429,13 +429,6 @@ if test -n "$COMPILE_ENVIRONMENT"; then
|
|||
fi
|
||||
|
||||
if test -z "$SKIP_COMPILER_CHECKS"; then
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
dnl ========================================================
|
||||
|
||||
AC_LANG_CPLUSPLUS
|
||||
|
||||
MOZ_CXX11
|
||||
|
||||
|
||||
dnl ========================================================
|
||||
dnl Put your C++ language/feature checks below
|
||||
|
|
|
|||
|
|
@ -90,7 +90,6 @@ OS_LIBS += CONFIG['REALTIME_LIBS']
|
|||
if CONFIG['OS_TARGET'] != 'WINNT':
|
||||
OS_LIBS += ['m']
|
||||
|
||||
if CONFIG['MOZ_NEEDS_LIBATOMIC']:
|
||||
OS_LIBS += ['atomic']
|
||||
OS_LIBS += CONFIG["LIBATOMIC_LIBS"]
|
||||
|
||||
include("../ffvpxcommon.mozbuild")
|
||||
|
|
|
|||
|
|
@ -21,8 +21,7 @@ USE_LIBS += [
|
|||
# The memory library defines this, so it's needed here too.
|
||||
DEFINES["IMPL_MFBT"] = True
|
||||
|
||||
if CONFIG["MOZ_NEEDS_LIBATOMIC"]:
|
||||
OS_LIBS += ["atomic"]
|
||||
OS_LIBS += CONFIG["LIBATOMIC_LIBS"]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
"/mfbt/double-conversion/double-conversion/bignum-dtoa.cc",
|
||||
|
|
|
|||
|
|
@ -79,8 +79,7 @@ USE_LIBS += [
|
|||
# The memory library defines this, so it's needed here too.
|
||||
DEFINES["IMPL_MFBT"] = True
|
||||
|
||||
if CONFIG["MOZ_NEEDS_LIBATOMIC"]:
|
||||
OS_LIBS += ["atomic"]
|
||||
OS_LIBS += CONFIG["LIBATOMIC_LIBS"]
|
||||
|
||||
OS_LIBS += CONFIG["DL_LIBS"]
|
||||
|
||||
|
|
|
|||
|
|
@ -205,8 +205,7 @@ SOURCES["lz4/xxhash.c"].flags += ["-Wno-unused-function"]
|
|||
|
||||
DisableStlWrapping()
|
||||
|
||||
if CONFIG["MOZ_NEEDS_LIBATOMIC"]:
|
||||
OS_LIBS += ["atomic"]
|
||||
OS_LIBS += CONFIG["LIBATOMIC_LIBS"]
|
||||
|
||||
DEFINES["LZ4LIB_VISIBILITY"] = ""
|
||||
|
||||
|
|
|
|||
|
|
@ -446,14 +446,6 @@ else
|
|||
fi # COMPILE_ENVIRONMENT
|
||||
|
||||
if test -z "$SKIP_COMPILER_CHECKS"; then
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
dnl ========================================================
|
||||
AC_LANG_CPLUSPLUS
|
||||
|
||||
MOZ_CXX11
|
||||
|
||||
AC_LANG_C
|
||||
|
||||
|
||||
dnl ========================================================
|
||||
dnl Put your C++ language/feature checks below
|
||||
|
|
|
|||
|
|
@ -86,8 +86,7 @@ def Libxul(name, output_category=None):
|
|||
|
||||
Libxul_defines()
|
||||
|
||||
if CONFIG["MOZ_NEEDS_LIBATOMIC"]:
|
||||
OS_LIBS += ["atomic"]
|
||||
OS_LIBS += CONFIG["LIBATOMIC_LIBS"]
|
||||
|
||||
# TouchBar-related classes are only available in the 10.12.2 SDK and later.
|
||||
# We need to weak link these classes until we've upgraded our SDK to at
|
||||
|
|
|
|||
Loading…
Reference in a new issue