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