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