-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathconfigure.ac
247 lines (203 loc) · 6.28 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
AC_PREREQ(2.59)
AC_INIT(micbench, 0.2.0, [email protected])
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_HEADER([src/config.h])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE($PACKAGE_NAME, $PACKAGE_VERSION)
AC_PROG_LIBTOOL
AC_CONFIG_FILES([Makefile
src/Makefile
test/Makefile
test/lib/Makefile
test/fixtures/Makefile])
dnl ******************************
dnl Check for CPU arch.
dnl ******************************
AC_PATH_PROG(UNAME, uname, none)
if test "$UNAME" = "none"; then
AC_MSG_ERROR([uname(1) is required to detect CPU arch.])
fi
case $(uname -m) in
x86_64)
ac_arch=x86_64
;;
amd64)
ac_arch=x86_64
;;
i?86)
ac_arch=x86
;;
*)
ac_arch=none
esac
if test "$ac_arch" = "none"; then
AC_MSG_ERROR([Arch. not supported: $ac_arch])
fi
AC_CHECK_FILE([/sys/devices/system/node], [numa_arch=yes], [numa_arch=no])
if test "$numa_arch" = "yes"; then
AC_DEFINE([NUMA_ARCH], [1], [Define to 1 if CPUs are numa architecture.])
fi
AM_CONDITIONAL([WITH_X86_64], [test "$ac_arch" = "x86_64"])
AM_CONDITIONAL([WITH_X86], [test "$ac_arch" = "x86"])
dnl ******************************
dnl Check for standard headers
dnl ******************************
AC_HEADER_STDC
AC_HEADER_STDBOOL
AC_HEADER_TIME
AC_CHECK_HEADER(inttypes.h, [], [AC_MSG_ERROR([inttypes.h required.])])
AC_CHECK_HEADER(getopt.h, [], [AC_MSG_ERROR([getopt.h required.])])
dnl ******************************
dnl Check for standard programs
dnl ******************************
dnl AC_PROG_GREP
dnl ******************************
dnl Check for ruby
dnl ******************************
AC_ARG_WITH([ruby],
AS_HELP_STRING([--with-ruby=PATH],
[Ruby interpreter path (default: auto-detect)]),
[RUBY="$withval"])
AC_PATH_PROG(RUBY, ruby, none)
if test "$RUBY" = "none"; then
AC_MSG_ERROR([Ruby is required.])
fi
dnl ******************************
dnl Check for libnuma
dnl ******************************
if test "$numa_arch" = "yes"; then
AC_CHECK_HEADERS(numa.h, [have_numa_h=yes], [have_numa_h=no])
AC_CHECK_HEADERS(numaif.h, [have_numaif_h=yes], [have_numaif_h=no])
AC_CHECK_LIB(numa, numa_available, [have_libnuma=yes], [have_libnuma=no])
if ! test "$have_numaif_h" = "yes"; then
AC_MSG_ERROR([numaif.h is required.])
fi
if ! test "$have_numa_h" = "yes"; then
AC_MSG_ERROR([numa.h is required.])
fi
if test "$have_libnuma" = "yes"; then
LIBS="$LIBS -lnuma"
fi
fi
dnl ******************************
dnl Check for numactl
dnl ******************************
if test "$numa_arch" = "yes"; then
AC_PATH_PROG(NUMACTL, numactl, none)
if test "$NUMACTL" = "none"; then
AC_MSG_ERROR([numactl is required.])
fi
fi
dnl ******************************
dnl Check for libaio
dnl ******************************
AC_CHECK_HEADERS(libaio.h, [have_libaio_h=yes], [have_libaio_h=no])
AC_CHECK_LIB(aio, io_submit, [have_libaio=yes], [have_libaio=no])
if ! test "$have_libaio" = "yes"; then
AC_MSG_ERROR([libaio is required.])
fi
if ! test "$have_libaio_h" = "yes"; then
AC_MSG_ERROR([libaio.h is required.])
fi
if test "$have_libaio" = "yes"; then
LIBS="$LIBS -laio"
fi
dnl ******************************
dnl Check for io_uring/liburing
dnl ******************************
AC_CHECK_HEADERS(linux/io_uring.h, [have_io_uring_h=yes], [have_io_uring_h=no])
AC_CHECK_HEADERS(liburing.h, [have_liburing_h=yes], [have_liburing_h=no])
if test "$have_io_uring_h" = "yes"; then
if test "$have_liburing_h" = "yes"; then
io_uring_available="yes"
LIBS="$LIBS -luring"
AC_DEFINE([HAVE_IO_URING], [1], [Define to 1 if io_uring is available])
else
io_uring_available="no"
fi
else
io_uring_available="no"
fi
dnl ******************************
dnl Check for numactl
dnl ******************************
AC_PATH_PROG(BLKTRACE, blktrace, none)
AC_PATH_PROG(BLKPARSE, blkparse, none)
if test "$BLKTRACE" != "none" && test "$BLKPARSE" != "none"; then
AC_DEFINE([HAVE_BLKTRACE], [1], [Define to 1 if blktrace command is available])
fi
AM_CONDITIONAL([WITH_BLKTRACE], [test "$BLKTRACE" != "none"])
dnl ******************************
dnl Check for OProfile
dnl ******************************
AC_PATH_PROG(OPCONTROL, opcontrol, none)
dnl find kernel image with debug info
VMLINUX=none
if lsb_release --id|grep "\(Ubuntu\|Debian\)"; then
AC_CHECK_FILE(/usr/lib/debug/boot/vmlinux-$(uname -r),
[have_vmlinux=yes],
[have_vmlinux=no])
if test "$have_vmlinux" = "yes"; then
VMLINUX="/usr/lib/debug/boot/vmlinux-$(uname -r)"
fi
fi
dnl **************************************************************
dnl Check for Cutter
dnl **************************************************************
m4_ifdef([AC_CHECK_CUTTER],
[AC_CHECK_CUTTER],
[ac_cv_use_cutter="no"])
m4_ifdef([AC_CHECK_GCUTTER],
[AC_CHECK_GCUTTER],
[ac_cv_use_gcutter="no"])
if test "$ac_cv_use_cutter" != "no" && test "$ac_cv_use_gcutter" != "no"; then
have_cutter="yes"
else
have_cutter="no"
fi
AM_CONDITIONAL([WITH_CUTTER], [test "$have_cutter" = "yes"])
if test "$have_cutter" = "yes"; then
AC_DEFINE(WITH_CUTTER, 1, [Define to 1 if you use Cutter])
fi
dnl **************************************************************
dnl Check for GLib
dnl **************************************************************
PKG_CHECK_MODULES([GLIB],
[glib-2.0 gthread-2.0],
[ac_glib_2_0_available="yes"],
[ac_glib_2_0_available="no"])
if test "$ac_cv_use_cutter" != "no"; then
if test "$ac_glib_2_0_available" = "no"; then
AC_MSG_ERROR([GLib is required for testing with Cutter.])
fi
fi
AM_CONDITIONAL([WITH_GLIB], [test "$ac_glib_2_0_available" = "yes"])
AC_OUTPUT
echo
echo "Configure Result:"
echo
echo " CPU arch: $ac_arch"
echo
echo "== required headers and libraries =="
if test "$numa_arch" = "yes"; then
echo " numa.h : $have_numa_h"
echo " libnuma : $have_libnuma"
fi
echo " libaio.h : $have_libaio_h"
echo " libaio : $have_libaio"
echo
echo "== required commands =="
echo " Ruby : $RUBY"
if test "$numa_arch" = "yes"; then
echo " numactl : $NUMACTL"
fi
echo
echo "== optional =="
echo " io_uring : $io_uring_available"
echo " blktrace : $BLKTRACE"
echo " blkparse : $BLKPARSE"
echo " OProfile : $OPCONTROL"
echo " vmlinux : $VMLINUX"
echo " Cutter : $CUTTER"
echo " GLib : $ac_glib_2_0_available"
echo