@@ -40,6 +40,25 @@ AC_TYPE_INT32_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
+AC_MSG_CHECKING(for 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
##########################################################################
Odp atomic operations based on compiler build-ins. Make sure that compiler supports such operation at configure stage. Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> --- configure.ac | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)