]> git.saurik.com Git - wxWidgets.git/blame - build/aclocal/atomic_builtins.m4
No changes, just rebaked and reran autoconf.
[wxWidgets.git] / build / aclocal / atomic_builtins.m4
CommitLineData
47964710
VS
1
2dnl Checks for availability of GCC's atomic operations builtins.
3dnl Defines HAVE_GCC_ATOMIC_BUILTINS if available.
4
5AC_DEFUN([WX_ATOMIC_BUILTINS],
6[
7 AC_REQUIRE([AC_PROG_CC])
8 if test -n "$GCC"; then
9d5507f7 9 AC_MSG_CHECKING([for __sync_fetch_and_add and __sync_sub_and_fetch builtins])
47964710 10 AC_CACHE_VAL(wx_cv_cc_gcc_atomic_builtins, [
9dcff96b 11 AC_TRY_LINK(
47964710
VS
12 [],
13 [
9dcff96b 14 unsigned int value=0;
9d5507f7
VS
15 /* wxAtomicInc doesn't use return value here */
16 __sync_fetch_and_add(&value, 2);
47964710 17 __sync_sub_and_fetch(&value, 1);
9d5507f7
VS
18 /* but wxAtomicDec does, so mimic that: */
19 unsigned int r2 = __sync_sub_and_fetch(&value, 1);
47964710
VS
20 ],
21 wx_cv_cc_gcc_atomic_builtins=yes,
22 wx_cv_cc_gcc_atomic_builtins=no)
23 ])
24 AC_MSG_RESULT([$wx_cv_cc_gcc_atomic_builtins])
25 if test $wx_cv_cc_gcc_atomic_builtins = yes; then
26 AC_DEFINE([HAVE_GCC_ATOMIC_BUILTINS])
27 fi
28 fi
29])