diff options
author | Andrew Galante <[email protected]> | 2018-06-11 15:05:25 -0700 |
---|---|---|
committer | Matt Turner <[email protected]> | 2018-06-13 10:09:46 -0700 |
commit | baf16b2ea3a72d01712d4e16fae97606ac68dff0 (patch) | |
tree | 1f6826a7cb0ddab085bea359c582b21ad5bd07d8 /configure.ac | |
parent | 9d547a7617fbcbc29f75ed85ff774807ddca5ce0 (diff) |
configure.ac: Test for __atomic_add_fetch in atomic checks
Some platforms have 64-bit __atomic_load_n but not 64-bit
__atomic_add_fetch, so test for both of them.
Bug: https://bugs.gentoo.org/655616
Reviewed-by: Matt Turner <[email protected]>
Reviewed-by: Eric Engestrom <[email protected]>
Reviewed-by: Dylan Baker <[email protected]>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac index 75ee1a7c01c..3f747bf38cc 100644 --- a/configure.ac +++ b/configure.ac @@ -445,7 +445,8 @@ int main() { struct { uint64_t *v; } x; - return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE); + return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) & + (int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL); }]])], GCC_ATOMIC_BUILTINS_SUPPORTED=yes, GCC_ATOMIC_BUILTINS_SUPPORTED=no) dnl If that didn't work, we try linking with -latomic, which is needed on some @@ -459,7 +460,8 @@ if test "x$GCC_ATOMIC_BUILTINS_SUPPORTED" != xyes; then struct { uint64_t *v; } x; - return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE); + return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) & + (int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL); }]])], GCC_ATOMIC_BUILTINS_SUPPORTED=yes LIBATOMIC_LIBS="-latomic", GCC_ATOMIC_BUILTINS_SUPPORTED=no) LDFLAGS=$save_LDFLAGS |