forked from accelio/accelio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
361 lines (308 loc) · 12.7 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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
# this is example-file: configure.ac
# initial information about the project
AC_INIT([libxio],[1.0],[[email protected]], [], [http://accelio.org])
# automake initialization (mandatory) and check for minimal automake API version 1.11
AM_INIT_AUTOMAKE([subdir-objects 1.11])
# Checks for language
AC_LANG_C
# Checks for programs
LT_INIT
AC_PROG_LIBTOOL
# check for C compiler and the library compiler
AC_PROG_CC
AM_PROG_CC_C_O
AM_SILENT_RULES([yes])
# use the C compiler for the following checks
AC_LANG([C])
##########################################################################
# rdma compilation support
##########################################################################
# usage: ./configure --enable-rdma=no
#
AC_MSG_CHECKING([whether to build with rdma])
AC_ARG_ENABLE([rdma],
[AS_HELP_STRING([--enable-rdma],
[enable rdma transport - default:yes ])],
[enable_rdma=$enableval],
[enable_rdma=yes])
AC_MSG_RESULT([$enable_rdma])
# Checks for header files.
if test "$enable_rdma" = "yes"; then
AC_CHECK_HEADERS([infiniband/verbs.h rdma/rdma_cma.h],
[mypj_found_verbs_headers=yes; break;])
else
mypj_found_verbs_headers=no
fi
AC_CHECK_HEADERS([numa.h],
[mypj_found_numa_headers=yes; break;])
AC_CHECK_HEADERS([event2/event.h],
[mypj_found_event_headers=yes; break;])
AM_CONDITIONAL(HAVE_INFINIBAND_VERBS, test "x$mypj_found_verbs_headers" = "xyes")
AS_IF([test "x$mypj_found_numa_headers" != "xyes"],
[AC_MSG_ERROR([Unable to find the numactl-devel header files])])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AC_CHECK_LIB(numa, numa_available)
#
# Check for Contiguous Pages support
#
if test "$enable_rdma" = "yes"; then
AC_CHECK_DECLS(IBV_EXP_ACCESS_ALLOCATE_MR,
[AC_DEFINE([HAVE_MPAGES_EXP], 1, [Contiguous pages support, experimental]) havempages="yes"],
[],
[[#include <infiniband/verbs.h>]])
AC_CHECK_DECLS(IBV_DEVICE_MR_ALLOCATE,
[AC_DEFINE([HAVE_MPAGES], 1, [Contiguous pages support]) havempages="yes"],
[],
[[#include <infiniband/verbs.h>]])
AS_IF([test "x$havempages" != "xyes"],
[AC_MSG_WARN([Contiguous pages not supported.])])
fi
##########################################################################
# perf support
##########################################################################
# usage: ./configure --enable-perf=yes
#
AC_MSG_CHECKING([whether to enable profiler perf tool flags])
AC_ARG_ENABLE([perf],
[AS_HELP_STRING([--enable-perf],
[enable perf profiling])],
[enable_perf="$enableval"],
[enable_perf=no])
AC_MSG_RESULT([$enable_perf])
if test "$enable_perf" = "yes"; then
AM_CFLAGS="$AM_CFLAGS -fno-omit-frame-pointer"
fi
##########################################################################
# debug compilation support
##########################################################################
# usage: ./configure --enable-debug=yes
#
AC_MSG_CHECKING([whether to build with debug information])
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],
[enable debug data generation])],
[enable_debug="$enableval"],
[enable_debug=no])
AC_MSG_RESULT([$enable_debug])
if test "$enable_debug" = "yes"; then
AC_DEFINE([DEBUG],[],[Debug Mode])
AM_CFLAGS="$AM_CFLAGS -g -ggdb -Wall -Werror -Wdeclaration-after-statement \
-Wsign-compare -Wc++-compat \
-fno-omit-frame-pointer -O0 -D_REENTRANT -D_GNU_SOURCE"
else
AC_DEFINE([NDEBUG],[],[No-debug Mode])
AM_CFLAGS="$AM_CFLAGS -g -ggdb -Wall -Werror -Wpadded -Wdeclaration-after-statement \
-Wsign-compare -Wc++-compat \
-O3 -D_REENTRANT -D_GNU_SOURCE"
fi
AC_CACHE_CHECK(whether ld accepts --version-script, ac_cv_version_script,
if test -n "`$LD --help < /dev/null 2>/dev/null | grep version-script`"; then
ac_cv_version_script=yes
else
ac_cv_version_script=no
fi)
AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$ac_cv_version_script" = "yes")
##########################################################################
# performance compilation support
##########################################################################
# usage: ./configure --disable-extra-checks=yes
#
AC_MSG_CHECKING([perform extra checks for messages but reduces performance - use carefully])
AC_ARG_ENABLE([extra_checks],
[AS_HELP_STRING([--enable-extra-checks],
[enable extra checks for messages validity - default yes])],
[enable_extra_checks="$enableval"],
[enable_extra_checks=yes])
AC_MSG_RESULT([$enable_extra_checks])
if test "$enable_extra_checks" != "no"; then
AM_CFLAGS="$AM_CFLAGS -DXIO_CFLAG_EXTRA_CHECKS"
fi
##########################################################################
# statistics counters emission support
##########################################################################
# usage: ./configure --enable-stat-counters=yes
#
AC_MSG_CHECKING([enable statistic counters emission via netlink socket])
AC_ARG_ENABLE([stat_counters],
[AS_HELP_STRING([--enable-stat-counters],
[enable statistics counters via netlink - default yes])],
[enable_statistics_counters="$enableval"],
[enable_statistics_counters=yes])
AC_MSG_RESULT([$enable_statistics_counters])
if test "$enable_statistics_counters" != "no"; then
AM_CFLAGS="$AM_CFLAGS -DXIO_CFLAG_STAT_COUNTERS"
fi
##########################################################################
# debug thread safety support
##########################################################################
# usage: ./configure --enable-debug-thread-safety=yes
#
AC_MSG_CHECKING([EXPIRIMENTAL: checks if the application is thread safe when it comes to accelio callbacks and methods])
AC_ARG_ENABLE([debug-thread-safety],
[AS_HELP_STRING([--enable-debug-thread-safety],
[experimental:enable debug thread safety - default no])],
[enable_debug_thread_safety="$enableval"],
[enable_debug_thread_safety=no])
AC_MSG_RESULT([$enable_debug_thread_safety])
if test "$enable_debug_thread_safety" = "yes"; then
AM_CFLAGS="$AM_CFLAGS -DXIO_THREAD_SAFE_DEBUG"
fi
##########################################################################
# raio compilation support
##########################################################################
# usage: ./configure --disable-raio-build
#
AC_MSG_CHECKING([whether to build with raio example library])
AC_ARG_ENABLE([raio_build],
[AS_HELP_STRING([--enable-raio-build],
[enable raio library generation - default:yes ])],
[enable_raio_build=$enableval],
[enable_raio_build=yes])
AC_MSG_RESULT([$enable_raio_build])
if test "$enable_raio_build" != "no"; then
AC_CHECK_HEADERS([libaio.h],
[mypj_found_aio_headers=yes; break;])
AS_IF([test "x$mypj_found_aio_headers" != "xyes"],
[AC_MSG_ERROR([Unable to find the libaio-devel header files])])
fi
##########################################################################
# fio compilation support
##########################################################################
# usage: ./configure --enable-fio-build=yes
#
AC_MSG_CHECKING([whether to build with fio ioengine])
AC_ARG_ENABLE([fio_build],
[AS_HELP_STRING([--enable-fio-build],
[enable fio ioengine generation ])],
[enable_fio_build="$enableval"],
[enable_fio_build=no])
AC_MSG_RESULT([$enable_fio_build])
AM_CONDITIONAL([FIO_ROOT],[test "$FIO_ROOT" != 0])
AC_ARG_VAR([FIO_ROOT],[The root directory of the fio suite])
AC_SUBST([FIO_ROOT])
##########################################################################
AC_MSG_CHECKING([whether to build kernel module])
AC_ARG_ENABLE(kernel-module,
[ --enable-kernel-module Compile kernel module ],
[enable_kernel_module="$enableval"],
[enable_kernel_module=no])
AC_MSG_RESULT([$enable_kernel_module])
if test "$enable_kernel_module" != "no"; then
AC_CONFIG_SUBDIRS([src/kernel/xio])
AC_CONFIG_SUBDIRS([src/kernel/transport/rdma])
AC_CONFIG_SUBDIRS([src/kernel/transport/tcp])
AC_CONFIG_SUBDIRS([examples/kernel/hello_world])
AC_CONFIG_SUBDIRS([examples/kernel/hello_world_mt])
AC_CONFIG_SUBDIRS([tests/kernel/hello_test])
AC_CONFIG_SUBDIRS([tests/kernel/hello_test_lat])
AC_CONFIG_SUBDIRS([tests/kernel/hello_test_ow])
AC_CONFIG_SUBDIRS([tests/kernel/direct_rdma_test])
if test "$enable_raio_build" == "yes"; then
AC_CONFIG_SUBDIRS([examples/raio/kernel/nbdx])
fi
else
subdirs2="src/usr";
subdirs2="$subdirs2 src/tools/usr/";
subdirs2="$subdirs2 examples/usr/hello_world";
subdirs2="$subdirs2 examples/usr/hello_world_mt";
subdirs2="$subdirs2 examples/usr/hello_world_iov";
subdirs2="$subdirs2 examples/usr/hello_world_daemon";
if test "$mypj_found_event_headers" == "yes"; then
subdirs2="$subdirs2 examples/usr/hello_world_libevent";
fi
if test "$enable_raio_build" != "no"; then
subdirs2="$subdirs2 examples/raio";
if test "$enable_fio_build" != "no"; then
subdirs2="$subdirs2 examples/raio/usr/fio";
fi
fi
subdirs2="$subdirs2 tests/usr/common";
subdirs2="$subdirs2 tests/usr/hello_test";
subdirs2="$subdirs2 tests/usr/hello_test_mt";
subdirs2="$subdirs2 tests/usr/hello_test_bidi";
subdirs2="$subdirs2 tests/usr/hello_test_lat";
subdirs2="$subdirs2 tests/usr/hello_test_ow";
subdirs2="$subdirs2 tests/usr/hello_test_oneway";
subdirs2="$subdirs2 tests/usr/event_loop_tests";
if test "$enable_rdma" != "no"; then
subdirs2="$subdirs2 tests/usr/direct_rdma_test";
fi
subdirs2="$subdirs2 benchmarks/usr/xio_perftest";
subdirs2="$subdirs2 regression/usr/reg_basic_mt";
fi
##########################################################################
##########################################################################
# add version.c uses strings to get GIT hash version
##########################################################################
if test -d "${GIT_DIR:-${ac_top_srcdir:-./}/.git}" ; then
GITHEAD=`git describe --tags --long 2>/dev/null`
if test -z ${GITHEAD} ; then
GITHEAD=`git rev-parse HEAD`
fi
if test -n "`git diff-index -m --name-only HEAD`" ; then
GITHEAD=${GITHEAD}-dirty
fi
else
GITHEAD=
fi
echo "const char XIO_GIT_HEAD@<:@@:>@ = \"GIT_VERSION: $GITHEAD\";" \/\* for use with strings \*\/ >version.c
echo "const char XIO_GIT_HEAD_STRING@<:@@:>@ = \"$GITHEAD\";" >>version.c
echo "const char XIO_VERSION_STRING@<:@@:>@ = \"accelio_$GITHEAD\";" >>version.c
AC_MSG_CHECKING([for git head])
AC_MSG_RESULT([$GITHEAD])
AC_DEFINE_UNQUOTED([XIO_GITHEAD], ["$GITHEAD"], [Git commit used to build xio library])
# distribute additional compiler and linker flags
# --> set these variables instead of CFLAGS or LDFLAGS
AC_SUBST([AM_CFLAGS])
AC_SUBST([AM_LDFLAGS])
AC_SUBST([LIBS])
AC_SUBST([subdirs2])
# files to generate via autotools (.am or .in source files)
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([Doxyfile])
AC_CONFIG_FILES([src/usr/Makefile])
AC_CONFIG_FILES([src/tools/usr/Makefile])
AC_CONFIG_FILES([examples/usr/hello_world/Makefile])
AC_CONFIG_FILES([examples/usr/hello_world_mt/Makefile])
AC_CONFIG_FILES([examples/usr/hello_world_iov/Makefile])
AC_CONFIG_FILES([examples/usr/hello_world_daemon/Makefile])
if test "$mypj_found_event_headers" == "yes"; then
AC_CONFIG_FILES([examples/usr/hello_world_libevent/Makefile])
fi
AC_CONFIG_FILES([examples/raio/Makefile])
if test "$enable_fio_build" != "no"; then
AC_CONFIG_FILES([examples/raio/usr/fio/Makefile])
fi
AC_CONFIG_FILES([tests/usr/common/Makefile])
AC_CONFIG_FILES([tests/usr/hello_test/Makefile])
AC_CONFIG_FILES([tests/usr/hello_test_mt/Makefile])
AC_CONFIG_FILES([tests/usr/hello_test_bidi/Makefile])
AC_CONFIG_FILES([tests/usr/hello_test_lat/Makefile])
AC_CONFIG_FILES([tests/usr/hello_test_ow/Makefile])
AC_CONFIG_FILES([tests/usr/hello_test_oneway/Makefile])
AC_CONFIG_FILES([tests/usr/event_loop_tests/Makefile])
AC_CONFIG_FILES([tests/usr/direct_rdma_test/Makefile])
AC_CONFIG_FILES([benchmarks/usr/xio_perftest/Makefile])
AC_CONFIG_FILES([regression/usr/reg_basic_mt/Makefile])
# generate the final Makefile etc.
AC_OUTPUT
# print warning if tests are enabled but gccxml not found
if test "$enable_fio_build" = "yes"; then
if (! test "$FIO_ROOT") ; then
AC_MSG_WARN([
*********************************************************************************
!!!! There is a problem with the current configuration environment !!!!
To run the tests of this package, the following variable(s) need to be defined :
FIO_ROOT : The root directory of the fio package
installation: git clone git://git.kernel.dk/fio.git. run make for
build
tested version: fio-2.1.1
The variables can be defined as environment variables (eg. with bash "export") or
passed to the configure command (e.g. ./configure FIO_ROOT=/opt/fio/ ).
The variables should point to the directory which contain
/engines,/examples,etcsubdirs.
*********************************************************************************
])
fi
fi