summaryrefslogtreecommitdiffstats
path: root/build/m4/ax_c___atomic.m4
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2018-11-07 12:22:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2018-11-07 12:22:44 +0000
commit1e6c93250172946eeb38e94a92a1fd12c9d3011e (patch)
tree8ca5e16dfc7ad6b3bf2738ca0a48408a950f8f7e /build/m4/ax_c___atomic.m4
parentUpdate watch file (diff)
downloadnetdata-1e6c93250172946eeb38e94a92a1fd12c9d3011e.tar.xz
netdata-1e6c93250172946eeb38e94a92a1fd12c9d3011e.zip
Merging upstream version 1.11.0+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'build/m4/ax_c___atomic.m4')
-rw-r--r--build/m4/ax_c___atomic.m436
1 files changed, 36 insertions, 0 deletions
diff --git a/build/m4/ax_c___atomic.m4 b/build/m4/ax_c___atomic.m4
new file mode 100644
index 000000000..dd5ee3d1c
--- /dev/null
+++ b/build/m4/ax_c___atomic.m4
@@ -0,0 +1,36 @@
+# AC_C___ATOMIC
+# -------------
+# Define HAVE_C___ATOMIC if __atomic works.
+AN_IDENTIFIER([__atomic], [AC_C___ATOMIC])
+AC_DEFUN([AC_C___ATOMIC],
+[AC_CACHE_CHECK([for __atomic], ac_cv_c___atomic,
+[AC_LINK_IFELSE(
+ [AC_LANG_SOURCE(
+ [[int
+ main (int argc, char **argv)
+ {
+ volatile unsigned long ul1 = 1, ul2 = 0, ul3 = 2;
+ __atomic_load_n(&ul1, __ATOMIC_SEQ_CST);
+ __atomic_compare_exchange(&ul1, &ul2, &ul3, 1, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
+ __atomic_fetch_add(&ul1, 1, __ATOMIC_SEQ_CST);
+ __atomic_fetch_sub(&ul3, 1, __ATOMIC_SEQ_CST);
+ __atomic_or_fetch(&ul1, ul2, __ATOMIC_SEQ_CST);
+ __atomic_and_fetch(&ul1, ul2, __ATOMIC_SEQ_CST);
+ volatile unsigned long long ull1 = 1, ull2 = 0, ull3 = 2;
+ __atomic_load_n(&ull1, __ATOMIC_SEQ_CST);
+ __atomic_compare_exchange(&ull1, &ull2, &ull3, 1, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
+ __atomic_fetch_add(&ull1, 1, __ATOMIC_SEQ_CST);
+ __atomic_fetch_sub(&ull3, 1, __ATOMIC_SEQ_CST);
+ __atomic_or_fetch(&ull1, ull2, __ATOMIC_SEQ_CST);
+ __atomic_and_fetch(&ull1, ull2, __ATOMIC_SEQ_CST);
+ return 0;
+ }
+ ]])],
+ [ac_cv_c___atomic=yes],
+ [ac_cv_c___atomic=no])])
+if test $ac_cv_c___atomic = yes; then
+ AC_DEFINE([HAVE_C___ATOMIC], 1,
+ [Define to 1 if __atomic operations work.])
+fi
+])# AC_C___ATOMIC
+