mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-01 05:32:11 +01:00
meson: Add exception for atomic ops test for Android
Some compilers, particularly Android on armv5 and old versions of Clang provide atomic ops, but don't define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 so we need to define it ourselves. This matches what configure does, with the exception that now it's only done for Android since clang defines __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 now. https://bugzilla.gnome.org/show_bug.cgi?id=796325
This commit is contained in:
parent
0b60f2589f
commit
74af384153
17
meson.build
17
meson.build
@ -1460,15 +1460,28 @@ atomictest = '''int main() {
|
|||||||
}
|
}
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
atomicdefine = '''
|
||||||
|
#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
|
||||||
|
#error "compiler has atomic ops, but doesn't define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4"
|
||||||
|
#endif
|
||||||
|
'''
|
||||||
|
|
||||||
# We know that we can always use real ("lock free") atomic operations with MSVC
|
# We know that we can always use real ("lock free") atomic operations with MSVC
|
||||||
if cc.get_id() == 'msvc' or cc.links(atomictest, name : 'atomic ops')
|
if cc.get_id() == 'msvc' or cc.links(atomictest, name : 'atomic ops')
|
||||||
glibconfig_conf.set('G_ATOMIC_LOCK_FREE', true)
|
have_atomic_lock_free = true
|
||||||
|
if host_system == 'android' and not cc.compiles(atomicdefine, name : 'atomic ops define')
|
||||||
|
# When building for armv5 on Android, gcc 4.9 provides
|
||||||
|
# __sync_bool_compare_and_swap but doesn't define
|
||||||
|
# __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
|
||||||
|
glib_conf.set('__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4', true)
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
|
have_atomic_lock_free = false
|
||||||
if host_machine.cpu_family() == 'x86' and cc.links(atomictest, args : '-march=i486')
|
if host_machine.cpu_family() == 'x86' and cc.links(atomictest, args : '-march=i486')
|
||||||
error('GLib must be built with -march=i486 or later.')
|
error('GLib must be built with -march=i486 or later.')
|
||||||
endif
|
endif
|
||||||
glibconfig_conf.set('G_ATOMIC_LOCK_FREE', false)
|
|
||||||
endif
|
endif
|
||||||
|
glibconfig_conf.set('G_ATOMIC_LOCK_FREE', have_atomic_lock_free)
|
||||||
|
|
||||||
# === Threads ===
|
# === Threads ===
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user