-# Find arch type
-AS_CASE([$host_cpu],
- [k1om], [ARCHTYPE="x86"],
- [i386], [ARCHTYPE="x86" && SUBARCHTYPE="x86compat"],
- [i486], [ARCHTYPE="x86"],
- [i586], [ARCHTYPE="x86"],
- [i686], [ARCHTYPE="x86"],
- [amd64], [ARCHTYPE="x86"],
- [x86_64], [ARCHTYPE="x86"],
- [powerpc], [ARCHTYPE="ppc"],
- [ppc64], [ARCHTYPE="ppc"],
- [powerpc64], [ARCHTYPE="ppc"],
- [powerpc64le], [ARCHTYPE="ppc"],
- [ppc], [ARCHTYPE="ppc"],
- [s390], [ARCHTYPE="s390"],
- [s390x], [ARCHTYPE="s390"],
- [sparc], [ARCHTYPE="sparc64"],
- [sparc64], [ARCHTYPE="sparc64"],
- [alpha*], [ARCHTYPE="alpha"],
- [ia64], [ARCHTYPE="ia64"],
- [arm*], [ARCHTYPE="arm"],
- [aarch64*], [ARCHTYPE="aarch64"],
- [mips*], [ARCHTYPE="mips"],
- [nios2*], [ARCHTYPE="nios2"],
- [tile*], [ARCHTYPE="tile"],
- [hppa*], [ARCHTYPE="hppa"],
- [m68k], [ARCHTYPE="m68k"],
- [riscv*], [ARCHTYPE="riscv"],
- [ARCHTYPE="unknown"]
-)
-
-AS_CASE([$host],[*-cygwin*],
- [AM_CONDITIONAL(USE_CYGWIN, true)],
- [AM_CONDITIONAL(USE_CYGWIN, false)]
-)
-
-AC_SUBST(ARCHTYPE)
-AC_SUBST(SUBARCHTYPE)
-
-UATOMICSRC=include/urcu/uatomic/$ARCHTYPE.h
-ARCHSRC=include/urcu/arch/$ARCHTYPE.h
-
-AS_IF([test "x$SUBARCHTYPE" = xx86compat],[
- AC_DEFINE([CONFIG_RCU_COMPAT_ARCH], [1])
-])
-
-AS_IF([test "$host_cpu" = "armv7l"],[
- AM_CFLAGS="$AM_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" -a "x$host_cpu" != "xk1om"],[
- AC_MSG_RESULT([yes])
- AC_DEFINE([CONFIG_RCU_HAVE_FENCE], [1])
- config_rcu_have_fence=yes
- ],[
- AC_MSG_RESULT([no])
- config_rcu_have_fence=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
- ]])
-],[
- AC_MSG_RESULT([yes])
- AC_DEFINE([CONFIG_RCU_HAVE_FUTEX], [1])
- compat_futex_test=0
-],[
- AC_MSG_RESULT([no])
- compat_futex_test=1
-])
-