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