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