]> git.saurik.com Git - wxWidgets.git/blob - build/aclocal/atomic_builtins.m4
cleanup
[wxWidgets.git] / build / aclocal / atomic_builtins.m4
1
2 dnl Checks for availability of GCC's atomic operations builtins.
3 dnl Defines HAVE_GCC_ATOMIC_BUILTINS if available.
4
5 AC_DEFUN([WX_ATOMIC_BUILTINS],
6 [
7 AC_REQUIRE([AC_PROG_CC])
8 if test -n "$GCC"; then
9 AC_MSG_CHECKING([for __sync_fetch_* builtins])
10 AC_CACHE_VAL(wx_cv_cc_gcc_atomic_builtins, [
11 AC_TRY_COMPILE(
12 [],
13 [
14 int value=0;
15 __sync_fetch_and_add(&value, 1);
16 __sync_sub_and_fetch(&value, 1);
17 ],
18 wx_cv_cc_gcc_atomic_builtins=yes,
19 wx_cv_cc_gcc_atomic_builtins=no)
20 ])
21 AC_MSG_RESULT([$wx_cv_cc_gcc_atomic_builtins])
22 if test $wx_cv_cc_gcc_atomic_builtins = yes; then
23 AC_DEFINE([HAVE_GCC_ATOMIC_BUILTINS])
24 fi
25 fi
26 ])