comparison configure.in @ 5004:0c72ae7b7cb2

Added native atomic operations for Windows, Mac OS X, and gcc compiler intrinsics. Changed the CAS return value to bool, so it's efficient with OSAtomicCompareAndSwap32Barrier() Added an atomic test adapted from code by Michael Davidsaver
author Sam Lantinga <slouken@libsdl.org>
date Sun, 16 Jan 2011 15:16:39 -0800
parents 3a95a2b93eb3
children 5d7d48157be7
comparison
equal deleted inserted replaced
5003:3a95a2b93eb3 5004:0c72ae7b7cb2
179 179
180 if test x$have_gcc_mmd_mt = xyes; then 180 if test x$have_gcc_mmd_mt = xyes; then
181 DEPENDENCY_TRACKING_OPTIONS="-MMD -MT \$@" 181 DEPENDENCY_TRACKING_OPTIONS="-MMD -MT \$@"
182 fi 182 fi
183 fi 183 fi
184 184
185 dnl See whether we are allowed to use the system C library 185 dnl See whether we are allowed to use the system C library
186 AC_ARG_ENABLE(libc, 186 AC_ARG_ENABLE(libc,
187 AC_HELP_STRING([--enable-libc], [Use the system C library [[default=yes]]]), 187 AC_HELP_STRING([--enable-libc], [Use the system C library [[default=yes]]]),
188 , enable_libc=yes) 188 , enable_libc=yes)
189 if test x$enable_libc = xyes; then 189 if test x$enable_libc = xyes; then
281 AC_DEFINE(SDL_HAS_64BIT_TYPE) 281 AC_DEFINE(SDL_HAS_64BIT_TYPE)
282 fi 282 fi
283 fi 283 fi
284 AC_DEFINE(size_t, unsigned int) 284 AC_DEFINE(size_t, unsigned int)
285 AC_DEFINE(uintptr_t, unsigned long) 285 AC_DEFINE(uintptr_t, unsigned long)
286 fi
287
288 dnl See whether we can use gcc atomic operations on this architecture
289 AC_ARG_ENABLE(gcc-atomics,
290 AC_HELP_STRING([--enable-gcc-atomics],
291 [Use gcc builtin atomics [[default=yes]]]),
292 , enable_gcc_atomics=yes)
293 if test x$enable_gcc_atomics = xyes; then
294 have_gcc_atomics=no
295 AC_MSG_CHECKING(for GCC builtin atomic operations)
296 AC_TRY_LINK([
297 ],[
298 int a;
299 void *x, *y, *z;
300 __sync_lock_test_and_set(&a, 4);
301 __sync_fetch_and_add(&a, 1);
302 __sync_bool_compare_and_swap(&a, 5, 10);
303 __sync_bool_compare_and_swap(&x, y, z);
304 ],[
305 have_gcc_atomics=yes
306 ])
307 AC_MSG_RESULT($have_gcc_atomics)
308
309 if test x$have_gcc_mmd_mt = xyes; then
310 AC_DEFINE(HAVE_GCC_ATOMICS)
311 fi
286 fi 312 fi
287 313
288 # Standard C sources 314 # Standard C sources
289 SOURCES="$SOURCES $srcdir/src/*.c" 315 SOURCES="$SOURCES $srcdir/src/*.c"
290 SOURCES="$SOURCES $srcdir/src/audio/*.c" 316 SOURCES="$SOURCES $srcdir/src/audio/*.c"