Test whether libgcc or kernel defines __sync_bool_compare_and_swap_4.
From-SVN: r169504
diff --git a/libgo/configure.ac b/libgo/configure.ac
index e1c0dd0..6cd04d2 100644
--- a/libgo/configure.ac
+++ b/libgo/configure.ac
@@ -332,6 +332,20 @@
AM_CONDITIONAL(HAVE_SYS_MMAN_H, test "$ac_cv_header_sys_mman_h" = yes)
AC_CHECK_FUNCS(srandom random strsignal)
+AC_CACHE_CHECK([for __sync_bool_compare_and_swap_4],
+[libgo_cv_func___sync_bool_compare_and_swap_4],
+[AC_LINK_IFELSE([
+typedef unsigned int uint32 __attribute__ ((mode (SI)));
+uint32 i;
+int main() { return __sync_bool_compare_and_swap (&i, 0, 1); }
+],
+[libgo_cv_func___sync_bool_compare_and_swap_4=yes],
+[libgo_cv_func___sync_bool_compare_and_swap_4=no])])
+if test "$libgo_cv_func___sync_bool_compare_and_swap_4" = "yes"; then
+ AC_DEFINE(HAVE_SYNC_BOOL_COMPARE_AND_SWAP_4, 1,
+ [Define to 1 if the compiler provides the __sync_bool_compare_and_swap function for uint32])
+fi
+
dnl For x86 we want to use the -minline-all-stringops option to avoid
dnl forcing a stack split when calling memcpy and friends.
AC_CACHE_CHECK([whether compiler supports -minline-all-stringops],