X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/479647105b2ad7d4016b04aefcf2021daed922a1..992d6e1e2c5208ec3fded3d92691425f6b484630:/build/aclocal/atomic_builtins.m4 diff --git a/build/aclocal/atomic_builtins.m4 b/build/aclocal/atomic_builtins.m4 index 45b88e90f4..8366eb3ef4 100644 --- a/build/aclocal/atomic_builtins.m4 +++ b/build/aclocal/atomic_builtins.m4 @@ -6,14 +6,17 @@ AC_DEFUN([WX_ATOMIC_BUILTINS], [ AC_REQUIRE([AC_PROG_CC]) if test -n "$GCC"; then - AC_MSG_CHECKING([for __sync_fetch_* builtins]) + AC_MSG_CHECKING([for __sync_fetch_and_add and __sync_sub_and_fetch builtins]) AC_CACHE_VAL(wx_cv_cc_gcc_atomic_builtins, [ - AC_TRY_COMPILE( + AC_TRY_LINK( [], [ - int value=0; - __sync_fetch_and_add(&value, 1); + unsigned int value=0; + /* wxAtomicInc doesn't use return value here */ + __sync_fetch_and_add(&value, 2); __sync_sub_and_fetch(&value, 1); + /* but wxAtomicDec does, so mimic that: */ + unsigned int r2 = __sync_sub_and_fetch(&value, 1); ], wx_cv_cc_gcc_atomic_builtins=yes, wx_cv_cc_gcc_atomic_builtins=no)