summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2018-01-24 19:49:02 -0500
committerCorey Farrell <git@cfware.com>2018-01-24 20:00:48 -0500
commit6fbd85522896c9c94281ed775c98a041721de424 (patch)
treea9336ae88416860fc6877837a733d0bb5602e718 /configure.ac
parent7ce34f4e6a8a2bbfc3cfac9a4465eb0f71372205 (diff)
Build System: Add support for __atomic built-in operators.
Add a check to configure.ac for __atomic_fetch_add support. If found use the __atomic built-in operators for ast_atomic_dec_and_test and ast_atomic_fetchadd_int. ASTERISK~27619 Change-Id: I65b4feb02bae368904ed0fb03f585c05f50a690e
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac12
1 files changed, 10 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index c590c6b0b..07ff3b3f8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1070,11 +1070,19 @@ AC_LINK_IFELSE(
# for FreeBSD thr_self
AC_CHECK_HEADERS([sys/thr.h])
-AC_MSG_CHECKING(for compiler atomic operations)
+AC_MSG_CHECKING(for compiler sync operations)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([], [int foo1; int foo2 = __sync_fetch_and_add(&foo1, 1);])],
AC_MSG_RESULT(yes)
-AC_DEFINE([HAVE_GCC_ATOMICS], 1, [Define to 1 if your GCC C compiler provides atomic operations.]),
+AC_DEFINE([HAVE_GCC_ATOMICS], 1, [Define to 1 if your GCC C compiler provides __sync atomic operations.]),
+AC_MSG_RESULT(no)
+)
+
+AC_MSG_CHECKING(for compiler atomic operations)
+AC_LINK_IFELSE(
+[AC_LANG_PROGRAM([], [int foo1; int foo2 = __atomic_fetch_add(&foo1, 1, __ATOMIC_RELAXED);])],
+AC_MSG_RESULT(yes)
+AC_DEFINE([HAVE_C_ATOMICS], 1, [Define to 1 if your C compiler provides __atomic operations.]),
AC_MSG_RESULT(no)
)