3 AC_DEFUN([HAVE_GCC_ATOMICS],
4 [AC_CACHE_CHECK([whether the compiler provides atomic builtins],
5 [ax_cv_gcc_atomic_builtins],
8 AC_RUN_IFELSE([AC_LANG_PROGRAM([],
10 int foo= -10; int bar= 10;
11 if (!__sync_fetch_and_add(&foo, bar) || foo)
15 bar= __sync_lock_test_and_set(&foo, bar);
20 bar= __sync_val_compare_and_swap(&bar, foo, 15);
26 [ax_cv_gcc_atomic_builtins=yes],
27 [ax_cv_gcc_atomic_builtins=no],
28 [AC_MSG_WARN([test program execution failed])])
33 AS_IF([test "x$ax_cv_gcc_atomic_builtins" = "xyes"],
34 [AC_DEFINE([HAVE_GCC_ATOMIC_BUILTINS],[1],
35 [Define to 1 if compiler provides atomic builtins.])