meson: Fix -latomic check
authorMatt Turner <mattst88@gmail.com>
Mon, 11 Jun 2018 21:56:26 +0000 (14:56 -0700)
committerMatt Turner <mattst88@gmail.com>
Wed, 13 Jun 2018 17:09:46 +0000 (10:09 -0700)
Commit 54ba73ef102f (configure.ac/meson.build: Fix -latomic test) fixed
some checks for -latomic, and then commit 54bbe600ec26 (configure.ac:
rework -latomic check) further extended the fixes in configure.ac but
not in Meson. This commit extends those fixes to the Meson tests.

Fixes: 54bbe600ec26 (configure.ac: rework -latomic check)
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
meson.build

index aefb9f3c85e8ce45f4a0c8b07a224ee25f2fc57d..375751bce10d62bc93a2fdb4da56fd8c6d5dd3fb 100644 (file)
@@ -830,7 +830,13 @@ endif
 # Check for GCC style atomics
 dep_atomic = null_dep
 
-if cc.compiles('int main() { int n; return __atomic_load_n(&n, __ATOMIC_ACQUIRE); }',
+if cc.compiles('''#include <stdint.h>
+                  int main() {
+                    struct {
+                      uint64_t *v;
+                    } x;
+                    return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE);
+                  }''',
                name : 'GCC atomic builtins')
   pre_args += '-DUSE_GCC_ATOMIC_BUILTINS'