Merge branch 'nvme/support-sync-fua-for-iouring-v2' of https://github.com/minwooim/fio
[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 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"
173libzbc=""
174dynamic_engines="no"
175prefix=/usr/local
176
177# parse options
178for opt do
179 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
180 case "$opt" in
181 --prefix=*) prefix="$optarg"
182 ;;
183 --cpu=*) cpu="$optarg"
184 ;;
185 # esx is cross compiled and cannot be detect through simple uname calls
186 --esx)
187 esx="yes"
188 ;;
189 --cc=*) CC="$optarg"
190 ;;
191 --extra-cflags=*) CFLAGS="$CFLAGS $optarg"
192 ;;
193 --build-32bit-win) build_32bit_win="yes"
194 ;;
195 --target-win-ver=*) target_win_ver="$optarg"
196 ;;
197 --enable-pdb) pdb="yes"
198 ;;
199 --build-static) build_static="yes"
200 ;;
201 --enable-gfio) gfio_check="yes"
202 ;;
203 --disable-numa) disable_numa="yes"
204 ;;
205 --disable-rdma) disable_rdma="yes"
206 ;;
207 --disable-rados) disable_rados="yes"
208 ;;
209 --disable-rbd) disable_rbd="yes"
210 ;;
211 --disable-http) disable_http="yes"
212 ;;
213 --disable-gfapi) disable_gfapi="yes"
214 ;;
215 --enable-libhdfs) libhdfs="yes"
216 ;;
217 --disable-lex) disable_lex="yes"
218 ;;
219 --enable-lex) disable_lex="no"
220 ;;
221 --disable-shm) no_shm="yes"
222 ;;
223 --disable-optimizations) disable_opt="yes"
224 ;;
225 --disable-pmem) disable_pmem="yes"
226 ;;
227 --enable-cuda) cuda="yes"
228 ;;
229 --enable-libcufile) libcufile="yes"
230 ;;
231 --disable-native) disable_native="yes"
232 ;;
233 --with-ime=*) ime_path="$optarg"
234 ;;
235 --enable-libiscsi) libiscsi="yes"
236 ;;
237 --enable-libnbd) libnbd="yes"
238 ;;
239 --disable-libzbc) libzbc="no"
240 ;;
241 --disable-tcmalloc) disable_tcmalloc="yes"
242 ;;
243 --dynamic-libengines) dynamic_engines="yes"
244 ;;
245 --help)
246 show_help="yes"
247 ;;
248 *)
249 echo "Bad option $opt"
250 show_help="yes"
251 exit_val=1
252 esac
253done
254
255if test "$show_help" = "yes" ; then
256 echo "--prefix= Use this directory as installation prefix"
257 echo "--cpu= Specify target CPU if auto-detect fails"
258 echo "--cc= Specify compiler to use"
259 echo "--extra-cflags= Specify extra CFLAGS to pass to compiler"
260 echo "--build-32bit-win Enable 32-bit build on Windows"
261 echo "--target-win-ver= Minimum version of Windows to target (only accepts 7)"
262 echo "--enable-pdb Enable Windows PDB symbols generation (needs clang/lld)"
263 echo "--build-static Build a static fio"
264 echo "--esx Configure build options for esx"
265 echo "--enable-gfio Enable building of gtk gfio"
266 echo "--disable-numa Disable libnuma even if found"
267 echo "--disable-rdma Disable RDMA support even if found"
268 echo "--disable-rados Disable Rados support even if found"
269 echo "--disable-rbd Disable Rados Block Device even if found"
270 echo "--disable-http Disable HTTP support even if found"
271 echo "--disable-gfapi Disable gfapi"
272 echo "--enable-libhdfs Enable hdfs support"
273 echo "--disable-lex Disable use of lex/yacc for math"
274 echo "--disable-pmem Disable pmem based engines even if found"
275 echo "--enable-lex Enable use of lex/yacc for math"
276 echo "--disable-shm Disable SHM support"
277 echo "--disable-optimizations Don't enable compiler optimizations"
278 echo "--enable-cuda Enable GPUDirect RDMA support"
279 echo "--enable-libcufile Enable GPUDirect Storage cuFile support"
280 echo "--disable-native Don't build for native host"
281 echo "--with-ime= Install path for DDN's Infinite Memory Engine"
282 echo "--enable-libiscsi Enable iscsi support"
283 echo "--enable-libnbd Enable libnbd (NBD engine) support"
284 echo "--disable-libzbc Disable libzbc even if found"
285 echo "--disable-tcmalloc Disable tcmalloc support"
286 echo "--dynamic-libengines Lib-based ioengines as dynamic libraries"
287 exit $exit_val
288fi
289
290cross_prefix=${cross_prefix-${CROSS_COMPILE}}
291# Preferred compiler (can be overriden later after we know the platform):
292# ${CC} (if set)
293# ${cross_prefix}gcc (if cross-prefix specified)
294# gcc if available
295# clang if available
296if test -z "${CC}${cross_prefix}"; then
297 if has gcc; then
298 cc=gcc
299 elif has clang; then
300 cc=clang
301 fi
302else
303 cc="${CC-${cross_prefix}gcc}"
304fi
305
306if check_define __ANDROID__ ; then
307 targetos="Android"
308elif check_define __linux__ ; then
309 targetos="Linux"
310elif check_define __OpenBSD__ ; then
311 targetos='OpenBSD'
312elif check_define __NetBSD__ ; then
313 targetos='NetBSD'
314elif check_define __sun__ ; then
315 targetos='SunOS'
316 CFLAGS="$CFLAGS -D_REENTRANT"
317elif check_define _WIN32 ; then
318 targetos='CYGWIN'
319else
320 targetos=`uname -s`
321fi
322
323echo "# Automatically generated by configure - do not modify" > $config_host_mak
324printf "# Configured with:" >> $config_host_mak
325printf " '%s'" "$0" "$@" >> $config_host_mak
326echo >> $config_host_mak
327echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak
328
329if test "$no_shm" = "yes" ; then
330 output_sym "CONFIG_NO_SHM"
331fi
332
333if test "$disable_opt" = "yes" ; then
334 output_sym "CONFIG_FIO_NO_OPT"
335fi
336
337# Some host OSes need non-standard checks for which CPU to use.
338# Note that these checks are broken for cross-compilation: if you're
339# cross-compiling to one of these OSes then you'll need to specify
340# the correct CPU with the --cpu option.
341case $targetos in
342AIX|OpenBSD|NetBSD)
343 # Unless explicitly enabled, turn off lex.
344 # OpenBSD will hit syntax error when enabled.
345 if test -z "$disable_lex" ; then
346 disable_lex="yes"
347 else
348 force_no_lex_o="yes"
349 fi
350 ;;
351FreeBSD)
352 CFLAGS="$CFLAGS -I/usr/local/include"
353 LDFLAGS="$LDFLAGS -L/usr/local/lib"
354 ;;
355Darwin)
356 # on Leopard most of the system is 32-bit, so we have to ask the kernel if
357 # we can run 64-bit userspace code.
358 # If the user didn't specify a CPU explicitly and the kernel says this is
359 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual
360 # detection code.
361 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
362 cpu="x86_64"
363 fi
364 # Avoid configure feature detection of features provided by weak symbols
365cat > $TMPC <<EOF
366int main(void)
367{
368 return 0;
369}
370EOF
371 if compile_prog "" "-Werror=partial-availability" "error on weak symbols"; then
372 CONFIGURE_CFLAGS="$CONFIGURE_CFLAGS -Werror=partial-availability"
373 fi
374 ;;
375SunOS)
376 # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
377 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
378 cpu="x86_64"
379 fi
380 LIBS="-lnsl -lsocket"
381 ;;
382CYGWIN*)
383 # We still force some options, so keep this message here.
384 echo "Forcing some known good options on Windows"
385 if test -z "${CC}${cross_prefix}"; then
386 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
387 cc="i686-w64-mingw32-gcc"
388 else
389 cc="x86_64-w64-mingw32-gcc"
390 fi
391 fi
392
393 target_win_ver=$(echo "$target_win_ver" | tr '[:lower:]' '[:upper:]')
394 if test -z "$target_win_ver"; then
395 # Default Windows API target
396 target_win_ver="7"
397 fi
398 if test "$target_win_ver" = "7"; then
399 output_sym "CONFIG_WINDOWS_7"
400 CFLAGS="$CFLAGS -D_WIN32_WINNT=0x0601"
401 else
402 fatal "Unknown target Windows version"
403 fi
404
405 # We need this to be output_sym'd here because this is Windows specific.
406 # The regular configure path never sets this config.
407 output_sym "CONFIG_WINDOWSAIO"
408 # We now take the regular configuration path without having exit 0 here.
409 # Flags below are still necessary mostly for MinGW.
410 build_static="yes"
411 rusage_thread="yes"
412 fdatasync="yes"
413 clock_gettime="yes" # clock_monotonic probe has dependency on this
414 clock_monotonic="yes"
415 sched_idle="yes"
416 ;;
417esac
418
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
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"
464elif check_define __aarch64__ ; then
465 cpu="aarch64"
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)
478 cpu="x86"
479 ;;
480 x86_64|amd64)
481 cpu="x86_64"
482 ;;
483 armv*b|armv*l|arm)
484 cpu="arm"
485 ;;
486 aarch64)
487 cpu="arm64"
488 ;;
489 hppa|parisc|parisc64)
490 cpu="hppa"
491 ;;
492 mips*)
493 cpu="mips"
494 ;;
495 sparc|sun4[cdmuv])
496 cpu="sparc"
497 ;;
498 *)
499 echo "Unknown CPU"
500 ;;
501esac
502
503##########################################
504# check cross compile
505
506if test "$cross_compile" != "yes" ; then
507 cross_compile="no"
508fi
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
521##########################################
522# check endianness
523if test "$bigendian" != "yes" ; then
524 bigendian="no"
525fi
526if test "$cross_compile" = "no" ; then
527 cat > $TMPC <<EOF
528#include <inttypes.h>
529int main(void)
530{
531 volatile uint32_t i=0x01234567;
532 return (*((uint8_t*)(&i))) == 0x67;
533}
534EOF
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"
553fi
554
555
556print_config "Operating system" "$targetos"
557print_config "CPU" "$cpu"
558print_config "Big endian" "$bigendian"
559if test ! -z "$target_win_ver"; then
560 print_config "Target Windows version" "$target_win_ver"
561fi
562print_config "Compiler" "$cc"
563print_config "Cross compile" "$cross_compile"
564echo
565
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
574print_config "Static build" "$build_static"
575
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
595##########################################
596# check for wordsize
597wordsize="0"
598cat > $TMPC <<EOF
599#include <limits.h>
600#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
601int main(void)
602{
603 BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE);
604 return 0;
605}
606EOF
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"
613fi
614print_config "Wordsize" "$wordsize"
615
616##########################################
617# zlib probe
618if test "$zlib" != "yes" ; then
619 zlib="no"
620fi
621cat > $TMPC <<EOF
622#include <zlib.h>
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"
634fi
635print_config "zlib" "$zlib"
636
637##########################################
638# linux-aio probe
639if test "$libaio" != "yes" ; then
640 libaio="no"
641fi
642if test "$esx" != "yes" ; then
643 cat > $TMPC <<EOF
644#include <libaio.h>
645#include <stddef.h>
646int main(void)
647{
648 io_setup(0, NULL);
649 return 0;
650}
651EOF
652 if compile_prog "" "-laio" "libaio" ; then
653 libaio=yes
654 else
655 if test "$libaio" = "yes" ; then
656 feature_not_found "linux AIO" "libaio-dev or libaio-devel"
657 fi
658 libaio=no
659 fi
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
676fi
677print_config "Linux AIO support" "$libaio"
678print_config "Linux AIO support rw flags" "$libaio_rw_flags"
679
680##########################################
681# posix aio probe
682if test "$posix_aio" != "yes" ; then
683 posix_aio="no"
684fi
685if test "$posix_aio_lrt" != "yes" ; then
686 posix_aio_lrt="no"
687fi
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"
699elif compile_prog "" "-lrt" "posixaio -lrt"; then
700 posix_aio="yes"
701 posix_aio_lrt="yes"
702 LIBS="-lrt $LIBS"
703fi
704print_config "POSIX AIO support" "$posix_aio"
705print_config "POSIX AIO support needs -lrt" "$posix_aio_lrt"
706
707##########################################
708# posix aio fsync probe
709if test "$posix_aio_fsync" != "yes" ; then
710 posix_aio_fsync="no"
711fi
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
727print_config "POSIX AIO fsync" "$posix_aio_fsync"
728
729##########################################
730# POSIX pshared attribute probe
731if test "$posix_pshared" != "yes" ; then
732 posix_pshared="no"
733fi
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
757print_config "POSIX pshared support" "$posix_pshared"
758
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
775elif compile_prog "" "$LIBS -lpthread" "pthread_condattr_setclock" ; then
776 pthread_condattr_setclock=yes
777 LIBS="$LIBS -lpthread"
778fi
779print_config "pthread_condattr_setclock()" "$pthread_condattr_setclock"
780
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
802##########################################
803# solaris aio probe
804if test "$solaris_aio" != "yes" ; then
805 solaris_aio="no"
806fi
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
822print_config "Solaris AIO support" "$solaris_aio"
823
824##########################################
825# __sync_fetch_and_add test
826if test "$sfaa" != "yes" ; then
827 sfaa="no"
828fi
829cat > $TMPC << EOF
830#include <inttypes.h>
831static int sfaa(uint64_t *ptr)
832{
833 return __sync_fetch_and_add(ptr, 0);
834}
835
836int main(int argc, char **argv)
837{
838 uint64_t val = 42;
839 sfaa(&val);
840 return val;
841}
842EOF
843if compile_prog "" "" "__sync_fetch_and_add()" ; then
844 sfaa="yes"
845fi
846print_config "__sync_fetch_and_add" "$sfaa"
847
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
886##########################################
887# libverbs probe
888if test "$libverbs" != "yes" ; then
889 libverbs="no"
890fi
891cat > $TMPC << EOF
892#include <infiniband/verbs.h>
893int main(int argc, char **argv)
894{
895 struct ibv_pd *pd = ibv_alloc_pd(NULL);
896 return pd != NULL;
897}
898EOF
899if test "$disable_rdma" != "yes" && compile_prog "" "-libverbs" "libverbs" ; then
900 libverbs="yes"
901fi
902print_config "libverbs" "$libverbs"
903
904##########################################
905# rdmacm probe
906if test "$rdmacm" != "yes" ; then
907 rdmacm="no"
908fi
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
918if test "$disable_rdma" != "yes" && compile_prog "" "-lrdmacm" "rdma"; then
919 rdmacm="yes"
920fi
921print_config "rdmacm" "$rdmacm"
922
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{
933 char *buf;
934 return asprintf(&buf, "%s", "str") == 0;
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{
950 va_list ap;
951 char *buf;
952 return vasprintf(&buf, "%s", ap) == 0;
953}
954EOF
955if compile_prog "" "" "have_vasprintf"; then
956 have_vasprintf="yes"
957fi
958print_config "vasprintf()" "$have_vasprintf"
959
960##########################################
961# Linux fallocate probe
962if test "$linux_fallocate" != "yes" ; then
963 linux_fallocate="no"
964fi
965cat > $TMPC << EOF
966#include <stdio.h>
967#include <fcntl.h>
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
978print_config "Linux fallocate" "$linux_fallocate"
979
980##########################################
981# POSIX fadvise probe
982if test "$posix_fadvise" != "yes" ; then
983 posix_fadvise="no"
984fi
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
997print_config "POSIX fadvise" "$posix_fadvise"
998
999##########################################
1000# POSIX fallocate probe
1001if test "$posix_fallocate" != "yes" ; then
1002 posix_fallocate="no"
1003fi
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
1016print_config "POSIX fallocate" "$posix_fallocate"
1017
1018##########################################
1019# sched_set/getaffinity 2 or 3 argument test
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
1026cat > $TMPC << EOF
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
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
1049print_config "sched_setaffinity(3 arg)" "$linux_3arg_affinity"
1050print_config "sched_setaffinity(2 arg)" "$linux_2arg_affinity"
1051
1052##########################################
1053# clock_gettime probe
1054if test "$clock_gettime" != "yes" ; then
1055 clock_gettime="no"
1056fi
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
1071print_config "clock_gettime" "$clock_gettime"
1072
1073##########################################
1074# CLOCK_MONOTONIC probe
1075if test "$clock_monotonic" != "yes" ; then
1076 clock_monotonic="no"
1077fi
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
1091print_config "CLOCK_MONOTONIC" "$clock_monotonic"
1092
1093##########################################
1094# clockid_t probe
1095if test "$clockid_t" != "yes" ; then
1096 clockid_t="no"
1097fi
1098cat > $TMPC << EOF
1099#include <time.h>
1100#include <string.h>
1101int main(int argc, char **argv)
1102{
1103 volatile clockid_t cid;
1104 memset((void*)&cid, 0, sizeof(cid));
1105 return 0;
1106}
1107EOF
1108if compile_prog "" "$LIBS" "clockid_t"; then
1109 clockid_t="yes"
1110fi
1111print_config "clockid_t" "$clockid_t"
1112
1113##########################################
1114# gettimeofday() probe
1115if test "$gettimeofday" != "yes" ; then
1116 gettimeofday="no"
1117fi
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
1130print_config "gettimeofday" "$gettimeofday"
1131
1132##########################################
1133# fdatasync() probe
1134if test "$fdatasync" != "yes" ; then
1135 fdatasync="no"
1136fi
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
1148print_config "fdatasync" "$fdatasync"
1149
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
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
1203##########################################
1204# sync_file_range() probe
1205if test "$sync_file_range" != "yes" ; then
1206 sync_file_range="no"
1207fi
1208cat > $TMPC << EOF
1209#include <stdio.h>
1210#include <unistd.h>
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
1223print_config "sync_file_range" "$sync_file_range"
1224
1225##########################################
1226# ext4 move extent probe
1227if test "$ext4_me" != "yes" ; then
1228 ext4_me="no"
1229fi
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
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.
1245 ext4_me="yes"
1246fi
1247print_config "EXT4 move extent" "$ext4_me"
1248
1249##########################################
1250# splice probe
1251if test "$linux_splice" != "yes" ; then
1252 linux_splice="no"
1253fi
1254cat > $TMPC << EOF
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
1265print_config "Linux splice(2)" "$linux_splice"
1266
1267##########################################
1268# libnuma probe
1269if test "$libnuma" != "yes" ; then
1270 libnuma="no"
1271fi
1272cat > $TMPC << EOF
1273#include <numa.h>
1274int main(int argc, char **argv)
1275{
1276 return numa_available();
1277}
1278EOF
1279if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then
1280 libnuma="yes"
1281 LIBS="-lnuma $LIBS"
1282fi
1283print_config "libnuma" "$libnuma"
1284
1285##########################################
1286# libnuma 2.x version API, initialize with "no" only if $libnuma is set to "yes"
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);
1294 return mask->size == 0;
1295}
1296EOF
1297if compile_prog "" "" "libnuma api"; then
1298 libnuma_v2="yes"
1299fi
1300print_config "libnuma v2" "$libnuma_v2"
1301fi
1302
1303##########################################
1304# strsep() probe
1305if test "$strsep" != "yes" ; then
1306 strsep="no"
1307fi
1308cat > $TMPC << EOF
1309#include <string.h>
1310int main(int argc, char **argv)
1311{
1312 static char *string = "This is a string";
1313 strsep(&string, "needle");
1314 return 0;
1315}
1316EOF
1317if compile_prog "" "" "strsep"; then
1318 strsep="yes"
1319fi
1320print_config "strsep" "$strsep"
1321
1322##########################################
1323# strcasestr() probe
1324if test "$strcasestr" != "yes" ; then
1325 strcasestr="no"
1326fi
1327cat > $TMPC << EOF
1328#include <string.h>
1329int main(int argc, char **argv)
1330{
1331 return strcasestr(argv[0], argv[1]) != NULL;
1332}
1333EOF
1334if compile_prog "" "" "strcasestr"; then
1335 strcasestr="yes"
1336fi
1337print_config "strcasestr" "$strcasestr"
1338
1339##########################################
1340# strlcat() probe
1341if test "$strlcat" != "yes" ; then
1342 strlcat="no"
1343fi
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
1358print_config "strlcat" "$strlcat"
1359
1360##########################################
1361# getopt_long_only() probe
1362if test "$getopt_long_only" != "yes" ; then
1363 getopt_long_only="no"
1364fi
1365cat > $TMPC << EOF
1366#include <unistd.h>
1367#include <stdio.h>
1368#include <getopt.h>
1369int main(int argc, char **argv)
1370{
1371 int c = getopt_long_only(argc, argv, "", NULL, NULL);
1372 return c;
1373}
1374EOF
1375if compile_prog "" "" "getopt_long_only"; then
1376 getopt_long_only="yes"
1377fi
1378print_config "getopt_long_only()" "$getopt_long_only"
1379
1380##########################################
1381# inet_aton() probe
1382if test "$inet_aton" != "yes" ; then
1383 inet_aton="no"
1384fi
1385cat > $TMPC << EOF
1386#ifdef _WIN32
1387#include <winsock2.h>
1388#else
1389#include <sys/socket.h>
1390#include <arpa/inet.h>
1391#endif
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
1402print_config "inet_aton" "$inet_aton"
1403
1404##########################################
1405# socklen_t probe
1406if test "$socklen_t" != "yes" ; then
1407 socklen_t="no"
1408fi
1409cat > $TMPC << EOF
1410#ifdef _WIN32
1411#include <winsock2.h>
1412#include <ws2tcpip.h>
1413#else
1414#include <sys/socket.h>
1415#endif
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
1425print_config "socklen_t" "$socklen_t"
1426
1427##########################################
1428# Whether or not __thread is supported for TLS
1429if test "$tls_thread" != "yes" ; then
1430 tls_thread="no"
1431fi
1432cat > $TMPC << EOF
1433#include <stdio.h>
1434static __thread int ret;
1435int main(int argc, char **argv)
1436{
1437 return ret;
1438}
1439EOF
1440if compile_prog "" "" "__thread"; then
1441 tls_thread="yes"
1442fi
1443print_config "__thread" "$tls_thread"
1444
1445##########################################
1446# Check if we have required gtk/glib support for gfio
1447if test "$gfio" != "yes" ; then
1448 gfio="no"
1449fi
1450if test "$gfio_check" = "yes" ; then
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();
1458 gdk_threads_leave();
1459
1460 return GTK_CHECK_VERSION(2, 18, 0) ? 0 : 1; /* 0 on success */
1461}
1462EOF
1463GTK_CFLAGS=$(${cross_prefix}pkg-config --cflags gtk+-2.0 gthread-2.0)
1464ORG_LDFLAGS=$LDFLAGS
1465LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g)
1466if test "$?" != "0" ; then
1467 echo "configure: gtk and gthread not found"
1468 exit 1
1469fi
1470GTK_LIBS=$(${cross_prefix}pkg-config --libs gtk+-2.0 gthread-2.0)
1471if test "$?" != "0" ; then
1472 echo "configure: gtk and gthread not found"
1473 exit 1
1474fi
1475gfio="yes"
1476if check_min_lib_version gtk+-2.0 2.18.0 "gfio"; then
1477 if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
1478 GFIO_LIBS="$LIBS $GTK_LIBS"
1479 CFLAGS="$CFLAGS $GTK_CFLAGS"
1480 else
1481 echo "Please install gtk and gdk libraries"
1482 gfio="no"
1483 fi
1484else
1485 gfio="no"
1486fi
1487LDFLAGS=$ORG_LDFLAGS
1488fi
1489
1490if test "$gfio_check" = "yes" ; then
1491 print_config "gtk 2.18 or higher" "$gfio"
1492fi
1493
1494##########################################
1495# Check whether we have getrusage(RUSAGE_THREAD)
1496if test "$rusage_thread" != "yes" ; then
1497 rusage_thread="no"
1498fi
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
1512print_config "RUSAGE_THREAD" "$rusage_thread"
1513
1514##########################################
1515# Check whether we have SCHED_IDLE
1516if test "$sched_idle" != "yes" ; then
1517 sched_idle="no"
1518fi
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
1530print_config "SCHED_IDLE" "$sched_idle"
1531
1532##########################################
1533# Check whether we have TCP_NODELAY
1534if test "$tcp_nodelay" != "yes" ; then
1535 tcp_nodelay="no"
1536fi
1537cat > $TMPC << EOF
1538#ifdef _WIN32
1539#include <winsock2.h>
1540#else
1541#include <stdio.h>
1542#include <sys/types.h>
1543#include <sys/socket.h>
1544#include <netinet/tcp.h>
1545#endif
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"
1553elif compile_prog "" "-lws2_32" "TCP_NODELAY"; then
1554 tcp_nodelay="yes"
1555 LIBS="$LIBS -lws2_32"
1556fi
1557print_config "TCP_NODELAY" "$tcp_nodelay"
1558
1559##########################################
1560# Check whether we have SO_SNDBUF
1561if test "$window_size" != "yes" ; then
1562 window_size="no"
1563fi
1564cat > $TMPC << EOF
1565#ifdef _WIN32
1566#include <winsock2.h>
1567#else
1568#include <stdio.h>
1569#include <sys/types.h>
1570#include <sys/socket.h>
1571#include <netinet/tcp.h>
1572#endif
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"
1581elif compile_prog "" "-lws2_32" "SO_SNDBUF"; then
1582 window_size="yes"
1583 LIBS="$LIBS -lws2_32"
1584fi
1585print_config "Net engine window_size" "$window_size"
1586
1587##########################################
1588# Check whether we have TCP_MAXSEG
1589if test "$mss" != "yes" ; then
1590 mss="no"
1591fi
1592cat > $TMPC << EOF
1593#ifdef _WIN32
1594#include <winsock2.h>
1595#else
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>
1602#endif
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"
1610elif compile_prog "" "-lws2_32" "TCP_MAXSEG"; then
1611 mss="yes"
1612 LIBS="$LIBS -lws2_32"
1613fi
1614print_config "TCP_MAXSEG" "$mss"
1615
1616##########################################
1617# Check whether we have RLIMIT_MEMLOCK
1618if test "$rlimit_memlock" != "yes" ; then
1619 rlimit_memlock="no"
1620fi
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
1633print_config "RLIMIT_MEMLOCK" "$rlimit_memlock"
1634
1635##########################################
1636# Check whether we have pwritev/preadv
1637if test "$pwritev" != "yes" ; then
1638 pwritev="no"
1639fi
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
1651print_config "pwritev/preadv" "$pwritev"
1652
1653##########################################
1654# Check whether we have pwritev2/preadv2
1655if test "$pwritev2" != "yes" ; then
1656 pwritev2="no"
1657fi
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
1669print_config "pwritev2/preadv2" "$pwritev2"
1670
1671##########################################
1672# Check whether we have the required functions for ipv6
1673if test "$ipv6" != "yes" ; then
1674 ipv6="no"
1675fi
1676cat > $TMPC << EOF
1677#ifdef _WIN32
1678#include <winsock2.h>
1679#include <ws2tcpip.h>
1680#else
1681#include <sys/types.h>
1682#include <sys/socket.h>
1683#include <netinet/in.h>
1684#include <netdb.h>
1685#endif
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
1703print_config "IPv6 helpers" "$ipv6"
1704
1705##########################################
1706# check for http
1707if test "$http" != "yes" ; then
1708 http="no"
1709fi
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
1750 output_sym "CONFIG_HAVE_OPAQUE_HMAC_CTX"
1751 http="yes"
1752 elif mv $TMPC2 $TMPC && compile_prog "" "$HTTP_LIBS" "curl-old-ssl"; then
1753 http="yes"
1754 fi
1755fi
1756print_config "http engine" "$http"
1757
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
1782 rados="yes"
1783fi
1784print_config "Rados engine" "$rados"
1785
1786##########################################
1787# check for rbd
1788if test "$rbd" != "yes" ; then
1789 rbd="no"
1790fi
1791cat > $TMPC << EOF
1792#include <rbd/librbd.h>
1793
1794int main(int argc, char **argv)
1795{
1796 rados_t cluster;
1797 rados_ioctx_t io_ctx;
1798 const char cluster_name[] = "ceph";
1799 const char user_name[] = "client.admin";
1800 const char pool[] = "rbd";
1801 int major, minor, extra;
1802
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);
1806 rados_ioctx_create(cluster, pool, &io_ctx);
1807
1808 return 0;
1809}
1810EOF
1811if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then
1812 rbd="yes"
1813fi
1814print_config "Rados Block Device engine" "$rbd"
1815
1816##########################################
1817# check for rbd_poll
1818if test "$rbd_poll" != "yes" ; then
1819 rbd_poll="no"
1820fi
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
1841print_config "rbd_poll" "$rbd_poll"
1842fi
1843
1844##########################################
1845# check for rbd_invalidate_cache()
1846if test "$rbd_inval" != "yes" ; then
1847 rbd_inval="no"
1848fi
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
1863print_config "rbd_invalidate_cache" "$rbd_inval"
1864fi
1865
1866##########################################
1867# Check whether we have setvbuf
1868if test "$setvbuf" != "yes" ; then
1869 setvbuf="no"
1870fi
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
1884print_config "setvbuf" "$setvbuf"
1885
1886##########################################
1887# check for gfapi
1888if test "$gfapi" != "yes" ; then
1889 gfapi="no"
1890fi
1891cat > $TMPC << EOF
1892#include <glusterfs/api/glfs.h>
1893
1894int main(int argc, char **argv)
1895{
1896 glfs_t *g = glfs_new("foo");
1897
1898 return 0;
1899}
1900EOF
1901if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1902 gfapi="yes"
1903fi
1904print_config "Gluster API engine" "$gfapi"
1905
1906##########################################
1907# check for gfapi fadvise support, initialize with "no" only if $gfapi is set to "yes"
1908if test "$gfapi" = "yes" ; then
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
1921if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1922 gf_fadvise="yes"
1923fi
1924print_config "Gluster API use fadvise" "$gf_fadvise"
1925fi
1926
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
1945##########################################
1946# check for gfapi trim support
1947if test "$gf_trim" != "yes" ; then
1948 gf_trim="no"
1949fi
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
1962print_config "Gluster API trim support" "$gf_trim"
1963fi
1964
1965##########################################
1966# Check if we support stckf on s390
1967if test "$s390_z196_facilities" != "yes" ; then
1968 s390_z196_facilities="no"
1969fi
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
1992 if [ $? -eq 0 ]; then
1993 s390_z196_facilities="yes"
1994 fi
1995fi
1996print_config "s390_z196_facilities" "$s390_z196_facilities"
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
2015 feature_not_found "libhdfs" ""
2016 fi
2017 FIO_HDFS_CPU=$cpu
2018 if test "$FIO_HDFS_CPU" = "x86_64" ; then
2019 FIO_HDFS_CPU="amd64"
2020 fi
2021fi
2022print_config "HDFS engine" "$libhdfs"
2023
2024##########################################
2025# Check whether we have MTD
2026if test "$mtd" != "yes" ; then
2027 mtd="no"
2028fi
2029cat > $TMPC << EOF
2030#include <string.h>
2031#include <mtd/mtd-user.h>
2032#include <sys/ioctl.h>
2033int main(int argc, char **argv)
2034{
2035 struct mtd_write_req ops;
2036 struct mtd_info_user info;
2037 memset(&ops, 0, sizeof(ops));
2038 info.type = MTD_MLCNANDFLASH;
2039 return ioctl(0, MEMGETINFO, &info);
2040}
2041EOF
2042if compile_prog "" "" "mtd"; then
2043 mtd="yes"
2044fi
2045print_config "MTD" "$mtd"
2046
2047##########################################
2048# Check whether we have libpmem
2049if test "$libpmem" != "yes" ; then
2050 libpmem="no"
2051fi
2052cat > $TMPC << EOF
2053#include <libpmem.h>
2054#include <stdlib.h>
2055int main(int argc, char **argv)
2056{
2057 int rc;
2058 rc = pmem_is_pmem(NULL, NULL);
2059 return 0;
2060}
2061EOF
2062if compile_prog "" "-lpmem" "libpmem"; then
2063 libpmem="yes"
2064fi
2065print_config "libpmem" "$libpmem"
2066
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
2088##########################################
2089# Check whether we have libpmemblk
2090# libpmem is a prerequisite
2091if test "$libpmemblk" != "yes" ; then
2092 libpmemblk="no"
2093fi
2094if test "$libpmem" = "yes"; then
2095 cat > $TMPC << EOF
2096#include <libpmemblk.h>
2097int main(int argc, char **argv)
2098{
2099 PMEMblkpool *pbp;
2100 pbp = pmemblk_open("", 0);
2101 return 0;
2102}
2103EOF
2104 if compile_prog "" "-lpmemblk" "libpmemblk"; then
2105 libpmemblk="yes"
2106 fi
2107fi
2108print_config "libpmemblk" "$libpmemblk"
2109
2110# Choose libpmem-based ioengines
2111if test "$libpmem" = "yes" && test "$disable_pmem" = "no"; then
2112 devdax="yes"
2113 if test "$libpmem1_5" = "yes"; then
2114 pmem="yes"
2115 fi
2116 if test "$libpmemblk" = "yes"; then
2117 pmemblk="yes"
2118 fi
2119fi
2120
2121##########################################
2122# Report whether pmemblk engine is enabled
2123print_config "PMDK pmemblk engine" "$pmemblk"
2124
2125##########################################
2126# Report whether dev-dax engine is enabled
2127print_config "PMDK dev-dax engine" "$devdax"
2128
2129##########################################
2130# Report whether libpmem engine is enabled
2131print_config "PMDK libpmem engine" "$pmem"
2132
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
2156##########################################
2157# Check if we have libiscsi
2158if test "$libiscsi" != "no" ; then
2159 if check_min_lib_version libiscsi 1.9.0; then
2160 libiscsi="yes"
2161 libiscsi_cflags=$(pkg-config --cflags libiscsi)
2162 libiscsi_libs=$(pkg-config --libs libiscsi)
2163 else
2164 libiscsi="no"
2165 fi
2166fi
2167print_config "iscsi engine" "$libiscsi"
2168
2169##########################################
2170# Check if we have libnbd (for NBD support)
2171if test "$libnbd" != "no" ; then
2172 if check_min_lib_version libnbd 0.9.8; then
2173 libnbd="yes"
2174 libnbd_cflags=$(pkg-config --cflags libnbd)
2175 libnbd_libs=$(pkg-config --libs libnbd)
2176 else
2177 libnbd="no"
2178 fi
2179fi
2180print_config "NBD engine" "$libnbd"
2181
2182##########################################
2183# Check if we have lex/yacc available
2184yacc="no"
2185yacc_is_bison="no"
2186lex="no"
2187arith="no"
2188if test "$disable_lex" = "no" || test -z "$disable_lex" ; then
2189if test "$targetos" != "SunOS" ; then
2190if has lex; then
2191 lex="yes"
2192fi
2193if has bison; then
2194 yacc="yes"
2195 yacc_is_bison="yes"
2196elif has yacc; then
2197 yacc="yes"
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
2213if compile_prog "" "-lfl" "flex"; then
2214 LIBS="-lfl $LIBS"
2215elif compile_prog "" "-ll" "lex"; then
2216 LIBS="-ll $LIBS"
2217else
2218 arith="no"
2219fi
2220fi
2221fi
2222fi
2223
2224# Check if lex fails using -o
2225if test "$arith" = "yes" ; then
2226if test "$force_no_lex_o" = "yes" ; then
2227 lex_use_o="no"
2228else
2229if lex -o lex.yy.c exp/expression-parser.l 2> /dev/null; then
2230 lex_use_o="yes"
2231else
2232 lex_use_o="no"
2233fi
2234fi
2235fi
2236
2237print_config "lex/yacc for arithmetic" "$arith"
2238
2239##########################################
2240# Check whether we have setmntent/getmntent
2241if test "$getmntent" != "yes" ; then
2242 getmntent="no"
2243fi
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);
2251 endmntent(mtab);
2252 return 0;
2253}
2254EOF
2255if compile_prog "" "" "getmntent"; then
2256 getmntent="yes"
2257fi
2258print_config "getmntent" "$getmntent"
2259
2260##########################################
2261# Check whether we have getmntinfo
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.
2267if test "$getmntinfo" != "yes" ; then
2268 getmntinfo="no"
2269fi
2270cat > $TMPC << EOF
2271#include <stdio.h>
2272#include <sys/param.h>
2273#include <sys/mount.h>
2274int main(int argc, char **argv)
2275{
2276 struct statfs *st;
2277 return getmntinfo(&st, MNT_NOWAIT);
2278}
2279EOF
2280if compile_prog "-Werror" "" "getmntinfo"; then
2281 getmntinfo="yes"
2282fi
2283print_config "getmntinfo" "$getmntinfo"
2284
2285# getmntinfo(3) for NetBSD.
2286if test "$getmntinfo_statvfs" != "yes" ; then
2287 getmntinfo_statvfs="no"
2288fi
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"
2301 print_config "getmntinfo_statvfs" "$getmntinfo_statvfs"
2302fi
2303
2304##########################################
2305# Check whether we have _Static_assert
2306if test "$static_assert" != "yes" ; then
2307 static_assert="no"
2308fi
2309cat > $TMPC << EOF
2310#include <assert.h>
2311#include <stdlib.h>
2312#include <stddef.h>
2313
2314struct foo {
2315 int a, b;
2316};
2317
2318int main(int argc, char **argv)
2319{
2320 _Static_assert(offsetof(struct foo, a) == 0 , "Check");
2321 return 0 ;
2322}
2323EOF
2324if compile_prog "" "" "static_assert"; then
2325 static_assert="yes"
2326fi
2327print_config "Static Assert" "$static_assert"
2328
2329##########################################
2330# Check whether we have bool / stdbool.h
2331if test "$have_bool" != "yes" ; then
2332 have_bool="no"
2333fi
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
2345print_config "bool" "$have_bool"
2346
2347##########################################
2348# Check whether we have strndup()
2349strndup="no"
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
2366##########################################
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
2385if test "$targetos" = "Linux" ; then
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
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
2421##########################################
2422# libzbc probe
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
2432if test "$libzbc" != "no" ; then
2433 if compile_prog "" "-lzbc" "libzbc"; then
2434 libzbc="yes"
2435 if ! check_min_lib_version libzbc 5; then
2436 libzbc="no"
2437 fi
2438 else
2439 if test "$libzbc" = "yes" ; then
2440 feature_not_found "libzbc" "libzbc or libzbc/zbc.h"
2441 fi
2442 libzbc="no"
2443 fi
2444fi
2445print_config "libzbc engine" "$libzbc"
2446
2447##########################################
2448# check march=armv8-a+crc+crypto
2449if test "$march_armv8_a_crc_crypto" != "yes" ; then
2450 march_armv8_a_crc_crypto="no"
2451fi
2452if test "$cpu" = "arm64" ; then
2453 cat > $TMPC <<EOF
2454#include <arm_acle.h>
2455#include <arm_neon.h>
2456#include <sys/auxv.h>
2457
2458int main(void)
2459{
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
2466}
2467EOF
2468 if compile_prog "-march=armv8-a+crc+crypto" "" "ARM CRC32c"; then
2469 march_armv8_a_crc_crypto="yes"
2470 CFLAGS="$CFLAGS -march=armv8-a+crc+crypto"
2471 march_set="yes"
2472 fi
2473fi
2474print_config "march_armv8_a_crc_crypto" "$march_armv8_a_crc_crypto"
2475
2476##########################################
2477# cuda probe
2478if test "$cuda" != "no" ; then
2479cat > $TMPC << EOF
2480#include <cuda.h>
2481int main(int argc, char **argv)
2482{
2483 return cuInit(0);
2484}
2485EOF
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
2495fi
2496print_config "cuda" "$cuda"
2497
2498##########################################
2499# libcufile probe
2500if test "$libcufile" != "no" ; then
2501cat > $TMPC << EOF
2502#include <cufile.h>
2503
2504int main(int argc, char* argv[]) {
2505 cuFileDriverOpen();
2506 return 0;
2507}
2508EOF
2509 if compile_prog "" "-lcuda -lcudart -lcufile" "libcufile"; then
2510 libcufile="yes"
2511 LIBS="-lcuda -lcudart -lcufile $LIBS"
2512 else
2513 if test "$libcufile" = "yes" ; then
2514 feature_not_found "libcufile" ""
2515 fi
2516 libcufile="no"
2517 fi
2518fi
2519print_config "libcufile" "$libcufile"
2520
2521##########################################
2522# check for cc -march=native
2523build_native="no"
2524cat > $TMPC << EOF
2525int main(int argc, char **argv)
2526{
2527 return 0;
2528}
2529EOF
2530if test "$disable_native" = "no" && test "$disable_opt" != "yes" && \
2531 compile_prog "-march=native" "" "march=native"; then
2532 build_native="yes"
2533fi
2534print_config "Build march=native" "$build_native"
2535
2536##########################################
2537# check for -lcunit
2538if test "$cunit" != "yes" ; then
2539 cunit="no"
2540fi
2541cat > $TMPC << EOF
2542#include <CUnit/CUnit.h>
2543#include <CUnit/Basic.h>
2544int main(void)
2545{
2546 if (CU_initialize_registry() != CUE_SUCCESS)
2547 return CU_get_error();
2548 CU_basic_set_mode(CU_BRM_VERBOSE);
2549 CU_basic_run_tests();
2550 CU_cleanup_registry();
2551 return CU_get_error();
2552}
2553EOF
2554if compile_prog "" "-lcunit" "CUnit"; then
2555 cunit="yes"
2556fi
2557print_config "CUnit" "$cunit"
2558
2559##########################################
2560# check for __kernel_rwf_t
2561__kernel_rwf_t="no"
2562cat > $TMPC << EOF
2563#include <linux/fs.h>
2564int main(int argc, char **argv)
2565{
2566 __kernel_rwf_t x;
2567 x = 0;
2568 return x;
2569}
2570EOF
2571if compile_prog "" "" "__kernel_rwf_t"; then
2572 __kernel_rwf_t="yes"
2573fi
2574print_config "__kernel_rwf_t" "$__kernel_rwf_t"
2575
2576##########################################
2577# check if gcc has -Wimplicit-fallthrough=2
2578fallthrough="no"
2579cat > $TMPC << EOF
2580int main(int argc, char **argv)
2581{
2582 return 0;
2583}
2584EOF
2585if compile_prog "-Wimplicit-fallthrough=2" "" "-Wimplicit-fallthrough=2"; then
2586 fallthrough="yes"
2587fi
2588print_config "-Wimplicit-fallthrough=2" "$fallthrough"
2589
2590##########################################
2591# check for MADV_HUGEPAGE support
2592if test "$thp" != "yes" ; then
2593 thp="no"
2594fi
2595if test "$esx" != "yes" ; then
2596 cat > $TMPC <<EOF
2597#include <sys/mman.h>
2598int main(void)
2599{
2600 return madvise(0, 0x1000, MADV_HUGEPAGE);
2601}
2602EOF
2603 if compile_prog "" "" "thp" ; then
2604 thp=yes
2605 else
2606 if test "$thp" = "yes" ; then
2607 feature_not_found "Transparent Huge Page" ""
2608 fi
2609 thp=no
2610 fi
2611fi
2612print_config "MADV_HUGEPAGE" "$thp"
2613
2614##########################################
2615# check for gettid()
2616gettid="no"
2617cat > $TMPC << EOF
2618#include <unistd.h>
2619int main(int argc, char **argv)
2620{
2621 return gettid();
2622}
2623EOF
2624if compile_prog "" "" "gettid"; then
2625 gettid="yes"
2626fi
2627print_config "gettid" "$gettid"
2628
2629##########################################
2630# check for statx(2) support by libc
2631statx="no"
2632cat > $TMPC << EOF
2633#include <unistd.h>
2634#include <sys/stat.h>
2635
2636int main(int argc, char **argv)
2637{
2638 struct statx st;
2639 return statx(-1, *argv, 0, 0, &st);
2640}
2641EOF
2642if compile_prog "" "" "statx"; then
2643 statx="yes"
2644fi
2645print_config "statx(2)/libc" "$statx"
2646
2647##########################################
2648# check for statx(2) support by kernel
2649statx_syscall="no"
2650cat > $TMPC << EOF
2651#include <unistd.h>
2652#include <linux/stat.h>
2653#include <sys/stat.h>
2654#include <sys/syscall.h>
2655
2656static int _statx(int dfd, const char *pathname, int flags, unsigned int mask,
2657 struct statx *buffer)
2658{
2659 return syscall(__NR_statx, dfd, pathname, flags, mask, buffer);
2660}
2661
2662int main(int argc, char **argv)
2663{
2664 struct statx st;
2665 return _statx(-1, *argv, 0, 0, &st);
2666}
2667EOF
2668if compile_prog "" "" "statx_syscall"; then
2669 statx_syscall="yes"
2670fi
2671print_config "statx(2)/syscall" "$statx_syscall"
2672
2673##########################################
2674# check for Windows PDB generation support
2675if test "pdb" != "no" ; then
2676 cat > $TMPC <<EOF
2677int main(void)
2678{
2679 return 0;
2680}
2681EOF
2682 if compile_prog "-g -gcodeview" "-fuse-ld=lld -Wl,-pdb,$TMPO" "pdb"; then
2683 pdb=yes
2684 else
2685 if test "$pdb" = "yes"; then
2686 feature_not_found "PDB" "clang and lld"
2687 fi
2688 pdb=no
2689 fi
2690else
2691 pdb=no
2692fi
2693print_config "Windows PDB generation" "$pdb"
2694
2695##########################################
2696# check for timerfd support
2697timerfd_create="no"
2698if test "$esx" != "yes" ; then
2699cat > $TMPC << EOF
2700#include <sys/time.h>
2701#include <sys/timerfd.h>
2702
2703int main(int argc, char **argv)
2704{
2705 return timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK);
2706}
2707EOF
2708 if compile_prog "" "" "timerfd_create"; then
2709 timerfd_create="yes"
2710 fi
2711fi
2712print_config "timerfd_create" "$timerfd_create"
2713
2714#############################################################################
2715
2716if test "$wordsize" = "64" ; then
2717 output_sym "CONFIG_64BIT"
2718elif test "$wordsize" = "32" ; then
2719 output_sym "CONFIG_32BIT"
2720else
2721 fatal "Unknown wordsize!"
2722fi
2723if test "$bigendian" = "yes" ; then
2724 output_sym "CONFIG_BIG_ENDIAN"
2725else
2726 output_sym "CONFIG_LITTLE_ENDIAN"
2727fi
2728if test "$zlib" = "yes" ; then
2729 output_sym "CONFIG_ZLIB"
2730fi
2731if test "$libaio" = "yes" ; then
2732 output_sym "CONFIG_LIBAIO"
2733 if test "$libaio_rw_flags" = "yes" ; then
2734 output_sym "CONFIG_LIBAIO_RW_FLAGS"
2735 fi
2736fi
2737if test "$posix_aio" = "yes" ; then
2738 output_sym "CONFIG_POSIXAIO"
2739fi
2740if test "$posix_aio_fsync" = "yes" ; then
2741 output_sym "CONFIG_POSIXAIO_FSYNC"
2742fi
2743if test "$posix_pshared" = "yes" ; then
2744 output_sym "CONFIG_PSHARED"
2745fi
2746if test "$pthread_condattr_setclock" = "yes" ; then
2747 output_sym "CONFIG_PTHREAD_CONDATTR_SETCLOCK"
2748fi
2749if test "$pthread_sigmask" = "yes" ; then
2750 output_sym "CONFIG_PTHREAD_SIGMASK"
2751fi
2752if test "$have_asprintf" = "yes" ; then
2753 output_sym "CONFIG_HAVE_ASPRINTF"
2754fi
2755if test "$have_vasprintf" = "yes" ; then
2756 output_sym "CONFIG_HAVE_VASPRINTF"
2757fi
2758if test "$linux_fallocate" = "yes" ; then
2759 output_sym "CONFIG_LINUX_FALLOCATE"
2760fi
2761if test "$posix_fallocate" = "yes" ; then
2762 output_sym "CONFIG_POSIX_FALLOCATE"
2763fi
2764if test "$fdatasync" = "yes" ; then
2765 output_sym "CONFIG_FDATASYNC"
2766fi
2767if test "$pipe" = "yes" ; then
2768 output_sym "CONFIG_PIPE"
2769fi
2770if test "$pipe2" = "yes" ; then
2771 output_sym "CONFIG_PIPE2"
2772fi
2773if test "$pread" = "yes" ; then
2774 output_sym "CONFIG_PREAD"
2775fi
2776if test "$sync_file_range" = "yes" ; then
2777 output_sym "CONFIG_SYNC_FILE_RANGE"
2778fi
2779if test "$sfaa" = "yes" ; then
2780 output_sym "CONFIG_SFAA"
2781fi
2782if test "$sync_sync" = "yes" ; then
2783 output_sym "CONFIG_SYNC_SYNC"
2784fi
2785if test "$cmp_swap" = "yes" ; then
2786 output_sym "CONFIG_CMP_SWAP"
2787fi
2788if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
2789 output_sym "CONFIG_RDMA"
2790fi
2791if test "$clock_gettime" = "yes" ; then
2792 output_sym "CONFIG_CLOCK_GETTIME"
2793fi
2794if test "$clock_monotonic" = "yes" ; then
2795 output_sym "CONFIG_CLOCK_MONOTONIC"
2796fi
2797if test "$clock_monotonic_raw" = "yes" ; then
2798 output_sym "CONFIG_CLOCK_MONOTONIC_RAW"
2799fi
2800if test "$clock_monotonic_precise" = "yes" ; then
2801 output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
2802fi
2803if test "$clockid_t" = "yes"; then
2804 output_sym "CONFIG_CLOCKID_T"
2805fi
2806if test "$gettimeofday" = "yes" ; then
2807 output_sym "CONFIG_GETTIMEOFDAY"
2808fi
2809if test "$posix_fadvise" = "yes" ; then
2810 output_sym "CONFIG_POSIX_FADVISE"
2811fi
2812if test "$linux_3arg_affinity" = "yes" ; then
2813 output_sym "CONFIG_3ARG_AFFINITY"
2814elif test "$linux_2arg_affinity" = "yes" ; then
2815 output_sym "CONFIG_2ARG_AFFINITY"
2816fi
2817if test "$strsep" = "yes" ; then
2818 output_sym "CONFIG_STRSEP"
2819fi
2820if test "$strcasestr" = "yes" ; then
2821 output_sym "CONFIG_STRCASESTR"
2822fi
2823if test "$strlcat" = "yes" ; then
2824 output_sym "CONFIG_STRLCAT"
2825fi
2826if test "$getopt_long_only" = "yes" ; then
2827 output_sym "CONFIG_GETOPT_LONG_ONLY"
2828fi
2829if test "$inet_aton" = "yes" ; then
2830 output_sym "CONFIG_INET_ATON"
2831fi
2832if test "$socklen_t" = "yes" ; then
2833 output_sym "CONFIG_SOCKLEN_T"
2834fi
2835if test "$ext4_me" = "yes" ; then
2836 output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
2837fi
2838if test "$linux_splice" = "yes" ; then
2839 output_sym "CONFIG_LINUX_SPLICE"
2840fi
2841if test "$libnuma_v2" = "yes" ; then
2842 output_sym "CONFIG_LIBNUMA"
2843fi
2844if test "$solaris_aio" = "yes" ; then
2845 output_sym "CONFIG_SOLARISAIO"
2846fi
2847if test "$tls_thread" = "yes" ; then
2848 output_sym "CONFIG_TLS_THREAD"
2849fi
2850if test "$rusage_thread" = "yes" ; then
2851 output_sym "CONFIG_RUSAGE_THREAD"
2852fi
2853if test "$gfio" = "yes" ; then
2854 output_sym "CONFIG_GFIO"
2855fi
2856if test "$esx" = "yes" ; then
2857 output_sym "CONFIG_ESX"
2858 output_sym "CONFIG_NO_SHM"
2859fi
2860if test "$sched_idle" = "yes" ; then
2861 output_sym "CONFIG_SCHED_IDLE"
2862fi
2863if test "$tcp_nodelay" = "yes" ; then
2864 output_sym "CONFIG_TCP_NODELAY"
2865fi
2866if test "$window_size" = "yes" ; then
2867 output_sym "CONFIG_NET_WINDOWSIZE"
2868fi
2869if test "$mss" = "yes" ; then
2870 output_sym "CONFIG_NET_MSS"
2871fi
2872if test "$rlimit_memlock" = "yes" ; then
2873 output_sym "CONFIG_RLIMIT_MEMLOCK"
2874fi
2875if test "$pwritev" = "yes" ; then
2876 output_sym "CONFIG_PWRITEV"
2877fi
2878if test "$pwritev2" = "yes" ; then
2879 output_sym "CONFIG_PWRITEV2"
2880fi
2881if test "$ipv6" = "yes" ; then
2882 output_sym "CONFIG_IPV6"
2883fi
2884if test "$http" = "yes" ; then
2885 output_sym "CONFIG_HTTP"
2886fi
2887if test "$rados" = "yes" ; then
2888 output_sym "CONFIG_RADOS"
2889fi
2890if test "$rbd" = "yes" ; then
2891 output_sym "CONFIG_RBD"
2892fi
2893if test "$rbd_poll" = "yes" ; then
2894 output_sym "CONFIG_RBD_POLL"
2895fi
2896if test "$rbd_inval" = "yes" ; then
2897 output_sym "CONFIG_RBD_INVAL"
2898fi
2899if test "$setvbuf" = "yes" ; then
2900 output_sym "CONFIG_SETVBUF"
2901fi
2902if test "$s390_z196_facilities" = "yes" ; then
2903 output_sym "CONFIG_S390_Z196_FACILITIES"
2904 CFLAGS="$CFLAGS -march=z9-109"
2905 march_set="yes"
2906fi
2907if test "$gfapi" = "yes" ; then
2908 output_sym "CONFIG_GFAPI"
2909fi
2910if test "$gf_fadvise" = "yes" ; then
2911 output_sym "CONFIG_GF_FADVISE"
2912fi
2913if test "$gf_trim" = "yes" ; then
2914 output_sym "CONFIG_GF_TRIM"
2915fi
2916if test "$gf_new" = "yes" ; then
2917 output_sym "CONFIG_GF_NEW_API"
2918fi
2919if test "$libhdfs" = "yes" ; then
2920 output_sym "CONFIG_LIBHDFS"
2921 echo "FIO_HDFS_CPU=$FIO_HDFS_CPU" >> $config_host_mak
2922 echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak
2923 echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak
2924 echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak
2925fi
2926if test "$mtd" = "yes" ; then
2927 output_sym "CONFIG_MTD"
2928fi
2929if test "$pmemblk" = "yes" ; then
2930 output_sym "CONFIG_PMEMBLK"
2931fi
2932if test "$devdax" = "yes" ; then
2933 output_sym "CONFIG_LINUX_DEVDAX"
2934fi
2935if test "$pmem" = "yes" ; then
2936 output_sym "CONFIG_LIBPMEM"
2937fi
2938if test "$libime" = "yes" ; then
2939 output_sym "CONFIG_IME"
2940fi
2941if test "$arith" = "yes" ; then
2942 output_sym "CONFIG_ARITHMETIC"
2943 if test "$yacc_is_bison" = "yes" ; then
2944 echo "YACC=bison -y" >> $config_host_mak
2945 else
2946 echo "YACC=yacc" >> $config_host_mak
2947 fi
2948 if test "$lex_use_o" = "yes" ; then
2949 echo "CONFIG_LEX_USE_O=y" >> $config_host_mak
2950 fi
2951fi
2952if test "$getmntent" = "yes" ; then
2953 output_sym "CONFIG_GETMNTENT"
2954fi
2955if test "$getmntinfo" = "yes" ; then
2956 output_sym "CONFIG_GETMNTINFO"
2957fi
2958if test "$getmntinfo_statvfs" = "yes" ; then
2959 output_sym "CONFIG_GETMNTINFO_STATVFS"
2960fi
2961if test "$static_assert" = "yes" ; then
2962 output_sym "CONFIG_STATIC_ASSERT"
2963fi
2964if test "$have_bool" = "yes" ; then
2965 output_sym "CONFIG_HAVE_BOOL"
2966fi
2967if test "$strndup" = "yes" ; then
2968 output_sym "CONFIG_HAVE_STRNDUP"
2969fi
2970if test "$disable_opt" = "yes" ; then
2971 output_sym "CONFIG_DISABLE_OPTIMIZATIONS"
2972fi
2973if test "$valgrind_dev" = "yes"; then
2974 output_sym "CONFIG_VALGRIND_DEV"
2975fi
2976if test "$linux_blkzoned" = "yes" ; then
2977 output_sym "CONFIG_HAS_BLKZONED"
2978fi
2979if test "$libzbc" = "yes" ; then
2980 output_sym "CONFIG_LIBZBC"
2981fi
2982if test "$zlib" = "no" ; then
2983 echo "Consider installing zlib-dev (zlib-devel, some fio features depend on it."
2984 if test "$build_static" = "yes"; then
2985 echo "Note that some distros have separate packages for static libraries."
2986 fi
2987fi
2988if test "$march_armv8_a_crc_crypto" = "yes" ; then
2989 output_sym "ARCH_HAVE_CRC_CRYPTO"
2990fi
2991if test "$cuda" = "yes" ; then
2992 output_sym "CONFIG_CUDA"
2993fi
2994if test "$libcufile" = "yes" ; then
2995 output_sym "CONFIG_LIBCUFILE"
2996fi
2997if test "$march_set" = "no" && test "$build_native" = "yes" ; then
2998 output_sym "CONFIG_BUILD_NATIVE"
2999fi
3000if test "$cunit" = "yes" ; then
3001 output_sym "CONFIG_HAVE_CUNIT"
3002fi
3003if test "$__kernel_rwf_t" = "yes"; then
3004 output_sym "CONFIG_HAVE_KERNEL_RWF_T"
3005fi
3006if test "$gettid" = "yes"; then
3007 output_sym "CONFIG_HAVE_GETTID"
3008fi
3009if test "$statx" = "yes"; then
3010 output_sym "CONFIG_HAVE_STATX"
3011fi
3012if test "$statx_syscall" = "yes"; then
3013 output_sym "CONFIG_HAVE_STATX_SYSCALL"
3014fi
3015if test "$timerfd_create" = "yes"; then
3016 output_sym "CONFIG_HAVE_TIMERFD_CREATE"
3017fi
3018if test "$fallthrough" = "yes"; then
3019 CFLAGS="$CFLAGS -Wimplicit-fallthrough"
3020fi
3021if test "$thp" = "yes" ; then
3022 output_sym "CONFIG_HAVE_THP"
3023fi
3024if test "$libiscsi" = "yes" ; then
3025 output_sym "CONFIG_LIBISCSI"
3026 echo "CONFIG_LIBISCSI=m" >> $config_host_mak
3027 echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak
3028 echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak
3029fi
3030if test "$libnbd" = "yes" ; then
3031 output_sym "CONFIG_LIBNBD"
3032 echo "CONFIG_LIBNBD=m" >> $config_host_mak
3033 echo "LIBNBD_CFLAGS=$libnbd_cflags" >> $config_host_mak
3034 echo "LIBNBD_LIBS=$libnbd_libs" >> $config_host_mak
3035fi
3036if test "$dynamic_engines" = "yes" ; then
3037 output_sym "CONFIG_DYNAMIC_ENGINES"
3038fi
3039if test "$pdb" = yes; then
3040 output_sym "CONFIG_PDB"
3041fi
3042
3043print_config "Lib-based ioengines dynamic" "$dynamic_engines"
3044cat > $TMPC << EOF
3045int main(int argc, char **argv)
3046{
3047 return 0;
3048}
3049EOF
3050if test "$disable_tcmalloc" != "yes"; then
3051 if compile_prog "" "-ltcmalloc" "tcmalloc"; then
3052 tcmalloc="yes"
3053 LIBS="-ltcmalloc $LIBS"
3054 elif compile_prog "" "-l:libtcmalloc_minimal.so.4" "tcmalloc_minimal4"; then
3055 tcmalloc="yes"
3056 LIBS="-l:libtcmalloc_minimal.so.4 $LIBS"
3057 else
3058 tcmalloc="no"
3059 fi
3060fi
3061print_config "TCMalloc support" "$tcmalloc"
3062
3063echo "LIBS+=$LIBS" >> $config_host_mak
3064echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak
3065echo "CFLAGS+=$CFLAGS" >> $config_host_mak
3066echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak
3067echo "CC=$cc" >> $config_host_mak
3068echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak
3069echo "INSTALL_PREFIX=$prefix" >> $config_host_mak
3070
3071if [ `dirname $0` != "." -a ! -e Makefile ]; then
3072 cat > Makefile <<EOF
3073SRCDIR:=`dirname $0`
3074include \$(SRCDIR)/Makefile
3075EOF
3076fi