uatomic compat: complete i386 support
[urcu.git] / configure.ac
CommitLineData
48d848c7
PMF
1# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4
0540b338 5AC_INIT([userspace-rcu], [0.2.3], [mathieu dot desnoyers at polymtl dot ca])
48d848c7 6AC_CONFIG_AUX_DIR([config])
7d413817
MD
7AC_CANONICAL_TARGET
8AC_CANONICAL_HOST
48d848c7
PMF
9AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip])
10AC_CONFIG_SRCDIR([urcu.h])
0f4ac97f 11AM_PROG_MKDIR_P
7d413817 12
e72596d1
MD
13AC_CONFIG_HEADERS([config.h urcu/config.h])
14
15# Keep at the end to do not pollute installed header.
49617de1
MD
16AH_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.])
17AH_TEMPLATE([CONFIG_URCU_HAVE_FENCE], [Defined when on a system that has memory fence instructions.])
18AH_TEMPLATE([CONFIG_URCU_HAVE_FUTEX], [Defined when on a system with futex support.])
bf9de1b7
MD
19AH_TEMPLATE([CONFIG_URCU_COMPAT_ARCH], [Compatibility mode for i386 which lacks
20cmpxchg instruction.])
48d848c7
PMF
21
22# Checks for programs.
23AC_PROG_CC
24AC_PROG_MAKE_SET
25AC_PROG_LIBTOOL
26
27# Checks for typedefs, structures, and compiler characteristics.
28AC_C_INLINE
29AC_TYPE_PID_T
30AC_TYPE_SIZE_T
31
32# Checks for library functions.
33AC_FUNC_MALLOC
34AC_FUNC_MMAP
35AC_CHECK_FUNCS([bzero gettimeofday munmap strtoul])
36
37# Find arch type
7d413817
MD
38case $target_cpu in
39 i386) ARCHTYPE="x86"; SUBARCHTYPE="x86compat" ;;
bf9de1b7
MD
40 i486) ARCHTYPE="x86";;
41 i586) ARCHTYPE="x86";;
42 i686) ARCHTYPE="x86";;
48d848c7 43 x86_64) ARCHTYPE="x86";;
48d848c7
PMF
44 powerpc) ARCHTYPE="ppc" ;;
45 ppc64) ARCHTYPE="ppc" ;;
7d413817 46 powerpc64) ARCHTYPE="ppc" ;;
48d848c7
PMF
47 ppc) ARCHTYPE="ppc" ;;
48 s390) ARCHTYPE="s390" ;;
49 s390x) ARCHTYPE="s390" ;;
50 *) ARCHTYPE="unknown";;
51esac
52
53if test "$ARCHTYPE" = "unknown"; then
54 AC_MSG_ERROR([Unable to detect the architecture.])
55fi
56AC_SUBST(ARCHTYPE)
7d413817 57AC_SUBST(SUBARCHTYPE)
48d848c7 58
90586875 59[
6cb4ed53
MD
60#if test "x$ARCHTYPE" = "xx86" -a "x$target_cpu" != "xi386" -a "x$target_cpu" != "xi486" -a "x$target_cpu" != "xi586"; then
61#For now, using lock; addl compatibility mode even for i686, because the
62#Pentium III is seen as a i686, but lacks mfence instruction.
63#Only using fence for x86_64.
64if test "x$ARCHTYPE" = "xx86" -a "x$target_cpu" != "xi386" -a "x$target_cpu" != "xi486" -a "x$target_cpu" != "xi586" -a "x$target_cpu" != "xi686"; then
90586875 65]
49617de1 66 AC_DEFINE([CONFIG_URCU_HAVE_FENCE], [1])
90586875
MD
67[
68fi
69]
70
49617de1 71AC_MSG_CHECKING([sys_futex()])
0854ccff
MD
72AC_TRY_COMPILE(
73[
74#include <sys/syscall.h>
75],
76[
77#ifndef __NR_futex
78#error "futexes not available"
79#endif
80],
81[
82 AC_MSG_RESULT([yes])
49617de1 83 AC_DEFINE([CONFIG_URCU_HAVE_FUTEX], [1])
0854ccff
MD
84 compat_futex_test=0
85]
86,
87[
88 AC_MSG_RESULT([no])
89 compat_futex_test=1
90]
91)
92
93AM_CONDITIONAL([COMPAT_FUTEX], [ test "x$compat_futex_test" = "x1" ])
94
40646e1e 95AM_CONDITIONAL([GCC_API], [test "x$ARCHTYPE" != xx86 -a "x$ARCHTYPE" != xppc])
48d848c7 96
0854ccff 97AM_CONDITIONAL([COMPAT_ARCH], [test "x$SUBARCHTYPE" = xx86compat ])
7d413817 98
bf9de1b7
MD
99[
100if test "x$SUBARCHTYPE" = xx86compat; then
101]
102 AC_DEFINE([CONFIG_URCU_COMPAT_ARCH], [1])
103[
104fi
105]
106
7d413817
MD
107AC_ARG_ENABLE([smp-support], [ --disable-smp-support Disable SMP support. Warning: only use this
108 on uniprocessor systems. [[default=enabled]]], [def_smp_support=$enableval], [def_smp_support="yes"])
109
110[
111if test "$def_smp_support" = "no"; then
112 echo "SMP support disabled."
113else
114]
49617de1 115 AC_DEFINE([CONFIG_URCU_SMP], [1])
7d413817
MD
116[
117 echo "SMP support enabled."
118fi
119]
48d848c7
PMF
120
121AC_CONFIG_FILES([
122 Makefile
123 tests/Makefile
124])
125AC_OUTPUT
This page took 0.039115 seconds and 4 git commands to generate.