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