-[
-#if test "x$ARCHTYPE" = "xx86" -a "x$host_cpu" != "xi386" -a "x$host_cpu" != "xi486" -a "x$host_cpu" != "xi586"; then
-#For now, using lock; addl compatibility mode even for i686, because the
-#Pentium III is seen as a i686, but lacks mfence instruction.
-#Only using fence for x86_64.
-if test "x$ARCHTYPE" = "xx86" -a "x$host_cpu" != "xi386" -a "x$host_cpu" != "xi486" -a "x$host_cpu" != "xi586" -a "x$host_cpu" != "xi686"; then
-]
- AC_DEFINE([CONFIG_RCU_HAVE_FENCE], [1])
-[
-fi
-]
-
-AC_MSG_CHECKING([sys_futex()])
-AC_TRY_COMPILE(
-[
-#include <sys/syscall.h>
-],
-[
-#ifndef __NR_futex
-#error "futexes not available"
-#endif
-],
-[
+UATOMICSRC=urcu/uatomic/$ARCHTYPE.h
+ARCHSRC=urcu/arch/$ARCHTYPE.h
+
+AS_IF([test "x$SUBARCHTYPE" = xx86compat],[
+ AC_DEFINE([CONFIG_RCU_COMPAT_ARCH], [1])
+])
+
+AS_IF([test "$host_cpu" = "armv7l"],[
+ CFLAGS="$CFLAGS -mcpu=cortex-a9 -mtune=cortex-a9 -O1"
+])
+
+# ARM-specific checks
+AS_IF([test "x$ARCHTYPE" = "xarm"],[
+ AC_MSG_CHECKING([for dmb instruction])
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+ int main()
+ {
+ asm volatile("dmb":::"memory");
+ return 0;
+ }
+ ]])
+ ],[
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([CONFIG_RCU_ARM_HAVE_DMB], [1])
+ ],[
+ AC_MSG_RESULT([no])
+ ])
+])
+
+# Tile-specific checks
+AS_IF([echo "$host_cpu" | grep "^tile"],[
+ AC_MSG_CHECKING([for Tile architecture type])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #ifndef __tilegx__
+ #error
+ #endif
+ ]])
+ ],[
+ AC_MSG_RESULT([ok])
+ ],[
+ AC_MSG_FAILURE([URCU has only been tested on the TileGx architecture. For other Tile* architectures, please run the tests first and report the results to the maintainer so that proper support can be added.])
+ ])
+])
+
+# x86-specific checks
+AS_IF([test "x$ARCHTYPE" = "xx86"],[
+ AC_MSG_CHECKING([if architecture really supports the mfence instruction])
+ #For now, using lock; addl compatibility mode even for i686, because the
+ #Pentium III is seen as a i686, but lacks mfence instruction.
+ #Only using fence for x86_64.
+ #
+ #k1om is the name for the Intel MIC family (Xeon Phi). It is an x86_64
+ #variant but lacks fence instructions.
+ AS_IF([test "x$host_cpu" != "xi386" -a "x$host_cpu" != "xi486" -a "x$host_cpu" != "xi586" -a "x$host_cpu" != "xi686" -a "x$host_vendor" != "xk1om"],[
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([CONFIG_RCU_HAVE_FENCE], [1])
+ ],[
+ AC_MSG_RESULT([no])
+ ])
+])
+
+# Check if sys_futex() is available
+AC_MSG_CHECKING([for sys_futex()])
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+ #include <sys/syscall.h>
+ #ifndef __NR_futex
+ #error "futexes not available"
+ #endif
+ ]])
+],[