File: atomic_builtins.m4

package info (click to toggle)
wxpython3.0 3.0.2.0%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 482,760 kB
  • ctags: 518,293
  • sloc: cpp: 2,127,226; python: 294,045; makefile: 51,942; ansic: 19,033; sh: 3,013; xml: 1,629; perl: 17
file content (29 lines) | stat: -rw-r--r-- 942 bytes parent folder | download | duplicates (10)
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

dnl Checks for availability of GCC's atomic operations builtins.
dnl Defines HAVE_GCC_ATOMIC_BUILTINS if available.

AC_DEFUN([WX_ATOMIC_BUILTINS],
[
  AC_REQUIRE([AC_PROG_CC])
  if test -n "$GCC"; then
    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_LINK(
        [],
        [
          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: */
          volatile unsigned int r2 = __sync_sub_and_fetch(&value, 1);
        ],
        wx_cv_cc_gcc_atomic_builtins=yes,
        wx_cv_cc_gcc_atomic_builtins=no)
      ])
    AC_MSG_RESULT([$wx_cv_cc_gcc_atomic_builtins])
    if test $wx_cv_cc_gcc_atomic_builtins = yes; then
      AC_DEFINE([HAVE_GCC_ATOMIC_BUILTINS])
    fi
  fi
])