1 dnl Copyright (C) 2009 Sun Microsystems, Inc.
2 dnl This file is free software; Sun Microsystems, Inc.
3 dnl gives unlimited permission to copy and/or distribute it,
4 dnl with or without modifications, as long as this notice is preserved.
6 #--------------------------------------------------------------------
7 # Check for GCC Atomic Support
8 #--------------------------------------------------------------------
11 AC_DEFUN([PANDORA_HAVE_GCC_ATOMICS],[
14 [whether the compiler provides atomic builtins],
15 [ac_cv_gcc_atomic_builtins],
17 [AC_LANG_PROGRAM([],[[
18 int foo= -10; int bar= 10;
19 if (!__sync_fetch_and_add(&foo, bar) || foo)
21 bar= __sync_lock_test_and_set(&foo, bar);
24 bar= __sync_val_compare_and_swap(&bar, foo, 15);
29 [ac_cv_gcc_atomic_builtins=yes],
30 [ac_cv_gcc_atomic_builtins=no])])
32 AS_IF([test "x$ac_cv_gcc_atomic_builtins" = "xyes"],[
33 AC_DEFINE(HAVE_GCC_ATOMIC_BUILTINS, 1,
34 [Define to 1 if compiler provides atomic builtins.])