diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2015-09-08 20:35:33 -0300 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2015-09-22 22:46:08 +0000 |
commit | 3d7586b760550b7d89594c8d7462fc30b868ecc6 (patch) | |
tree | 926b254d3b72385365c9dd51d66d311b31b71209 /configure | |
parent | 847d5d1309a4365af7d0f4fa1bff5754b8286e34 (diff) |
Auto-detect whether 64-bit std::atomic really works
The C++ standard says it must, but some badly-configured toolchains seem
to be lacking support.
In particular, for some 32-bit platforms without native support for
them, GCC implements 64-bit atomics via out-of-line functions in
libatomic. If that library is missing... well, then std::atomic 64-bit
doesn't work and we mustn't try to use it.
This was found when trying to compile Qt 5.6 for MIPS 32-bit:
Linking library libQt5Core.so.5.6.0
.obj/qsimd.o: In function `std::__atomic_base<unsigned long long>::load(std::memory_order) const':
/opt/poky/1.7/sysroots/mips32r2-poky-linux/usr/include/c++/4.9.1/bits/atomic_base.h:500: undefined reference to `__atomic_load_8'
.obj/qsimd.o: In function `std::__atomic_base<unsigned long long>::store(unsigned long long, std::memory_order)':
/opt/poky/1.7/sysroots/mips32r2-poky-linux/usr/include/c++/4.9.1/bits/atomic_base.h:478: undefined reference to `__atomic_store_8'
Yocto bug report: https://bugzilla.yoctoproject.org/show_bug.cgi?id=8274
Change-Id: I42e7ef1a481840699a8dffff140224d6614e5c36
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -2,7 +2,7 @@ ############################################################################# ## ## Copyright (C) 2015 The Qt Company Ltd. -## Copyright (C) 2013 Intel Corporation. +## Copyright (C) 2015 Intel Corporation. ## Contact: http://www.qt.io/licensing/ ## ## This file is the build configuration utility of the Qt Toolkit. @@ -662,6 +662,7 @@ CFG_SYSTEM_PROXIES=no CFG_ANDROID_STYLE_ASSETS=yes CFG_GSTREAMER=auto CFG_GSTREAMER_VERSION="" +CFG_ATOMIC64=auto # Target architecture CFG_ARCH= @@ -4389,6 +4390,15 @@ if compileTest common/c++default "default C++ standard edition"; then fi fi +# Detect whether 64-bit std::atomic works -- some 32-bit platforms require extra library support +if compileTest common/atomic64 "64-bit std::atomic"; then + CFG_ATOMIC64=yes +elif compileTest common/atomic64 "64-bit std::atomic in -latomic" -latomic; then + CFG_ATOMIC64=libatomic +else + CFG_ATOMIC64=no +fi + # detect sse2 support if [ "${CFG_SSE2}" = "auto" ]; then if compileTest common/sse2 "sse2"; then @@ -6127,6 +6137,10 @@ if [ "$CFG_STDCXX" != "c++98" ]; then fi fi +if [ "$CFG_ATOMIC64" = "libatomic" ]; then + QMAKE_CONFIG="$QMAKE_CONFIG atomic64-libatomic" +fi + if [ "$CFG_SILENT" = "yes" ]; then QMAKE_CONFIG="$QMAKE_CONFIG silent" fi @@ -6681,6 +6695,10 @@ else echo "#define QT_POINTER_SIZE $?" >>"$outpath/src/corelib/global/qconfig.h.new" fi +if [ "$CFG_ATOMIC64" = "no" ]; then + echo "#define QT_NO_STD_ATOMIC64" >> "$outpath/src/corelib/global/qconfig.h.new" +fi + #REDUCE_RELOCATIONS is a elf/unix only thing, so not in windows configure.exe if [ "$CFG_REDUCE_RELOCATIONS" = "yes" ]; then echo "#define QT_REDUCE_RELOCATIONS" >>"$outpath/src/corelib/global/qconfig.h.new" |