~drizzle-trunk/drizzle/development

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
dnl  Copyright (C) 2009 Sun Microsystems, Inc.
dnl This file is free software; Sun Microsystems, Inc.
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.

#--------------------------------------------------------------------
# Check for GCC Atomic Support
#--------------------------------------------------------------------


AC_DEFUN([PANDORA_HAVE_GCC_ATOMICS],[
	
  AC_CACHE_CHECK(
    [whether the compiler provides atomic builtins],
    [ac_cv_gcc_atomic_builtins],
    [AC_LINK_IFELSE(
      [AC_LANG_PROGRAM([],[[
        int foo= -10; int bar= 10;
        if (!__sync_fetch_and_add(&foo, bar) || foo)
          return -1;
        bar= __sync_lock_test_and_set(&foo, bar);
        if (bar || foo != 10)
          return -1;
        bar= __sync_val_compare_and_swap(&bar, foo, 15);
        if (bar)
          return -1;
        return 0;
        ]])],
      [ac_cv_gcc_atomic_builtins=yes],
      [ac_cv_gcc_atomic_builtins=no])])

  AS_IF([test "x$ac_cv_gcc_atomic_builtins" = "xyes"],[
    AC_DEFINE(HAVE_GCC_ATOMIC_BUILTINS, 1,
              [Define to 1 if compiler provides atomic builtins.])
  ])

])