summaryrefslogtreecommitdiffstats
path: root/cpukit/aclocal/check-atomic.m4
blob: 69cca509a7177bb4a7a61ae5fa2b76823882d78b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
dnl
AC_DEFUN([RTEMS_CHECK_ATOMIC],
[dnl
AC_REQUIRE([RTEMS_CANONICAL_TARGET_CPU])dnl

AC_CACHE_CHECK([whether CPU supports atomic operations],
  [rtems_cv_ATOMIC],[
    AC_LINK_IFELSE(
      [AC_LANG_PROGRAM([[#include <stdatomic.h>]],
        [[atomic_uint_fast32_t t; uint_fast32_t m = 1;
          atomic_init(&t, 0); 
          atomic_store( &t, 1 );
          atomic_exchange( &t, 2 );
          atomic_compare_exchange_strong( &t, &m, 2);
          atomic_fetch_add( &t, 3 );]])],
        [rtems_cv_ATOMIC="yes"],
        [rtems_cv_ATOMIC="no"])
  ])
])