Compat futex
[urcu.git] / configure.ac
index 348eda03c75905218d13570e581bbab950a7c056..be9fd72b499b7e9fef75d02da51ce01f93a8bbae 100644 (file)
@@ -2,13 +2,17 @@
 # Process this file with autoconf to produce a configure script.
 
 
-AC_PREREQ([2.63])
-AC_INIT([userspace-rcu], [0.2.2], [mathieu dot desnoyers at polymtl dot ca])
+AC_INIT([userspace-rcu], [0.2.3-alpha], [mathieu dot desnoyers at polymtl dot ca])
 AC_CONFIG_AUX_DIR([config])
-AC_CONFIG_MACRO_DIR([m4])
+AC_CANONICAL_TARGET
+AC_CANONICAL_HOST
 AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip])
 AC_CONFIG_SRCDIR([urcu.h])
-AC_CONFIG_HEADERS([config.h])
+
+AH_TEMPLATE([CONFIG_URCU_SMP], [Enable SMP support. With SMP support enabled, uniprocessors are also supported. With SMP support disabled, UP systems work fine, but the behavior of SMP systems is undefined.])
+AH_TEMPLATE([CONFIG_URCU_HAVE_FENCE], [Defined when on a system that has memory fence instructions.])
+AH_TEMPLATE([CONFIG_URCU_HAVE_FUTEX], [Defined when on a system with futex support.])
+AC_CONFIG_HEADERS([urcu/config.h])
 
 # Checks for programs.
 AC_PROG_CC
@@ -26,12 +30,15 @@ AC_FUNC_MMAP
 AC_CHECK_FUNCS([bzero gettimeofday munmap strtoul])
 
 # Find arch type
-case $host_cpu in
+case $target_cpu in
+       i386) ARCHTYPE="x86"; SUBARCHTYPE="x86compat" ;;
+       i486) ARCHTYPE="x86"; SUBARCHTYPE="x86compat" ;;
+       i586) ARCHTYPE="x86"; SUBARCHTYPE="x86compat" ;;
+       i686) ARCHTYPE="x86"; SUBARCHTYPE="x86compat" ;;
        x86_64) ARCHTYPE="x86";;
-       i586) ARCHTYPE="x86" ;;
-       i686) ARCHTYPE="x86" ;;
        powerpc) ARCHTYPE="ppc" ;;
        ppc64) ARCHTYPE="ppc" ;;
+       powerpc64) ARCHTYPE="ppc" ;;
        ppc) ARCHTYPE="ppc" ;;
        s390) ARCHTYPE="s390" ;;
        s390x) ARCHTYPE="s390" ;;
@@ -42,9 +49,57 @@ if test "$ARCHTYPE" = "unknown"; then
        AC_MSG_ERROR([Unable to detect the architecture.])
 fi
 AC_SUBST(ARCHTYPE)
+AC_SUBST(SUBARCHTYPE)
+
+[
+if test "x$ARCHTYPE" = "xx86" -a "x$target_cpu" != "xi386" -a "x$target_cpu" != "xi486" -a "x$target_cpu" != "xi586"; then
+]
+       AC_DEFINE([CONFIG_URCU_HAVE_FENCE], [1])
+[
+fi
+]
+
+AC_MSG_CHECKING([sys_futex()])
+AC_TRY_COMPILE(
+[
+#include <sys/syscall.h>
+],
+[
+#ifndef __NR_futex
+#error "futexes not available"
+#endif
+],
+[
+       AC_MSG_RESULT([yes])
+       AC_DEFINE([CONFIG_URCU_HAVE_FUTEX], [1])
+       compat_futex_test=0
+]
+,
+[
+       AC_MSG_RESULT([no])
+       compat_futex_test=1
+]
+)
+
+AM_CONDITIONAL([COMPAT_FUTEX], [ test "x$compat_futex_test" = "x1" ])
 
 AM_CONDITIONAL([GCC_API], [test "x$ARCHTYPE" != xx86 -a "x$ARCHTYPE" != xppc])
 
+AM_CONDITIONAL([COMPAT_ARCH], [test "x$SUBARCHTYPE" = xx86compat ])
+
+AC_ARG_ENABLE([smp-support], [  --disable-smp-support   Disable SMP support. Warning: only use this
+                          on uniprocessor systems. [[default=enabled]]], [def_smp_support=$enableval], [def_smp_support="yes"])
+
+[
+if test "$def_smp_support" = "no"; then
+       echo "SMP support disabled."
+else
+]
+       AC_DEFINE([CONFIG_URCU_SMP], [1])
+[
+       echo "SMP support enabled."
+fi
+]
 
 AC_CONFIG_FILES([
        Makefile
This page took 0.022761 seconds and 4 git commands to generate.