Commit | Line | Data |
---|---|---|
67bf9823 JA |
1 | #!/bin/sh |
2 | # | |
3 | # Fio configure script. Heavily influenced by the manual qemu configure | |
4 | # script. Sad this this is easier than autoconf and enemies. | |
5 | # | |
6 | ||
7 | # set temporary file name | |
8 | if test ! -z "$TMPDIR" ; then | |
9 | TMPDIR1="${TMPDIR}" | |
10 | elif test ! -z "$TEMPDIR" ; then | |
11 | TMPDIR1="${TEMPDIR}" | |
12 | else | |
13 | TMPDIR1="/tmp" | |
14 | fi | |
15 | ||
16 | TMPC="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.c" | |
17 | TMPO="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.o" | |
18 | TMPE="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.exe" | |
19 | ||
20 | # NB: do not call "exit" in the trap handler; this is buggy with some shells; | |
21 | # see <1285349658-3122-1-git-send-email-loic.minier@linaro.org> | |
22 | trap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM | |
23 | ||
24 | rm -rf config.log | |
25 | ||
26 | config_host_mak="config-host.mak" | |
4feafb1e JA |
27 | config_host_h="config-host.h" |
28 | ||
29 | rm -rf $config_host_mak | |
30 | rm -rf $config_host_h | |
67bf9823 | 31 | |
d7145a78 JA |
32 | fatal() { |
33 | echo $@ | |
34 | echo "Configure failed, check config.log and/or the above output" | |
35 | rm -rf $config_host_mak | |
36 | rm -rf $config_host_h | |
37 | exit 1 | |
38 | } | |
39 | ||
44404c5a | 40 | # Default CFLAGS |
af4862b3 JA |
41 | CFLAGS="-D_GNU_SOURCE -include config-host.h" |
42 | BUILD_CFLAGS="" | |
67bf9823 JA |
43 | |
44 | # Print a helpful header at the top of config.log | |
45 | echo "# FIO configure log $(date)" >> config.log | |
46 | printf "# Configured with:" >> config.log | |
47 | printf " '%s'" "$0" "$@" >> config.log | |
48 | echo >> config.log | |
49 | echo "#" >> config.log | |
50 | ||
7560fe7c JA |
51 | # Print configure header at the top of $config_host_h |
52 | echo "/*" > $config_host_h | |
53 | echo " * Automatically generated by configure - do not modify" >> $config_host_h | |
54 | printf " * Configured with:" >> $config_host_h | |
55 | printf " * '%s'" "$0" "$@" >> $config_host_h | |
56 | echo "" >> $config_host_h | |
57 | echo " */" >> $config_host_h | |
58 | ||
67bf9823 JA |
59 | do_cc() { |
60 | # Run the compiler, capturing its output to the log. | |
61 | echo $cc "$@" >> config.log | |
62 | $cc "$@" >> config.log 2>&1 || return $? | |
63 | # Test passed. If this is an --enable-werror build, rerun | |
64 | # the test with -Werror and bail out if it fails. This | |
65 | # makes warning-generating-errors in configure test code | |
66 | # obvious to developers. | |
67 | if test "$werror" != "yes"; then | |
68 | return 0 | |
69 | fi | |
70 | # Don't bother rerunning the compile if we were already using -Werror | |
71 | case "$*" in | |
72 | *-Werror*) | |
73 | return 0 | |
74 | ;; | |
75 | esac | |
76 | echo $cc -Werror "$@" >> config.log | |
77 | $cc -Werror "$@" >> config.log 2>&1 && return $? | |
78 | echo "ERROR: configure test passed without -Werror but failed with -Werror." | |
79 | echo "This is probably a bug in the configure script. The failing command" | |
80 | echo "will be at the bottom of config.log." | |
d7145a78 | 81 | fatal "You can run configure with --disable-werror to bypass this check." |
67bf9823 JA |
82 | } |
83 | ||
84 | compile_object() { | |
85 | do_cc $CFLAGS -c -o $TMPO $TMPC | |
86 | } | |
87 | ||
88 | compile_prog() { | |
89 | local_cflags="$1" | |
adaa46d8 | 90 | local_ldflags="$2 $LIBS" |
67bf9823 JA |
91 | echo "Compiling test case $3" >> config.log |
92 | do_cc $CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags | |
93 | } | |
94 | ||
95 | feature_not_found() { | |
96 | feature=$1 | |
c55d728b | 97 | packages=$2 |
67bf9823 JA |
98 | |
99 | echo "ERROR" | |
100 | echo "ERROR: User requested feature $feature" | |
c55d728b JA |
101 | if test ! -z "$packages" ; then |
102 | echo "ERROR: That feature needs $packages installed" | |
103 | fi | |
67bf9823 | 104 | echo "ERROR: configure was not able to find it" |
d7145a78 | 105 | fatal "ERROR" |
67bf9823 JA |
106 | } |
107 | ||
108 | has() { | |
109 | type "$1" >/dev/null 2>&1 | |
110 | } | |
111 | ||
112 | check_define() { | |
113 | cat > $TMPC <<EOF | |
114 | #if !defined($1) | |
115 | #error $1 not defined | |
116 | #endif | |
117 | int main(void) | |
118 | { | |
119 | return 0; | |
120 | } | |
121 | EOF | |
122 | compile_object | |
123 | } | |
124 | ||
4feafb1e JA |
125 | output_sym() { |
126 | echo "$1=y" >> $config_host_mak | |
127 | echo "#define $1" >> $config_host_h | |
128 | } | |
129 | ||
67bf9823 JA |
130 | targetos="" |
131 | cpu="" | |
132 | ||
91f94d5b | 133 | # default options |
47f44635 JA |
134 | show_help="no" |
135 | exit_val=0 | |
ebec2094 | 136 | gfio_check="no" |
1b10477b | 137 | libhdfs="no" |
020d54bd | 138 | prefix=/usr/local |
91f94d5b | 139 | |
cb1125b0 JA |
140 | # parse options |
141 | for opt do | |
142 | optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` | |
143 | case "$opt" in | |
020d54bd JA |
144 | --prefix=*) prefix="$optarg" |
145 | ;; | |
8b156d8e JA |
146 | --cpu=*) cpu="$optarg" |
147 | ;; | |
c8931876 JA |
148 | # esx is cross compiled and cannot be detect through simple uname calls |
149 | --esx) | |
150 | esx="yes" | |
151 | ;; | |
cb1125b0 JA |
152 | --cc=*) CC="$optarg" |
153 | ;; | |
208e4c8b JA |
154 | --extra-cflags=*) CFLAGS="$CFLAGS $optarg" |
155 | ;; | |
b7c12794 | 156 | --build-32bit-win) build_32bit_win="yes" |
7409711b | 157 | ;; |
d2aeedb9 JA |
158 | --build-static) build_static="yes" |
159 | ;; | |
91f94d5b | 160 | --enable-gfio) |
ebec2094 | 161 | gfio_check="yes" |
899fab33 | 162 | ;; |
44462517 CF |
163 | --disable-numa) disable_numa="yes" |
164 | ;; | |
ce18290e TM |
165 | --disable-rbd) disable_rbd="yes" |
166 | ;; | |
167 | --disable-gfapi) disable_gfapi="yes" | |
168 | ;; | |
1b10477b MM |
169 | --enable-libhdfs) libhdfs="yes" |
170 | ;; | |
ba40757e JA |
171 | --disable-shm) output_sym "CONFIG_NO_SHM" |
172 | ;; | |
827da4f5 | 173 | --help) |
47f44635 | 174 | show_help="yes" |
827da4f5 | 175 | ;; |
cb1125b0 JA |
176 | *) |
177 | echo "Bad option $opt" | |
47f44635 JA |
178 | show_help="yes" |
179 | exit_val=1 | |
cb1125b0 JA |
180 | esac |
181 | done | |
182 | ||
47f44635 | 183 | if test "$show_help" = "yes" ; then |
020d54bd | 184 | echo "--prefix= Use this directory as installation prefix" |
8b156d8e | 185 | echo "--cpu= Specify target CPU if auto-detect fails" |
b7a99316 | 186 | echo "--cc= Specify compiler to use" |
899fab33 | 187 | echo "--extra-cflags= Specify extra CFLAGS to pass to compiler" |
b7c12794 | 188 | echo "--build-32bit-win Enable 32-bit build on Windows" |
d2aeedb9 | 189 | echo "--build-static Build a static fio" |
c8931876 | 190 | echo "--esx Configure build options for esx" |
b7a99316 | 191 | echo "--enable-gfio Enable building of gtk gfio" |
44462517 | 192 | echo "--disable-numa Disable libnuma even if found" |
1b10477b | 193 | echo "--enable-libhdfs Enable hdfs support" |
b7a99316 | 194 | exit $exit_val |
47f44635 JA |
195 | fi |
196 | ||
47986339 SH |
197 | cross_prefix=${cross_prefix-${CROSS_COMPILE}} |
198 | cc="${CC-${cross_prefix}gcc}" | |
199 | ||
6d0e9f83 AC |
200 | if check_define __ANDROID__ ; then |
201 | targetos="Android" | |
202 | elif check_define __linux__ ; then | |
67bf9823 | 203 | targetos="Linux" |
67bf9823 JA |
204 | elif check_define __OpenBSD__ ; then |
205 | targetos='OpenBSD' | |
206 | elif check_define __sun__ ; then | |
207 | targetos='SunOS' | |
7cb024f8 | 208 | CFLAGS="$CFLAGS -D_REENTRANT" |
b24f59ab SH |
209 | elif check_define _WIN32 ; then |
210 | targetos='CYGWIN' | |
67bf9823 JA |
211 | else |
212 | targetos=`uname -s` | |
213 | fi | |
214 | ||
53cd4eee AC |
215 | echo "# Automatically generated by configure - do not modify" > $config_host_mak |
216 | printf "# Configured with:" >> $config_host_mak | |
217 | printf " '%s'" "$0" "$@" >> $config_host_mak | |
218 | echo >> $config_host_mak | |
219 | echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak | |
220 | ||
67bf9823 JA |
221 | # Some host OSes need non-standard checks for which CPU to use. |
222 | # Note that these checks are broken for cross-compilation: if you're | |
223 | # cross-compiling to one of these OSes then you'll need to specify | |
224 | # the correct CPU with the --cpu option. | |
225 | case $targetos in | |
226 | Darwin) | |
227 | # on Leopard most of the system is 32-bit, so we have to ask the kernel if | |
228 | # we can run 64-bit userspace code. | |
229 | # If the user didn't specify a CPU explicitly and the kernel says this is | |
230 | # 64 bit hw, then assume x86_64. Otherwise fall through to the usual | |
231 | # detection code. | |
232 | if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then | |
233 | cpu="x86_64" | |
234 | fi | |
235 | ;; | |
236 | SunOS) | |
237 | # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo | |
238 | if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then | |
239 | cpu="x86_64" | |
240 | fi | |
adaa46d8 | 241 | LIBS="-lnsl -lsocket" |
cfd94f79 JA |
242 | ;; |
243 | CYGWIN*) | |
244 | echo "Forcing known good options on Windows" | |
4578d01f | 245 | if test -z "$CC" ; then |
7409711b HL |
246 | if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then |
247 | CC="i686-w64-mingw32-gcc" | |
248 | else | |
249 | CC="x86_64-w64-mingw32-gcc" | |
250 | fi | |
4578d01f | 251 | fi |
4feafb1e | 252 | output_sym "CONFIG_LITTLE_ENDIAN" |
7409711b HL |
253 | if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then |
254 | output_sym "CONFIG_32BIT" | |
255 | else | |
256 | output_sym "CONFIG_64BIT_LLP64" | |
257 | fi | |
4feafb1e JA |
258 | output_sym "CONFIG_FADVISE" |
259 | output_sym "CONFIG_SOCKLEN_T" | |
4feafb1e JA |
260 | output_sym "CONFIG_FADVISE" |
261 | output_sym "CONFIG_SFAA" | |
262 | output_sym "CONFIG_RUSAGE_THREAD" | |
263 | output_sym "CONFIG_WINDOWSAIO" | |
264 | output_sym "CONFIG_FDATASYNC" | |
59308a64 | 265 | output_sym "CONFIG_CLOCK_MONOTONIC" |
dc0518ca BC |
266 | output_sym "CONFIG_GETTIMEOFDAY" |
267 | output_sym "CONFIG_CLOCK_GETTIME" | |
7e09a9f1 | 268 | output_sym "CONFIG_SCHED_IDLE" |
1eafa37a | 269 | output_sym "CONFIG_TCP_NODELAY" |
7d6be13a | 270 | output_sym "CONFIG_TLS_THREAD" |
ef07baa1 | 271 | output_sym "CONFIG_IPV6" |
4feafb1e | 272 | echo "CC=$CC" >> $config_host_mak |
af4862b3 | 273 | echo "BUILD_CFLAGS=$CFLAGS -include config-host.h -D_GNU_SOURCE" >> $config_host_mak |
cfd94f79 | 274 | exit 0 |
6d0e9f83 | 275 | ;; |
67bf9823 JA |
276 | esac |
277 | ||
278 | if test ! -z "$cpu" ; then | |
279 | # command line argument | |
280 | : | |
281 | elif check_define __i386__ ; then | |
282 | cpu="i386" | |
283 | elif check_define __x86_64__ ; then | |
284 | cpu="x86_64" | |
285 | elif check_define __sparc__ ; then | |
286 | if check_define __arch64__ ; then | |
287 | cpu="sparc64" | |
288 | else | |
289 | cpu="sparc" | |
290 | fi | |
291 | elif check_define _ARCH_PPC ; then | |
292 | if check_define _ARCH_PPC64 ; then | |
293 | cpu="ppc64" | |
294 | else | |
295 | cpu="ppc" | |
296 | fi | |
297 | elif check_define __mips__ ; then | |
298 | cpu="mips" | |
299 | elif check_define __ia64__ ; then | |
300 | cpu="ia64" | |
301 | elif check_define __s390__ ; then | |
302 | if check_define __s390x__ ; then | |
303 | cpu="s390x" | |
304 | else | |
305 | cpu="s390" | |
306 | fi | |
307 | elif check_define __arm__ ; then | |
308 | cpu="arm" | |
309 | elif check_define __hppa__ ; then | |
310 | cpu="hppa" | |
311 | else | |
312 | cpu=`uname -m` | |
313 | fi | |
314 | ||
315 | # Normalise host CPU name and set ARCH. | |
316 | case "$cpu" in | |
317 | ia64|ppc|ppc64|s390|s390x|sparc64) | |
318 | cpu="$cpu" | |
319 | ;; | |
320 | i386|i486|i586|i686|i86pc|BePC) | |
321 | cpu="i386" | |
322 | ;; | |
323 | x86_64|amd64) | |
324 | cpu="x86_64" | |
325 | ;; | |
326 | armv*b|armv*l|arm) | |
327 | cpu="arm" | |
328 | ;; | |
329 | hppa|parisc|parisc64) | |
330 | cpu="hppa" | |
331 | ;; | |
332 | mips*) | |
333 | cpu="mips" | |
334 | ;; | |
335 | sparc|sun4[cdmuv]) | |
336 | cpu="sparc" | |
337 | ;; | |
338 | *) | |
8b156d8e | 339 | echo "Unknown CPU" |
67bf9823 JA |
340 | ;; |
341 | esac | |
342 | ||
dcbbf5b0 | 343 | if test -z "$CC" ; then |
67bf9823 JA |
344 | if test "$targetos" = "FreeBSD"; then |
345 | if has clang; then | |
346 | CC=clang | |
347 | else | |
348 | CC=gcc | |
349 | fi | |
67bf9823 JA |
350 | fi |
351 | fi | |
352 | ||
353 | cc="${CC-${cross_prefix}gcc}" | |
354 | ||
1a17cfdb AC |
355 | ########################################## |
356 | # check cross compile | |
357 | ||
358 | cross_compile="no" | |
359 | cat > $TMPC <<EOF | |
360 | int main(void) | |
361 | { | |
362 | return 0; | |
363 | } | |
364 | EOF | |
365 | if compile_prog "" "" "cross"; then | |
366 | $TMPE 2>/dev/null || cross_compile="yes" | |
367 | else | |
368 | fatal "compile test failed" | |
369 | fi | |
370 | ||
0dcebdf4 JA |
371 | ########################################## |
372 | # check endianness | |
373 | bigendian="no" | |
1a17cfdb AC |
374 | if test "$cross_compile" = "no" ; then |
375 | cat > $TMPC <<EOF | |
0dcebdf4 JA |
376 | #include <inttypes.h> |
377 | int main(void) | |
378 | { | |
379 | volatile uint32_t i=0x01234567; | |
380 | return (*((uint8_t*)(&i))) == 0x67; | |
381 | } | |
382 | EOF | |
1a17cfdb AC |
383 | if compile_prog "" "" "endian"; then |
384 | $TMPE && bigendian="yes" | |
385 | fi | |
386 | else | |
387 | # If we're cross compiling, try our best to work it out and rely on the | |
388 | # run-time check to fail if we get it wrong. | |
389 | cat > $TMPC <<EOF | |
390 | #include <endian.h> | |
391 | int main(void) | |
392 | { | |
393 | #if __BYTE_ORDER != __BIG_ENDIAN | |
394 | # error "Unknown endianness" | |
395 | #endif | |
396 | } | |
397 | EOF | |
398 | compile_prog "" "" "endian" && bigendian="yes" | |
399 | check_define "__ARMEB__" && bigendian="yes" | |
400 | check_define "__MIPSEB__" && bigendian="yes" | |
0dcebdf4 JA |
401 | fi |
402 | ||
403 | ||
67bf9823 JA |
404 | echo "Operating system $targetos" |
405 | echo "CPU $cpu" | |
0dcebdf4 | 406 | echo "Big endian $bigendian" |
67bf9823 | 407 | echo "Compiler $cc" |
1a17cfdb | 408 | echo "Cross compile $cross_compile" |
67bf9823 JA |
409 | echo |
410 | ||
d2aeedb9 JA |
411 | ########################################## |
412 | # See if we need to build a static build | |
413 | if test "$build_static" = "yes" ; then | |
414 | CFLAGS="$CFLAGS -ffunction-sections -fdata-sections" | |
415 | LDFLAGS="$LDFLAGS -static -Wl,--gc-sections" | |
416 | else | |
417 | build_static="no" | |
418 | fi | |
419 | echo "Static build $build_static" | |
420 | ||
67bf9823 JA |
421 | ########################################## |
422 | # check for wordsize | |
423 | wordsize="0" | |
424 | cat > $TMPC <<EOF | |
142429e5 AC |
425 | #include <limits.h> |
426 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) | |
67bf9823 JA |
427 | int main(void) |
428 | { | |
142429e5 | 429 | BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE); |
67bf9823 JA |
430 | return 0; |
431 | } | |
432 | EOF | |
142429e5 AC |
433 | if compile_prog "-DWORDSIZE=32" "" "wordsize"; then |
434 | wordsize="32" | |
435 | elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then | |
436 | wordsize="64" | |
437 | else | |
438 | fatal "Unknown wordsize" | |
67bf9823 JA |
439 | fi |
440 | echo "Wordsize $wordsize" | |
441 | ||
a9bca4aa JA |
442 | ########################################## |
443 | # zlib probe | |
444 | zlib="no" | |
445 | cat > $TMPC <<EOF | |
e0186b6f | 446 | #include <zlib.h> |
a9bca4aa JA |
447 | int main(void) |
448 | { | |
449 | z_stream stream; | |
450 | if (inflateInit(&stream) != Z_OK) | |
451 | return 1; | |
452 | return 0; | |
453 | } | |
454 | EOF | |
455 | if compile_prog "" "-lz" "zlib" ; then | |
456 | zlib=yes | |
457 | LIBS="-lz $LIBS" | |
a9bca4aa JA |
458 | fi |
459 | echo "zlib $zlib" | |
460 | ||
67bf9823 JA |
461 | ########################################## |
462 | # linux-aio probe | |
463 | libaio="no" | |
464 | cat > $TMPC <<EOF | |
465 | #include <libaio.h> | |
466 | #include <stddef.h> | |
467 | int main(void) | |
468 | { | |
469 | io_setup(0, NULL); | |
470 | return 0; | |
471 | } | |
472 | EOF | |
473 | if compile_prog "" "-laio" "libaio" ; then | |
474 | libaio=yes | |
475 | LIBS="-laio $LIBS" | |
476 | else | |
477 | if test "$libaio" = "yes" ; then | |
c55d728b | 478 | feature_not_found "linux AIO" "libaio-dev or libaio-devel" |
67bf9823 JA |
479 | fi |
480 | libaio=no | |
481 | fi | |
482 | echo "Linux AIO support $libaio" | |
483 | ||
484 | ########################################## | |
485 | # posix aio probe | |
486 | posix_aio="no" | |
487 | posix_aio_lrt="no" | |
488 | cat > $TMPC <<EOF | |
489 | #include <aio.h> | |
490 | int main(void) | |
491 | { | |
492 | struct aiocb cb; | |
493 | aio_read(&cb); | |
494 | return 0; | |
495 | } | |
496 | EOF | |
497 | if compile_prog "" "" "posixaio" ; then | |
498 | posix_aio="yes" | |
499 | elif compile_prog "" "-lrt" "posixaio"; then | |
500 | posix_aio="yes" | |
501 | posix_aio_lrt="yes" | |
502 | LIBS="-lrt $LIBS" | |
503 | fi | |
504 | echo "POSIX AIO support $posix_aio" | |
505 | echo "POSIX AIO support needs -lrt $posix_aio_lrt" | |
506 | ||
507 | ########################################## | |
508 | # posix aio fsync probe | |
509 | posix_aio_fsync="no" | |
510 | if test "$posix_aio" = "yes" ; then | |
511 | cat > $TMPC <<EOF | |
512 | #include <fcntl.h> | |
513 | #include <aio.h> | |
514 | int main(void) | |
515 | { | |
516 | struct aiocb cb; | |
517 | return aio_fsync(O_SYNC, &cb); | |
518 | return 0; | |
519 | } | |
520 | EOF | |
521 | if compile_prog "" "$LIBS" "posix_aio_fsync" ; then | |
522 | posix_aio_fsync=yes | |
523 | fi | |
524 | fi | |
525 | echo "POSIX AIO fsync $posix_aio_fsync" | |
526 | ||
527 | ########################################## | |
528 | # solaris aio probe | |
529 | solaris_aio="no" | |
530 | cat > $TMPC <<EOF | |
531 | #include <sys/types.h> | |
532 | #include <sys/asynch.h> | |
533 | #include <unistd.h> | |
534 | int main(void) | |
535 | { | |
536 | aio_result_t res; | |
537 | return aioread(0, NULL, 0, 0, SEEK_SET, &res); | |
538 | return 0; | |
539 | } | |
540 | EOF | |
541 | if compile_prog "" "-laio" "solarisaio" ; then | |
542 | solaris_aio=yes | |
543 | LIBS="-laio $LIBS" | |
544 | fi | |
545 | echo "Solaris AIO support $solaris_aio" | |
546 | ||
547 | ########################################## | |
548 | # __sync_fetch_and_and test | |
549 | sfaa="no" | |
550 | cat > $TMPC << EOF | |
551 | static int sfaa(int *ptr) | |
552 | { | |
9c639a76 | 553 | return __sync_fetch_and_add(ptr, 0); |
67bf9823 JA |
554 | } |
555 | ||
556 | int main(int argc, char **argv) | |
557 | { | |
558 | int val = 42; | |
559 | sfaa(&val); | |
560 | return val; | |
561 | } | |
562 | EOF | |
563 | if compile_prog "" "" "__sync_fetch_and_add()" ; then | |
564 | sfaa="yes" | |
565 | fi | |
9c639a76 | 566 | echo "__sync_fetch_and_add $sfaa" |
67bf9823 JA |
567 | |
568 | ########################################## | |
569 | # libverbs probe | |
570 | libverbs="no" | |
571 | cat > $TMPC << EOF | |
572 | #include <stdio.h> | |
573 | #include <infiniband/arch.h> | |
574 | int main(int argc, char **argv) | |
575 | { | |
576 | struct ibv_pd *pd = ibv_alloc_pd(NULL); | |
577 | return 0; | |
578 | } | |
579 | EOF | |
580 | if compile_prog "" "-libverbs" "libverbs" ; then | |
581 | libverbs="yes" | |
582 | LIBS="-libverbs $LIBS" | |
583 | fi | |
584 | echo "libverbs $libverbs" | |
585 | ||
586 | ########################################## | |
587 | # rdmacm probe | |
588 | rdmacm="no" | |
589 | cat > $TMPC << EOF | |
590 | #include <stdio.h> | |
591 | #include <rdma/rdma_cma.h> | |
592 | int main(int argc, char **argv) | |
593 | { | |
594 | rdma_destroy_qp(NULL); | |
595 | return 0; | |
596 | } | |
597 | EOF | |
598 | if compile_prog "" "-lrdmacm" "rdma"; then | |
599 | rdmacm="yes" | |
600 | LIBS="-lrdmacm $LIBS" | |
601 | fi | |
602 | echo "rdmacm $rdmacm" | |
603 | ||
604 | ########################################## | |
605 | # Linux fallocate probe | |
606 | linux_fallocate="no" | |
607 | cat > $TMPC << EOF | |
608 | #include <stdio.h> | |
aa6738a5 | 609 | #include <fcntl.h> |
67bf9823 JA |
610 | #include <linux/falloc.h> |
611 | int main(int argc, char **argv) | |
612 | { | |
613 | int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024); | |
614 | return r; | |
615 | } | |
616 | EOF | |
617 | if compile_prog "" "" "linux_fallocate"; then | |
618 | linux_fallocate="yes" | |
619 | fi | |
620 | echo "Linux fallocate $linux_fallocate" | |
621 | ||
622 | ########################################## | |
623 | # POSIX fadvise probe | |
624 | posix_fadvise="no" | |
625 | cat > $TMPC << EOF | |
626 | #include <stdio.h> | |
627 | #include <fcntl.h> | |
628 | int main(int argc, char **argv) | |
629 | { | |
630 | int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL); | |
631 | return r; | |
632 | } | |
633 | EOF | |
634 | if compile_prog "" "" "posix_fadvise"; then | |
635 | posix_fadvise="yes" | |
636 | fi | |
637 | echo "POSIX fadvise $posix_fadvise" | |
638 | ||
639 | ########################################## | |
640 | # POSIX fallocate probe | |
641 | posix_fallocate="no" | |
642 | cat > $TMPC << EOF | |
643 | #include <stdio.h> | |
644 | #include <fcntl.h> | |
645 | int main(int argc, char **argv) | |
646 | { | |
647 | int r = posix_fallocate(0, 0, 1024); | |
648 | return r; | |
649 | } | |
650 | EOF | |
651 | if compile_prog "" "" "posix_fallocate"; then | |
652 | posix_fallocate="yes" | |
653 | fi | |
654 | echo "POSIX fallocate $posix_fallocate" | |
655 | ||
656 | ########################################## | |
657 | # sched_set/getaffinity 2 or 3 argument test | |
658 | linux_2arg_affinity="no" | |
659 | linux_3arg_affinity="no" | |
660 | cat > $TMPC << EOF | |
67bf9823 JA |
661 | #include <sched.h> |
662 | int main(int argc, char **argv) | |
663 | { | |
664 | cpu_set_t mask; | |
665 | return sched_setaffinity(0, sizeof(mask), &mask); | |
666 | } | |
667 | EOF | |
668 | if compile_prog "" "" "sched_setaffinity(,,)"; then | |
669 | linux_3arg_affinity="yes" | |
670 | else | |
671 | cat > $TMPC << EOF | |
67bf9823 JA |
672 | #include <sched.h> |
673 | int main(int argc, char **argv) | |
674 | { | |
675 | cpu_set_t mask; | |
676 | return sched_setaffinity(0, &mask); | |
677 | } | |
678 | EOF | |
679 | if compile_prog "" "" "sched_setaffinity(,)"; then | |
680 | linux_2arg_affinity="yes" | |
681 | fi | |
682 | fi | |
683 | echo "sched_setaffinity(3 arg) $linux_3arg_affinity" | |
684 | echo "sched_setaffinity(2 arg) $linux_2arg_affinity" | |
685 | ||
686 | ########################################## | |
687 | # clock_gettime probe | |
688 | clock_gettime="no" | |
689 | cat > $TMPC << EOF | |
690 | #include <stdio.h> | |
691 | #include <time.h> | |
692 | int main(int argc, char **argv) | |
693 | { | |
694 | return clock_gettime(0, NULL); | |
695 | } | |
696 | EOF | |
697 | if compile_prog "" "" "clock_gettime"; then | |
698 | clock_gettime="yes" | |
699 | elif compile_prog "" "-lrt" "clock_gettime"; then | |
700 | clock_gettime="yes" | |
701 | LIBS="-lrt $LIBS" | |
702 | fi | |
703 | echo "clock_gettime $clock_gettime" | |
704 | ||
705 | ########################################## | |
706 | # CLOCK_MONOTONIC probe | |
707 | clock_monotonic="no" | |
708 | if test "$clock_gettime" = "yes" ; then | |
709 | cat > $TMPC << EOF | |
710 | #include <stdio.h> | |
711 | #include <time.h> | |
712 | int main(int argc, char **argv) | |
713 | { | |
714 | return clock_gettime(CLOCK_MONOTONIC, NULL); | |
715 | } | |
716 | EOF | |
717 | if compile_prog "" "$LIBS" "clock monotonic"; then | |
718 | clock_monotonic="yes" | |
719 | fi | |
720 | fi | |
721 | echo "CLOCK_MONOTONIC $clock_monotonic" | |
722 | ||
c544f604 SN |
723 | ########################################## |
724 | # CLOCK_MONOTONIC_RAW probe | |
725 | clock_monotonic_raw="no" | |
726 | if test "$clock_gettime" = "yes" ; then | |
727 | cat > $TMPC << EOF | |
728 | #include <stdio.h> | |
729 | #include <time.h> | |
730 | int main(int argc, char **argv) | |
731 | { | |
732 | return clock_gettime(CLOCK_MONOTONIC_RAW, NULL); | |
733 | } | |
734 | EOF | |
735 | if compile_prog "" "$LIBS" "clock monotonic"; then | |
736 | clock_monotonic_raw="yes" | |
737 | fi | |
738 | fi | |
739 | echo "CLOCK_MONOTONIC_RAW $clock_monotonic_raw" | |
740 | ||
67bf9823 JA |
741 | ########################################## |
742 | # CLOCK_MONOTONIC_PRECISE probe | |
743 | clock_monotonic_precise="no" | |
744 | if test "$clock_gettime" = "yes" ; then | |
745 | cat > $TMPC << EOF | |
746 | #include <stdio.h> | |
747 | #include <time.h> | |
748 | int main(int argc, char **argv) | |
749 | { | |
750 | return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL); | |
751 | } | |
752 | EOF | |
753 | if compile_prog "" "$LIBS" "clock monotonic precise"; then | |
754 | clock_monotonic_precise="yes" | |
755 | fi | |
756 | fi | |
757 | echo "CLOCK_MONOTONIC_PRECISE $clock_monotonic_precise" | |
758 | ||
759 | ########################################## | |
760 | # gettimeofday() probe | |
761 | gettimeofday="no" | |
762 | cat > $TMPC << EOF | |
763 | #include <sys/time.h> | |
764 | #include <stdio.h> | |
765 | int main(int argc, char **argv) | |
766 | { | |
767 | struct timeval tv; | |
768 | return gettimeofday(&tv, NULL); | |
769 | } | |
770 | EOF | |
771 | if compile_prog "" "" "gettimeofday"; then | |
772 | gettimeofday="yes" | |
773 | fi | |
774 | echo "gettimeofday $gettimeofday" | |
775 | ||
776 | ########################################## | |
777 | # fdatasync() probe | |
778 | fdatasync="no" | |
779 | cat > $TMPC << EOF | |
780 | #include <stdio.h> | |
781 | #include <unistd.h> | |
782 | int main(int argc, char **argv) | |
783 | { | |
784 | return fdatasync(0); | |
785 | } | |
786 | EOF | |
787 | if compile_prog "" "" "fdatasync"; then | |
788 | fdatasync="yes" | |
789 | fi | |
790 | echo "fdatasync $fdatasync" | |
791 | ||
792 | ########################################## | |
793 | # sync_file_range() probe | |
794 | sync_file_range="no" | |
795 | cat > $TMPC << EOF | |
796 | #include <stdio.h> | |
797 | #include <unistd.h> | |
67bf9823 JA |
798 | #include <fcntl.h> |
799 | #include <linux/fs.h> | |
800 | int main(int argc, char **argv) | |
801 | { | |
802 | unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE | | |
803 | SYNC_FILE_RANGE_WAIT_AFTER; | |
804 | return sync_file_range(0, 0, 0, flags); | |
805 | } | |
806 | EOF | |
807 | if compile_prog "" "" "sync_file_range"; then | |
808 | sync_file_range="yes" | |
809 | fi | |
810 | echo "sync_file_range $sync_file_range" | |
811 | ||
812 | ########################################## | |
813 | # ext4 move extent probe | |
814 | ext4_me="no" | |
815 | cat > $TMPC << EOF | |
816 | #include <fcntl.h> | |
817 | #include <sys/ioctl.h> | |
818 | int main(int argc, char **argv) | |
819 | { | |
820 | struct move_extent me; | |
821 | return ioctl(0, EXT4_IOC_MOVE_EXT, &me); | |
822 | } | |
823 | EOF | |
c7165b8d JA |
824 | if compile_prog "" "" "ext4 move extent" ; then |
825 | ext4_me="yes" | |
826 | elif test $targetos = "Linux" ; then | |
827 | # On Linux, just default to it on and let it error at runtime if we really | |
828 | # don't have it. None of my updated systems have it defined, but it does | |
829 | # work. Takes a while to bubble back. | |
67bf9823 JA |
830 | ext4_me="yes" |
831 | fi | |
832 | echo "EXT4 move extent $ext4_me" | |
833 | ||
834 | ########################################## | |
835 | # splice probe | |
836 | linux_splice="no" | |
837 | cat > $TMPC << EOF | |
67bf9823 JA |
838 | #include <stdio.h> |
839 | #include <fcntl.h> | |
840 | int main(int argc, char **argv) | |
841 | { | |
842 | return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK); | |
843 | } | |
844 | EOF | |
845 | if compile_prog "" "" "linux splice"; then | |
846 | linux_splice="yes" | |
847 | fi | |
848 | echo "Linux splice(2) $linux_splice" | |
849 | ||
850 | ########################################## | |
851 | # GUASI probe | |
852 | guasi="no" | |
853 | cat > $TMPC << EOF | |
854 | #include <guasi.h> | |
855 | #include <guasi_syscalls.h> | |
856 | int main(int argc, char **argv) | |
857 | { | |
858 | guasi_t ctx = guasi_create(0, 0, 0); | |
859 | return 0; | |
860 | } | |
861 | EOF | |
862 | if compile_prog "" "" "guasi"; then | |
863 | guasi="yes" | |
864 | fi | |
865 | echo "GUASI $guasi" | |
866 | ||
867 | ########################################## | |
868 | # fusion-aw probe | |
869 | fusion_aw="no" | |
870 | cat > $TMPC << EOF | |
b2c77c25 | 871 | #include <nvm/nvm_primitives.h> |
67bf9823 JA |
872 | int main(int argc, char **argv) |
873 | { | |
b2c77c25 SK |
874 | nvm_version_t ver_info; |
875 | nvm_handle_t handle; | |
876 | ||
877 | handle = nvm_get_handle(0, &ver_info); | |
878 | return nvm_atomic_write(handle, 0, 0, 0); | |
67bf9823 JA |
879 | } |
880 | EOF | |
92aef550 ARJ |
881 | if compile_prog "" "-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread" "fusion-aw"; then |
882 | LIBS="-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread $LIBS" | |
67bf9823 JA |
883 | fusion_aw="yes" |
884 | fi | |
885 | echo "Fusion-io atomic engine $fusion_aw" | |
886 | ||
887 | ########################################## | |
888 | # libnuma probe | |
889 | libnuma="no" | |
890 | cat > $TMPC << EOF | |
891 | #include <numa.h> | |
892 | int main(int argc, char **argv) | |
893 | { | |
894 | return numa_available(); | |
895 | } | |
896 | EOF | |
44462517 | 897 | if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then |
67bf9823 JA |
898 | libnuma="yes" |
899 | LIBS="-lnuma $LIBS" | |
900 | fi | |
901 | echo "libnuma $libnuma" | |
902 | ||
50206d9b JA |
903 | ########################################## |
904 | # libnuma 2.x version API | |
905 | if test "$libnuma" = "yes" ; then | |
906 | libnuma_v2="no" | |
907 | cat > $TMPC << EOF | |
908 | #include <numa.h> | |
909 | int main(int argc, char **argv) | |
910 | { | |
911 | struct bitmask *mask = numa_parse_nodestring(NULL); | |
61bde962 | 912 | return mask->size == 0; |
50206d9b JA |
913 | } |
914 | EOF | |
915 | if compile_prog "" "" "libnuma api"; then | |
916 | libnuma_v2="yes" | |
917 | fi | |
918 | echo "libnuma v2 $libnuma_v2" | |
919 | fi | |
920 | ||
67bf9823 JA |
921 | ########################################## |
922 | # strsep() probe | |
923 | strsep="no" | |
924 | cat > $TMPC << EOF | |
925 | #include <string.h> | |
926 | int main(int argc, char **argv) | |
927 | { | |
928 | strsep(NULL, NULL); | |
929 | return 0; | |
930 | } | |
931 | EOF | |
932 | if compile_prog "" "" "strsep"; then | |
933 | strsep="yes" | |
934 | fi | |
935 | echo "strsep $strsep" | |
936 | ||
9ad8da82 JA |
937 | ########################################## |
938 | # strcasestr() probe | |
939 | strcasestr="no" | |
940 | cat > $TMPC << EOF | |
941 | #include <string.h> | |
942 | int main(int argc, char **argv) | |
943 | { | |
aa6738a5 | 944 | return strcasestr(argv[0], argv[1]) != NULL; |
9ad8da82 JA |
945 | } |
946 | EOF | |
947 | if compile_prog "" "" "strcasestr"; then | |
948 | strcasestr="yes" | |
949 | fi | |
950 | echo "strcasestr $strcasestr" | |
951 | ||
67bf9823 JA |
952 | ########################################## |
953 | # getopt_long_only() probe | |
954 | getopt_long_only="no" | |
955 | cat > $TMPC << EOF | |
956 | #include <unistd.h> | |
957 | #include <stdio.h> | |
aa6738a5 | 958 | #include <getopt.h> |
67bf9823 JA |
959 | int main(int argc, char **argv) |
960 | { | |
961 | int c = getopt_long_only(argc, argv, NULL, NULL, NULL); | |
962 | return c; | |
963 | } | |
964 | EOF | |
965 | if compile_prog "" "" "getopt_long_only"; then | |
966 | getopt_long_only="yes" | |
967 | fi | |
968 | echo "getopt_long_only() $getopt_long_only" | |
969 | ||
970 | ########################################## | |
971 | # inet_aton() probe | |
972 | inet_aton="no" | |
973 | cat > $TMPC << EOF | |
974 | #include <sys/socket.h> | |
975 | #include <arpa/inet.h> | |
976 | #include <stdio.h> | |
977 | int main(int argc, char **argv) | |
978 | { | |
979 | struct in_addr in; | |
980 | return inet_aton(NULL, &in); | |
981 | } | |
982 | EOF | |
983 | if compile_prog "" "" "inet_aton"; then | |
984 | inet_aton="yes" | |
985 | fi | |
986 | echo "inet_aton $inet_aton" | |
987 | ||
988 | ########################################## | |
989 | # socklen_t probe | |
990 | socklen_t="no" | |
991 | cat > $TMPC << EOF | |
f6482613 | 992 | #include <sys/socket.h> |
67bf9823 JA |
993 | int main(int argc, char **argv) |
994 | { | |
995 | socklen_t len = 0; | |
996 | return len; | |
997 | } | |
998 | EOF | |
999 | if compile_prog "" "" "socklen_t"; then | |
1000 | socklen_t="yes" | |
1001 | fi | |
1002 | echo "socklen_t $socklen_t" | |
1003 | ||
1004 | ########################################## | |
1005 | # Whether or not __thread is supported for TLS | |
1006 | tls_thread="no" | |
1007 | cat > $TMPC << EOF | |
1008 | #include <stdio.h> | |
aa6738a5 | 1009 | static __thread int ret; |
67bf9823 JA |
1010 | int main(int argc, char **argv) |
1011 | { | |
1012 | return ret; | |
1013 | } | |
1014 | EOF | |
1015 | if compile_prog "" "" "__thread"; then | |
1016 | tls_thread="yes" | |
1017 | fi | |
1018 | echo "__thread $tls_thread" | |
1019 | ||
91f94d5b | 1020 | ########################################## |
2639f056 | 1021 | # Check if we have required gtk/glib support for gfio |
ebec2094 JA |
1022 | gfio="no" |
1023 | if test "$gfio_check" = "yes" ; then | |
91f94d5b JA |
1024 | cat > $TMPC << EOF |
1025 | #include <glib.h> | |
1026 | #include <cairo.h> | |
1027 | #include <gtk/gtk.h> | |
1028 | int main(void) | |
1029 | { | |
1030 | gdk_threads_enter(); | |
91f94d5b | 1031 | gdk_threads_leave(); |
b7a99316 JA |
1032 | |
1033 | printf("%d", GTK_CHECK_VERSION(2, 18, 0)); | |
91f94d5b JA |
1034 | } |
1035 | EOF | |
1036 | GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0) | |
86719845 JA |
1037 | ORG_LDFLAGS=$LDFLAGS |
1038 | LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g) | |
91f94d5b JA |
1039 | if test "$?" != "0" ; then |
1040 | echo "configure: gtk and gthread not found" | |
1041 | exit 1 | |
1042 | fi | |
1043 | GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0) | |
1044 | if test "$?" != "0" ; then | |
1045 | echo "configure: gtk and gthread not found" | |
1046 | exit 1 | |
1047 | fi | |
b7a99316 JA |
1048 | if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then |
1049 | r=$($TMPE) | |
1050 | if test "$r" != "0" ; then | |
1051 | gfio="yes" | |
86719845 | 1052 | GFIO_LIBS="$LIBS $GTK_LIBS" |
b7a99316 JA |
1053 | CFLAGS="$CFLAGS $GTK_CFLAGS" |
1054 | else | |
1055 | echo "GTK found, but need version 2.18 or higher" | |
1056 | gfio="no" | |
1057 | fi | |
91f94d5b JA |
1058 | else |
1059 | echo "Please install gtk and gdk libraries" | |
1060 | gfio="no" | |
1061 | fi | |
86719845 | 1062 | LDFLAGS=$ORG_LDFLAGS |
91f94d5b JA |
1063 | fi |
1064 | ||
ebec2094 JA |
1065 | if test "$gfio_check" = "yes" ; then |
1066 | echo "gtk 2.18 or higher $gfio" | |
1067 | fi | |
91f94d5b | 1068 | |
44404c5a JA |
1069 | # Check whether we have getrusage(RUSAGE_THREAD) |
1070 | rusage_thread="no" | |
1071 | cat > $TMPC << EOF | |
1072 | #include <sys/time.h> | |
1073 | #include <sys/resource.h> | |
1074 | int main(int argc, char **argv) | |
1075 | { | |
1076 | struct rusage ru; | |
1077 | getrusage(RUSAGE_THREAD, &ru); | |
1078 | return 0; | |
1079 | } | |
1080 | EOF | |
1081 | if compile_prog "" "" "RUSAGE_THREAD"; then | |
1082 | rusage_thread="yes" | |
1083 | fi | |
1084 | echo "RUSAGE_THREAD $rusage_thread" | |
1085 | ||
7e09a9f1 JA |
1086 | ########################################## |
1087 | # Check whether we have SCHED_IDLE | |
1088 | sched_idle="no" | |
1089 | cat > $TMPC << EOF | |
1090 | #include <sched.h> | |
1091 | int main(int argc, char **argv) | |
1092 | { | |
1093 | struct sched_param p; | |
1094 | return sched_setscheduler(0, SCHED_IDLE, &p); | |
1095 | } | |
1096 | EOF | |
1097 | if compile_prog "" "" "SCHED_IDLE"; then | |
1098 | sched_idle="yes" | |
1099 | fi | |
1100 | echo "SCHED_IDLE $sched_idle" | |
1101 | ||
1eafa37a JA |
1102 | ########################################## |
1103 | # Check whether we have TCP_NODELAY | |
1104 | tcp_nodelay="no" | |
1105 | cat > $TMPC << EOF | |
1106 | #include <stdio.h> | |
1107 | #include <sys/types.h> | |
1108 | #include <sys/socket.h> | |
1109 | #include <netinet/tcp.h> | |
1110 | int main(int argc, char **argv) | |
1111 | { | |
1112 | return getsockopt(0, 0, TCP_NODELAY, NULL, NULL); | |
1113 | } | |
1114 | EOF | |
1115 | if compile_prog "" "" "TCP_NODELAY"; then | |
1116 | tcp_nodelay="yes" | |
1117 | fi | |
1118 | echo "TCP_NODELAY $tcp_nodelay" | |
1119 | ||
1008602c JA |
1120 | ########################################## |
1121 | # Check whether we have SO_SNDBUF | |
1122 | window_size="no" | |
1123 | cat > $TMPC << EOF | |
1124 | #include <stdio.h> | |
1125 | #include <sys/types.h> | |
1126 | #include <sys/socket.h> | |
1127 | #include <netinet/tcp.h> | |
1128 | int main(int argc, char **argv) | |
1129 | { | |
1130 | setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0); | |
1131 | setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0); | |
1132 | } | |
1133 | EOF | |
1134 | if compile_prog "" "" "SO_SNDBUF"; then | |
1135 | window_size="yes" | |
1136 | fi | |
1137 | echo "Net engine window_size $window_size" | |
1138 | ||
e5f34d95 JA |
1139 | ########################################## |
1140 | # Check whether we have TCP_MAXSEG | |
1141 | mss="no" | |
1142 | cat > $TMPC << EOF | |
1143 | #include <stdio.h> | |
1144 | #include <sys/types.h> | |
1145 | #include <sys/socket.h> | |
1146 | #include <netinet/tcp.h> | |
1147 | #include <arpa/inet.h> | |
1148 | #include <netinet/in.h> | |
1149 | int main(int argc, char **argv) | |
1150 | { | |
1151 | return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0); | |
1152 | } | |
1153 | EOF | |
1154 | if compile_prog "" "" "TCP_MAXSEG"; then | |
1155 | mss="yes" | |
1156 | fi | |
1157 | echo "TCP_MAXSEG $mss" | |
1158 | ||
38b9354a JA |
1159 | ########################################## |
1160 | # Check whether we have RLIMIT_MEMLOCK | |
1161 | rlimit_memlock="no" | |
1162 | cat > $TMPC << EOF | |
1163 | #include <sys/time.h> | |
1164 | #include <sys/resource.h> | |
1165 | int main(int argc, char **argv) | |
1166 | { | |
1167 | struct rlimit rl; | |
1168 | return getrlimit(RLIMIT_MEMLOCK, &rl); | |
1169 | } | |
1170 | EOF | |
1171 | if compile_prog "" "" "RLIMIT_MEMLOCK"; then | |
1172 | rlimit_memlock="yes" | |
1173 | fi | |
1174 | echo "RLIMIT_MEMLOCK $rlimit_memlock" | |
1175 | ||
07fc0acd JA |
1176 | ########################################## |
1177 | # Check whether we have pwritev/preadv | |
1178 | pwritev="no" | |
1179 | cat > $TMPC << EOF | |
1180 | #include <stdio.h> | |
1181 | #include <sys/uio.h> | |
1182 | int main(int argc, char **argv) | |
1183 | { | |
1184 | return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0); | |
1185 | } | |
1186 | EOF | |
1187 | if compile_prog "" "" "pwritev"; then | |
1188 | pwritev="yes" | |
1189 | fi | |
1190 | echo "pwritev/preadv $pwritev" | |
1191 | ||
ecad55e9 JA |
1192 | ########################################## |
1193 | # Check whether we have the required functions for ipv6 | |
1194 | ipv6="no" | |
1195 | cat > $TMPC << EOF | |
1196 | #include <sys/types.h> | |
1197 | #include <sys/socket.h> | |
d219028d | 1198 | #include <netinet/in.h> |
ecad55e9 JA |
1199 | #include <netdb.h> |
1200 | #include <stdio.h> | |
1201 | int main(int argc, char **argv) | |
1202 | { | |
1203 | struct addrinfo hints; | |
1204 | struct in6_addr addr; | |
1205 | int ret; | |
1206 | ||
1207 | ret = getaddrinfo(NULL, NULL, &hints, NULL); | |
1208 | freeaddrinfo(NULL); | |
1209 | printf("%s\n", gai_strerror(ret)); | |
1210 | addr = in6addr_any; | |
1211 | return 0; | |
1212 | } | |
1213 | EOF | |
1214 | if compile_prog "" "" "ipv6"; then | |
1215 | ipv6="yes" | |
1216 | fi | |
1217 | echo "IPv6 helpers $ipv6" | |
07fc0acd | 1218 | |
fc5c0345 DG |
1219 | ########################################## |
1220 | # check for rbd | |
1221 | rbd="no" | |
1222 | cat > $TMPC << EOF | |
1223 | #include <rbd/librbd.h> | |
1224 | ||
1225 | int main(int argc, char **argv) | |
1226 | { | |
1227 | ||
1228 | rados_t cluster; | |
1229 | rados_ioctx_t io_ctx; | |
1230 | const char pool[] = "rbd"; | |
1231 | ||
1232 | int major, minor, extra; | |
1233 | rbd_version(&major, &minor, &extra); | |
1234 | ||
1235 | rados_ioctx_create(cluster, pool, &io_ctx); | |
1236 | return 0; | |
1237 | } | |
1238 | EOF | |
ce18290e | 1239 | if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then |
fc5c0345 DG |
1240 | LIBS="-lrbd -lrados $LIBS" |
1241 | rbd="yes" | |
1242 | fi | |
1243 | echo "Rados Block Device engine $rbd" | |
1244 | ||
903b2812 JA |
1245 | ########################################## |
1246 | # check for rbd_invaidate_cache() | |
1247 | rbd_inval="no" | |
1248 | if test "$rbd" = "yes"; then | |
1249 | cat > $TMPC << EOF | |
1250 | #include <rbd/librbd.h> | |
1251 | ||
1252 | int main(int argc, char **argv) | |
1253 | { | |
1254 | rbd_image_t image; | |
1255 | ||
1256 | return rbd_invalidate_cache(image); | |
1257 | } | |
1258 | EOF | |
1259 | if compile_prog "" "-lrbd -lrados" "rbd"; then | |
1260 | rbd_inval="yes" | |
1261 | fi | |
1262 | echo "rbd_invalidate_cache $rbd_inval" | |
1263 | fi | |
1264 | ||
2e802282 JA |
1265 | ########################################## |
1266 | # Check whether we have setvbuf | |
1267 | setvbuf="no" | |
1268 | cat > $TMPC << EOF | |
1269 | #include <stdio.h> | |
1270 | int main(int argc, char **argv) | |
1271 | { | |
1272 | FILE *f = NULL; | |
1273 | char buf[80]; | |
1274 | setvbuf(f, buf, _IOFBF, sizeof(buf)); | |
1275 | return 0; | |
1276 | } | |
1277 | EOF | |
1278 | if compile_prog "" "" "setvbuf"; then | |
1279 | setvbuf="yes" | |
1280 | fi | |
1281 | echo "setvbuf $setvbuf" | |
fc5c0345 | 1282 | |
6e7d7dfb | 1283 | # check for gfapi |
1284 | gfapi="no" | |
1285 | cat > $TMPC << EOF | |
1286 | #include <glusterfs/api/glfs.h> | |
1287 | ||
1288 | int main(int argc, char **argv) | |
1289 | { | |
1290 | ||
1291 | glfs_t *g = glfs_new("foo"); | |
1292 | ||
1293 | return 0; | |
1294 | } | |
1295 | EOF | |
ce18290e | 1296 | if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then |
6e7d7dfb | 1297 | LIBS="-lgfapi -lglusterfs $LIBS" |
1298 | gfapi="yes" | |
1299 | fi | |
6fa14b99 | 1300 | echo "Gluster API engine $gfapi" |
6e7d7dfb | 1301 | |
6fa14b99 | 1302 | ########################################## |
1303 | # check for gfapi fadvise support | |
6876c98c | 1304 | if test "$gfapi" = "yes" ; then |
6fa14b99 | 1305 | gf_fadvise="no" |
1306 | cat > $TMPC << EOF | |
1307 | #include <glusterfs/api/glfs.h> | |
1308 | ||
1309 | int main(int argc, char **argv) | |
1310 | { | |
1311 | struct glfs_fd *fd; | |
1312 | int ret = glfs_fadvise(fd, 0, 0, 1); | |
1313 | ||
1314 | return 0; | |
1315 | } | |
1316 | EOF | |
6fa14b99 | 1317 | if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then |
1318 | gf_fadvise="yes" | |
1319 | fi | |
1320 | echo "Gluster API use fadvise $gf_fadvise" | |
6876c98c JA |
1321 | fi |
1322 | ||
1323 | ########################################## | |
1324 | # check for gfapi trim support | |
1325 | gf_trim="no" | |
1326 | if test "$gfapi" = "yes" ; then | |
1327 | cat > $TMPC << EOF | |
1328 | #include <glusterfs/api/glfs.h> | |
1329 | ||
1330 | int main(int argc, char **argv) | |
1331 | { | |
1332 | return glfs_discard_async(NULL, 0, 0); | |
1333 | } | |
1334 | EOF | |
1335 | if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then | |
1336 | gf_trim="yes" | |
1337 | fi | |
1338 | echo "Gluster API trim support $gf_trim" | |
1339 | fi | |
fc5c0345 | 1340 | |
81795ce3 CE |
1341 | ########################################## |
1342 | # Check if we support stckf on s390 | |
1343 | s390_z196_facilities="no" | |
1344 | cat > $TMPC << EOF | |
1345 | #define STFLE_BITS_Z196 45 /* various z196 facilities ... */ | |
1346 | int main(int argc, char **argv) | |
1347 | { | |
1348 | /* We want just 1 double word to be returned. */ | |
1349 | register unsigned long reg0 asm("0") = 0; | |
1350 | unsigned long stfle_bits; | |
1351 | asm volatile(".machine push" "\n\t" | |
1352 | ".machine \"z9-109\"" "\n\t" | |
1353 | "stfle %0" "\n\t" | |
1354 | ".machine pop" "\n" | |
1355 | : "=QS" (stfle_bits), "+d" (reg0) | |
1356 | : : "cc"); | |
1357 | ||
1358 | if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0) | |
1359 | return 0; | |
1360 | else | |
1361 | return -1; | |
1362 | } | |
1363 | EOF | |
1364 | if compile_prog "" "" "s390_z196_facilities"; then | |
1365 | $TMPE | |
1366 | if [[ $? -eq 0 ]]; then | |
1367 | s390_z196_facilities="yes" | |
1368 | fi | |
1369 | fi | |
1370 | echo "s390_z196_facilities $s390_z196_facilities" | |
1b10477b MM |
1371 | |
1372 | ########################################## | |
1373 | # Check if we have required environment variables configured for libhdfs | |
1374 | if test "$libhdfs" = "yes" ; then | |
1375 | hdfs_conf_error=0 | |
1376 | if test "$JAVA_HOME" = "" ; then | |
1377 | echo "configure: JAVA_HOME should be defined to jdk/jvm path" | |
1378 | hdfs_conf_error=1 | |
1379 | fi | |
1380 | if test "$FIO_LIBHDFS_INCLUDE" = "" ; then | |
1381 | echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path" | |
1382 | hdfs_conf_error=1 | |
1383 | fi | |
1384 | if test "$FIO_LIBHDFS_LIB" = "" ; then | |
1385 | echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path" | |
1386 | hdfs_conf_error=1 | |
1387 | fi | |
1388 | if test "$hdfs_conf_error" = "1" ; then | |
1389 | exit 1 | |
1390 | fi | |
1391 | fi | |
1392 | echo "HDFS engine $libhdfs" | |
1393 | ||
b8116a87 DE |
1394 | ########################################## |
1395 | # Check whether we have MTD | |
1396 | mtd="no" | |
1397 | cat > $TMPC << EOF | |
1398 | #include <mtd/mtd-user.h> | |
1399 | #include <sys/ioctl.h> | |
1400 | int main(int argc, char **argv) | |
1401 | { | |
1402 | struct mtd_info_user info; | |
400cd0ff | 1403 | info.type = MTD_MLCNANDFLASH; |
b8116a87 DE |
1404 | return ioctl(0, MEMGETINFO, &info); |
1405 | } | |
1406 | EOF | |
1407 | if compile_prog "" "" "mtd"; then | |
1408 | mtd="yes" | |
1409 | fi | |
1410 | echo "MTD $mtd" | |
1411 | ||
b470a02c SC |
1412 | # Check if we have lex/yacc available |
1413 | yacc="no" | |
e7b2c7a3 | 1414 | yacc_is_bison="no" |
b470a02c SC |
1415 | lex="no" |
1416 | arith="no" | |
cf6dd80e | 1417 | if test "$targetos" != "SunOS" ; then |
e7b2c7a3 | 1418 | LEX=$(which lex 2> /dev/null) |
b470a02c SC |
1419 | if test -x "$LEX" ; then |
1420 | lex="yes" | |
1421 | fi | |
7e0049e9 | 1422 | YACC=$(which bison 2> /dev/null) |
b470a02c SC |
1423 | if test -x "$YACC" ; then |
1424 | yacc="yes" | |
7e0049e9 | 1425 | yacc_is_bison="yes" |
e7b2c7a3 | 1426 | else |
7e0049e9 | 1427 | YACC=$(which yacc 2> /dev/null) |
e7b2c7a3 JA |
1428 | if test -x "$YACC" ; then |
1429 | yacc="yes" | |
e7b2c7a3 | 1430 | fi |
b470a02c SC |
1431 | fi |
1432 | if test "$yacc" = "yes" && test "$lex" = "yes" ; then | |
1433 | arith="yes" | |
1434 | fi | |
1435 | ||
1436 | if test "$arith" = "yes" ; then | |
1437 | cat > $TMPC << EOF | |
1438 | extern int yywrap(void); | |
1439 | ||
1440 | int main(int argc, char **argv) | |
1441 | { | |
1442 | yywrap(); | |
1443 | return 0; | |
1444 | } | |
1445 | EOF | |
719cda03 JA |
1446 | if compile_prog "" "-ll" "lex"; then |
1447 | LIBS="-ll $LIBS" | |
b470a02c SC |
1448 | else |
1449 | arith="no" | |
1450 | fi | |
1451 | fi | |
cf6dd80e | 1452 | fi |
b470a02c SC |
1453 | |
1454 | echo "lex/yacc for arithmetic $arith" | |
1455 | ||
67bf9823 JA |
1456 | ############################################################################# |
1457 | ||
67bf9823 | 1458 | if test "$wordsize" = "64" ; then |
4feafb1e | 1459 | output_sym "CONFIG_64BIT" |
67bf9823 | 1460 | elif test "$wordsize" = "32" ; then |
4feafb1e | 1461 | output_sym "CONFIG_32BIT" |
67bf9823 | 1462 | else |
d7145a78 | 1463 | fatal "Unknown wordsize!" |
67bf9823 | 1464 | fi |
0dcebdf4 | 1465 | if test "$bigendian" = "yes" ; then |
4feafb1e | 1466 | output_sym "CONFIG_BIG_ENDIAN" |
0dcebdf4 | 1467 | else |
4feafb1e | 1468 | output_sym "CONFIG_LITTLE_ENDIAN" |
0dcebdf4 | 1469 | fi |
3989b143 JA |
1470 | if test "$zlib" = "yes" ; then |
1471 | output_sym "CONFIG_ZLIB" | |
1472 | fi | |
67bf9823 | 1473 | if test "$libaio" = "yes" ; then |
4feafb1e | 1474 | output_sym "CONFIG_LIBAIO" |
67bf9823 JA |
1475 | fi |
1476 | if test "$posix_aio" = "yes" ; then | |
4feafb1e | 1477 | output_sym "CONFIG_POSIXAIO" |
67bf9823 JA |
1478 | fi |
1479 | if test "$posix_aio_fsync" = "yes" ; then | |
4feafb1e | 1480 | output_sym "CONFIG_POSIXAIO_FSYNC" |
67bf9823 JA |
1481 | fi |
1482 | if test "$linux_fallocate" = "yes" ; then | |
4feafb1e | 1483 | output_sym "CONFIG_LINUX_FALLOCATE" |
67bf9823 JA |
1484 | fi |
1485 | if test "$posix_fallocate" = "yes" ; then | |
4feafb1e | 1486 | output_sym "CONFIG_POSIX_FALLOCATE" |
67bf9823 JA |
1487 | fi |
1488 | if test "$fdatasync" = "yes" ; then | |
4feafb1e | 1489 | output_sym "CONFIG_FDATASYNC" |
67bf9823 JA |
1490 | fi |
1491 | if test "$sync_file_range" = "yes" ; then | |
4feafb1e | 1492 | output_sym "CONFIG_SYNC_FILE_RANGE" |
67bf9823 JA |
1493 | fi |
1494 | if test "$sfaa" = "yes" ; then | |
4feafb1e | 1495 | output_sym "CONFIG_SFAA" |
67bf9823 | 1496 | fi |
954cd73a | 1497 | if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then |
4feafb1e | 1498 | output_sym "CONFIG_RDMA" |
67bf9823 JA |
1499 | fi |
1500 | if test "$clock_gettime" = "yes" ; then | |
4feafb1e | 1501 | output_sym "CONFIG_CLOCK_GETTIME" |
67bf9823 JA |
1502 | fi |
1503 | if test "$clock_monotonic" = "yes" ; then | |
4feafb1e | 1504 | output_sym "CONFIG_CLOCK_MONOTONIC" |
67bf9823 | 1505 | fi |
c544f604 SN |
1506 | if test "$clock_monotonic_raw" = "yes" ; then |
1507 | output_sym "CONFIG_CLOCK_MONOTONIC_RAW" | |
1508 | fi | |
67bf9823 | 1509 | if test "$clock_monotonic_precise" = "yes" ; then |
4feafb1e | 1510 | output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE" |
67bf9823 JA |
1511 | fi |
1512 | if test "$gettimeofday" = "yes" ; then | |
4feafb1e | 1513 | output_sym "CONFIG_GETTIMEOFDAY" |
67bf9823 JA |
1514 | fi |
1515 | if test "$posix_fadvise" = "yes" ; then | |
4feafb1e | 1516 | output_sym "CONFIG_POSIX_FADVISE" |
67bf9823 JA |
1517 | fi |
1518 | if test "$linux_3arg_affinity" = "yes" ; then | |
4feafb1e | 1519 | output_sym "CONFIG_3ARG_AFFINITY" |
67bf9823 | 1520 | elif test "$linux_2arg_affinity" = "yes" ; then |
4feafb1e | 1521 | output_sym "CONFIG_2ARG_AFFINITY" |
67bf9823 JA |
1522 | fi |
1523 | if test "$strsep" = "yes" ; then | |
4feafb1e | 1524 | output_sym "CONFIG_STRSEP" |
67bf9823 | 1525 | fi |
9ad8da82 JA |
1526 | if test "$strcasestr" = "yes" ; then |
1527 | output_sym "CONFIG_STRCASESTR" | |
1528 | fi | |
67bf9823 | 1529 | if test "$getopt_long_only" = "yes" ; then |
4feafb1e | 1530 | output_sym "CONFIG_GETOPT_LONG_ONLY" |
67bf9823 JA |
1531 | fi |
1532 | if test "$inet_aton" = "yes" ; then | |
4feafb1e | 1533 | output_sym "CONFIG_INET_ATON" |
67bf9823 JA |
1534 | fi |
1535 | if test "$socklen_t" = "yes" ; then | |
4feafb1e | 1536 | output_sym "CONFIG_SOCKLEN_T" |
67bf9823 JA |
1537 | fi |
1538 | if test "$ext4_me" = "yes" ; then | |
4feafb1e | 1539 | output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT" |
67bf9823 JA |
1540 | fi |
1541 | if test "$linux_splice" = "yes" ; then | |
4feafb1e | 1542 | output_sym "CONFIG_LINUX_SPLICE" |
67bf9823 JA |
1543 | fi |
1544 | if test "$guasi" = "yes" ; then | |
4feafb1e | 1545 | output_sym "CONFIG_GUASI" |
67bf9823 JA |
1546 | fi |
1547 | if test "$fusion_aw" = "yes" ; then | |
4feafb1e | 1548 | output_sym "CONFIG_FUSION_AW" |
67bf9823 | 1549 | fi |
50206d9b | 1550 | if test "$libnuma_v2" = "yes" ; then |
4feafb1e | 1551 | output_sym "CONFIG_LIBNUMA" |
67bf9823 JA |
1552 | fi |
1553 | if test "$solaris_aio" = "yes" ; then | |
4feafb1e | 1554 | output_sym "CONFIG_SOLARISAIO" |
67bf9823 JA |
1555 | fi |
1556 | if test "$tls_thread" = "yes" ; then | |
4feafb1e | 1557 | output_sym "CONFIG_TLS_THREAD" |
67bf9823 | 1558 | fi |
44404c5a | 1559 | if test "$rusage_thread" = "yes" ; then |
4feafb1e | 1560 | output_sym "CONFIG_RUSAGE_THREAD" |
67bf9823 | 1561 | fi |
91f94d5b JA |
1562 | if test "$gfio" = "yes" ; then |
1563 | echo "CONFIG_GFIO=y" >> $config_host_mak | |
1564 | fi | |
c8931876 JA |
1565 | if test "$esx" = "yes" ; then |
1566 | output_sym "CONFIG_ESX" | |
1567 | output_sym "CONFIG_NO_SHM" | |
1568 | fi | |
7e09a9f1 JA |
1569 | if test "$sched_idle" = "yes" ; then |
1570 | output_sym "CONFIG_SCHED_IDLE" | |
1571 | fi | |
1eafa37a JA |
1572 | if test "$tcp_nodelay" = "yes" ; then |
1573 | output_sym "CONFIG_TCP_NODELAY" | |
1574 | fi | |
1008602c JA |
1575 | if test "$window_size" = "yes" ; then |
1576 | output_sym "CONFIG_NET_WINDOWSIZE" | |
1577 | fi | |
e5f34d95 JA |
1578 | if test "$mss" = "yes" ; then |
1579 | output_sym "CONFIG_NET_MSS" | |
1580 | fi | |
38b9354a JA |
1581 | if test "$rlimit_memlock" = "yes" ; then |
1582 | output_sym "CONFIG_RLIMIT_MEMLOCK" | |
1583 | fi | |
07fc0acd JA |
1584 | if test "$pwritev" = "yes" ; then |
1585 | output_sym "CONFIG_PWRITEV" | |
1586 | fi | |
ecad55e9 JA |
1587 | if test "$ipv6" = "yes" ; then |
1588 | output_sym "CONFIG_IPV6" | |
1589 | fi | |
fc5c0345 DG |
1590 | if test "$rbd" = "yes" ; then |
1591 | output_sym "CONFIG_RBD" | |
1592 | fi | |
903b2812 JA |
1593 | if test "$rbd_inval" = "yes" ; then |
1594 | output_sym "CONFIG_RBD_INVAL" | |
1595 | fi | |
2e802282 JA |
1596 | if test "$setvbuf" = "yes" ; then |
1597 | output_sym "CONFIG_SETVBUF" | |
1598 | fi | |
81795ce3 CE |
1599 | if test "$s390_z196_facilities" = "yes" ; then |
1600 | output_sym "CONFIG_S390_Z196_FACILITIES" | |
1601 | CFLAGS="$CFLAGS -march=z9-109" | |
1602 | fi | |
6e7d7dfb | 1603 | if test "$gfapi" = "yes" ; then |
1604 | output_sym "CONFIG_GFAPI" | |
1605 | fi | |
6fa14b99 | 1606 | if test "$gf_fadvise" = "yes" ; then |
1607 | output_sym "CONFIG_GF_FADVISE" | |
1608 | fi | |
6876c98c JA |
1609 | if test "$gf_trim" = "yes" ; then |
1610 | output_sym "CONFIG_GF_TRIM" | |
1611 | fi | |
1b10477b MM |
1612 | if test "$libhdfs" = "yes" ; then |
1613 | output_sym "CONFIG_LIBHDFS" | |
1527dc50 FB |
1614 | echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak |
1615 | echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak | |
1616 | echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak | |
1617 | fi | |
b8116a87 DE |
1618 | if test "$mtd" = "yes" ; then |
1619 | output_sym "CONFIG_MTD" | |
1620 | fi | |
b470a02c SC |
1621 | if test "$arith" = "yes" ; then |
1622 | output_sym "CONFIG_ARITHMETIC" | |
e7b2c7a3 JA |
1623 | if test "$yacc_is_bison" = "yes" ; then |
1624 | echo "YACC=$YACC -y" >> $config_host_mak | |
1625 | else | |
1626 | echo "YACC=$YACC" >> $config_host_mak | |
1627 | fi | |
b470a02c | 1628 | fi |
67bf9823 | 1629 | |
605cf82e JA |
1630 | if test "$zlib" = "no" ; then |
1631 | echo "Consider installing zlib-dev (zlib-devel), some fio features depend on it." | |
1632 | fi | |
1633 | ||
67bf9823 | 1634 | echo "LIBS+=$LIBS" >> $config_host_mak |
86719845 | 1635 | echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak |
91f94d5b | 1636 | echo "CFLAGS+=$CFLAGS" >> $config_host_mak |
d2aeedb9 | 1637 | echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak |
67bf9823 | 1638 | echo "CC=$cc" >> $config_host_mak |
af4862b3 | 1639 | echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak |
020d54bd | 1640 | echo "INSTALL_PREFIX=$prefix" >> $config_host_mak |