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