# HG changeset patch # User Sam Lantinga # Date 1295674924 28800 # Node ID fd125217f00c6143b375e2b2194a1cc35d90f847 # Parent 231dbbc3e31cb501681f84e518d7de4b29a48d1f Separated out the minimum functionality that we need from gcc for our spinlock fallback. diff -r 231dbbc3e31c -r fd125217f00c configure.in --- a/configure.in Fri Jan 21 21:35:43 2011 -0800 +++ b/configure.in Fri Jan 21 21:42:04 2011 -0800 @@ -312,6 +312,18 @@ if test x$have_gcc_atomics = xyes; then AC_DEFINE(HAVE_GCC_ATOMICS) fi + + # See if we have the minimum operation needed for GCC atomics + AC_TRY_LINK([ + ],[ + int a; + __sync_lock_test_and_set(&a, 1); + ],[ + have_gcc_sync_lock_test_and_set=yes + ]) + if test x$have_gcc_sync_lock_test_and_set = xyes; then + AC_DEFINE(HAVE_GCC_SYNC_LOCK_TEST_AND_SET) + fi fi # Standard C sources diff -r 231dbbc3e31c -r fd125217f00c include/SDL_config.h.in --- a/include/SDL_config.h.in Fri Jan 21 21:35:43 2011 -0800 +++ b/include/SDL_config.h.in Fri Jan 21 21:42:04 2011 -0800 @@ -59,6 +59,7 @@ #undef SIZEOF_VOIDP #undef SDL_HAS_64BIT_TYPE #undef HAVE_GCC_ATOMICS +#undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET /* Comment this if you want to build without any C library requirements */ #undef HAVE_LIBC diff -r 231dbbc3e31c -r fd125217f00c src/atomic/SDL_spinlock.c --- a/src/atomic/SDL_spinlock.c Fri Jan 21 21:35:43 2011 -0800 +++ b/src/atomic/SDL_spinlock.c Fri Jan 21 21:42:04 2011 -0800 @@ -36,7 +36,7 @@ #elif defined(__MACOSX__) return OSAtomicCompareAndSwap32Barrier(0, 1, lock); -#elif defined(HAVE_GCC_ATOMICS) +#elif defined(HAVE_GCC_SYNC_LOCK_TEST_AND_SET) return (__sync_lock_test_and_set(lock, 1) == 0); #elif defined(__GNUC__) && defined(__arm__) && defined(__ARM_ARCH_5__)