~drizzle-trunk/drizzle/development

1192.3.28 by Monty Taylor
pandora-build v0.72 - Moved remaining hard-coded tests into pandora-build
1
dnl  Copyright (C) 2009 Sun Microsystems
2
dnl This file is free software; Sun Microsystems
3
dnl gives unlimited permission to copy and/or distribute it,
4
dnl with or without modifications, as long as this notice is preserved.
5
6
#--------------------------------------------------------------------
7
# Check for GCC Atomic Support
8
#--------------------------------------------------------------------
9
10
11
AC_DEFUN([PANDORA_HAVE_GCC_ATOMICS],[
12
	
13
  AC_CACHE_CHECK(
14
    [whether the compiler provides atomic builtins],
15
    [ac_cv_gcc_atomic_builtins],
1273.12.2 by Monty Taylor
pandora-build v0.103 - fix macros for cross-compiling. Fix stack direction check.
16
    [AC_LINK_IFELSE(
1192.3.28 by Monty Taylor
pandora-build v0.72 - Moved remaining hard-coded tests into pandora-build
17
      [AC_LANG_PROGRAM([],[[
18
        int foo= -10; int bar= 10;
19
        if (!__sync_fetch_and_add(&foo, bar) || foo)
20
          return -1;
21
        bar= __sync_lock_test_and_set(&foo, bar);
22
        if (bar || foo != 10)
23
          return -1;
24
        bar= __sync_val_compare_and_swap(&bar, foo, 15);
25
        if (bar)
26
          return -1;
27
        return 0;
28
        ]])],
29
      [ac_cv_gcc_atomic_builtins=yes],
30
      [ac_cv_gcc_atomic_builtins=no])])
31
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.])
35
  ])
36
1273.12.2 by Monty Taylor
pandora-build v0.103 - fix macros for cross-compiling. Fix stack direction check.
37
])