-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.ac
150 lines (130 loc) · 4.54 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
dnl Process this file with autoconf to produce a configure script.
dnl Initialize autoconf.
AC_PREREQ(2.68)
AC_INIT([MainMemory], [0.4.1], [[email protected]])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_SRCDIR([src/base/bitops.h])
AC_CONFIG_HEADERS([src/config.h])
dnl Initialize automake.
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects])
dnl Determine the host system type.
AC_CANONICAL_HOST
AC_MSG_CHECKING([host architecture])
case "$host" in
i[[3456789]]86-*-*)
arch=x86
AC_DEFINE([ARCH_X86], 1, [Build for x86 architecture.])
;;
x86_64-*-*|amd64-*-*)
arch=x86-64
AC_DEFINE([ARCH_X86_64], 1, [Build for x86-64 architecture.])
;;
*)
arch=generic
AC_DEFINE([ARCH_GENERIC], 1, [Build for generic architecture.])
;;
esac
AC_MSG_RESULT([$arch])
AM_CONDITIONAL([ARCH_X86], [test "$arch" = "x86"])
AM_CONDITIONAL([ARCH_X86_64], [test "$arch" = "x86-64"])
AM_CONDITIONAL([ARCH_GENERIC], [test "$arch" = "generic"])
dnl Check for API variants.
AC_GNU_SOURCE
#case "$host" in
# *-*-darwin*)
# AC_DEFINE([_XOPEN_SOURCE], 600, [Enable for ucontext.h on Darwin])
# AC_DEFINE([_DARWIN_C_SOURCE], 1, [Enable for ucontext.h on Darwin])
# ;;
#esac
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CC_C99
AM_PROG_CC_C_O
AM_PROG_AR
AM_PROG_AS
dnl Initialize libtool.
LT_INIT([disable-shared])
dnl Checks for libraries.
AC_SEARCH_LIBS([clock_gettime], [rt])
AC_SEARCH_LIBS([pthread_create], [pthread],
[], [AC_MSG_ERROR(Cannot find pthread library)])
dnl Checks for header files.
AC_CHECK_HEADERS([stdlib.h sysexits.h unistd.h ucontext.h])
AC_CHECK_HEADERS([mach/semaphore.h mach/thread_policy.h])
AC_CHECK_HEADERS([pthread.h pthread_np.h sched.h])
AC_CHECK_HEADERS([sys/param.h sys/cpuset.h], [], [], [[
#if HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
]])
AC_CHECK_HEADERS([sys/epoll.h sys/eventfd.h sys/event.h])
AC_CHECK_HEADERS([sys/sysctl.h linux/futex.h])
AC_CHECK_HEADERS([mach/mach_time.h sys/time.h time.h])
AC_CHECK_HEADERS([xmmintrin.h])
dnl Checks for typedefs, structures, and compiler characteristics.
AX_CHECK_COMPILE_FLAG([-msse4.2], [sse4_2=yes], [sse4_2=no], [], [])
if test "x$sse4_2" = "xyes"; then
ARCH_CFLAGS=-msse4.2
fi
AC_SUBST([ARCH_CFLAGS], $ARCH_CFLAGS)
dnl Checks for library functions.
AC_CHECK_FUNCS(pthread_setaffinity_np)
AC_CHECK_FUNCS(pthread_setname_np)
AC_CHECK_FUNCS(pthread_yield_np)
AC_CHECK_FUNCS(pthread_yield)
dnl Check command line arguments
AC_ARG_ENABLE([smp],
[AS_HELP_STRING([--enable-smp], [enable SMP support (default=yes)])],
[smp="$enableval"], [smp=yes])
if test "x$smp" = "xyes"; then
AC_DEFINE([ENABLE_SMP], 1, [Define to 1 to enable SMP support.])
fi
AC_ARG_ENABLE([inline-syscalls],
[AS_HELP_STRING([--enable-inline-syscalls], [enable inline syscalls (default=yes)])],
[inline_syscalls="$enableval"], [inline_syscalls=yes])
if test "x$inline_syscalls" = "xyes"; then
AC_DEFINE([ENABLE_INLINE_SYSCALLS], 1, [Define to 1 to enable inline syscalls.])
fi
AC_ARG_ENABLE([crc32-hash],
[AS_HELP_STRING([--enable-crc32-hash], [enable crc32 as a hash function (default=yes, if sse4.2 is supported by the compiler)])],
[crc32_hash="$enableval"], [crc32_hash="$sse4_2"])
if test "x$crc32_hash" = "xyes"; then
AC_DEFINE([ENABLE_CRC32_HASH], 1, [Define to 1 to enable crc32 as hash function])
fi
AC_ARG_ENABLE([event-stats],
[AS_HELP_STRING([--enable-event-stats], [enable event statistics (default=no)])],
[event_stats="$enableval"], [event_stats=no])
if test "x$event_stats" = "xyes"; then
AC_DEFINE([ENABLE_EVENT_STATS], 1, [Define to 1 to enable event statistics.])
fi
AC_ARG_ENABLE([lock-stats],
[AS_HELP_STRING([--enable-lock-stats], [enable lock statistics (default=no)])],
[lock_stats="$enableval"], [lock_stats=no])
if test "x$lock_stats" = "xyes"; then
AC_DEFINE([ENABLE_LOCK_STATS], 1, [Define to 1 to enable lock statistics.])
fi
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug], [enable debug run-time checks (default=no)])],
[debug="$enableval"], [debug=no])
if test "x$debug" = "xyes"; then
AC_DEFINE([ENABLE_DEBUG], 1, [Define to 1 to enable debug run-time checks.])
fi
AC_ARG_ENABLE([trace],
[AS_HELP_STRING([--enable-trace], [enable function call trace (default=no)])],
[trace="$enableval"], [trace=no])
if test "x$trace" = "xyes"; then
AC_DEFINE([ENABLE_TRACE], 1, [Define to 1 to enable function call trace.])
fi
AC_CONFIG_FILES([
Makefile
src/Makefile
src/base/Makefile
src/memcache/Makefile
tests/Makefile
tests/base/Makefile
tests/unit/Makefile
examples/Makefile
examples/hello_server/Makefile
examples/proxy_server/Makefile])
AC_OUTPUT