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