mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-01 05:32:11 +01:00
meson: error out if atomic ops would be available with -march=i486
Same as autotools build.
This commit is contained in:
parent
0689231bd6
commit
4268372fae
@ -1198,6 +1198,12 @@ else
|
|||||||
endif
|
endif
|
||||||
glibconfig_conf.set('G_ATOMIC_OP_MEMORY_BARRIER_NEEDED', glib_memory_barrier_needed)
|
glibconfig_conf.set('G_ATOMIC_OP_MEMORY_BARRIER_NEEDED', glib_memory_barrier_needed)
|
||||||
|
|
||||||
|
# Note that the atomic ops are only available with GCC on x86 when
|
||||||
|
# using -march=i486 or higher. If we detect that the atomic ops are
|
||||||
|
# not available but would be available given the right flags, we want
|
||||||
|
# to abort and advise the user to fix their CFLAGS. It's better to do
|
||||||
|
# that then to silently fall back on emulated atomic ops just because
|
||||||
|
# the user had the wrong build environment.
|
||||||
atomictest = '''void func() {
|
atomictest = '''void func() {
|
||||||
volatile int atomic = 2;
|
volatile int atomic = 2;
|
||||||
__sync_bool_compare_and_swap (&atomic, 2, 3);
|
__sync_bool_compare_and_swap (&atomic, 2, 3);
|
||||||
@ -1206,6 +1212,9 @@ atomictest = '''void func() {
|
|||||||
if cc.compiles(atomictest)
|
if cc.compiles(atomictest)
|
||||||
glibconfig_conf.set('G_ATOMIC_LOCK_FREE', true)
|
glibconfig_conf.set('G_ATOMIC_LOCK_FREE', true)
|
||||||
else
|
else
|
||||||
|
if host_machine.cpu_family() == 'x86' and cc.compiles(atomictest, args : '-march=i486')
|
||||||
|
error('GLib must be built with -march=i486 or later.')
|
||||||
|
endif
|
||||||
glibconfig_conf.set('G_ATOMIC_LOCK_FREE', false)
|
glibconfig_conf.set('G_ATOMIC_LOCK_FREE', false)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user