Bug 1178266 - Link against libatomic when necessary. r=froydnj

This commit is contained in:
Mike Hommey 2015-12-01 11:56:42 +09:00
parent 82383a59e7
commit c92b4e9eed
3 changed files with 31 additions and 0 deletions

View File

@ -224,7 +224,33 @@ if test "$GNU_CXX"; then
elif test "$ac_cv_cxx0x_headers_bug" = "yes"; then elif test "$ac_cv_cxx0x_headers_bug" = "yes"; then
AC_MSG_ERROR([Your toolchain does not support C++0x/C++11 mode properly. Please upgrade your toolchain]) AC_MSG_ERROR([Your toolchain does not support C++0x/C++11 mode properly. Please upgrade your toolchain])
fi fi
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 fi
if test -n "$CROSS_COMPILE"; then if test -n "$CROSS_COMPILE"; then
dnl When cross compile, we have no variable telling us what the host compiler is. Figure it out. dnl When cross compile, we have no variable telling us what the host compiler is. Figure it out.
cat > conftest.C <<EOF cat > conftest.C <<EOF

View File

@ -125,3 +125,6 @@ if CONFIG['GNU_CXX']:
if CONFIG['_MSC_VER']: if CONFIG['_MSC_VER']:
# Error 4804 is "'>' : unsafe use of type 'bool' in operation" # Error 4804 is "'>' : unsafe use of type 'bool' in operation"
SOURCES['/mfbt/Compression.cpp'].flags += ['-wd4804'] SOURCES['/mfbt/Compression.cpp'].flags += ['-wd4804']
if CONFIG['MOZ_NEEDS_LIBATOMIC']:
OS_LIBS += ['atomic']

View File

@ -55,6 +55,8 @@ def Libxul(name):
if not CONFIG['JS_SHARED_LIBRARY']: if not CONFIG['JS_SHARED_LIBRARY']:
LIBRARY_DEFINES['STATIC_EXPORTABLE_JS_API'] = True LIBRARY_DEFINES['STATIC_EXPORTABLE_JS_API'] = True
if CONFIG['MOZ_NEEDS_LIBATOMIC']:
OS_LIBS += ['atomic']
Libxul('xul') Libxul('xul')