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