configure.in
changeset 5004 0c72ae7b7cb2
parent 5003 3a95a2b93eb3
child 5029 5d7d48157be7
--- a/configure.in	Sat Jan 15 12:41:59 2011 -0800
+++ b/configure.in	Sun Jan 16 15:16:39 2011 -0800
@@ -181,7 +181,7 @@
         DEPENDENCY_TRACKING_OPTIONS="-MMD -MT \$@"
     fi
 fi
-    
+
 dnl See whether we are allowed to use the system C library
 AC_ARG_ENABLE(libc,
 AC_HELP_STRING([--enable-libc], [Use the system C library [[default=yes]]]),
@@ -285,6 +285,32 @@
     AC_DEFINE(uintptr_t, unsigned long)
 fi
 
+dnl See whether we can use gcc atomic operations on this architecture
+AC_ARG_ENABLE(gcc-atomics,
+AC_HELP_STRING([--enable-gcc-atomics],
+               [Use gcc builtin atomics [[default=yes]]]),
+              , enable_gcc_atomics=yes)
+if test x$enable_gcc_atomics = xyes; then
+    have_gcc_atomics=no
+    AC_MSG_CHECKING(for GCC builtin atomic operations)
+    AC_TRY_LINK([
+    ],[
+    int a;
+    void *x, *y, *z;
+    __sync_lock_test_and_set(&a, 4);
+    __sync_fetch_and_add(&a, 1);
+    __sync_bool_compare_and_swap(&a, 5, 10);
+    __sync_bool_compare_and_swap(&x, y, z);
+    ],[
+    have_gcc_atomics=yes
+    ])
+    AC_MSG_RESULT($have_gcc_atomics)
+
+    if test x$have_gcc_mmd_mt = xyes; then
+        AC_DEFINE(HAVE_GCC_ATOMICS)
+    fi
+fi
+
 # Standard C sources
 SOURCES="$SOURCES $srcdir/src/*.c"
 SOURCES="$SOURCES $srcdir/src/audio/*.c"