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