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