Commit | Line | Data |
---|---|---|
67bf9823 JA |
1 | #!/bin/sh |
2 | # | |
3 | # Fio configure script. Heavily influenced by the manual qemu configure | |
c922e0b0 | 4 | # script. Sad this is easier than autoconf and enemies. |
67bf9823 JA |
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 | ||
484b0b65 TK |
40 | # Print result for each configuration test |
41 | print_config() { | |
42 | printf "%-30s%s\n" "$1" "$2" | |
43 | } | |
44 | ||
44404c5a | 45 | # Default CFLAGS |
af4862b3 JA |
46 | CFLAGS="-D_GNU_SOURCE -include config-host.h" |
47 | BUILD_CFLAGS="" | |
67bf9823 JA |
48 | |
49 | # Print a helpful header at the top of config.log | |
50 | echo "# FIO configure log $(date)" >> config.log | |
51 | printf "# Configured with:" >> config.log | |
52 | printf " '%s'" "$0" "$@" >> config.log | |
53 | echo >> config.log | |
54 | echo "#" >> config.log | |
55 | ||
7560fe7c JA |
56 | # Print configure header at the top of $config_host_h |
57 | echo "/*" > $config_host_h | |
58 | echo " * Automatically generated by configure - do not modify" >> $config_host_h | |
59 | printf " * Configured with:" >> $config_host_h | |
60 | printf " * '%s'" "$0" "$@" >> $config_host_h | |
61 | echo "" >> $config_host_h | |
62 | echo " */" >> $config_host_h | |
63 | ||
67bf9823 JA |
64 | do_cc() { |
65 | # Run the compiler, capturing its output to the log. | |
66 | echo $cc "$@" >> config.log | |
67 | $cc "$@" >> config.log 2>&1 || return $? | |
68 | # Test passed. If this is an --enable-werror build, rerun | |
69 | # the test with -Werror and bail out if it fails. This | |
70 | # makes warning-generating-errors in configure test code | |
71 | # obvious to developers. | |
72 | if test "$werror" != "yes"; then | |
73 | return 0 | |
74 | fi | |
75 | # Don't bother rerunning the compile if we were already using -Werror | |
76 | case "$*" in | |
77 | *-Werror*) | |
78 | return 0 | |
79 | ;; | |
80 | esac | |
81 | echo $cc -Werror "$@" >> config.log | |
82 | $cc -Werror "$@" >> config.log 2>&1 && return $? | |
83 | echo "ERROR: configure test passed without -Werror but failed with -Werror." | |
84 | echo "This is probably a bug in the configure script. The failing command" | |
85 | echo "will be at the bottom of config.log." | |
d7145a78 | 86 | fatal "You can run configure with --disable-werror to bypass this check." |
67bf9823 JA |
87 | } |
88 | ||
89 | compile_object() { | |
90 | do_cc $CFLAGS -c -o $TMPO $TMPC | |
91 | } | |
92 | ||
93 | compile_prog() { | |
94 | local_cflags="$1" | |
adaa46d8 | 95 | local_ldflags="$2 $LIBS" |
67bf9823 JA |
96 | echo "Compiling test case $3" >> config.log |
97 | do_cc $CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags | |
98 | } | |
99 | ||
100 | feature_not_found() { | |
101 | feature=$1 | |
c55d728b | 102 | packages=$2 |
67bf9823 JA |
103 | |
104 | echo "ERROR" | |
105 | echo "ERROR: User requested feature $feature" | |
c55d728b JA |
106 | if test ! -z "$packages" ; then |
107 | echo "ERROR: That feature needs $packages installed" | |
108 | fi | |
67bf9823 | 109 | echo "ERROR: configure was not able to find it" |
d7145a78 | 110 | fatal "ERROR" |
67bf9823 JA |
111 | } |
112 | ||
113 | has() { | |
114 | type "$1" >/dev/null 2>&1 | |
115 | } | |
116 | ||
117 | check_define() { | |
118 | cat > $TMPC <<EOF | |
119 | #if !defined($1) | |
120 | #error $1 not defined | |
121 | #endif | |
122 | int main(void) | |
123 | { | |
124 | return 0; | |
125 | } | |
126 | EOF | |
127 | compile_object | |
128 | } | |
129 | ||
4feafb1e JA |
130 | output_sym() { |
131 | echo "$1=y" >> $config_host_mak | |
132 | echo "#define $1" >> $config_host_h | |
133 | } | |
134 | ||
67bf9823 JA |
135 | targetos="" |
136 | cpu="" | |
137 | ||
91f94d5b | 138 | # default options |
47f44635 JA |
139 | show_help="no" |
140 | exit_val=0 | |
ebec2094 | 141 | gfio_check="no" |
1b10477b | 142 | libhdfs="no" |
43f3cec2 | 143 | pmemblk="no" |
cbb15e42 | 144 | devdax="no" |
ae0db592 | 145 | pmem="no" |
de26b824 | 146 | disable_lex="" |
3ee2a3c1 | 147 | disable_pmem="no" |
a817dc3b | 148 | disable_native="no" |
9f75af77 | 149 | march_set="no" |
020d54bd | 150 | prefix=/usr/local |
91f94d5b | 151 | |
cb1125b0 JA |
152 | # parse options |
153 | for opt do | |
154 | optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` | |
155 | case "$opt" in | |
020d54bd JA |
156 | --prefix=*) prefix="$optarg" |
157 | ;; | |
8b156d8e JA |
158 | --cpu=*) cpu="$optarg" |
159 | ;; | |
c8931876 JA |
160 | # esx is cross compiled and cannot be detect through simple uname calls |
161 | --esx) | |
162 | esx="yes" | |
163 | ;; | |
cb1125b0 JA |
164 | --cc=*) CC="$optarg" |
165 | ;; | |
208e4c8b JA |
166 | --extra-cflags=*) CFLAGS="$CFLAGS $optarg" |
167 | ;; | |
b7c12794 | 168 | --build-32bit-win) build_32bit_win="yes" |
7409711b | 169 | ;; |
d2aeedb9 JA |
170 | --build-static) build_static="yes" |
171 | ;; | |
bad7e42c | 172 | --enable-gfio) gfio_check="yes" |
899fab33 | 173 | ;; |
44462517 CF |
174 | --disable-numa) disable_numa="yes" |
175 | ;; | |
f678f8d2 MF |
176 | --disable-rdma) disable_rdma="yes" |
177 | ;; | |
d5f9b0ea IF |
178 | --disable-rados) disable_rados="yes" |
179 | ;; | |
ce18290e TM |
180 | --disable-rbd) disable_rbd="yes" |
181 | ;; | |
182 | --disable-gfapi) disable_gfapi="yes" | |
183 | ;; | |
1b10477b MM |
184 | --enable-libhdfs) libhdfs="yes" |
185 | ;; | |
a655bbc4 JA |
186 | --disable-lex) disable_lex="yes" |
187 | ;; | |
de26b824 JA |
188 | --enable-lex) disable_lex="no" |
189 | ;; | |
61054f0d JA |
190 | --disable-shm) no_shm="yes" |
191 | ;; | |
192 | --disable-optimizations) disable_opt="yes" | |
ba40757e | 193 | ;; |
3ee2a3c1 DJ |
194 | --disable-pmem) disable_pmem="yes" |
195 | ;; | |
03553853 YR |
196 | --enable-cuda) enable_cuda="yes" |
197 | ;; | |
a817dc3b JA |
198 | --disable-native) disable_native="yes" |
199 | ;; | |
827da4f5 | 200 | --help) |
47f44635 | 201 | show_help="yes" |
827da4f5 | 202 | ;; |
cb1125b0 JA |
203 | *) |
204 | echo "Bad option $opt" | |
47f44635 JA |
205 | show_help="yes" |
206 | exit_val=1 | |
cb1125b0 JA |
207 | esac |
208 | done | |
209 | ||
47f44635 | 210 | if test "$show_help" = "yes" ; then |
05cef7a0 TK |
211 | echo "--prefix= Use this directory as installation prefix" |
212 | echo "--cpu= Specify target CPU if auto-detect fails" | |
213 | echo "--cc= Specify compiler to use" | |
214 | echo "--extra-cflags= Specify extra CFLAGS to pass to compiler" | |
215 | echo "--build-32bit-win Enable 32-bit build on Windows" | |
216 | echo "--build-static Build a static fio" | |
217 | echo "--esx Configure build options for esx" | |
218 | echo "--enable-gfio Enable building of gtk gfio" | |
219 | echo "--disable-numa Disable libnuma even if found" | |
03553853 | 220 | echo "--disable-rdma Disable RDMA support even if found" |
05cef7a0 TK |
221 | echo "--disable-gfapi Disable gfapi" |
222 | echo "--enable-libhdfs Enable hdfs support" | |
223 | echo "--disable-lex Disable use of lex/yacc for math" | |
224 | echo "--disable-pmem Disable pmem based engines even if found" | |
225 | echo "--enable-lex Enable use of lex/yacc for math" | |
226 | echo "--disable-shm Disable SHM support" | |
61054f0d | 227 | echo "--disable-optimizations Don't enable compiler optimizations" |
03553853 | 228 | echo "--enable-cuda Enable GPUDirect RDMA support" |
a817dc3b | 229 | echo "--disable-native Don't build for native host" |
b7a99316 | 230 | exit $exit_val |
47f44635 JA |
231 | fi |
232 | ||
47986339 | 233 | cross_prefix=${cross_prefix-${CROSS_COMPILE}} |
b73af738 SW |
234 | # Preferred compiler (can be overriden later after we know the platform): |
235 | # ${CC} (if set) | |
236 | # ${cross_prefix}gcc (if cross-prefix specified) | |
237 | # gcc if available | |
238 | # clang if available | |
239 | if test -z "${CC}${cross_prefix}"; then | |
240 | if has gcc; then | |
241 | cc=gcc | |
242 | elif has clang; then | |
243 | cc=clang | |
244 | fi | |
245 | else | |
246 | cc="${CC-${cross_prefix}gcc}" | |
247 | fi | |
47986339 | 248 | |
6d0e9f83 AC |
249 | if check_define __ANDROID__ ; then |
250 | targetos="Android" | |
251 | elif check_define __linux__ ; then | |
67bf9823 | 252 | targetos="Linux" |
67bf9823 JA |
253 | elif check_define __OpenBSD__ ; then |
254 | targetos='OpenBSD' | |
255 | elif check_define __sun__ ; then | |
256 | targetos='SunOS' | |
7cb024f8 | 257 | CFLAGS="$CFLAGS -D_REENTRANT" |
b24f59ab SH |
258 | elif check_define _WIN32 ; then |
259 | targetos='CYGWIN' | |
67bf9823 JA |
260 | else |
261 | targetos=`uname -s` | |
262 | fi | |
263 | ||
53cd4eee AC |
264 | echo "# Automatically generated by configure - do not modify" > $config_host_mak |
265 | printf "# Configured with:" >> $config_host_mak | |
266 | printf " '%s'" "$0" "$@" >> $config_host_mak | |
267 | echo >> $config_host_mak | |
268 | echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak | |
269 | ||
61054f0d JA |
270 | if test "$no_shm" = "yes" ; then |
271 | output_sym "CONFIG_NO_SHM" | |
272 | fi | |
273 | ||
274 | if test "$disable_opt" = "yes" ; then | |
275 | output_sym "CONFIG_FIO_NO_OPT" | |
276 | fi | |
277 | ||
67bf9823 JA |
278 | # Some host OSes need non-standard checks for which CPU to use. |
279 | # Note that these checks are broken for cross-compilation: if you're | |
280 | # cross-compiling to one of these OSes then you'll need to specify | |
281 | # the correct CPU with the --cpu option. | |
282 | case $targetos in | |
baa78fdc | 283 | AIX|OpenBSD) |
de26b824 | 284 | # Unless explicitly enabled, turn off lex. |
baa78fdc | 285 | # OpenBSD will hit syntax error when enabled. |
de26b824 JA |
286 | if test -z "$disable_lex" ; then |
287 | disable_lex="yes" | |
daf705b5 JA |
288 | else |
289 | force_no_lex_o="yes" | |
de26b824 JA |
290 | fi |
291 | ;; | |
67bf9823 JA |
292 | Darwin) |
293 | # on Leopard most of the system is 32-bit, so we have to ask the kernel if | |
294 | # we can run 64-bit userspace code. | |
295 | # If the user didn't specify a CPU explicitly and the kernel says this is | |
296 | # 64 bit hw, then assume x86_64. Otherwise fall through to the usual | |
297 | # detection code. | |
298 | if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then | |
299 | cpu="x86_64" | |
300 | fi | |
ccf2d89d SW |
301 | # Error at compile time linking of weak/partial symbols if possible... |
302 | cat > $TMPC <<EOF | |
303 | int main(void) | |
304 | { | |
305 | return 0; | |
306 | } | |
307 | EOF | |
308 | if compile_prog "" "-Wl,-no_weak_imports" "disable weak symbols"; then | |
309 | echo "Disabling weak symbols" | |
310 | LDFLAGS="$LDFLAGS -Wl,-no_weak_imports" | |
311 | fi | |
67bf9823 JA |
312 | ;; |
313 | SunOS) | |
314 | # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo | |
315 | if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then | |
316 | cpu="x86_64" | |
317 | fi | |
adaa46d8 | 318 | LIBS="-lnsl -lsocket" |
cfd94f79 JA |
319 | ;; |
320 | CYGWIN*) | |
ca205a75 TK |
321 | # We still force some options, so keep this message here. |
322 | echo "Forcing some known good options on Windows" | |
b73af738 | 323 | if test -z "${CC}${cross_prefix}"; then |
7409711b | 324 | if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then |
b73af738 | 325 | cc="i686-w64-mingw32-gcc" |
7409711b | 326 | else |
b73af738 | 327 | cc="x86_64-w64-mingw32-gcc" |
7409711b | 328 | fi |
4578d01f | 329 | fi |
7409711b HL |
330 | if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then |
331 | output_sym "CONFIG_32BIT" | |
332 | else | |
333 | output_sym "CONFIG_64BIT_LLP64" | |
334 | fi | |
ca205a75 TK |
335 | # We need this to be output_sym'd here because this is Windows specific. |
336 | # The regular configure path never sets this config. | |
4feafb1e | 337 | output_sym "CONFIG_WINDOWSAIO" |
ca205a75 TK |
338 | # We now take the regular configuration path without having exit 0 here. |
339 | # Flags below are still necessary mostly for MinGW. | |
340 | socklen_t="yes" | |
341 | sfaa="yes" | |
a250edd0 JA |
342 | sync_sync="yes" |
343 | cmp_swap="yes" | |
ca205a75 TK |
344 | rusage_thread="yes" |
345 | fdatasync="yes" | |
346 | clock_gettime="yes" # clock_monotonic probe has dependency on this | |
347 | clock_monotonic="yes" | |
348 | gettimeofday="yes" | |
349 | sched_idle="yes" | |
350 | tcp_nodelay="yes" | |
351 | tls_thread="yes" | |
352 | static_assert="yes" | |
353 | ipv6="yes" | |
4252396e | 354 | mkdir_two="no" |
b86770c6 | 355 | echo "BUILD_CFLAGS=$CFLAGS -include config-host.h -D_GNU_SOURCE" >> $config_host_mak |
6d0e9f83 | 356 | ;; |
67bf9823 JA |
357 | esac |
358 | ||
b73af738 SW |
359 | # Now we know the target platform we can have another guess at the preferred |
360 | # compiler when it wasn't explictly set | |
361 | if test -z "${CC}${cross_prefix}"; then | |
362 | if test "$targetos" = "FreeBSD" || test "$targetos" = "Darwin"; then | |
363 | if has clang; then | |
364 | cc=clang | |
365 | fi | |
366 | fi | |
367 | fi | |
368 | if test -z "$cc"; then | |
369 | echo "configure: failed to find compiler" | |
370 | exit 1 | |
371 | fi | |
372 | ||
67bf9823 JA |
373 | if test ! -z "$cpu" ; then |
374 | # command line argument | |
375 | : | |
376 | elif check_define __i386__ ; then | |
377 | cpu="i386" | |
378 | elif check_define __x86_64__ ; then | |
379 | cpu="x86_64" | |
380 | elif check_define __sparc__ ; then | |
381 | if check_define __arch64__ ; then | |
382 | cpu="sparc64" | |
383 | else | |
384 | cpu="sparc" | |
385 | fi | |
386 | elif check_define _ARCH_PPC ; then | |
387 | if check_define _ARCH_PPC64 ; then | |
388 | cpu="ppc64" | |
389 | else | |
390 | cpu="ppc" | |
391 | fi | |
392 | elif check_define __mips__ ; then | |
393 | cpu="mips" | |
394 | elif check_define __ia64__ ; then | |
395 | cpu="ia64" | |
396 | elif check_define __s390__ ; then | |
397 | if check_define __s390x__ ; then | |
398 | cpu="s390x" | |
399 | else | |
400 | cpu="s390" | |
401 | fi | |
402 | elif check_define __arm__ ; then | |
403 | cpu="arm" | |
214e2d56 | 404 | elif check_define __aarch64__ ; then |
405 | cpu="aarch64" | |
67bf9823 JA |
406 | elif check_define __hppa__ ; then |
407 | cpu="hppa" | |
408 | else | |
409 | cpu=`uname -m` | |
410 | fi | |
411 | ||
412 | # Normalise host CPU name and set ARCH. | |
413 | case "$cpu" in | |
414 | ia64|ppc|ppc64|s390|s390x|sparc64) | |
415 | cpu="$cpu" | |
416 | ;; | |
417 | i386|i486|i586|i686|i86pc|BePC) | |
95ef38ab | 418 | cpu="x86" |
67bf9823 JA |
419 | ;; |
420 | x86_64|amd64) | |
421 | cpu="x86_64" | |
422 | ;; | |
423 | armv*b|armv*l|arm) | |
424 | cpu="arm" | |
425 | ;; | |
214e2d56 | 426 | aarch64) |
427 | cpu="arm64" | |
428 | ;; | |
67bf9823 JA |
429 | hppa|parisc|parisc64) |
430 | cpu="hppa" | |
431 | ;; | |
432 | mips*) | |
433 | cpu="mips" | |
434 | ;; | |
435 | sparc|sun4[cdmuv]) | |
436 | cpu="sparc" | |
437 | ;; | |
438 | *) | |
8b156d8e | 439 | echo "Unknown CPU" |
67bf9823 JA |
440 | ;; |
441 | esac | |
442 | ||
1a17cfdb AC |
443 | ########################################## |
444 | # check cross compile | |
445 | ||
ca205a75 TK |
446 | if test "$cross_compile" != "yes" ; then |
447 | cross_compile="no" | |
448 | fi | |
1a17cfdb AC |
449 | cat > $TMPC <<EOF |
450 | int main(void) | |
451 | { | |
452 | return 0; | |
453 | } | |
454 | EOF | |
455 | if compile_prog "" "" "cross"; then | |
456 | $TMPE 2>/dev/null || cross_compile="yes" | |
457 | else | |
458 | fatal "compile test failed" | |
459 | fi | |
460 | ||
0dcebdf4 JA |
461 | ########################################## |
462 | # check endianness | |
ca205a75 TK |
463 | if test "$bigendian" != "yes" ; then |
464 | bigendian="no" | |
465 | fi | |
1a17cfdb AC |
466 | if test "$cross_compile" = "no" ; then |
467 | cat > $TMPC <<EOF | |
0dcebdf4 JA |
468 | #include <inttypes.h> |
469 | int main(void) | |
470 | { | |
471 | volatile uint32_t i=0x01234567; | |
472 | return (*((uint8_t*)(&i))) == 0x67; | |
473 | } | |
474 | EOF | |
1a17cfdb AC |
475 | if compile_prog "" "" "endian"; then |
476 | $TMPE && bigendian="yes" | |
477 | fi | |
478 | else | |
479 | # If we're cross compiling, try our best to work it out and rely on the | |
480 | # run-time check to fail if we get it wrong. | |
481 | cat > $TMPC <<EOF | |
482 | #include <endian.h> | |
483 | int main(void) | |
484 | { | |
485 | #if __BYTE_ORDER != __BIG_ENDIAN | |
486 | # error "Unknown endianness" | |
487 | #endif | |
488 | } | |
489 | EOF | |
490 | compile_prog "" "" "endian" && bigendian="yes" | |
491 | check_define "__ARMEB__" && bigendian="yes" | |
492 | check_define "__MIPSEB__" && bigendian="yes" | |
0dcebdf4 JA |
493 | fi |
494 | ||
495 | ||
484b0b65 TK |
496 | print_config "Operating system" "$targetos" |
497 | print_config "CPU" "$cpu" | |
498 | print_config "Big endian" "$bigendian" | |
499 | print_config "Compiler" "$cc" | |
500 | print_config "Cross compile" "$cross_compile" | |
67bf9823 JA |
501 | echo |
502 | ||
d2aeedb9 JA |
503 | ########################################## |
504 | # See if we need to build a static build | |
505 | if test "$build_static" = "yes" ; then | |
506 | CFLAGS="$CFLAGS -ffunction-sections -fdata-sections" | |
507 | LDFLAGS="$LDFLAGS -static -Wl,--gc-sections" | |
508 | else | |
509 | build_static="no" | |
510 | fi | |
484b0b65 | 511 | print_config "Static build" "$build_static" |
d2aeedb9 | 512 | |
67bf9823 JA |
513 | ########################################## |
514 | # check for wordsize | |
515 | wordsize="0" | |
516 | cat > $TMPC <<EOF | |
142429e5 AC |
517 | #include <limits.h> |
518 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) | |
67bf9823 JA |
519 | int main(void) |
520 | { | |
142429e5 | 521 | BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE); |
67bf9823 JA |
522 | return 0; |
523 | } | |
524 | EOF | |
142429e5 AC |
525 | if compile_prog "-DWORDSIZE=32" "" "wordsize"; then |
526 | wordsize="32" | |
527 | elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then | |
528 | wordsize="64" | |
529 | else | |
530 | fatal "Unknown wordsize" | |
67bf9823 | 531 | fi |
484b0b65 | 532 | print_config "Wordsize" "$wordsize" |
67bf9823 | 533 | |
a9bca4aa JA |
534 | ########################################## |
535 | # zlib probe | |
ca205a75 TK |
536 | if test "$zlib" != "yes" ; then |
537 | zlib="no" | |
538 | fi | |
a9bca4aa | 539 | cat > $TMPC <<EOF |
804a1e05 | 540 | #include <zlib.h> |
a9bca4aa JA |
541 | int main(void) |
542 | { | |
543 | z_stream stream; | |
544 | if (inflateInit(&stream) != Z_OK) | |
545 | return 1; | |
546 | return 0; | |
547 | } | |
548 | EOF | |
549 | if compile_prog "" "-lz" "zlib" ; then | |
550 | zlib=yes | |
551 | LIBS="-lz $LIBS" | |
a9bca4aa | 552 | fi |
484b0b65 | 553 | print_config "zlib" "$zlib" |
a9bca4aa | 554 | |
67bf9823 JA |
555 | ########################################## |
556 | # linux-aio probe | |
ca205a75 TK |
557 | if test "$libaio" != "yes" ; then |
558 | libaio="no" | |
559 | fi | |
7c77ebef | 560 | if test "$esx" != "yes" ; then |
561 | cat > $TMPC <<EOF | |
67bf9823 JA |
562 | #include <libaio.h> |
563 | #include <stddef.h> | |
564 | int main(void) | |
565 | { | |
566 | io_setup(0, NULL); | |
567 | return 0; | |
568 | } | |
569 | EOF | |
7c77ebef | 570 | if compile_prog "" "-laio" "libaio" ; then |
571 | libaio=yes | |
572 | LIBS="-laio $LIBS" | |
573 | else | |
574 | if test "$libaio" = "yes" ; then | |
575 | feature_not_found "linux AIO" "libaio-dev or libaio-devel" | |
576 | fi | |
577 | libaio=no | |
67bf9823 | 578 | fi |
67bf9823 | 579 | fi |
484b0b65 | 580 | print_config "Linux AIO support" "$libaio" |
67bf9823 JA |
581 | |
582 | ########################################## | |
583 | # posix aio probe | |
ca205a75 TK |
584 | if test "$posix_aio" != "yes" ; then |
585 | posix_aio="no" | |
586 | fi | |
587 | if test "$posix_aio_lrt" != "yes" ; then | |
588 | posix_aio_lrt="no" | |
589 | fi | |
67bf9823 JA |
590 | cat > $TMPC <<EOF |
591 | #include <aio.h> | |
592 | int main(void) | |
593 | { | |
594 | struct aiocb cb; | |
595 | aio_read(&cb); | |
596 | return 0; | |
597 | } | |
598 | EOF | |
599 | if compile_prog "" "" "posixaio" ; then | |
600 | posix_aio="yes" | |
601 | elif compile_prog "" "-lrt" "posixaio"; then | |
602 | posix_aio="yes" | |
603 | posix_aio_lrt="yes" | |
604 | LIBS="-lrt $LIBS" | |
605 | fi | |
484b0b65 TK |
606 | print_config "POSIX AIO support" "$posix_aio" |
607 | print_config "POSIX AIO support needs -lrt" "$posix_aio_lrt" | |
67bf9823 JA |
608 | |
609 | ########################################## | |
610 | # posix aio fsync probe | |
ca205a75 TK |
611 | if test "$posix_aio_fsync" != "yes" ; then |
612 | posix_aio_fsync="no" | |
613 | fi | |
67bf9823 JA |
614 | if test "$posix_aio" = "yes" ; then |
615 | cat > $TMPC <<EOF | |
616 | #include <fcntl.h> | |
617 | #include <aio.h> | |
618 | int main(void) | |
619 | { | |
620 | struct aiocb cb; | |
621 | return aio_fsync(O_SYNC, &cb); | |
622 | return 0; | |
623 | } | |
624 | EOF | |
625 | if compile_prog "" "$LIBS" "posix_aio_fsync" ; then | |
626 | posix_aio_fsync=yes | |
627 | fi | |
628 | fi | |
484b0b65 | 629 | print_config "POSIX AIO fsync" "$posix_aio_fsync" |
67bf9823 | 630 | |
06eac6b2 SW |
631 | ########################################## |
632 | # POSIX pshared attribute probe | |
d418fa90 TK |
633 | if test "$posix_pshared" != "yes" ; then |
634 | posix_pshared="no" | |
635 | fi | |
06eac6b2 SW |
636 | cat > $TMPC <<EOF |
637 | #include <unistd.h> | |
638 | int main(void) | |
639 | { | |
640 | #if defined(_POSIX_THREAD_PROCESS_SHARED) && ((_POSIX_THREAD_PROCESS_SHARED + 0) > 0) | |
641 | # if defined(__CYGWIN__) | |
642 | # error "_POSIX_THREAD_PROCESS_SHARED is buggy on Cygwin" | |
643 | # elif defined(__APPLE__) | |
644 | # include <AvailabilityMacros.h> | |
645 | # include <TargetConditionals.h> | |
646 | # if TARGET_OS_MAC && MAC_OS_X_VERSION_MIN_REQUIRED < 1070 | |
647 | # error "_POSIX_THREAD_PROCESS_SHARED is buggy/unsupported prior to OSX 10.7" | |
648 | # endif | |
649 | # endif | |
650 | #else | |
651 | # error "_POSIX_THREAD_PROCESS_SHARED is unsupported" | |
652 | #endif | |
653 | return 0; | |
654 | } | |
655 | EOF | |
656 | if compile_prog "" "$LIBS" "posix_pshared" ; then | |
657 | posix_pshared=yes | |
658 | fi | |
484b0b65 | 659 | print_config "POSIX pshared support" "$posix_pshared" |
06eac6b2 | 660 | |
67bf9823 JA |
661 | ########################################## |
662 | # solaris aio probe | |
ca205a75 TK |
663 | if test "$solaris_aio" != "yes" ; then |
664 | solaris_aio="no" | |
665 | fi | |
67bf9823 JA |
666 | cat > $TMPC <<EOF |
667 | #include <sys/types.h> | |
668 | #include <sys/asynch.h> | |
669 | #include <unistd.h> | |
670 | int main(void) | |
671 | { | |
672 | aio_result_t res; | |
673 | return aioread(0, NULL, 0, 0, SEEK_SET, &res); | |
674 | return 0; | |
675 | } | |
676 | EOF | |
677 | if compile_prog "" "-laio" "solarisaio" ; then | |
678 | solaris_aio=yes | |
679 | LIBS="-laio $LIBS" | |
680 | fi | |
484b0b65 | 681 | print_config "Solaris AIO support" "$solaris_aio" |
67bf9823 JA |
682 | |
683 | ########################################## | |
f5cd2907 | 684 | # __sync_fetch_and_add test |
ca205a75 TK |
685 | if test "$sfaa" != "yes" ; then |
686 | sfaa="no" | |
687 | fi | |
67bf9823 | 688 | cat > $TMPC << EOF |
958886d8 JA |
689 | #include <inttypes.h> |
690 | static int sfaa(uint64_t *ptr) | |
67bf9823 | 691 | { |
9c639a76 | 692 | return __sync_fetch_and_add(ptr, 0); |
67bf9823 JA |
693 | } |
694 | ||
695 | int main(int argc, char **argv) | |
696 | { | |
958886d8 | 697 | uint64_t val = 42; |
67bf9823 JA |
698 | sfaa(&val); |
699 | return val; | |
700 | } | |
701 | EOF | |
702 | if compile_prog "" "" "__sync_fetch_and_add()" ; then | |
703 | sfaa="yes" | |
704 | fi | |
484b0b65 | 705 | print_config "__sync_fetch_and_add" "$sfaa" |
67bf9823 | 706 | |
a250edd0 JA |
707 | ########################################## |
708 | # __sync_synchronize() test | |
709 | if test "$sync_sync" != "yes" ; then | |
710 | sync_sync="no" | |
711 | fi | |
712 | cat > $TMPC << EOF | |
713 | #include <inttypes.h> | |
714 | ||
715 | int main(int argc, char **argv) | |
716 | { | |
717 | __sync_synchronize(); | |
718 | return 0; | |
719 | } | |
720 | EOF | |
721 | if compile_prog "" "" "__sync_synchronize()" ; then | |
722 | sync_sync="yes" | |
723 | fi | |
724 | print_config "__sync_synchronize" "$sync_sync" | |
725 | ||
726 | ########################################## | |
727 | # __sync_val_compare_and_swap() test | |
728 | if test "$cmp_swap" != "yes" ; then | |
729 | cmp_swap="no" | |
730 | fi | |
731 | cat > $TMPC << EOF | |
732 | #include <inttypes.h> | |
733 | ||
734 | int main(int argc, char **argv) | |
735 | { | |
736 | int x = 0; | |
737 | return __sync_val_compare_and_swap(&x, 1, 2); | |
738 | } | |
739 | EOF | |
740 | if compile_prog "" "" "__sync_val_compare_and_swap()" ; then | |
741 | cmp_swap="yes" | |
742 | fi | |
743 | print_config "__sync_val_compare_and_swap" "$cmp_swap" | |
744 | ||
67bf9823 JA |
745 | ########################################## |
746 | # libverbs probe | |
ca205a75 TK |
747 | if test "$libverbs" != "yes" ; then |
748 | libverbs="no" | |
749 | fi | |
67bf9823 | 750 | cat > $TMPC << EOF |
eb3bfdd8 | 751 | #include <infiniband/verbs.h> |
67bf9823 JA |
752 | int main(int argc, char **argv) |
753 | { | |
754 | struct ibv_pd *pd = ibv_alloc_pd(NULL); | |
755 | return 0; | |
756 | } | |
757 | EOF | |
f678f8d2 | 758 | if test "$disable_rdma" != "yes" && compile_prog "" "-libverbs" "libverbs" ; then |
67bf9823 JA |
759 | libverbs="yes" |
760 | LIBS="-libverbs $LIBS" | |
761 | fi | |
484b0b65 | 762 | print_config "libverbs" "$libverbs" |
67bf9823 JA |
763 | |
764 | ########################################## | |
765 | # rdmacm probe | |
ca205a75 TK |
766 | if test "$rdmacm" != "yes" ; then |
767 | rdmacm="no" | |
768 | fi | |
67bf9823 JA |
769 | cat > $TMPC << EOF |
770 | #include <stdio.h> | |
771 | #include <rdma/rdma_cma.h> | |
772 | int main(int argc, char **argv) | |
773 | { | |
774 | rdma_destroy_qp(NULL); | |
775 | return 0; | |
776 | } | |
777 | EOF | |
f678f8d2 | 778 | if test "$disable_rdma" != "yes" && compile_prog "" "-lrdmacm" "rdma"; then |
67bf9823 JA |
779 | rdmacm="yes" |
780 | LIBS="-lrdmacm $LIBS" | |
781 | fi | |
484b0b65 | 782 | print_config "rdmacm" "$rdmacm" |
67bf9823 JA |
783 | |
784 | ########################################## | |
785 | # Linux fallocate probe | |
ca205a75 TK |
786 | if test "$linux_fallocate" != "yes" ; then |
787 | linux_fallocate="no" | |
788 | fi | |
67bf9823 JA |
789 | cat > $TMPC << EOF |
790 | #include <stdio.h> | |
aa6738a5 | 791 | #include <fcntl.h> |
67bf9823 JA |
792 | #include <linux/falloc.h> |
793 | int main(int argc, char **argv) | |
794 | { | |
795 | int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024); | |
796 | return r; | |
797 | } | |
798 | EOF | |
799 | if compile_prog "" "" "linux_fallocate"; then | |
800 | linux_fallocate="yes" | |
801 | fi | |
484b0b65 | 802 | print_config "Linux fallocate" "$linux_fallocate" |
67bf9823 JA |
803 | |
804 | ########################################## | |
805 | # POSIX fadvise probe | |
ca205a75 TK |
806 | if test "$posix_fadvise" != "yes" ; then |
807 | posix_fadvise="no" | |
808 | fi | |
67bf9823 JA |
809 | cat > $TMPC << EOF |
810 | #include <stdio.h> | |
811 | #include <fcntl.h> | |
812 | int main(int argc, char **argv) | |
813 | { | |
814 | int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL); | |
815 | return r; | |
816 | } | |
817 | EOF | |
818 | if compile_prog "" "" "posix_fadvise"; then | |
819 | posix_fadvise="yes" | |
820 | fi | |
484b0b65 | 821 | print_config "POSIX fadvise" "$posix_fadvise" |
67bf9823 JA |
822 | |
823 | ########################################## | |
824 | # POSIX fallocate probe | |
ca205a75 TK |
825 | if test "$posix_fallocate" != "yes" ; then |
826 | posix_fallocate="no" | |
827 | fi | |
67bf9823 JA |
828 | cat > $TMPC << EOF |
829 | #include <stdio.h> | |
830 | #include <fcntl.h> | |
831 | int main(int argc, char **argv) | |
832 | { | |
833 | int r = posix_fallocate(0, 0, 1024); | |
834 | return r; | |
835 | } | |
836 | EOF | |
837 | if compile_prog "" "" "posix_fallocate"; then | |
838 | posix_fallocate="yes" | |
839 | fi | |
484b0b65 | 840 | print_config "POSIX fallocate" "$posix_fallocate" |
67bf9823 JA |
841 | |
842 | ########################################## | |
843 | # sched_set/getaffinity 2 or 3 argument test | |
ca205a75 TK |
844 | if test "$linux_2arg_affinity" != "yes" ; then |
845 | linux_2arg_affinity="no" | |
846 | fi | |
847 | if test "$linux_3arg_affinity" != "yes" ; then | |
848 | linux_3arg_affinity="no" | |
849 | fi | |
67bf9823 | 850 | cat > $TMPC << EOF |
67bf9823 JA |
851 | #include <sched.h> |
852 | int main(int argc, char **argv) | |
853 | { | |
854 | cpu_set_t mask; | |
855 | return sched_setaffinity(0, sizeof(mask), &mask); | |
856 | } | |
857 | EOF | |
858 | if compile_prog "" "" "sched_setaffinity(,,)"; then | |
859 | linux_3arg_affinity="yes" | |
860 | else | |
861 | cat > $TMPC << EOF | |
67bf9823 JA |
862 | #include <sched.h> |
863 | int main(int argc, char **argv) | |
864 | { | |
865 | cpu_set_t mask; | |
866 | return sched_setaffinity(0, &mask); | |
867 | } | |
868 | EOF | |
869 | if compile_prog "" "" "sched_setaffinity(,)"; then | |
870 | linux_2arg_affinity="yes" | |
871 | fi | |
872 | fi | |
484b0b65 TK |
873 | print_config "sched_setaffinity(3 arg)" "$linux_3arg_affinity" |
874 | print_config "sched_setaffinity(2 arg)" "$linux_2arg_affinity" | |
67bf9823 JA |
875 | |
876 | ########################################## | |
877 | # clock_gettime probe | |
ca205a75 TK |
878 | if test "$clock_gettime" != "yes" ; then |
879 | clock_gettime="no" | |
880 | fi | |
67bf9823 JA |
881 | cat > $TMPC << EOF |
882 | #include <stdio.h> | |
883 | #include <time.h> | |
884 | int main(int argc, char **argv) | |
885 | { | |
886 | return clock_gettime(0, NULL); | |
887 | } | |
888 | EOF | |
889 | if compile_prog "" "" "clock_gettime"; then | |
890 | clock_gettime="yes" | |
891 | elif compile_prog "" "-lrt" "clock_gettime"; then | |
892 | clock_gettime="yes" | |
893 | LIBS="-lrt $LIBS" | |
894 | fi | |
484b0b65 | 895 | print_config "clock_gettime" "$clock_gettime" |
67bf9823 JA |
896 | |
897 | ########################################## | |
898 | # CLOCK_MONOTONIC probe | |
ca205a75 TK |
899 | if test "$clock_monotonic" != "yes" ; then |
900 | clock_monotonic="no" | |
901 | fi | |
67bf9823 JA |
902 | if test "$clock_gettime" = "yes" ; then |
903 | cat > $TMPC << EOF | |
904 | #include <stdio.h> | |
905 | #include <time.h> | |
906 | int main(int argc, char **argv) | |
907 | { | |
908 | return clock_gettime(CLOCK_MONOTONIC, NULL); | |
909 | } | |
910 | EOF | |
911 | if compile_prog "" "$LIBS" "clock monotonic"; then | |
912 | clock_monotonic="yes" | |
913 | fi | |
914 | fi | |
484b0b65 | 915 | print_config "CLOCK_MONOTONIC" "$clock_monotonic" |
67bf9823 | 916 | |
c544f604 SN |
917 | ########################################## |
918 | # CLOCK_MONOTONIC_RAW probe | |
ca205a75 TK |
919 | if test "$clock_monotonic_raw" != "yes" ; then |
920 | clock_monotonic_raw="no" | |
921 | fi | |
c544f604 SN |
922 | if test "$clock_gettime" = "yes" ; then |
923 | cat > $TMPC << EOF | |
924 | #include <stdio.h> | |
925 | #include <time.h> | |
926 | int main(int argc, char **argv) | |
927 | { | |
928 | return clock_gettime(CLOCK_MONOTONIC_RAW, NULL); | |
929 | } | |
930 | EOF | |
931 | if compile_prog "" "$LIBS" "clock monotonic"; then | |
932 | clock_monotonic_raw="yes" | |
933 | fi | |
934 | fi | |
484b0b65 | 935 | print_config "CLOCK_MONOTONIC_RAW" "$clock_monotonic_raw" |
c544f604 | 936 | |
67bf9823 JA |
937 | ########################################## |
938 | # CLOCK_MONOTONIC_PRECISE probe | |
ca205a75 TK |
939 | if test "$clock_monotonic_precise" != "yes" ; then |
940 | clock_monotonic_precise="no" | |
941 | fi | |
67bf9823 JA |
942 | if test "$clock_gettime" = "yes" ; then |
943 | cat > $TMPC << EOF | |
944 | #include <stdio.h> | |
945 | #include <time.h> | |
946 | int main(int argc, char **argv) | |
947 | { | |
948 | return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL); | |
949 | } | |
950 | EOF | |
951 | if compile_prog "" "$LIBS" "clock monotonic precise"; then | |
952 | clock_monotonic_precise="yes" | |
953 | fi | |
954 | fi | |
484b0b65 | 955 | print_config "CLOCK_MONOTONIC_PRECISE" "$clock_monotonic_precise" |
67bf9823 | 956 | |
25f8227d JA |
957 | ########################################## |
958 | # clockid_t probe | |
ca205a75 TK |
959 | if test "$clockid_t" != "yes" ; then |
960 | clockid_t="no" | |
961 | fi | |
25f8227d | 962 | cat > $TMPC << EOF |
25f8227d | 963 | #include <time.h> |
209c37b4 | 964 | #include <string.h> |
25f8227d JA |
965 | int main(int argc, char **argv) |
966 | { | |
ccf2d89d | 967 | volatile clockid_t cid; |
7fcad9e1 | 968 | memset((void*)&cid, 0, sizeof(cid)); |
ccf2d89d | 969 | return 0; |
25f8227d JA |
970 | } |
971 | EOF | |
972 | if compile_prog "" "$LIBS" "clockid_t"; then | |
973 | clockid_t="yes" | |
974 | fi | |
484b0b65 | 975 | print_config "clockid_t" "$clockid_t" |
25f8227d | 976 | |
67bf9823 JA |
977 | ########################################## |
978 | # gettimeofday() probe | |
ca205a75 TK |
979 | if test "$gettimeofday" != "yes" ; then |
980 | gettimeofday="no" | |
981 | fi | |
67bf9823 JA |
982 | cat > $TMPC << EOF |
983 | #include <sys/time.h> | |
984 | #include <stdio.h> | |
985 | int main(int argc, char **argv) | |
986 | { | |
987 | struct timeval tv; | |
988 | return gettimeofday(&tv, NULL); | |
989 | } | |
990 | EOF | |
991 | if compile_prog "" "" "gettimeofday"; then | |
992 | gettimeofday="yes" | |
993 | fi | |
484b0b65 | 994 | print_config "gettimeofday" "$gettimeofday" |
67bf9823 JA |
995 | |
996 | ########################################## | |
997 | # fdatasync() probe | |
ca205a75 TK |
998 | if test "$fdatasync" != "yes" ; then |
999 | fdatasync="no" | |
1000 | fi | |
67bf9823 JA |
1001 | cat > $TMPC << EOF |
1002 | #include <stdio.h> | |
1003 | #include <unistd.h> | |
1004 | int main(int argc, char **argv) | |
1005 | { | |
1006 | return fdatasync(0); | |
1007 | } | |
1008 | EOF | |
1009 | if compile_prog "" "" "fdatasync"; then | |
1010 | fdatasync="yes" | |
1011 | fi | |
484b0b65 | 1012 | print_config "fdatasync" "$fdatasync" |
67bf9823 JA |
1013 | |
1014 | ########################################## | |
1015 | # sync_file_range() probe | |
ca205a75 TK |
1016 | if test "$sync_file_range" != "yes" ; then |
1017 | sync_file_range="no" | |
1018 | fi | |
67bf9823 JA |
1019 | cat > $TMPC << EOF |
1020 | #include <stdio.h> | |
1021 | #include <unistd.h> | |
67bf9823 JA |
1022 | #include <fcntl.h> |
1023 | #include <linux/fs.h> | |
1024 | int main(int argc, char **argv) | |
1025 | { | |
1026 | unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE | | |
1027 | SYNC_FILE_RANGE_WAIT_AFTER; | |
1028 | return sync_file_range(0, 0, 0, flags); | |
1029 | } | |
1030 | EOF | |
1031 | if compile_prog "" "" "sync_file_range"; then | |
1032 | sync_file_range="yes" | |
1033 | fi | |
484b0b65 | 1034 | print_config "sync_file_range" "$sync_file_range" |
67bf9823 JA |
1035 | |
1036 | ########################################## | |
1037 | # ext4 move extent probe | |
ca205a75 TK |
1038 | if test "$ext4_me" != "yes" ; then |
1039 | ext4_me="no" | |
1040 | fi | |
67bf9823 JA |
1041 | cat > $TMPC << EOF |
1042 | #include <fcntl.h> | |
1043 | #include <sys/ioctl.h> | |
1044 | int main(int argc, char **argv) | |
1045 | { | |
1046 | struct move_extent me; | |
1047 | return ioctl(0, EXT4_IOC_MOVE_EXT, &me); | |
1048 | } | |
1049 | EOF | |
c7165b8d JA |
1050 | if compile_prog "" "" "ext4 move extent" ; then |
1051 | ext4_me="yes" | |
1052 | elif test $targetos = "Linux" ; then | |
1053 | # On Linux, just default to it on and let it error at runtime if we really | |
1054 | # don't have it. None of my updated systems have it defined, but it does | |
1055 | # work. Takes a while to bubble back. | |
67bf9823 JA |
1056 | ext4_me="yes" |
1057 | fi | |
484b0b65 | 1058 | print_config "EXT4 move extent" "$ext4_me" |
67bf9823 JA |
1059 | |
1060 | ########################################## | |
1061 | # splice probe | |
ca205a75 TK |
1062 | if test "$linux_splice" != "yes" ; then |
1063 | linux_splice="no" | |
1064 | fi | |
67bf9823 | 1065 | cat > $TMPC << EOF |
67bf9823 JA |
1066 | #include <stdio.h> |
1067 | #include <fcntl.h> | |
1068 | int main(int argc, char **argv) | |
1069 | { | |
1070 | return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK); | |
1071 | } | |
1072 | EOF | |
1073 | if compile_prog "" "" "linux splice"; then | |
1074 | linux_splice="yes" | |
1075 | fi | |
484b0b65 | 1076 | print_config "Linux splice(2)" "$linux_splice" |
67bf9823 JA |
1077 | |
1078 | ########################################## | |
1079 | # GUASI probe | |
ca205a75 TK |
1080 | if test "$guasi" != "yes" ; then |
1081 | guasi="no" | |
1082 | fi | |
67bf9823 JA |
1083 | cat > $TMPC << EOF |
1084 | #include <guasi.h> | |
1085 | #include <guasi_syscalls.h> | |
1086 | int main(int argc, char **argv) | |
1087 | { | |
1088 | guasi_t ctx = guasi_create(0, 0, 0); | |
1089 | return 0; | |
1090 | } | |
1091 | EOF | |
1092 | if compile_prog "" "" "guasi"; then | |
1093 | guasi="yes" | |
1094 | fi | |
484b0b65 | 1095 | print_config "GUASI" "$guasi" |
67bf9823 JA |
1096 | |
1097 | ########################################## | |
1098 | # fusion-aw probe | |
ca205a75 TK |
1099 | if test "$fusion_aw" != "yes" ; then |
1100 | fusion_aw="no" | |
1101 | fi | |
67bf9823 | 1102 | cat > $TMPC << EOF |
b2c77c25 | 1103 | #include <nvm/nvm_primitives.h> |
67bf9823 JA |
1104 | int main(int argc, char **argv) |
1105 | { | |
b2c77c25 SK |
1106 | nvm_version_t ver_info; |
1107 | nvm_handle_t handle; | |
1108 | ||
1109 | handle = nvm_get_handle(0, &ver_info); | |
1110 | return nvm_atomic_write(handle, 0, 0, 0); | |
67bf9823 JA |
1111 | } |
1112 | EOF | |
92aef550 ARJ |
1113 | if compile_prog "" "-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread" "fusion-aw"; then |
1114 | LIBS="-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread $LIBS" | |
67bf9823 JA |
1115 | fusion_aw="yes" |
1116 | fi | |
484b0b65 | 1117 | print_config "Fusion-io atomic engine" "$fusion_aw" |
67bf9823 JA |
1118 | |
1119 | ########################################## | |
1120 | # libnuma probe | |
ca205a75 TK |
1121 | if test "$libnuma" != "yes" ; then |
1122 | libnuma="no" | |
1123 | fi | |
67bf9823 JA |
1124 | cat > $TMPC << EOF |
1125 | #include <numa.h> | |
1126 | int main(int argc, char **argv) | |
1127 | { | |
1128 | return numa_available(); | |
1129 | } | |
1130 | EOF | |
44462517 | 1131 | if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then |
67bf9823 JA |
1132 | libnuma="yes" |
1133 | LIBS="-lnuma $LIBS" | |
1134 | fi | |
484b0b65 | 1135 | print_config "libnuma" "$libnuma" |
67bf9823 | 1136 | |
50206d9b | 1137 | ########################################## |
ca205a75 | 1138 | # libnuma 2.x version API, initialize with "no" only if $libnuma is set to "yes" |
50206d9b JA |
1139 | if test "$libnuma" = "yes" ; then |
1140 | libnuma_v2="no" | |
1141 | cat > $TMPC << EOF | |
1142 | #include <numa.h> | |
1143 | int main(int argc, char **argv) | |
1144 | { | |
1145 | struct bitmask *mask = numa_parse_nodestring(NULL); | |
61bde962 | 1146 | return mask->size == 0; |
50206d9b JA |
1147 | } |
1148 | EOF | |
1149 | if compile_prog "" "" "libnuma api"; then | |
1150 | libnuma_v2="yes" | |
1151 | fi | |
484b0b65 | 1152 | print_config "libnuma v2" "$libnuma_v2" |
50206d9b JA |
1153 | fi |
1154 | ||
67bf9823 JA |
1155 | ########################################## |
1156 | # strsep() probe | |
ca205a75 TK |
1157 | if test "$strsep" != "yes" ; then |
1158 | strsep="no" | |
1159 | fi | |
67bf9823 JA |
1160 | cat > $TMPC << EOF |
1161 | #include <string.h> | |
1162 | int main(int argc, char **argv) | |
1163 | { | |
ae156be6 JA |
1164 | static char *string = "This is a string"; |
1165 | strsep(&string, "needle"); | |
67bf9823 JA |
1166 | return 0; |
1167 | } | |
1168 | EOF | |
1169 | if compile_prog "" "" "strsep"; then | |
1170 | strsep="yes" | |
1171 | fi | |
484b0b65 | 1172 | print_config "strsep" "$strsep" |
67bf9823 | 1173 | |
9ad8da82 JA |
1174 | ########################################## |
1175 | # strcasestr() probe | |
ca205a75 TK |
1176 | if test "$strcasestr" != "yes" ; then |
1177 | strcasestr="no" | |
1178 | fi | |
9ad8da82 JA |
1179 | cat > $TMPC << EOF |
1180 | #include <string.h> | |
1181 | int main(int argc, char **argv) | |
1182 | { | |
aa6738a5 | 1183 | return strcasestr(argv[0], argv[1]) != NULL; |
9ad8da82 JA |
1184 | } |
1185 | EOF | |
1186 | if compile_prog "" "" "strcasestr"; then | |
1187 | strcasestr="yes" | |
1188 | fi | |
484b0b65 | 1189 | print_config "strcasestr" "$strcasestr" |
9ad8da82 | 1190 | |
5ad7be56 KD |
1191 | ########################################## |
1192 | # strlcat() probe | |
ca205a75 TK |
1193 | if test "$strlcat" != "yes" ; then |
1194 | strlcat="no" | |
1195 | fi | |
5ad7be56 KD |
1196 | cat > $TMPC << EOF |
1197 | #include <string.h> | |
1198 | int main(int argc, char **argv) | |
1199 | { | |
1200 | static char dst[64]; | |
1201 | static char *string = "This is a string"; | |
1202 | memset(dst, 0, sizeof(dst)); | |
1203 | strlcat(dst, string, sizeof(dst)); | |
1204 | return 0; | |
1205 | } | |
1206 | EOF | |
1207 | if compile_prog "" "" "strlcat"; then | |
1208 | strlcat="yes" | |
1209 | fi | |
484b0b65 | 1210 | print_config "strlcat" "$strlcat" |
5ad7be56 | 1211 | |
67bf9823 JA |
1212 | ########################################## |
1213 | # getopt_long_only() probe | |
ca205a75 TK |
1214 | if test "$getopt_long_only" != "yes" ; then |
1215 | getopt_long_only="no" | |
1216 | fi | |
67bf9823 JA |
1217 | cat > $TMPC << EOF |
1218 | #include <unistd.h> | |
1219 | #include <stdio.h> | |
aa6738a5 | 1220 | #include <getopt.h> |
67bf9823 JA |
1221 | int main(int argc, char **argv) |
1222 | { | |
1223 | int c = getopt_long_only(argc, argv, NULL, NULL, NULL); | |
1224 | return c; | |
1225 | } | |
1226 | EOF | |
1227 | if compile_prog "" "" "getopt_long_only"; then | |
1228 | getopt_long_only="yes" | |
1229 | fi | |
484b0b65 | 1230 | print_config "getopt_long_only()" "$getopt_long_only" |
67bf9823 JA |
1231 | |
1232 | ########################################## | |
1233 | # inet_aton() probe | |
ca205a75 TK |
1234 | if test "$inet_aton" != "yes" ; then |
1235 | inet_aton="no" | |
1236 | fi | |
67bf9823 JA |
1237 | cat > $TMPC << EOF |
1238 | #include <sys/socket.h> | |
1239 | #include <arpa/inet.h> | |
1240 | #include <stdio.h> | |
1241 | int main(int argc, char **argv) | |
1242 | { | |
1243 | struct in_addr in; | |
1244 | return inet_aton(NULL, &in); | |
1245 | } | |
1246 | EOF | |
1247 | if compile_prog "" "" "inet_aton"; then | |
1248 | inet_aton="yes" | |
1249 | fi | |
484b0b65 | 1250 | print_config "inet_aton" "$inet_aton" |
67bf9823 JA |
1251 | |
1252 | ########################################## | |
1253 | # socklen_t probe | |
ca205a75 TK |
1254 | if test "$socklen_t" != "yes" ; then |
1255 | socklen_t="no" | |
1256 | fi | |
67bf9823 | 1257 | cat > $TMPC << EOF |
f6482613 | 1258 | #include <sys/socket.h> |
67bf9823 JA |
1259 | int main(int argc, char **argv) |
1260 | { | |
1261 | socklen_t len = 0; | |
1262 | return len; | |
1263 | } | |
1264 | EOF | |
1265 | if compile_prog "" "" "socklen_t"; then | |
1266 | socklen_t="yes" | |
1267 | fi | |
484b0b65 | 1268 | print_config "socklen_t" "$socklen_t" |
67bf9823 JA |
1269 | |
1270 | ########################################## | |
1271 | # Whether or not __thread is supported for TLS | |
ca205a75 TK |
1272 | if test "$tls_thread" != "yes" ; then |
1273 | tls_thread="no" | |
1274 | fi | |
67bf9823 JA |
1275 | cat > $TMPC << EOF |
1276 | #include <stdio.h> | |
aa6738a5 | 1277 | static __thread int ret; |
67bf9823 JA |
1278 | int main(int argc, char **argv) |
1279 | { | |
1280 | return ret; | |
1281 | } | |
1282 | EOF | |
1283 | if compile_prog "" "" "__thread"; then | |
1284 | tls_thread="yes" | |
1285 | fi | |
484b0b65 | 1286 | print_config "__thread" "$tls_thread" |
67bf9823 | 1287 | |
91f94d5b | 1288 | ########################################## |
2639f056 | 1289 | # Check if we have required gtk/glib support for gfio |
ca205a75 TK |
1290 | if test "$gfio" != "yes" ; then |
1291 | gfio="no" | |
1292 | fi | |
ebec2094 | 1293 | if test "$gfio_check" = "yes" ; then |
91f94d5b JA |
1294 | cat > $TMPC << EOF |
1295 | #include <glib.h> | |
1296 | #include <cairo.h> | |
1297 | #include <gtk/gtk.h> | |
1298 | int main(void) | |
1299 | { | |
1300 | gdk_threads_enter(); | |
91f94d5b | 1301 | gdk_threads_leave(); |
b7a99316 | 1302 | |
ef2b61aa | 1303 | return GTK_CHECK_VERSION(2, 18, 0) ? 0 : 1; /* 0 on success */ |
91f94d5b JA |
1304 | } |
1305 | EOF | |
1306 | GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0) | |
86719845 JA |
1307 | ORG_LDFLAGS=$LDFLAGS |
1308 | LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g) | |
91f94d5b JA |
1309 | if test "$?" != "0" ; then |
1310 | echo "configure: gtk and gthread not found" | |
1311 | exit 1 | |
1312 | fi | |
1313 | GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0) | |
1314 | if test "$?" != "0" ; then | |
1315 | echo "configure: gtk and gthread not found" | |
1316 | exit 1 | |
1317 | fi | |
b7a99316 | 1318 | if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then |
ef2b61aa TK |
1319 | $TMPE |
1320 | if test "$?" = "0" ; then | |
b7a99316 | 1321 | gfio="yes" |
86719845 | 1322 | GFIO_LIBS="$LIBS $GTK_LIBS" |
b7a99316 JA |
1323 | CFLAGS="$CFLAGS $GTK_CFLAGS" |
1324 | else | |
1325 | echo "GTK found, but need version 2.18 or higher" | |
1326 | gfio="no" | |
1327 | fi | |
91f94d5b JA |
1328 | else |
1329 | echo "Please install gtk and gdk libraries" | |
1330 | gfio="no" | |
1331 | fi | |
86719845 | 1332 | LDFLAGS=$ORG_LDFLAGS |
91f94d5b JA |
1333 | fi |
1334 | ||
ebec2094 | 1335 | if test "$gfio_check" = "yes" ; then |
484b0b65 | 1336 | print_config "gtk 2.18 or higher" "$gfio" |
ebec2094 | 1337 | fi |
91f94d5b | 1338 | |
bda92394 | 1339 | ########################################## |
44404c5a | 1340 | # Check whether we have getrusage(RUSAGE_THREAD) |
ca205a75 TK |
1341 | if test "$rusage_thread" != "yes" ; then |
1342 | rusage_thread="no" | |
1343 | fi | |
44404c5a JA |
1344 | cat > $TMPC << EOF |
1345 | #include <sys/time.h> | |
1346 | #include <sys/resource.h> | |
1347 | int main(int argc, char **argv) | |
1348 | { | |
1349 | struct rusage ru; | |
1350 | getrusage(RUSAGE_THREAD, &ru); | |
1351 | return 0; | |
1352 | } | |
1353 | EOF | |
1354 | if compile_prog "" "" "RUSAGE_THREAD"; then | |
1355 | rusage_thread="yes" | |
1356 | fi | |
484b0b65 | 1357 | print_config "RUSAGE_THREAD" "$rusage_thread" |
44404c5a | 1358 | |
7e09a9f1 JA |
1359 | ########################################## |
1360 | # Check whether we have SCHED_IDLE | |
ca205a75 TK |
1361 | if test "$sched_idle" != "yes" ; then |
1362 | sched_idle="no" | |
1363 | fi | |
7e09a9f1 JA |
1364 | cat > $TMPC << EOF |
1365 | #include <sched.h> | |
1366 | int main(int argc, char **argv) | |
1367 | { | |
1368 | struct sched_param p; | |
1369 | return sched_setscheduler(0, SCHED_IDLE, &p); | |
1370 | } | |
1371 | EOF | |
1372 | if compile_prog "" "" "SCHED_IDLE"; then | |
1373 | sched_idle="yes" | |
1374 | fi | |
484b0b65 | 1375 | print_config "SCHED_IDLE" "$sched_idle" |
7e09a9f1 | 1376 | |
1eafa37a JA |
1377 | ########################################## |
1378 | # Check whether we have TCP_NODELAY | |
ca205a75 TK |
1379 | if test "$tcp_nodelay" != "yes" ; then |
1380 | tcp_nodelay="no" | |
1381 | fi | |
1eafa37a JA |
1382 | cat > $TMPC << EOF |
1383 | #include <stdio.h> | |
1384 | #include <sys/types.h> | |
1385 | #include <sys/socket.h> | |
1386 | #include <netinet/tcp.h> | |
1387 | int main(int argc, char **argv) | |
1388 | { | |
1389 | return getsockopt(0, 0, TCP_NODELAY, NULL, NULL); | |
1390 | } | |
1391 | EOF | |
1392 | if compile_prog "" "" "TCP_NODELAY"; then | |
1393 | tcp_nodelay="yes" | |
1394 | fi | |
484b0b65 | 1395 | print_config "TCP_NODELAY" "$tcp_nodelay" |
1eafa37a | 1396 | |
1008602c JA |
1397 | ########################################## |
1398 | # Check whether we have SO_SNDBUF | |
ca205a75 TK |
1399 | if test "$window_size" != "yes" ; then |
1400 | window_size="no" | |
1401 | fi | |
1008602c JA |
1402 | cat > $TMPC << EOF |
1403 | #include <stdio.h> | |
1404 | #include <sys/types.h> | |
1405 | #include <sys/socket.h> | |
1406 | #include <netinet/tcp.h> | |
1407 | int main(int argc, char **argv) | |
1408 | { | |
1409 | setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0); | |
1410 | setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0); | |
1411 | } | |
1412 | EOF | |
1413 | if compile_prog "" "" "SO_SNDBUF"; then | |
1414 | window_size="yes" | |
1415 | fi | |
484b0b65 | 1416 | print_config "Net engine window_size" "$window_size" |
1008602c | 1417 | |
e5f34d95 JA |
1418 | ########################################## |
1419 | # Check whether we have TCP_MAXSEG | |
ca205a75 TK |
1420 | if test "$mss" != "yes" ; then |
1421 | mss="no" | |
1422 | fi | |
e5f34d95 JA |
1423 | cat > $TMPC << EOF |
1424 | #include <stdio.h> | |
1425 | #include <sys/types.h> | |
1426 | #include <sys/socket.h> | |
1427 | #include <netinet/tcp.h> | |
1428 | #include <arpa/inet.h> | |
1429 | #include <netinet/in.h> | |
1430 | int main(int argc, char **argv) | |
1431 | { | |
1432 | return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0); | |
1433 | } | |
1434 | EOF | |
1435 | if compile_prog "" "" "TCP_MAXSEG"; then | |
1436 | mss="yes" | |
1437 | fi | |
484b0b65 | 1438 | print_config "TCP_MAXSEG" "$mss" |
e5f34d95 | 1439 | |
38b9354a JA |
1440 | ########################################## |
1441 | # Check whether we have RLIMIT_MEMLOCK | |
ca205a75 TK |
1442 | if test "$rlimit_memlock" != "yes" ; then |
1443 | rlimit_memlock="no" | |
1444 | fi | |
38b9354a JA |
1445 | cat > $TMPC << EOF |
1446 | #include <sys/time.h> | |
1447 | #include <sys/resource.h> | |
1448 | int main(int argc, char **argv) | |
1449 | { | |
1450 | struct rlimit rl; | |
1451 | return getrlimit(RLIMIT_MEMLOCK, &rl); | |
1452 | } | |
1453 | EOF | |
1454 | if compile_prog "" "" "RLIMIT_MEMLOCK"; then | |
1455 | rlimit_memlock="yes" | |
1456 | fi | |
484b0b65 | 1457 | print_config "RLIMIT_MEMLOCK" "$rlimit_memlock" |
38b9354a | 1458 | |
07fc0acd JA |
1459 | ########################################## |
1460 | # Check whether we have pwritev/preadv | |
ca205a75 TK |
1461 | if test "$pwritev" != "yes" ; then |
1462 | pwritev="no" | |
1463 | fi | |
07fc0acd JA |
1464 | cat > $TMPC << EOF |
1465 | #include <stdio.h> | |
1466 | #include <sys/uio.h> | |
1467 | int main(int argc, char **argv) | |
1468 | { | |
1469 | return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0); | |
1470 | } | |
1471 | EOF | |
1472 | if compile_prog "" "" "pwritev"; then | |
1473 | pwritev="yes" | |
1474 | fi | |
484b0b65 | 1475 | print_config "pwritev/preadv" "$pwritev" |
07fc0acd | 1476 | |
2cafffbe JA |
1477 | ########################################## |
1478 | # Check whether we have pwritev2/preadv2 | |
ca205a75 TK |
1479 | if test "$pwritev2" != "yes" ; then |
1480 | pwritev2="no" | |
1481 | fi | |
2cafffbe JA |
1482 | cat > $TMPC << EOF |
1483 | #include <stdio.h> | |
1484 | #include <sys/uio.h> | |
1485 | int main(int argc, char **argv) | |
1486 | { | |
1487 | return pwritev2(0, NULL, 1, 0, 0) + preadv2(0, NULL, 1, 0, 0); | |
1488 | } | |
1489 | EOF | |
1490 | if compile_prog "" "" "pwritev2"; then | |
1491 | pwritev2="yes" | |
1492 | fi | |
484b0b65 | 1493 | print_config "pwritev2/preadv2" "$pwritev2" |
2cafffbe | 1494 | |
ecad55e9 JA |
1495 | ########################################## |
1496 | # Check whether we have the required functions for ipv6 | |
ca205a75 TK |
1497 | if test "$ipv6" != "yes" ; then |
1498 | ipv6="no" | |
1499 | fi | |
ecad55e9 JA |
1500 | cat > $TMPC << EOF |
1501 | #include <sys/types.h> | |
1502 | #include <sys/socket.h> | |
d219028d | 1503 | #include <netinet/in.h> |
ecad55e9 JA |
1504 | #include <netdb.h> |
1505 | #include <stdio.h> | |
1506 | int main(int argc, char **argv) | |
1507 | { | |
1508 | struct addrinfo hints; | |
1509 | struct in6_addr addr; | |
1510 | int ret; | |
1511 | ||
1512 | ret = getaddrinfo(NULL, NULL, &hints, NULL); | |
1513 | freeaddrinfo(NULL); | |
1514 | printf("%s\n", gai_strerror(ret)); | |
1515 | addr = in6addr_any; | |
1516 | return 0; | |
1517 | } | |
1518 | EOF | |
1519 | if compile_prog "" "" "ipv6"; then | |
1520 | ipv6="yes" | |
1521 | fi | |
484b0b65 | 1522 | print_config "IPv6 helpers" "$ipv6" |
07fc0acd | 1523 | |
d5f9b0ea IF |
1524 | ########################################## |
1525 | # check for rados | |
1526 | if test "$rados" != "yes" ; then | |
1527 | rados="no" | |
1528 | fi | |
1529 | cat > $TMPC << EOF | |
1530 | #include <rados/librados.h> | |
1531 | ||
1532 | int main(int argc, char **argv) | |
1533 | { | |
1534 | rados_t cluster; | |
1535 | rados_ioctx_t io_ctx; | |
1536 | const char cluster_name[] = "ceph"; | |
1537 | const char user_name[] = "client.admin"; | |
1538 | const char pool[] = "rados"; | |
1539 | ||
1540 | /* The rados_create2 signature required was only introduced in ceph 0.65 */ | |
1541 | rados_create2(&cluster, cluster_name, user_name, 0); | |
1542 | rados_ioctx_create(cluster, pool, &io_ctx); | |
1543 | ||
1544 | return 0; | |
1545 | } | |
1546 | EOF | |
1547 | if test "$disable_rados" != "yes" && compile_prog "" "-lrados" "rados"; then | |
1548 | LIBS="-lrados $LIBS" | |
1549 | rados="yes" | |
1550 | fi | |
1551 | print_config "Rados engine" "$rados" | |
1552 | ||
fc5c0345 DG |
1553 | ########################################## |
1554 | # check for rbd | |
ca205a75 TK |
1555 | if test "$rbd" != "yes" ; then |
1556 | rbd="no" | |
1557 | fi | |
fc5c0345 DG |
1558 | cat > $TMPC << EOF |
1559 | #include <rbd/librbd.h> | |
1560 | ||
1561 | int main(int argc, char **argv) | |
1562 | { | |
fc5c0345 DG |
1563 | rados_t cluster; |
1564 | rados_ioctx_t io_ctx; | |
fb9bc6e3 SW |
1565 | const char cluster_name[] = "ceph"; |
1566 | const char user_name[] = "client.admin"; | |
fc5c0345 | 1567 | const char pool[] = "rbd"; |
fc5c0345 | 1568 | int major, minor, extra; |
fc5c0345 | 1569 | |
fb9bc6e3 SW |
1570 | rbd_version(&major, &minor, &extra); |
1571 | /* The rados_create2 signature required was only introduced in ceph 0.65 */ | |
1572 | rados_create2(&cluster, cluster_name, user_name, 0); | |
fc5c0345 | 1573 | rados_ioctx_create(cluster, pool, &io_ctx); |
fb9bc6e3 | 1574 | |
fc5c0345 DG |
1575 | return 0; |
1576 | } | |
1577 | EOF | |
ce18290e | 1578 | if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then |
fc5c0345 DG |
1579 | LIBS="-lrbd -lrados $LIBS" |
1580 | rbd="yes" | |
1581 | fi | |
484b0b65 | 1582 | print_config "Rados Block Device engine" "$rbd" |
fc5c0345 | 1583 | |
53b6c979 PL |
1584 | ########################################## |
1585 | # check for rbd_poll | |
ca205a75 TK |
1586 | if test "$rbd_poll" != "yes" ; then |
1587 | rbd_poll="no" | |
1588 | fi | |
53b6c979 PL |
1589 | if test "$rbd" = "yes"; then |
1590 | cat > $TMPC << EOF | |
1591 | #include <rbd/librbd.h> | |
1592 | #include <sys/eventfd.h> | |
1593 | ||
1594 | int main(int argc, char **argv) | |
1595 | { | |
1596 | rbd_image_t image; | |
1597 | rbd_completion_t comp; | |
1598 | ||
1599 | int fd = eventfd(0, EFD_NONBLOCK); | |
1600 | rbd_set_image_notification(image, fd, EVENT_TYPE_EVENTFD); | |
1601 | rbd_poll_io_events(image, comp, 1); | |
1602 | ||
1603 | return 0; | |
1604 | } | |
1605 | EOF | |
1606 | if compile_prog "" "-lrbd -lrados" "rbd"; then | |
1607 | rbd_poll="yes" | |
1608 | fi | |
484b0b65 | 1609 | print_config "rbd_poll" "$rbd_poll" |
53b6c979 PL |
1610 | fi |
1611 | ||
903b2812 | 1612 | ########################################## |
6266dd72 | 1613 | # check for rbd_invalidate_cache() |
ca205a75 TK |
1614 | if test "$rbd_inval" != "yes" ; then |
1615 | rbd_inval="no" | |
1616 | fi | |
903b2812 JA |
1617 | if test "$rbd" = "yes"; then |
1618 | cat > $TMPC << EOF | |
1619 | #include <rbd/librbd.h> | |
1620 | ||
1621 | int main(int argc, char **argv) | |
1622 | { | |
1623 | rbd_image_t image; | |
1624 | ||
1625 | return rbd_invalidate_cache(image); | |
1626 | } | |
1627 | EOF | |
1628 | if compile_prog "" "-lrbd -lrados" "rbd"; then | |
1629 | rbd_inval="yes" | |
1630 | fi | |
484b0b65 | 1631 | print_config "rbd_invalidate_cache" "$rbd_inval" |
903b2812 JA |
1632 | fi |
1633 | ||
2e802282 JA |
1634 | ########################################## |
1635 | # Check whether we have setvbuf | |
ca205a75 TK |
1636 | if test "$setvbuf" != "yes" ; then |
1637 | setvbuf="no" | |
1638 | fi | |
2e802282 JA |
1639 | cat > $TMPC << EOF |
1640 | #include <stdio.h> | |
1641 | int main(int argc, char **argv) | |
1642 | { | |
1643 | FILE *f = NULL; | |
1644 | char buf[80]; | |
1645 | setvbuf(f, buf, _IOFBF, sizeof(buf)); | |
1646 | return 0; | |
1647 | } | |
1648 | EOF | |
1649 | if compile_prog "" "" "setvbuf"; then | |
1650 | setvbuf="yes" | |
1651 | fi | |
484b0b65 | 1652 | print_config "setvbuf" "$setvbuf" |
fc5c0345 | 1653 | |
bda92394 | 1654 | ########################################## |
6e7d7dfb | 1655 | # check for gfapi |
ca205a75 TK |
1656 | if test "$gfapi" != "yes" ; then |
1657 | gfapi="no" | |
1658 | fi | |
6e7d7dfb | 1659 | cat > $TMPC << EOF |
1660 | #include <glusterfs/api/glfs.h> | |
1661 | ||
1662 | int main(int argc, char **argv) | |
1663 | { | |
6e7d7dfb | 1664 | glfs_t *g = glfs_new("foo"); |
1665 | ||
1666 | return 0; | |
1667 | } | |
1668 | EOF | |
ce18290e | 1669 | if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then |
6e7d7dfb | 1670 | LIBS="-lgfapi -lglusterfs $LIBS" |
1671 | gfapi="yes" | |
1672 | fi | |
484b0b65 | 1673 | print_config "Gluster API engine" "$gfapi" |
6e7d7dfb | 1674 | |
6fa14b99 | 1675 | ########################################## |
ca205a75 | 1676 | # check for gfapi fadvise support, initialize with "no" only if $gfapi is set to "yes" |
6876c98c | 1677 | if test "$gfapi" = "yes" ; then |
6fa14b99 | 1678 | gf_fadvise="no" |
1679 | cat > $TMPC << EOF | |
1680 | #include <glusterfs/api/glfs.h> | |
1681 | ||
1682 | int main(int argc, char **argv) | |
1683 | { | |
1684 | struct glfs_fd *fd; | |
1685 | int ret = glfs_fadvise(fd, 0, 0, 1); | |
1686 | ||
1687 | return 0; | |
1688 | } | |
1689 | EOF | |
6fa14b99 | 1690 | if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then |
1691 | gf_fadvise="yes" | |
1692 | fi | |
484b0b65 | 1693 | print_config "Gluster API use fadvise" "$gf_fadvise" |
6876c98c JA |
1694 | fi |
1695 | ||
1696 | ########################################## | |
1697 | # check for gfapi trim support | |
ca205a75 TK |
1698 | if test "$gf_trim" != "yes" ; then |
1699 | gf_trim="no" | |
1700 | fi | |
6876c98c JA |
1701 | if test "$gfapi" = "yes" ; then |
1702 | cat > $TMPC << EOF | |
1703 | #include <glusterfs/api/glfs.h> | |
1704 | ||
1705 | int main(int argc, char **argv) | |
1706 | { | |
1707 | return glfs_discard_async(NULL, 0, 0); | |
1708 | } | |
1709 | EOF | |
1710 | if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then | |
1711 | gf_trim="yes" | |
1712 | fi | |
484b0b65 | 1713 | print_config "Gluster API trim support" "$gf_trim" |
6876c98c | 1714 | fi |
fc5c0345 | 1715 | |
81795ce3 CE |
1716 | ########################################## |
1717 | # Check if we support stckf on s390 | |
ca205a75 TK |
1718 | if test "$s390_z196_facilities" != "yes" ; then |
1719 | s390_z196_facilities="no" | |
1720 | fi | |
81795ce3 CE |
1721 | cat > $TMPC << EOF |
1722 | #define STFLE_BITS_Z196 45 /* various z196 facilities ... */ | |
1723 | int main(int argc, char **argv) | |
1724 | { | |
1725 | /* We want just 1 double word to be returned. */ | |
1726 | register unsigned long reg0 asm("0") = 0; | |
1727 | unsigned long stfle_bits; | |
1728 | asm volatile(".machine push" "\n\t" | |
1729 | ".machine \"z9-109\"" "\n\t" | |
1730 | "stfle %0" "\n\t" | |
1731 | ".machine pop" "\n" | |
1732 | : "=QS" (stfle_bits), "+d" (reg0) | |
1733 | : : "cc"); | |
1734 | ||
1735 | if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0) | |
1736 | return 0; | |
1737 | else | |
1738 | return -1; | |
1739 | } | |
1740 | EOF | |
1741 | if compile_prog "" "" "s390_z196_facilities"; then | |
1742 | $TMPE | |
6a2c9363 | 1743 | if [ $? -eq 0 ]; then |
81795ce3 CE |
1744 | s390_z196_facilities="yes" |
1745 | fi | |
1746 | fi | |
484b0b65 | 1747 | print_config "s390_z196_facilities" "$s390_z196_facilities" |
1b10477b MM |
1748 | |
1749 | ########################################## | |
1750 | # Check if we have required environment variables configured for libhdfs | |
1751 | if test "$libhdfs" = "yes" ; then | |
1752 | hdfs_conf_error=0 | |
1753 | if test "$JAVA_HOME" = "" ; then | |
1754 | echo "configure: JAVA_HOME should be defined to jdk/jvm path" | |
1755 | hdfs_conf_error=1 | |
1756 | fi | |
1757 | if test "$FIO_LIBHDFS_INCLUDE" = "" ; then | |
1758 | echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path" | |
1759 | hdfs_conf_error=1 | |
1760 | fi | |
1761 | if test "$FIO_LIBHDFS_LIB" = "" ; then | |
1762 | echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path" | |
1763 | hdfs_conf_error=1 | |
1764 | fi | |
1765 | if test "$hdfs_conf_error" = "1" ; then | |
1766 | exit 1 | |
1767 | fi | |
247e5436 JA |
1768 | FIO_HDFS_CPU=$cpu |
1769 | if test "$FIO_HDFS_CPU" = "x86_64" ; then | |
1770 | FIO_HDFS_CPU="amd64" | |
1771 | fi | |
1b10477b | 1772 | fi |
484b0b65 | 1773 | print_config "HDFS engine" "$libhdfs" |
1b10477b | 1774 | |
b8116a87 DE |
1775 | ########################################## |
1776 | # Check whether we have MTD | |
ca205a75 TK |
1777 | if test "$mtd" != "yes" ; then |
1778 | mtd="no" | |
1779 | fi | |
b8116a87 | 1780 | cat > $TMPC << EOF |
0e1c454a | 1781 | #include <string.h> |
b8116a87 DE |
1782 | #include <mtd/mtd-user.h> |
1783 | #include <sys/ioctl.h> | |
1784 | int main(int argc, char **argv) | |
1785 | { | |
0e1c454a | 1786 | struct mtd_write_req ops; |
b8116a87 | 1787 | struct mtd_info_user info; |
0e1c454a | 1788 | memset(&ops, 0, sizeof(ops)); |
400cd0ff | 1789 | info.type = MTD_MLCNANDFLASH; |
b8116a87 DE |
1790 | return ioctl(0, MEMGETINFO, &info); |
1791 | } | |
1792 | EOF | |
1793 | if compile_prog "" "" "mtd"; then | |
1794 | mtd="yes" | |
1795 | fi | |
484b0b65 | 1796 | print_config "MTD" "$mtd" |
b8116a87 | 1797 | |
3ee2a3c1 DJ |
1798 | ########################################## |
1799 | # Check whether we have libpmem | |
ca205a75 TK |
1800 | if test "$libpmem" != "yes" ; then |
1801 | libpmem="no" | |
1802 | fi | |
3ee2a3c1 DJ |
1803 | cat > $TMPC << EOF |
1804 | #include <libpmem.h> | |
1805 | int main(int argc, char **argv) | |
1806 | { | |
1807 | int rc; | |
1808 | rc = pmem_is_pmem(0, 0); | |
1809 | return 0; | |
1810 | } | |
1811 | EOF | |
1812 | if compile_prog "" "-lpmem" "libpmem"; then | |
1813 | libpmem="yes" | |
cf8775b8 | 1814 | LIBS="-lpmem $LIBS" |
3ee2a3c1 | 1815 | fi |
484b0b65 | 1816 | print_config "libpmem" "$libpmem" |
3ee2a3c1 DJ |
1817 | |
1818 | ########################################## | |
1819 | # Check whether we have libpmemblk | |
cf8775b8 | 1820 | # libpmem is a prerequisite |
ca205a75 TK |
1821 | if test "$libpmemblk" != "yes" ; then |
1822 | libpmemblk="no" | |
1823 | fi | |
cf8775b8 RE |
1824 | if test "$libpmem" = "yes"; then |
1825 | cat > $TMPC << EOF | |
3ee2a3c1 DJ |
1826 | #include <libpmemblk.h> |
1827 | int main(int argc, char **argv) | |
1828 | { | |
cf8775b8 RE |
1829 | PMEMblkpool *pbp; |
1830 | pbp = pmemblk_open("", 0); | |
3ee2a3c1 DJ |
1831 | return 0; |
1832 | } | |
1833 | EOF | |
cf8775b8 RE |
1834 | if compile_prog "" "-lpmemblk" "libpmemblk"; then |
1835 | libpmemblk="yes" | |
1836 | LIBS="-lpmemblk $LIBS" | |
1837 | fi | |
3ee2a3c1 | 1838 | fi |
484b0b65 | 1839 | print_config "libpmemblk" "$libpmemblk" |
3ee2a3c1 | 1840 | |
cf8775b8 | 1841 | # Choose the ioengines |
3ee2a3c1 | 1842 | if test "$libpmem" = "yes" && test "$disable_pmem" = "no"; then |
ae0db592 | 1843 | pmem="yes" |
3ee2a3c1 DJ |
1844 | devdax="yes" |
1845 | if test "$libpmemblk" = "yes"; then | |
1846 | pmemblk="yes" | |
1847 | fi | |
1848 | fi | |
1849 | ||
43f3cec2 BB |
1850 | ########################################## |
1851 | # Report whether pmemblk engine is enabled | |
484b0b65 | 1852 | print_config "NVML pmemblk engine" "$pmemblk" |
43f3cec2 | 1853 | |
cbb15e42 DJ |
1854 | ########################################## |
1855 | # Report whether dev-dax engine is enabled | |
484b0b65 | 1856 | print_config "NVML dev-dax engine" "$devdax" |
cbb15e42 | 1857 | |
ae0db592 TI |
1858 | ########################################## |
1859 | # Report whether libpmem engine is enabled | |
1860 | print_config "NVML libpmem engine" "$pmem" | |
1861 | ||
bda92394 | 1862 | ########################################## |
b470a02c SC |
1863 | # Check if we have lex/yacc available |
1864 | yacc="no" | |
e7b2c7a3 | 1865 | yacc_is_bison="no" |
b470a02c SC |
1866 | lex="no" |
1867 | arith="no" | |
de26b824 | 1868 | if test "$disable_lex" = "no" || test -z "$disable_lex" ; then |
cf6dd80e | 1869 | if test "$targetos" != "SunOS" ; then |
e7b2c7a3 | 1870 | LEX=$(which lex 2> /dev/null) |
b470a02c SC |
1871 | if test -x "$LEX" ; then |
1872 | lex="yes" | |
1873 | fi | |
7e0049e9 | 1874 | YACC=$(which bison 2> /dev/null) |
b470a02c SC |
1875 | if test -x "$YACC" ; then |
1876 | yacc="yes" | |
7e0049e9 | 1877 | yacc_is_bison="yes" |
e7b2c7a3 | 1878 | else |
7e0049e9 | 1879 | YACC=$(which yacc 2> /dev/null) |
e7b2c7a3 JA |
1880 | if test -x "$YACC" ; then |
1881 | yacc="yes" | |
e7b2c7a3 | 1882 | fi |
b470a02c SC |
1883 | fi |
1884 | if test "$yacc" = "yes" && test "$lex" = "yes" ; then | |
1885 | arith="yes" | |
1886 | fi | |
1887 | ||
1888 | if test "$arith" = "yes" ; then | |
1889 | cat > $TMPC << EOF | |
1890 | extern int yywrap(void); | |
1891 | ||
1892 | int main(int argc, char **argv) | |
1893 | { | |
1894 | yywrap(); | |
1895 | return 0; | |
1896 | } | |
1897 | EOF | |
719cda03 JA |
1898 | if compile_prog "" "-ll" "lex"; then |
1899 | LIBS="-ll $LIBS" | |
b470a02c SC |
1900 | else |
1901 | arith="no" | |
1902 | fi | |
1903 | fi | |
cf6dd80e | 1904 | fi |
a655bbc4 | 1905 | fi |
b470a02c | 1906 | |
63bda378 JA |
1907 | # Check if lex fails using -o |
1908 | if test "$arith" = "yes" ; then | |
daf705b5 JA |
1909 | if test "$force_no_lex_o" = "yes" ; then |
1910 | lex_use_o="no" | |
1911 | else | |
63bda378 JA |
1912 | $LEX -o lex.yy.c exp/expression-parser.l 2> /dev/null |
1913 | if test "$?" = "0" ; then | |
1914 | lex_use_o="yes" | |
1915 | else | |
1916 | lex_use_o="no" | |
1917 | fi | |
1918 | fi | |
daf705b5 | 1919 | fi |
63bda378 | 1920 | |
484b0b65 | 1921 | print_config "lex/yacc for arithmetic" "$arith" |
b470a02c | 1922 | |
aae599ba JA |
1923 | ########################################## |
1924 | # Check whether we have setmntent/getmntent | |
ca205a75 TK |
1925 | if test "$getmntent" != "yes" ; then |
1926 | getmntent="no" | |
1927 | fi | |
aae599ba JA |
1928 | cat > $TMPC << EOF |
1929 | #include <stdio.h> | |
1930 | #include <mntent.h> | |
1931 | int main(int argc, char **argv) | |
1932 | { | |
1933 | FILE *mtab = setmntent(NULL, "r"); | |
1934 | struct mntent *mnt = getmntent(mtab); | |
1581b82a | 1935 | endmntent(mtab); |
aae599ba JA |
1936 | return 0; |
1937 | } | |
1938 | EOF | |
1939 | if compile_prog "" "" "getmntent"; then | |
1940 | getmntent="yes" | |
1941 | fi | |
484b0b65 | 1942 | print_config "getmntent" "$getmntent" |
aae599ba | 1943 | |
e7e136da TK |
1944 | ########################################## |
1945 | # Check whether we have getmntinfo | |
b765bec0 TK |
1946 | # These are originally added for BSDs, but may also work |
1947 | # on other operating systems with getmntinfo(3). | |
1948 | ||
1949 | # getmntinfo(3) for FreeBSD/DragonFlyBSD/OpenBSD. | |
1950 | # Note that NetBSD needs -Werror to catch warning as error. | |
ca205a75 TK |
1951 | if test "$getmntinfo" != "yes" ; then |
1952 | getmntinfo="no" | |
1953 | fi | |
e7e136da TK |
1954 | cat > $TMPC << EOF |
1955 | #include <stdio.h> | |
1956 | #include <sys/param.h> | |
1957 | #include <sys/mount.h> | |
1958 | int main(int argc, char **argv) | |
1959 | { | |
9ada751d | 1960 | struct statfs *st; |
e7e136da TK |
1961 | return getmntinfo(&st, MNT_NOWAIT); |
1962 | } | |
1963 | EOF | |
b765bec0 | 1964 | if compile_prog "-Werror" "" "getmntinfo"; then |
e7e136da TK |
1965 | getmntinfo="yes" |
1966 | fi | |
484b0b65 | 1967 | print_config "getmntinfo" "$getmntinfo" |
e7e136da | 1968 | |
b765bec0 | 1969 | # getmntinfo(3) for NetBSD. |
ca205a75 TK |
1970 | if test "$getmntinfo_statvfs" != "yes" ; then |
1971 | getmntinfo_statvfs="no" | |
1972 | fi | |
b765bec0 TK |
1973 | cat > $TMPC << EOF |
1974 | #include <stdio.h> | |
1975 | #include <sys/statvfs.h> | |
1976 | int main(int argc, char **argv) | |
1977 | { | |
1978 | struct statvfs *st; | |
1979 | return getmntinfo(&st, MNT_NOWAIT); | |
1980 | } | |
1981 | EOF | |
1982 | # Skip the test if the one with statfs arg is detected. | |
1983 | if test "$getmntinfo" != "yes" && compile_prog "-Werror" "" "getmntinfo_statvfs"; then | |
1984 | getmntinfo_statvfs="yes" | |
484b0b65 | 1985 | print_config "getmntinfo_statvfs" "$getmntinfo_statvfs" |
b765bec0 TK |
1986 | fi |
1987 | ||
5018f79f AH |
1988 | ########################################## |
1989 | # Check whether we have _Static_assert | |
ca205a75 TK |
1990 | if test "$static_assert" != "yes" ; then |
1991 | static_assert="no" | |
1992 | fi | |
5018f79f AH |
1993 | cat > $TMPC << EOF |
1994 | #include <assert.h> | |
94815a5c | 1995 | #include <stdlib.h> |
51b4c81e | 1996 | #include <stddef.h> |
94815a5c JA |
1997 | |
1998 | struct foo { | |
1999 | int a, b; | |
2000 | }; | |
2001 | ||
5018f79f AH |
2002 | int main(int argc, char **argv) |
2003 | { | |
94815a5c | 2004 | _Static_assert(offsetof(struct foo, a) == 0 , "Check"); |
5018f79f AH |
2005 | return 0 ; |
2006 | } | |
2007 | EOF | |
2008 | if compile_prog "" "" "static_assert"; then | |
2009 | static_assert="yes" | |
2010 | fi | |
484b0b65 | 2011 | print_config "Static Assert" "$static_assert" |
e39c0676 JA |
2012 | |
2013 | ########################################## | |
2014 | # Check whether we have bool / stdbool.h | |
ca205a75 TK |
2015 | if test "$have_bool" != "yes" ; then |
2016 | have_bool="no" | |
2017 | fi | |
e39c0676 JA |
2018 | cat > $TMPC << EOF |
2019 | #include <stdbool.h> | |
2020 | int main(int argc, char **argv) | |
2021 | { | |
2022 | bool var = true; | |
2023 | return var != false; | |
2024 | } | |
2025 | EOF | |
2026 | if compile_prog "" "" "bool"; then | |
2027 | have_bool="yes" | |
2028 | fi | |
484b0b65 | 2029 | print_config "bool" "$have_bool" |
e39c0676 | 2030 | |
b29c71c4 JA |
2031 | ########################################## |
2032 | # Check whether we have strndup() | |
107ad008 | 2033 | strndup="no" |
b29c71c4 JA |
2034 | cat > $TMPC << EOF |
2035 | #include <string.h> | |
2036 | #include <stdlib.h> | |
2037 | int main(int argc, char **argv) | |
2038 | { | |
2039 | char *res = strndup("test string", 8); | |
2040 | ||
2041 | free(res); | |
2042 | return 0; | |
2043 | } | |
2044 | EOF | |
2045 | if compile_prog "" "" "strndup"; then | |
2046 | strndup="yes" | |
2047 | fi | |
2048 | print_config "strndup" "$strndup" | |
2049 | ||
214e2d56 | 2050 | ########################################## |
2051 | # check march=armv8-a+crc+crypto | |
ca205a75 TK |
2052 | if test "$march_armv8_a_crc_crypto" != "yes" ; then |
2053 | march_armv8_a_crc_crypto="no" | |
2054 | fi | |
214e2d56 | 2055 | if test "$cpu" = "arm64" ; then |
2056 | cat > $TMPC <<EOF | |
9b153dc2 TT |
2057 | #include <sys/auxv.h> |
2058 | #include <arm_acle.h> | |
2059 | #include <arm_neon.h> | |
2060 | ||
214e2d56 | 2061 | int main(void) |
2062 | { | |
2063 | return 0; | |
2064 | } | |
2065 | EOF | |
2066 | if compile_prog "-march=armv8-a+crc+crypto" "" ""; then | |
2067 | march_armv8_a_crc_crypto="yes" | |
2068 | CFLAGS="$CFLAGS -march=armv8-a+crc+crypto -DARCH_HAVE_CRC_CRYPTO" | |
9f75af77 | 2069 | march_set="yes" |
214e2d56 | 2070 | fi |
2071 | fi | |
484b0b65 | 2072 | print_config "march_armv8_a_crc_crypto" "$march_armv8_a_crc_crypto" |
214e2d56 | 2073 | |
03553853 YR |
2074 | ########################################## |
2075 | # cuda probe | |
d418fa90 TK |
2076 | if test "$cuda" != "yes" ; then |
2077 | cuda="no" | |
2078 | fi | |
03553853 YR |
2079 | cat > $TMPC << EOF |
2080 | #include <cuda.h> | |
2081 | int main(int argc, char **argv) | |
2082 | { | |
2083 | return cuInit(0); | |
2084 | } | |
2085 | EOF | |
4bd2c8b9 | 2086 | if test "$enable_cuda" = "yes" && compile_prog "" "-lcuda" "cuda"; then |
03553853 YR |
2087 | cuda="yes" |
2088 | LIBS="-lcuda $LIBS" | |
2089 | fi | |
484b0b65 | 2090 | print_config "cuda" "$cuda" |
214e2d56 | 2091 | |
4252396e JA |
2092 | ########################################## |
2093 | # mkdir() probe. mingw apparently has a one-argument mkdir :/ | |
2094 | mkdir_two="no" | |
2095 | cat > $TMPC << EOF | |
2096 | #include <sys/stat.h> | |
2097 | #include <sys/types.h> | |
2098 | int main(int argc, char **argv) | |
2099 | { | |
2100 | return mkdir("/tmp/bla", 0600); | |
2101 | } | |
2102 | EOF | |
2103 | if compile_prog "" "" "mkdir(a, b)"; then | |
2104 | mkdir_two="yes" | |
2105 | fi | |
2106 | print_config "mkdir(a, b)" "$mkdir_two" | |
2107 | ||
a817dc3b JA |
2108 | ########################################## |
2109 | # check for cc -march=native | |
2110 | build_native="no" | |
2111 | cat > $TMPC << EOF | |
2112 | int main(int argc, char **argv) | |
2113 | { | |
2114 | return 0; | |
2115 | } | |
2116 | EOF | |
c922e0b0 SW |
2117 | if test "$disable_native" = "no" && test "$disable_opt" != "yes" && \ |
2118 | compile_prog "-march=native" "" "march=native"; then | |
a817dc3b JA |
2119 | build_native="yes" |
2120 | fi | |
2121 | print_config "Build march=native" "$build_native" | |
2122 | ||
67bf9823 JA |
2123 | ############################################################################# |
2124 | ||
67bf9823 | 2125 | if test "$wordsize" = "64" ; then |
4feafb1e | 2126 | output_sym "CONFIG_64BIT" |
67bf9823 | 2127 | elif test "$wordsize" = "32" ; then |
4feafb1e | 2128 | output_sym "CONFIG_32BIT" |
67bf9823 | 2129 | else |
d7145a78 | 2130 | fatal "Unknown wordsize!" |
67bf9823 | 2131 | fi |
0dcebdf4 | 2132 | if test "$bigendian" = "yes" ; then |
4feafb1e | 2133 | output_sym "CONFIG_BIG_ENDIAN" |
0dcebdf4 | 2134 | else |
4feafb1e | 2135 | output_sym "CONFIG_LITTLE_ENDIAN" |
0dcebdf4 | 2136 | fi |
3989b143 JA |
2137 | if test "$zlib" = "yes" ; then |
2138 | output_sym "CONFIG_ZLIB" | |
2139 | fi | |
67bf9823 | 2140 | if test "$libaio" = "yes" ; then |
4feafb1e | 2141 | output_sym "CONFIG_LIBAIO" |
67bf9823 JA |
2142 | fi |
2143 | if test "$posix_aio" = "yes" ; then | |
4feafb1e | 2144 | output_sym "CONFIG_POSIXAIO" |
67bf9823 JA |
2145 | fi |
2146 | if test "$posix_aio_fsync" = "yes" ; then | |
4feafb1e | 2147 | output_sym "CONFIG_POSIXAIO_FSYNC" |
67bf9823 | 2148 | fi |
06eac6b2 SW |
2149 | if test "$posix_pshared" = "yes" ; then |
2150 | output_sym "CONFIG_PSHARED" | |
2151 | fi | |
67bf9823 | 2152 | if test "$linux_fallocate" = "yes" ; then |
4feafb1e | 2153 | output_sym "CONFIG_LINUX_FALLOCATE" |
67bf9823 JA |
2154 | fi |
2155 | if test "$posix_fallocate" = "yes" ; then | |
4feafb1e | 2156 | output_sym "CONFIG_POSIX_FALLOCATE" |
67bf9823 JA |
2157 | fi |
2158 | if test "$fdatasync" = "yes" ; then | |
4feafb1e | 2159 | output_sym "CONFIG_FDATASYNC" |
67bf9823 JA |
2160 | fi |
2161 | if test "$sync_file_range" = "yes" ; then | |
4feafb1e | 2162 | output_sym "CONFIG_SYNC_FILE_RANGE" |
67bf9823 JA |
2163 | fi |
2164 | if test "$sfaa" = "yes" ; then | |
4feafb1e | 2165 | output_sym "CONFIG_SFAA" |
67bf9823 | 2166 | fi |
a250edd0 JA |
2167 | if test "$sync_sync" = "yes" ; then |
2168 | output_sym "CONFIG_SYNC_SYNC" | |
2169 | fi | |
2170 | if test "$cmp_swap" = "yes" ; then | |
2171 | output_sym "CONFIG_CMP_SWAP" | |
2172 | fi | |
954cd73a | 2173 | if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then |
4feafb1e | 2174 | output_sym "CONFIG_RDMA" |
67bf9823 JA |
2175 | fi |
2176 | if test "$clock_gettime" = "yes" ; then | |
4feafb1e | 2177 | output_sym "CONFIG_CLOCK_GETTIME" |
67bf9823 JA |
2178 | fi |
2179 | if test "$clock_monotonic" = "yes" ; then | |
4feafb1e | 2180 | output_sym "CONFIG_CLOCK_MONOTONIC" |
67bf9823 | 2181 | fi |
c544f604 SN |
2182 | if test "$clock_monotonic_raw" = "yes" ; then |
2183 | output_sym "CONFIG_CLOCK_MONOTONIC_RAW" | |
2184 | fi | |
67bf9823 | 2185 | if test "$clock_monotonic_precise" = "yes" ; then |
4feafb1e | 2186 | output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE" |
67bf9823 | 2187 | fi |
25f8227d JA |
2188 | if test "$clockid_t" = "yes"; then |
2189 | output_sym "CONFIG_CLOCKID_T" | |
2190 | fi | |
67bf9823 | 2191 | if test "$gettimeofday" = "yes" ; then |
4feafb1e | 2192 | output_sym "CONFIG_GETTIMEOFDAY" |
67bf9823 JA |
2193 | fi |
2194 | if test "$posix_fadvise" = "yes" ; then | |
4feafb1e | 2195 | output_sym "CONFIG_POSIX_FADVISE" |
67bf9823 JA |
2196 | fi |
2197 | if test "$linux_3arg_affinity" = "yes" ; then | |
4feafb1e | 2198 | output_sym "CONFIG_3ARG_AFFINITY" |
67bf9823 | 2199 | elif test "$linux_2arg_affinity" = "yes" ; then |
4feafb1e | 2200 | output_sym "CONFIG_2ARG_AFFINITY" |
67bf9823 JA |
2201 | fi |
2202 | if test "$strsep" = "yes" ; then | |
4feafb1e | 2203 | output_sym "CONFIG_STRSEP" |
67bf9823 | 2204 | fi |
9ad8da82 JA |
2205 | if test "$strcasestr" = "yes" ; then |
2206 | output_sym "CONFIG_STRCASESTR" | |
2207 | fi | |
5ad7be56 KD |
2208 | if test "$strlcat" = "yes" ; then |
2209 | output_sym "CONFIG_STRLCAT" | |
2210 | fi | |
67bf9823 | 2211 | if test "$getopt_long_only" = "yes" ; then |
4feafb1e | 2212 | output_sym "CONFIG_GETOPT_LONG_ONLY" |
67bf9823 JA |
2213 | fi |
2214 | if test "$inet_aton" = "yes" ; then | |
4feafb1e | 2215 | output_sym "CONFIG_INET_ATON" |
67bf9823 JA |
2216 | fi |
2217 | if test "$socklen_t" = "yes" ; then | |
4feafb1e | 2218 | output_sym "CONFIG_SOCKLEN_T" |
67bf9823 JA |
2219 | fi |
2220 | if test "$ext4_me" = "yes" ; then | |
4feafb1e | 2221 | output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT" |
67bf9823 JA |
2222 | fi |
2223 | if test "$linux_splice" = "yes" ; then | |
4feafb1e | 2224 | output_sym "CONFIG_LINUX_SPLICE" |
67bf9823 JA |
2225 | fi |
2226 | if test "$guasi" = "yes" ; then | |
4feafb1e | 2227 | output_sym "CONFIG_GUASI" |
67bf9823 JA |
2228 | fi |
2229 | if test "$fusion_aw" = "yes" ; then | |
4feafb1e | 2230 | output_sym "CONFIG_FUSION_AW" |
67bf9823 | 2231 | fi |
50206d9b | 2232 | if test "$libnuma_v2" = "yes" ; then |
4feafb1e | 2233 | output_sym "CONFIG_LIBNUMA" |
67bf9823 JA |
2234 | fi |
2235 | if test "$solaris_aio" = "yes" ; then | |
4feafb1e | 2236 | output_sym "CONFIG_SOLARISAIO" |
67bf9823 JA |
2237 | fi |
2238 | if test "$tls_thread" = "yes" ; then | |
4feafb1e | 2239 | output_sym "CONFIG_TLS_THREAD" |
67bf9823 | 2240 | fi |
44404c5a | 2241 | if test "$rusage_thread" = "yes" ; then |
4feafb1e | 2242 | output_sym "CONFIG_RUSAGE_THREAD" |
67bf9823 | 2243 | fi |
91f94d5b | 2244 | if test "$gfio" = "yes" ; then |
bad7e42c | 2245 | output_sym "CONFIG_GFIO" |
91f94d5b | 2246 | fi |
c8931876 JA |
2247 | if test "$esx" = "yes" ; then |
2248 | output_sym "CONFIG_ESX" | |
2249 | output_sym "CONFIG_NO_SHM" | |
2250 | fi | |
7e09a9f1 JA |
2251 | if test "$sched_idle" = "yes" ; then |
2252 | output_sym "CONFIG_SCHED_IDLE" | |
2253 | fi | |
1eafa37a JA |
2254 | if test "$tcp_nodelay" = "yes" ; then |
2255 | output_sym "CONFIG_TCP_NODELAY" | |
2256 | fi | |
1008602c JA |
2257 | if test "$window_size" = "yes" ; then |
2258 | output_sym "CONFIG_NET_WINDOWSIZE" | |
2259 | fi | |
e5f34d95 JA |
2260 | if test "$mss" = "yes" ; then |
2261 | output_sym "CONFIG_NET_MSS" | |
2262 | fi | |
38b9354a JA |
2263 | if test "$rlimit_memlock" = "yes" ; then |
2264 | output_sym "CONFIG_RLIMIT_MEMLOCK" | |
2265 | fi | |
07fc0acd JA |
2266 | if test "$pwritev" = "yes" ; then |
2267 | output_sym "CONFIG_PWRITEV" | |
2268 | fi | |
2cafffbe JA |
2269 | if test "$pwritev2" = "yes" ; then |
2270 | output_sym "CONFIG_PWRITEV2" | |
2271 | fi | |
ecad55e9 JA |
2272 | if test "$ipv6" = "yes" ; then |
2273 | output_sym "CONFIG_IPV6" | |
2274 | fi | |
d5f9b0ea IF |
2275 | if test "$rados" = "yes" ; then |
2276 | output_sym "CONFIG_RADOS" | |
2277 | fi | |
fc5c0345 DG |
2278 | if test "$rbd" = "yes" ; then |
2279 | output_sym "CONFIG_RBD" | |
2280 | fi | |
53b6c979 PL |
2281 | if test "$rbd_poll" = "yes" ; then |
2282 | output_sym "CONFIG_RBD_POLL" | |
2283 | fi | |
903b2812 JA |
2284 | if test "$rbd_inval" = "yes" ; then |
2285 | output_sym "CONFIG_RBD_INVAL" | |
2286 | fi | |
2e802282 JA |
2287 | if test "$setvbuf" = "yes" ; then |
2288 | output_sym "CONFIG_SETVBUF" | |
2289 | fi | |
81795ce3 CE |
2290 | if test "$s390_z196_facilities" = "yes" ; then |
2291 | output_sym "CONFIG_S390_Z196_FACILITIES" | |
2292 | CFLAGS="$CFLAGS -march=z9-109" | |
9f75af77 | 2293 | march_set="yes" |
81795ce3 | 2294 | fi |
6e7d7dfb | 2295 | if test "$gfapi" = "yes" ; then |
2296 | output_sym "CONFIG_GFAPI" | |
2297 | fi | |
6fa14b99 | 2298 | if test "$gf_fadvise" = "yes" ; then |
2299 | output_sym "CONFIG_GF_FADVISE" | |
2300 | fi | |
6876c98c JA |
2301 | if test "$gf_trim" = "yes" ; then |
2302 | output_sym "CONFIG_GF_TRIM" | |
2303 | fi | |
1b10477b MM |
2304 | if test "$libhdfs" = "yes" ; then |
2305 | output_sym "CONFIG_LIBHDFS" | |
247e5436 | 2306 | echo "FIO_HDFS_CPU=$FIO_HDFS_CPU" >> $config_host_mak |
1527dc50 FB |
2307 | echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak |
2308 | echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak | |
2309 | echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak | |
2310 | fi | |
b8116a87 DE |
2311 | if test "$mtd" = "yes" ; then |
2312 | output_sym "CONFIG_MTD" | |
2313 | fi | |
43f3cec2 BB |
2314 | if test "$pmemblk" = "yes" ; then |
2315 | output_sym "CONFIG_PMEMBLK" | |
2316 | fi | |
cbb15e42 DJ |
2317 | if test "$devdax" = "yes" ; then |
2318 | output_sym "CONFIG_LINUX_DEVDAX" | |
2319 | fi | |
ae0db592 TI |
2320 | if test "$pmem" = "yes" ; then |
2321 | output_sym "CONFIG_LIBPMEM" | |
2322 | fi | |
b470a02c SC |
2323 | if test "$arith" = "yes" ; then |
2324 | output_sym "CONFIG_ARITHMETIC" | |
e7b2c7a3 JA |
2325 | if test "$yacc_is_bison" = "yes" ; then |
2326 | echo "YACC=$YACC -y" >> $config_host_mak | |
2327 | else | |
2328 | echo "YACC=$YACC" >> $config_host_mak | |
2329 | fi | |
63bda378 JA |
2330 | if test "$lex_use_o" = "yes" ; then |
2331 | echo "CONFIG_LEX_USE_O=y" >> $config_host_mak | |
2332 | fi | |
b470a02c | 2333 | fi |
aae599ba JA |
2334 | if test "$getmntent" = "yes" ; then |
2335 | output_sym "CONFIG_GETMNTENT" | |
2336 | fi | |
e7e136da TK |
2337 | if test "$getmntinfo" = "yes" ; then |
2338 | output_sym "CONFIG_GETMNTINFO" | |
2339 | fi | |
b765bec0 TK |
2340 | if test "$getmntinfo_statvfs" = "yes" ; then |
2341 | output_sym "CONFIG_GETMNTINFO_STATVFS" | |
2342 | fi | |
5018f79f AH |
2343 | if test "$static_assert" = "yes" ; then |
2344 | output_sym "CONFIG_STATIC_ASSERT" | |
2345 | fi | |
e39c0676 JA |
2346 | if test "$have_bool" = "yes" ; then |
2347 | output_sym "CONFIG_HAVE_BOOL" | |
2348 | fi | |
b29c71c4 JA |
2349 | if test "$strndup" = "yes" ; then |
2350 | output_sym "CONFIG_HAVE_STRNDUP" | |
2351 | fi | |
484817a9 JA |
2352 | if test "$disable_opt" = "yes" ; then |
2353 | output_sym "CONFIG_DISABLE_OPTIMIZATIONS" | |
2354 | fi | |
605cf82e | 2355 | if test "$zlib" = "no" ; then |
8f909424 JA |
2356 | echo "Consider installing zlib-dev (zlib-devel, some fio features depend on it." |
2357 | if test "$build_static" = "yes"; then | |
2358 | echo "Note that some distros have separate packages for static libraries." | |
2359 | fi | |
605cf82e | 2360 | fi |
03553853 YR |
2361 | if test "$cuda" = "yes" ; then |
2362 | output_sym "CONFIG_CUDA" | |
2363 | fi | |
4252396e JA |
2364 | if test "$mkdir_two" = "yes" ; then |
2365 | output_sym "CONFIG_HAVE_MKDIR_TWO" | |
2366 | fi | |
9f75af77 | 2367 | if test "$march_set" = "no" && test "$build_native" = "yes" ; then |
a817dc3b JA |
2368 | output_sym "CONFIG_BUILD_NATIVE" |
2369 | fi | |
605cf82e | 2370 | |
67bf9823 | 2371 | echo "LIBS+=$LIBS" >> $config_host_mak |
86719845 | 2372 | echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak |
91f94d5b | 2373 | echo "CFLAGS+=$CFLAGS" >> $config_host_mak |
d2aeedb9 | 2374 | echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak |
67bf9823 | 2375 | echo "CC=$cc" >> $config_host_mak |
af4862b3 | 2376 | echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak |
020d54bd | 2377 | echo "INSTALL_PREFIX=$prefix" >> $config_host_mak |
c61a3a44 | 2378 | |
59d8f412 | 2379 | if [ `dirname $0` != "." -a ! -e Makefile ]; then |
c61a3a44 JF |
2380 | cat > Makefile <<EOF |
2381 | SRCDIR:=`dirname $0` | |
2382 | include \$(SRCDIR)/Makefile | |
2383 | EOF | |
2384 | fi |