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