[PATCH libdrm v2] meson.build: fix intel atomics detection

Peter Seiderer ps.report at gmx.net
Fri Aug 9 23:28:18 UTC 2019


Use the stronger compiler.link() test (instead of the weaker
compiler.compile()) to fix the intel atomics detection.

Fixes false positive in case of sparc compile (buildroot toolchain).

Signed-off-by: Peter Seiderer <ps.report at gmx.net>
---
Changes v1 -> v2:
  - no changes, resend (old submission [1])

  [1] https://lists.freedesktop.org/archives/dri-devel/2018-July/183885.html
---
 meson.build | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index e292554..087780b 100644
--- a/meson.build
+++ b/meson.build
@@ -49,9 +49,10 @@ intel_atomics = false
 lib_atomics = false

 dep_atomic_ops = dependency('atomic_ops', required : false)
-if cc.compiles('''
+if cc.links('''
     int atomic_add(int *i) { return __sync_add_and_fetch (i, 1); }
     int atomic_cmpxchg(int *i, int j, int k) { return __sync_val_compare_and_swap (i, j, k); }
+    int main() { }
     ''',
     name : 'Intel Atomics')
   intel_atomics = true
--
2.22.0



More information about the dri-devel mailing list