diff options
author | Tim-Philipp Müller <tim@centricular.com> | 2017-06-14 23:57:11 +0100 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2017-07-13 19:03:39 -0400 |
commit | 4268372fae64a1942bcab0f8b1acb0b16a1d65cd (patch) | |
tree | 3f2daa4f199b8b287aedde57cdf932cb236cc7ae | |
parent | 0689231bd61f86190688cc262fcc3058cb672557 (diff) | |
download | glib-4268372fae64a1942bcab0f8b1acb0b16a1d65cd.tar.gz |
meson: error out if atomic ops would be available with -march=i486
Same as autotools build.
-rw-r--r-- | meson.build | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/meson.build b/meson.build index 993899113..f4d3b7b0b 100644 --- a/meson.build +++ b/meson.build @@ -1198,6 +1198,12 @@ else endif 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() { volatile int atomic = 2; __sync_bool_compare_and_swap (&atomic, 2, 3); @@ -1206,6 +1212,9 @@ atomictest = '''void func() { if cc.compiles(atomictest) glibconfig_conf.set('G_ATOMIC_LOCK_FREE', true) 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) endif |