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 | ||
723 | ########################################## | |
724 | # CLOCK_MONOTONIC_PRECISE probe | |
725 | clock_monotonic_precise="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_PRECISE, NULL); | |
733 | } | |
734 | EOF | |
735 | if compile_prog "" "$LIBS" "clock monotonic precise"; then | |
736 | clock_monotonic_precise="yes" | |
737 | fi | |
738 | fi | |
739 | echo "CLOCK_MONOTONIC_PRECISE $clock_monotonic_precise" | |
740 | ||
741 | ########################################## | |
742 | # gettimeofday() probe | |
743 | gettimeofday="no" | |
744 | cat > $TMPC << EOF | |
745 | #include <sys/time.h> | |
746 | #include <stdio.h> | |
747 | int main(int argc, char **argv) | |
748 | { | |
749 | struct timeval tv; | |
750 | return gettimeofday(&tv, NULL); | |
751 | } | |
752 | EOF | |
753 | if compile_prog "" "" "gettimeofday"; then | |
754 | gettimeofday="yes" | |
755 | fi | |
756 | echo "gettimeofday $gettimeofday" | |
757 | ||
758 | ########################################## | |
759 | # fdatasync() probe | |
760 | fdatasync="no" | |
761 | cat > $TMPC << EOF | |
762 | #include <stdio.h> | |
763 | #include <unistd.h> | |
764 | int main(int argc, char **argv) | |
765 | { | |
766 | return fdatasync(0); | |
767 | } | |
768 | EOF | |
769 | if compile_prog "" "" "fdatasync"; then | |
770 | fdatasync="yes" | |
771 | fi | |
772 | echo "fdatasync $fdatasync" | |
773 | ||
774 | ########################################## | |
775 | # sync_file_range() probe | |
776 | sync_file_range="no" | |
777 | cat > $TMPC << EOF | |
778 | #include <stdio.h> | |
779 | #include <unistd.h> | |
67bf9823 JA |
780 | #include <fcntl.h> |
781 | #include <linux/fs.h> | |
782 | int main(int argc, char **argv) | |
783 | { | |
784 | unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE | | |
785 | SYNC_FILE_RANGE_WAIT_AFTER; | |
786 | return sync_file_range(0, 0, 0, flags); | |
787 | } | |
788 | EOF | |
789 | if compile_prog "" "" "sync_file_range"; then | |
790 | sync_file_range="yes" | |
791 | fi | |
792 | echo "sync_file_range $sync_file_range" | |
793 | ||
794 | ########################################## | |
795 | # ext4 move extent probe | |
796 | ext4_me="no" | |
797 | cat > $TMPC << EOF | |
798 | #include <fcntl.h> | |
799 | #include <sys/ioctl.h> | |
800 | int main(int argc, char **argv) | |
801 | { | |
802 | struct move_extent me; | |
803 | return ioctl(0, EXT4_IOC_MOVE_EXT, &me); | |
804 | } | |
805 | EOF | |
c7165b8d JA |
806 | if compile_prog "" "" "ext4 move extent" ; then |
807 | ext4_me="yes" | |
808 | elif test $targetos = "Linux" ; then | |
809 | # On Linux, just default to it on and let it error at runtime if we really | |
810 | # don't have it. None of my updated systems have it defined, but it does | |
811 | # work. Takes a while to bubble back. | |
67bf9823 JA |
812 | ext4_me="yes" |
813 | fi | |
814 | echo "EXT4 move extent $ext4_me" | |
815 | ||
816 | ########################################## | |
817 | # splice probe | |
818 | linux_splice="no" | |
819 | cat > $TMPC << EOF | |
67bf9823 JA |
820 | #include <stdio.h> |
821 | #include <fcntl.h> | |
822 | int main(int argc, char **argv) | |
823 | { | |
824 | return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK); | |
825 | } | |
826 | EOF | |
827 | if compile_prog "" "" "linux splice"; then | |
828 | linux_splice="yes" | |
829 | fi | |
830 | echo "Linux splice(2) $linux_splice" | |
831 | ||
832 | ########################################## | |
833 | # GUASI probe | |
834 | guasi="no" | |
835 | cat > $TMPC << EOF | |
836 | #include <guasi.h> | |
837 | #include <guasi_syscalls.h> | |
838 | int main(int argc, char **argv) | |
839 | { | |
840 | guasi_t ctx = guasi_create(0, 0, 0); | |
841 | return 0; | |
842 | } | |
843 | EOF | |
844 | if compile_prog "" "" "guasi"; then | |
845 | guasi="yes" | |
846 | fi | |
847 | echo "GUASI $guasi" | |
848 | ||
849 | ########################################## | |
850 | # fusion-aw probe | |
851 | fusion_aw="no" | |
852 | cat > $TMPC << EOF | |
b2c77c25 | 853 | #include <nvm/nvm_primitives.h> |
67bf9823 JA |
854 | int main(int argc, char **argv) |
855 | { | |
b2c77c25 SK |
856 | nvm_version_t ver_info; |
857 | nvm_handle_t handle; | |
858 | ||
859 | handle = nvm_get_handle(0, &ver_info); | |
860 | return nvm_atomic_write(handle, 0, 0, 0); | |
67bf9823 JA |
861 | } |
862 | EOF | |
92aef550 ARJ |
863 | if compile_prog "" "-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread" "fusion-aw"; then |
864 | LIBS="-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread $LIBS" | |
67bf9823 JA |
865 | fusion_aw="yes" |
866 | fi | |
867 | echo "Fusion-io atomic engine $fusion_aw" | |
868 | ||
869 | ########################################## | |
870 | # libnuma probe | |
871 | libnuma="no" | |
872 | cat > $TMPC << EOF | |
873 | #include <numa.h> | |
874 | int main(int argc, char **argv) | |
875 | { | |
876 | return numa_available(); | |
877 | } | |
878 | EOF | |
44462517 | 879 | if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then |
67bf9823 JA |
880 | libnuma="yes" |
881 | LIBS="-lnuma $LIBS" | |
882 | fi | |
883 | echo "libnuma $libnuma" | |
884 | ||
50206d9b JA |
885 | ########################################## |
886 | # libnuma 2.x version API | |
887 | if test "$libnuma" = "yes" ; then | |
888 | libnuma_v2="no" | |
889 | cat > $TMPC << EOF | |
890 | #include <numa.h> | |
891 | int main(int argc, char **argv) | |
892 | { | |
893 | struct bitmask *mask = numa_parse_nodestring(NULL); | |
61bde962 | 894 | return mask->size == 0; |
50206d9b JA |
895 | } |
896 | EOF | |
897 | if compile_prog "" "" "libnuma api"; then | |
898 | libnuma_v2="yes" | |
899 | fi | |
900 | echo "libnuma v2 $libnuma_v2" | |
901 | fi | |
902 | ||
67bf9823 JA |
903 | ########################################## |
904 | # strsep() probe | |
905 | strsep="no" | |
906 | cat > $TMPC << EOF | |
907 | #include <string.h> | |
908 | int main(int argc, char **argv) | |
909 | { | |
910 | strsep(NULL, NULL); | |
911 | return 0; | |
912 | } | |
913 | EOF | |
914 | if compile_prog "" "" "strsep"; then | |
915 | strsep="yes" | |
916 | fi | |
917 | echo "strsep $strsep" | |
918 | ||
9ad8da82 JA |
919 | ########################################## |
920 | # strcasestr() probe | |
921 | strcasestr="no" | |
922 | cat > $TMPC << EOF | |
923 | #include <string.h> | |
924 | int main(int argc, char **argv) | |
925 | { | |
aa6738a5 | 926 | return strcasestr(argv[0], argv[1]) != NULL; |
9ad8da82 JA |
927 | } |
928 | EOF | |
929 | if compile_prog "" "" "strcasestr"; then | |
930 | strcasestr="yes" | |
931 | fi | |
932 | echo "strcasestr $strcasestr" | |
933 | ||
67bf9823 JA |
934 | ########################################## |
935 | # getopt_long_only() probe | |
936 | getopt_long_only="no" | |
937 | cat > $TMPC << EOF | |
938 | #include <unistd.h> | |
939 | #include <stdio.h> | |
aa6738a5 | 940 | #include <getopt.h> |
67bf9823 JA |
941 | int main(int argc, char **argv) |
942 | { | |
943 | int c = getopt_long_only(argc, argv, NULL, NULL, NULL); | |
944 | return c; | |
945 | } | |
946 | EOF | |
947 | if compile_prog "" "" "getopt_long_only"; then | |
948 | getopt_long_only="yes" | |
949 | fi | |
950 | echo "getopt_long_only() $getopt_long_only" | |
951 | ||
952 | ########################################## | |
953 | # inet_aton() probe | |
954 | inet_aton="no" | |
955 | cat > $TMPC << EOF | |
956 | #include <sys/socket.h> | |
957 | #include <arpa/inet.h> | |
958 | #include <stdio.h> | |
959 | int main(int argc, char **argv) | |
960 | { | |
961 | struct in_addr in; | |
962 | return inet_aton(NULL, &in); | |
963 | } | |
964 | EOF | |
965 | if compile_prog "" "" "inet_aton"; then | |
966 | inet_aton="yes" | |
967 | fi | |
968 | echo "inet_aton $inet_aton" | |
969 | ||
970 | ########################################## | |
971 | # socklen_t probe | |
972 | socklen_t="no" | |
973 | cat > $TMPC << EOF | |
f6482613 | 974 | #include <sys/socket.h> |
67bf9823 JA |
975 | int main(int argc, char **argv) |
976 | { | |
977 | socklen_t len = 0; | |
978 | return len; | |
979 | } | |
980 | EOF | |
981 | if compile_prog "" "" "socklen_t"; then | |
982 | socklen_t="yes" | |
983 | fi | |
984 | echo "socklen_t $socklen_t" | |
985 | ||
986 | ########################################## | |
987 | # Whether or not __thread is supported for TLS | |
988 | tls_thread="no" | |
989 | cat > $TMPC << EOF | |
990 | #include <stdio.h> | |
aa6738a5 | 991 | static __thread int ret; |
67bf9823 JA |
992 | int main(int argc, char **argv) |
993 | { | |
994 | return ret; | |
995 | } | |
996 | EOF | |
997 | if compile_prog "" "" "__thread"; then | |
998 | tls_thread="yes" | |
999 | fi | |
1000 | echo "__thread $tls_thread" | |
1001 | ||
91f94d5b | 1002 | ########################################## |
2639f056 | 1003 | # Check if we have required gtk/glib support for gfio |
ebec2094 JA |
1004 | gfio="no" |
1005 | if test "$gfio_check" = "yes" ; then | |
91f94d5b JA |
1006 | cat > $TMPC << EOF |
1007 | #include <glib.h> | |
1008 | #include <cairo.h> | |
1009 | #include <gtk/gtk.h> | |
1010 | int main(void) | |
1011 | { | |
1012 | gdk_threads_enter(); | |
91f94d5b | 1013 | gdk_threads_leave(); |
b7a99316 JA |
1014 | |
1015 | printf("%d", GTK_CHECK_VERSION(2, 18, 0)); | |
91f94d5b JA |
1016 | } |
1017 | EOF | |
1018 | GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0) | |
86719845 JA |
1019 | ORG_LDFLAGS=$LDFLAGS |
1020 | LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g) | |
91f94d5b JA |
1021 | if test "$?" != "0" ; then |
1022 | echo "configure: gtk and gthread not found" | |
1023 | exit 1 | |
1024 | fi | |
1025 | GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0) | |
1026 | if test "$?" != "0" ; then | |
1027 | echo "configure: gtk and gthread not found" | |
1028 | exit 1 | |
1029 | fi | |
b7a99316 JA |
1030 | if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then |
1031 | r=$($TMPE) | |
1032 | if test "$r" != "0" ; then | |
1033 | gfio="yes" | |
86719845 | 1034 | GFIO_LIBS="$LIBS $GTK_LIBS" |
b7a99316 JA |
1035 | CFLAGS="$CFLAGS $GTK_CFLAGS" |
1036 | else | |
1037 | echo "GTK found, but need version 2.18 or higher" | |
1038 | gfio="no" | |
1039 | fi | |
91f94d5b JA |
1040 | else |
1041 | echo "Please install gtk and gdk libraries" | |
1042 | gfio="no" | |
1043 | fi | |
86719845 | 1044 | LDFLAGS=$ORG_LDFLAGS |
91f94d5b JA |
1045 | fi |
1046 | ||
ebec2094 JA |
1047 | if test "$gfio_check" = "yes" ; then |
1048 | echo "gtk 2.18 or higher $gfio" | |
1049 | fi | |
91f94d5b | 1050 | |
44404c5a JA |
1051 | # Check whether we have getrusage(RUSAGE_THREAD) |
1052 | rusage_thread="no" | |
1053 | cat > $TMPC << EOF | |
1054 | #include <sys/time.h> | |
1055 | #include <sys/resource.h> | |
1056 | int main(int argc, char **argv) | |
1057 | { | |
1058 | struct rusage ru; | |
1059 | getrusage(RUSAGE_THREAD, &ru); | |
1060 | return 0; | |
1061 | } | |
1062 | EOF | |
1063 | if compile_prog "" "" "RUSAGE_THREAD"; then | |
1064 | rusage_thread="yes" | |
1065 | fi | |
1066 | echo "RUSAGE_THREAD $rusage_thread" | |
1067 | ||
7e09a9f1 JA |
1068 | ########################################## |
1069 | # Check whether we have SCHED_IDLE | |
1070 | sched_idle="no" | |
1071 | cat > $TMPC << EOF | |
1072 | #include <sched.h> | |
1073 | int main(int argc, char **argv) | |
1074 | { | |
1075 | struct sched_param p; | |
1076 | return sched_setscheduler(0, SCHED_IDLE, &p); | |
1077 | } | |
1078 | EOF | |
1079 | if compile_prog "" "" "SCHED_IDLE"; then | |
1080 | sched_idle="yes" | |
1081 | fi | |
1082 | echo "SCHED_IDLE $sched_idle" | |
1083 | ||
1eafa37a JA |
1084 | ########################################## |
1085 | # Check whether we have TCP_NODELAY | |
1086 | tcp_nodelay="no" | |
1087 | cat > $TMPC << EOF | |
1088 | #include <stdio.h> | |
1089 | #include <sys/types.h> | |
1090 | #include <sys/socket.h> | |
1091 | #include <netinet/tcp.h> | |
1092 | int main(int argc, char **argv) | |
1093 | { | |
1094 | return getsockopt(0, 0, TCP_NODELAY, NULL, NULL); | |
1095 | } | |
1096 | EOF | |
1097 | if compile_prog "" "" "TCP_NODELAY"; then | |
1098 | tcp_nodelay="yes" | |
1099 | fi | |
1100 | echo "TCP_NODELAY $tcp_nodelay" | |
1101 | ||
1008602c JA |
1102 | ########################################## |
1103 | # Check whether we have SO_SNDBUF | |
1104 | window_size="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 | setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0); | |
1113 | setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0); | |
1114 | } | |
1115 | EOF | |
1116 | if compile_prog "" "" "SO_SNDBUF"; then | |
1117 | window_size="yes" | |
1118 | fi | |
1119 | echo "Net engine window_size $window_size" | |
1120 | ||
e5f34d95 JA |
1121 | ########################################## |
1122 | # Check whether we have TCP_MAXSEG | |
1123 | mss="no" | |
1124 | cat > $TMPC << EOF | |
1125 | #include <stdio.h> | |
1126 | #include <sys/types.h> | |
1127 | #include <sys/socket.h> | |
1128 | #include <netinet/tcp.h> | |
1129 | #include <arpa/inet.h> | |
1130 | #include <netinet/in.h> | |
1131 | int main(int argc, char **argv) | |
1132 | { | |
1133 | return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0); | |
1134 | } | |
1135 | EOF | |
1136 | if compile_prog "" "" "TCP_MAXSEG"; then | |
1137 | mss="yes" | |
1138 | fi | |
1139 | echo "TCP_MAXSEG $mss" | |
1140 | ||
38b9354a JA |
1141 | ########################################## |
1142 | # Check whether we have RLIMIT_MEMLOCK | |
1143 | rlimit_memlock="no" | |
1144 | cat > $TMPC << EOF | |
1145 | #include <sys/time.h> | |
1146 | #include <sys/resource.h> | |
1147 | int main(int argc, char **argv) | |
1148 | { | |
1149 | struct rlimit rl; | |
1150 | return getrlimit(RLIMIT_MEMLOCK, &rl); | |
1151 | } | |
1152 | EOF | |
1153 | if compile_prog "" "" "RLIMIT_MEMLOCK"; then | |
1154 | rlimit_memlock="yes" | |
1155 | fi | |
1156 | echo "RLIMIT_MEMLOCK $rlimit_memlock" | |
1157 | ||
07fc0acd JA |
1158 | ########################################## |
1159 | # Check whether we have pwritev/preadv | |
1160 | pwritev="no" | |
1161 | cat > $TMPC << EOF | |
1162 | #include <stdio.h> | |
1163 | #include <sys/uio.h> | |
1164 | int main(int argc, char **argv) | |
1165 | { | |
1166 | return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0); | |
1167 | } | |
1168 | EOF | |
1169 | if compile_prog "" "" "pwritev"; then | |
1170 | pwritev="yes" | |
1171 | fi | |
1172 | echo "pwritev/preadv $pwritev" | |
1173 | ||
ecad55e9 JA |
1174 | ########################################## |
1175 | # Check whether we have the required functions for ipv6 | |
1176 | ipv6="no" | |
1177 | cat > $TMPC << EOF | |
1178 | #include <sys/types.h> | |
1179 | #include <sys/socket.h> | |
d219028d | 1180 | #include <netinet/in.h> |
ecad55e9 JA |
1181 | #include <netdb.h> |
1182 | #include <stdio.h> | |
1183 | int main(int argc, char **argv) | |
1184 | { | |
1185 | struct addrinfo hints; | |
1186 | struct in6_addr addr; | |
1187 | int ret; | |
1188 | ||
1189 | ret = getaddrinfo(NULL, NULL, &hints, NULL); | |
1190 | freeaddrinfo(NULL); | |
1191 | printf("%s\n", gai_strerror(ret)); | |
1192 | addr = in6addr_any; | |
1193 | return 0; | |
1194 | } | |
1195 | EOF | |
1196 | if compile_prog "" "" "ipv6"; then | |
1197 | ipv6="yes" | |
1198 | fi | |
1199 | echo "IPv6 helpers $ipv6" | |
07fc0acd | 1200 | |
fc5c0345 DG |
1201 | ########################################## |
1202 | # check for rbd | |
1203 | rbd="no" | |
1204 | cat > $TMPC << EOF | |
1205 | #include <rbd/librbd.h> | |
1206 | ||
1207 | int main(int argc, char **argv) | |
1208 | { | |
1209 | ||
1210 | rados_t cluster; | |
1211 | rados_ioctx_t io_ctx; | |
1212 | const char pool[] = "rbd"; | |
1213 | ||
1214 | int major, minor, extra; | |
1215 | rbd_version(&major, &minor, &extra); | |
1216 | ||
1217 | rados_ioctx_create(cluster, pool, &io_ctx); | |
1218 | return 0; | |
1219 | } | |
1220 | EOF | |
ce18290e | 1221 | if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then |
fc5c0345 DG |
1222 | LIBS="-lrbd -lrados $LIBS" |
1223 | rbd="yes" | |
1224 | fi | |
1225 | echo "Rados Block Device engine $rbd" | |
1226 | ||
903b2812 JA |
1227 | ########################################## |
1228 | # check for rbd_invaidate_cache() | |
1229 | rbd_inval="no" | |
1230 | if test "$rbd" = "yes"; then | |
1231 | cat > $TMPC << EOF | |
1232 | #include <rbd/librbd.h> | |
1233 | ||
1234 | int main(int argc, char **argv) | |
1235 | { | |
1236 | rbd_image_t image; | |
1237 | ||
1238 | return rbd_invalidate_cache(image); | |
1239 | } | |
1240 | EOF | |
1241 | if compile_prog "" "-lrbd -lrados" "rbd"; then | |
1242 | rbd_inval="yes" | |
1243 | fi | |
1244 | echo "rbd_invalidate_cache $rbd_inval" | |
1245 | fi | |
1246 | ||
2e802282 JA |
1247 | ########################################## |
1248 | # Check whether we have setvbuf | |
1249 | setvbuf="no" | |
1250 | cat > $TMPC << EOF | |
1251 | #include <stdio.h> | |
1252 | int main(int argc, char **argv) | |
1253 | { | |
1254 | FILE *f = NULL; | |
1255 | char buf[80]; | |
1256 | setvbuf(f, buf, _IOFBF, sizeof(buf)); | |
1257 | return 0; | |
1258 | } | |
1259 | EOF | |
1260 | if compile_prog "" "" "setvbuf"; then | |
1261 | setvbuf="yes" | |
1262 | fi | |
1263 | echo "setvbuf $setvbuf" | |
fc5c0345 | 1264 | |
6e7d7dfb | 1265 | # check for gfapi |
1266 | gfapi="no" | |
1267 | cat > $TMPC << EOF | |
1268 | #include <glusterfs/api/glfs.h> | |
1269 | ||
1270 | int main(int argc, char **argv) | |
1271 | { | |
1272 | ||
1273 | glfs_t *g = glfs_new("foo"); | |
1274 | ||
1275 | return 0; | |
1276 | } | |
1277 | EOF | |
ce18290e | 1278 | if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then |
6e7d7dfb | 1279 | LIBS="-lgfapi -lglusterfs $LIBS" |
1280 | gfapi="yes" | |
1281 | fi | |
6fa14b99 | 1282 | echo "Gluster API engine $gfapi" |
6e7d7dfb | 1283 | |
6fa14b99 | 1284 | ########################################## |
1285 | # check for gfapi fadvise support | |
6876c98c | 1286 | if test "$gfapi" = "yes" ; then |
6fa14b99 | 1287 | gf_fadvise="no" |
1288 | cat > $TMPC << EOF | |
1289 | #include <glusterfs/api/glfs.h> | |
1290 | ||
1291 | int main(int argc, char **argv) | |
1292 | { | |
1293 | struct glfs_fd *fd; | |
1294 | int ret = glfs_fadvise(fd, 0, 0, 1); | |
1295 | ||
1296 | return 0; | |
1297 | } | |
1298 | EOF | |
6fa14b99 | 1299 | if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then |
1300 | gf_fadvise="yes" | |
1301 | fi | |
1302 | echo "Gluster API use fadvise $gf_fadvise" | |
6876c98c JA |
1303 | fi |
1304 | ||
1305 | ########################################## | |
1306 | # check for gfapi trim support | |
1307 | gf_trim="no" | |
1308 | if test "$gfapi" = "yes" ; then | |
1309 | cat > $TMPC << EOF | |
1310 | #include <glusterfs/api/glfs.h> | |
1311 | ||
1312 | int main(int argc, char **argv) | |
1313 | { | |
1314 | return glfs_discard_async(NULL, 0, 0); | |
1315 | } | |
1316 | EOF | |
1317 | if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then | |
1318 | gf_trim="yes" | |
1319 | fi | |
1320 | echo "Gluster API trim support $gf_trim" | |
1321 | fi | |
fc5c0345 | 1322 | |
81795ce3 CE |
1323 | ########################################## |
1324 | # Check if we support stckf on s390 | |
1325 | s390_z196_facilities="no" | |
1326 | cat > $TMPC << EOF | |
1327 | #define STFLE_BITS_Z196 45 /* various z196 facilities ... */ | |
1328 | int main(int argc, char **argv) | |
1329 | { | |
1330 | /* We want just 1 double word to be returned. */ | |
1331 | register unsigned long reg0 asm("0") = 0; | |
1332 | unsigned long stfle_bits; | |
1333 | asm volatile(".machine push" "\n\t" | |
1334 | ".machine \"z9-109\"" "\n\t" | |
1335 | "stfle %0" "\n\t" | |
1336 | ".machine pop" "\n" | |
1337 | : "=QS" (stfle_bits), "+d" (reg0) | |
1338 | : : "cc"); | |
1339 | ||
1340 | if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0) | |
1341 | return 0; | |
1342 | else | |
1343 | return -1; | |
1344 | } | |
1345 | EOF | |
1346 | if compile_prog "" "" "s390_z196_facilities"; then | |
1347 | $TMPE | |
1348 | if [[ $? -eq 0 ]]; then | |
1349 | s390_z196_facilities="yes" | |
1350 | fi | |
1351 | fi | |
1352 | echo "s390_z196_facilities $s390_z196_facilities" | |
1b10477b MM |
1353 | |
1354 | ########################################## | |
1355 | # Check if we have required environment variables configured for libhdfs | |
1356 | if test "$libhdfs" = "yes" ; then | |
1357 | hdfs_conf_error=0 | |
1358 | if test "$JAVA_HOME" = "" ; then | |
1359 | echo "configure: JAVA_HOME should be defined to jdk/jvm path" | |
1360 | hdfs_conf_error=1 | |
1361 | fi | |
1362 | if test "$FIO_LIBHDFS_INCLUDE" = "" ; then | |
1363 | echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path" | |
1364 | hdfs_conf_error=1 | |
1365 | fi | |
1366 | if test "$FIO_LIBHDFS_LIB" = "" ; then | |
1367 | echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path" | |
1368 | hdfs_conf_error=1 | |
1369 | fi | |
1370 | if test "$hdfs_conf_error" = "1" ; then | |
1371 | exit 1 | |
1372 | fi | |
1373 | fi | |
1374 | echo "HDFS engine $libhdfs" | |
1375 | ||
b8116a87 DE |
1376 | ########################################## |
1377 | # Check whether we have MTD | |
1378 | mtd="no" | |
1379 | cat > $TMPC << EOF | |
1380 | #include <mtd/mtd-user.h> | |
1381 | #include <sys/ioctl.h> | |
1382 | int main(int argc, char **argv) | |
1383 | { | |
1384 | struct mtd_info_user info; | |
400cd0ff | 1385 | info.type = MTD_MLCNANDFLASH; |
b8116a87 DE |
1386 | return ioctl(0, MEMGETINFO, &info); |
1387 | } | |
1388 | EOF | |
1389 | if compile_prog "" "" "mtd"; then | |
1390 | mtd="yes" | |
1391 | fi | |
1392 | echo "MTD $mtd" | |
1393 | ||
b470a02c SC |
1394 | # Check if we have lex/yacc available |
1395 | yacc="no" | |
e7b2c7a3 | 1396 | yacc_is_bison="no" |
b470a02c SC |
1397 | lex="no" |
1398 | arith="no" | |
cf6dd80e | 1399 | if test "$targetos" != "SunOS" ; then |
e7b2c7a3 | 1400 | LEX=$(which lex 2> /dev/null) |
b470a02c SC |
1401 | if test -x "$LEX" ; then |
1402 | lex="yes" | |
1403 | fi | |
7e0049e9 | 1404 | YACC=$(which bison 2> /dev/null) |
b470a02c SC |
1405 | if test -x "$YACC" ; then |
1406 | yacc="yes" | |
7e0049e9 | 1407 | yacc_is_bison="yes" |
e7b2c7a3 | 1408 | else |
7e0049e9 | 1409 | YACC=$(which yacc 2> /dev/null) |
e7b2c7a3 JA |
1410 | if test -x "$YACC" ; then |
1411 | yacc="yes" | |
e7b2c7a3 | 1412 | fi |
b470a02c SC |
1413 | fi |
1414 | if test "$yacc" = "yes" && test "$lex" = "yes" ; then | |
1415 | arith="yes" | |
1416 | fi | |
1417 | ||
1418 | if test "$arith" = "yes" ; then | |
1419 | cat > $TMPC << EOF | |
1420 | extern int yywrap(void); | |
1421 | ||
1422 | int main(int argc, char **argv) | |
1423 | { | |
1424 | yywrap(); | |
1425 | return 0; | |
1426 | } | |
1427 | EOF | |
719cda03 JA |
1428 | if compile_prog "" "-ll" "lex"; then |
1429 | LIBS="-ll $LIBS" | |
b470a02c SC |
1430 | else |
1431 | arith="no" | |
1432 | fi | |
1433 | fi | |
cf6dd80e | 1434 | fi |
b470a02c SC |
1435 | |
1436 | echo "lex/yacc for arithmetic $arith" | |
1437 | ||
67bf9823 JA |
1438 | ############################################################################# |
1439 | ||
67bf9823 | 1440 | if test "$wordsize" = "64" ; then |
4feafb1e | 1441 | output_sym "CONFIG_64BIT" |
67bf9823 | 1442 | elif test "$wordsize" = "32" ; then |
4feafb1e | 1443 | output_sym "CONFIG_32BIT" |
67bf9823 | 1444 | else |
d7145a78 | 1445 | fatal "Unknown wordsize!" |
67bf9823 | 1446 | fi |
0dcebdf4 | 1447 | if test "$bigendian" = "yes" ; then |
4feafb1e | 1448 | output_sym "CONFIG_BIG_ENDIAN" |
0dcebdf4 | 1449 | else |
4feafb1e | 1450 | output_sym "CONFIG_LITTLE_ENDIAN" |
0dcebdf4 | 1451 | fi |
3989b143 JA |
1452 | if test "$zlib" = "yes" ; then |
1453 | output_sym "CONFIG_ZLIB" | |
1454 | fi | |
67bf9823 | 1455 | if test "$libaio" = "yes" ; then |
4feafb1e | 1456 | output_sym "CONFIG_LIBAIO" |
67bf9823 JA |
1457 | fi |
1458 | if test "$posix_aio" = "yes" ; then | |
4feafb1e | 1459 | output_sym "CONFIG_POSIXAIO" |
67bf9823 JA |
1460 | fi |
1461 | if test "$posix_aio_fsync" = "yes" ; then | |
4feafb1e | 1462 | output_sym "CONFIG_POSIXAIO_FSYNC" |
67bf9823 JA |
1463 | fi |
1464 | if test "$linux_fallocate" = "yes" ; then | |
4feafb1e | 1465 | output_sym "CONFIG_LINUX_FALLOCATE" |
67bf9823 JA |
1466 | fi |
1467 | if test "$posix_fallocate" = "yes" ; then | |
4feafb1e | 1468 | output_sym "CONFIG_POSIX_FALLOCATE" |
67bf9823 JA |
1469 | fi |
1470 | if test "$fdatasync" = "yes" ; then | |
4feafb1e | 1471 | output_sym "CONFIG_FDATASYNC" |
67bf9823 JA |
1472 | fi |
1473 | if test "$sync_file_range" = "yes" ; then | |
4feafb1e | 1474 | output_sym "CONFIG_SYNC_FILE_RANGE" |
67bf9823 JA |
1475 | fi |
1476 | if test "$sfaa" = "yes" ; then | |
4feafb1e | 1477 | output_sym "CONFIG_SFAA" |
67bf9823 | 1478 | fi |
954cd73a | 1479 | if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then |
4feafb1e | 1480 | output_sym "CONFIG_RDMA" |
67bf9823 JA |
1481 | fi |
1482 | if test "$clock_gettime" = "yes" ; then | |
4feafb1e | 1483 | output_sym "CONFIG_CLOCK_GETTIME" |
67bf9823 JA |
1484 | fi |
1485 | if test "$clock_monotonic" = "yes" ; then | |
4feafb1e | 1486 | output_sym "CONFIG_CLOCK_MONOTONIC" |
67bf9823 JA |
1487 | fi |
1488 | if test "$clock_monotonic_precise" = "yes" ; then | |
4feafb1e | 1489 | output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE" |
67bf9823 JA |
1490 | fi |
1491 | if test "$gettimeofday" = "yes" ; then | |
4feafb1e | 1492 | output_sym "CONFIG_GETTIMEOFDAY" |
67bf9823 JA |
1493 | fi |
1494 | if test "$posix_fadvise" = "yes" ; then | |
4feafb1e | 1495 | output_sym "CONFIG_POSIX_FADVISE" |
67bf9823 JA |
1496 | fi |
1497 | if test "$linux_3arg_affinity" = "yes" ; then | |
4feafb1e | 1498 | output_sym "CONFIG_3ARG_AFFINITY" |
67bf9823 | 1499 | elif test "$linux_2arg_affinity" = "yes" ; then |
4feafb1e | 1500 | output_sym "CONFIG_2ARG_AFFINITY" |
67bf9823 JA |
1501 | fi |
1502 | if test "$strsep" = "yes" ; then | |
4feafb1e | 1503 | output_sym "CONFIG_STRSEP" |
67bf9823 | 1504 | fi |
9ad8da82 JA |
1505 | if test "$strcasestr" = "yes" ; then |
1506 | output_sym "CONFIG_STRCASESTR" | |
1507 | fi | |
67bf9823 | 1508 | if test "$getopt_long_only" = "yes" ; then |
4feafb1e | 1509 | output_sym "CONFIG_GETOPT_LONG_ONLY" |
67bf9823 JA |
1510 | fi |
1511 | if test "$inet_aton" = "yes" ; then | |
4feafb1e | 1512 | output_sym "CONFIG_INET_ATON" |
67bf9823 JA |
1513 | fi |
1514 | if test "$socklen_t" = "yes" ; then | |
4feafb1e | 1515 | output_sym "CONFIG_SOCKLEN_T" |
67bf9823 JA |
1516 | fi |
1517 | if test "$ext4_me" = "yes" ; then | |
4feafb1e | 1518 | output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT" |
67bf9823 JA |
1519 | fi |
1520 | if test "$linux_splice" = "yes" ; then | |
4feafb1e | 1521 | output_sym "CONFIG_LINUX_SPLICE" |
67bf9823 JA |
1522 | fi |
1523 | if test "$guasi" = "yes" ; then | |
4feafb1e | 1524 | output_sym "CONFIG_GUASI" |
67bf9823 JA |
1525 | fi |
1526 | if test "$fusion_aw" = "yes" ; then | |
4feafb1e | 1527 | output_sym "CONFIG_FUSION_AW" |
67bf9823 | 1528 | fi |
50206d9b | 1529 | if test "$libnuma_v2" = "yes" ; then |
4feafb1e | 1530 | output_sym "CONFIG_LIBNUMA" |
67bf9823 JA |
1531 | fi |
1532 | if test "$solaris_aio" = "yes" ; then | |
4feafb1e | 1533 | output_sym "CONFIG_SOLARISAIO" |
67bf9823 JA |
1534 | fi |
1535 | if test "$tls_thread" = "yes" ; then | |
4feafb1e | 1536 | output_sym "CONFIG_TLS_THREAD" |
67bf9823 | 1537 | fi |
44404c5a | 1538 | if test "$rusage_thread" = "yes" ; then |
4feafb1e | 1539 | output_sym "CONFIG_RUSAGE_THREAD" |
67bf9823 | 1540 | fi |
91f94d5b JA |
1541 | if test "$gfio" = "yes" ; then |
1542 | echo "CONFIG_GFIO=y" >> $config_host_mak | |
1543 | fi | |
c8931876 JA |
1544 | if test "$esx" = "yes" ; then |
1545 | output_sym "CONFIG_ESX" | |
1546 | output_sym "CONFIG_NO_SHM" | |
1547 | fi | |
7e09a9f1 JA |
1548 | if test "$sched_idle" = "yes" ; then |
1549 | output_sym "CONFIG_SCHED_IDLE" | |
1550 | fi | |
1eafa37a JA |
1551 | if test "$tcp_nodelay" = "yes" ; then |
1552 | output_sym "CONFIG_TCP_NODELAY" | |
1553 | fi | |
1008602c JA |
1554 | if test "$window_size" = "yes" ; then |
1555 | output_sym "CONFIG_NET_WINDOWSIZE" | |
1556 | fi | |
e5f34d95 JA |
1557 | if test "$mss" = "yes" ; then |
1558 | output_sym "CONFIG_NET_MSS" | |
1559 | fi | |
38b9354a JA |
1560 | if test "$rlimit_memlock" = "yes" ; then |
1561 | output_sym "CONFIG_RLIMIT_MEMLOCK" | |
1562 | fi | |
07fc0acd JA |
1563 | if test "$pwritev" = "yes" ; then |
1564 | output_sym "CONFIG_PWRITEV" | |
1565 | fi | |
ecad55e9 JA |
1566 | if test "$ipv6" = "yes" ; then |
1567 | output_sym "CONFIG_IPV6" | |
1568 | fi | |
fc5c0345 DG |
1569 | if test "$rbd" = "yes" ; then |
1570 | output_sym "CONFIG_RBD" | |
1571 | fi | |
903b2812 JA |
1572 | if test "$rbd_inval" = "yes" ; then |
1573 | output_sym "CONFIG_RBD_INVAL" | |
1574 | fi | |
2e802282 JA |
1575 | if test "$setvbuf" = "yes" ; then |
1576 | output_sym "CONFIG_SETVBUF" | |
1577 | fi | |
81795ce3 CE |
1578 | if test "$s390_z196_facilities" = "yes" ; then |
1579 | output_sym "CONFIG_S390_Z196_FACILITIES" | |
1580 | CFLAGS="$CFLAGS -march=z9-109" | |
1581 | fi | |
6e7d7dfb | 1582 | if test "$gfapi" = "yes" ; then |
1583 | output_sym "CONFIG_GFAPI" | |
1584 | fi | |
6fa14b99 | 1585 | if test "$gf_fadvise" = "yes" ; then |
1586 | output_sym "CONFIG_GF_FADVISE" | |
1587 | fi | |
6876c98c JA |
1588 | if test "$gf_trim" = "yes" ; then |
1589 | output_sym "CONFIG_GF_TRIM" | |
1590 | fi | |
1b10477b MM |
1591 | if test "$libhdfs" = "yes" ; then |
1592 | output_sym "CONFIG_LIBHDFS" | |
1527dc50 FB |
1593 | echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak |
1594 | echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak | |
1595 | echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak | |
1596 | fi | |
b8116a87 DE |
1597 | if test "$mtd" = "yes" ; then |
1598 | output_sym "CONFIG_MTD" | |
1599 | fi | |
b470a02c SC |
1600 | if test "$arith" = "yes" ; then |
1601 | output_sym "CONFIG_ARITHMETIC" | |
e7b2c7a3 JA |
1602 | if test "$yacc_is_bison" = "yes" ; then |
1603 | echo "YACC=$YACC -y" >> $config_host_mak | |
1604 | else | |
1605 | echo "YACC=$YACC" >> $config_host_mak | |
1606 | fi | |
b470a02c | 1607 | fi |
67bf9823 | 1608 | |
605cf82e JA |
1609 | if test "$zlib" = "no" ; then |
1610 | echo "Consider installing zlib-dev (zlib-devel), some fio features depend on it." | |
1611 | fi | |
1612 | ||
67bf9823 | 1613 | echo "LIBS+=$LIBS" >> $config_host_mak |
86719845 | 1614 | echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak |
91f94d5b | 1615 | echo "CFLAGS+=$CFLAGS" >> $config_host_mak |
d2aeedb9 | 1616 | echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak |
67bf9823 | 1617 | echo "CC=$cc" >> $config_host_mak |
af4862b3 | 1618 | echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak |
020d54bd | 1619 | echo "INSTALL_PREFIX=$prefix" >> $config_host_mak |