From 12f5c0a222a2f0aebe63c0d367937a0ff985474a Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 26 Jun 2012 11:16:13 -0400 Subject: [PATCH] Fix check for Intel atomic ops --- configure.ac | 9 +++++---- src/hb-atomic-private.hh | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 2eebc7926..0e2bbf626 100644 --- a/configure.ac +++ b/configure.ac @@ -182,11 +182,12 @@ dnl =========================================================================== AC_CACHE_CHECK([for Intel atomic primitives], hb_cv_have_intel_atomic_primitives, [ hb_cv_have_intel_atomic_primitives=false - AC_TRY_LINK([], [ + AC_TRY_LINK([ void memory_barrier (void) { __sync_synchronize (); } - int atomic_add (int i) { return __sync_fetch_and_add (&i, 1); } - int atomic_cmpxchg (int *i, int *j, int *k) { return __sync_bool_compare_and_swap (&i, j, k); } - ], hb_cv_have_intel_atomic_primitives=true + int atomic_add (int *i) { return __sync_fetch_and_add (i, 1); } + int mutex_trylock (int *m) { return __sync_lock_test_and_set (m, 1); } + void mutex_unlock (int *m) { __sync_lock_release (m); } + ], [], hb_cv_have_intel_atomic_primitives=true ) ]) if $hb_cv_have_intel_atomic_primitives; then diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh index c543a8d93..918852d18 100644 --- a/src/hb-atomic-private.hh +++ b/src/hb-atomic-private.hh @@ -65,7 +65,7 @@ typedef int32_t hb_atomic_int_t; #define hb_atomic_ptr_cmpexch(P,O,N) OSAtomicCompareAndSwapPtrBarrier ((void *) (O), (void *) (N), (void **) (P)) -#elif !defined(HB_NO_MT) && defined(HAVE_INTEL_ATOMIC_PRIMITIVES) && !defined(__MINGW32__) +#elif !defined(HB_NO_MT) && defined(HAVE_INTEL_ATOMIC_PRIMITIVES) typedef int hb_atomic_int_t; #define hb_atomic_int_add(AI, V) __sync_fetch_and_add (&(AI), (V))