From fd1f3c27e093b1f51f0c1a381cc02cbf8f9889d7 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 21 Oct 2008 09:17:56 +0100 Subject: [PATCH] [configure] Check for atomic xchg. Bug 18140 identifies a case where we have an atomic increment, but not an atomic exchange. We need both to implement atomic reference counting, so add a second check to detect whether __sync_val_compare_and_swap generates a non-atomic instruction. Fixes http://bugs.freedesktop.org/show_bug.cgi?id=18140. --- build/aclocal.cairo.m4 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build/aclocal.cairo.m4 b/build/aclocal.cairo.m4 index 8292e8e28..f00b137fe 100644 --- a/build/aclocal.cairo.m4 +++ b/build/aclocal.cairo.m4 @@ -101,7 +101,10 @@ AC_DEFUN([CAIRO_CHECK_NATIVE_ATOMIC_PRIMITIVES], [ cairo_cv_atomic_primitives="none" - AC_TRY_LINK([int atomic_add(int i) { return __sync_fetch_and_add (&i, 1); }], [], + AC_TRY_LINK([ +int atomic_add(int i) { return __sync_fetch_and_add (&i, 1); } +int atomic_cmpxchg(int i, int j, int k) { return __sync_val_compare_and_swap (&i, j, k); } +], [], cairo_cv_atomic_primitives="Intel" ) ])