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