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