meson: Fix atomic ops test to match configure.ac

We must try linking, not just compiling. That will give a false
positive.
This commit is contained in:
Nirbheek Chauhan 2018-05-07 15:08:51 +05:30
parent 91c9cb5a52
commit 3e96523e6b

View File

@ -1465,10 +1465,10 @@ atomictest = '''void func() {
__sync_bool_compare_and_swap (&atomic, 2, 3); __sync_bool_compare_and_swap (&atomic, 2, 3);
} }
''' '''
if cc.compiles(atomictest) if cc.links(atomictest, name : 'atomic ops')
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') 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) glibconfig_conf.set('G_ATOMIC_LOCK_FREE', false)