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