Added configure test for the gcc/icc built-in functions for atomic memory access (__sync_bool_compare_and_swap() a.o.).

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8283 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/configure.in b/configure.in
index 3e5e233..52857e6 100644
--- a/configure.in
+++ b/configure.in
@@ -1109,6 +1109,23 @@
 fi
 
 
+# does this compiler have built-in functions for atomic memory access ?
+AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
+
+AC_TRY_LINK(,
+[
+  int variable = 1;
+  return __sync_bool_compare_and_swap(&variable, 1, 2) ? 1 : 0
+],
+[
+  AC_MSG_RESULT([yes])
+  AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() a.o.])
+],
+[
+  AC_MSG_RESULT([no])
+])
+
+
 # does the ppc assembler support "mtocrf" et al?
 AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])