Odp atomic operations based on compiler build-ins. Make
sure that compiler supports such operation at configure
stage.

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
---
 configure.ac | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/configure.ac b/configure.ac
index 8dbad4b..29387ee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -40,6 +40,25 @@ AC_TYPE_INT32_T
 AC_TYPE_UINT32_T
 AC_TYPE_UINT64_T
 
+AC_MSG_CHECKING(for MAX GCC atomic builtins)
+AC_LINK_IFELSE(
+    [AC_LANG_SOURCE(
+      [[#include <stdint.h>
+        int main() {
+        volatile uint32_t v = 1;
+        __atomic_fetch_add(&v, 1, __ATOMIC_RELAXED);
+        __atomic_fetch_sub(&v, 1, __ATOMIC_RELAXED);
+        __atomic_store_n(&v, 1, __ATOMIC_RELAXED);
+        __atomic_load_n(&v, __ATOMIC_RELAXED);
+        return 0;
+        }
+    ]])],
+    AC_MSG_RESULT(yes),
+    AC_MSG_RESULT(no)
+    echo "Atomic operation are not supported by your compiller."
+    echo "Use newer version. For gcc > 4.7.3"
+    exit -1)
+
 ##########################################################################
 # Determine which platform to build for
 ##########################################################################
-- 
1.8.5.1.163.gd7aced9


_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to