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