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