configure: apply ${cross_prefix} to pkg-config calls
[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
4d1bc43e 1347GTK_CFLAGS=$(${cross_prefix}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
4d1bc43e 1354GTK_LIBS=$(${cross_prefix}pkg-config --libs gtk+-2.0 gthread-2.0)
91f94d5b
JA
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
ce4d13ca
JA
1792##########################################
1793# check for newer gfapi
1794if test "$gfapi" = "yes" ; then
1795gf_new="no"
1796cat > $TMPC << EOF
1797#include <glusterfs/api/glfs.h>
1798
1799int main(int argc, char **argv)
1800{
1801 return glfs_fsync(NULL, NULL, NULL) && glfs_ftruncate(NULL, 0, NULL, NULL);
1802}
1803EOF
1804if compile_prog "" "-lgfapi -lglusterfs" "gf new api"; then
1805 gf_new="yes"
1806fi
1807print_config "Gluster new API" "$gf_new"
1808fi
1809
6876c98c
JA
1810##########################################
1811# check for gfapi trim support
ca205a75
TK
1812if test "$gf_trim" != "yes" ; then
1813 gf_trim="no"
1814fi
6876c98c
JA
1815if test "$gfapi" = "yes" ; then
1816cat > $TMPC << EOF
1817#include <glusterfs/api/glfs.h>
1818
1819int main(int argc, char **argv)
1820{
1821 return glfs_discard_async(NULL, 0, 0);
1822}
1823EOF
1824if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then
1825 gf_trim="yes"
1826fi
484b0b65 1827print_config "Gluster API trim support" "$gf_trim"
6876c98c 1828fi
fc5c0345 1829
81795ce3
CE
1830##########################################
1831# Check if we support stckf on s390
ca205a75
TK
1832if test "$s390_z196_facilities" != "yes" ; then
1833 s390_z196_facilities="no"
1834fi
81795ce3
CE
1835cat > $TMPC << EOF
1836#define STFLE_BITS_Z196 45 /* various z196 facilities ... */
1837int main(int argc, char **argv)
1838{
1839 /* We want just 1 double word to be returned. */
1840 register unsigned long reg0 asm("0") = 0;
1841 unsigned long stfle_bits;
1842 asm volatile(".machine push" "\n\t"
1843 ".machine \"z9-109\"" "\n\t"
1844 "stfle %0" "\n\t"
1845 ".machine pop" "\n"
1846 : "=QS" (stfle_bits), "+d" (reg0)
1847 : : "cc");
1848
1849 if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0)
1850 return 0;
1851 else
1852 return -1;
1853}
1854EOF
1855if compile_prog "" "" "s390_z196_facilities"; then
1856 $TMPE
6a2c9363 1857 if [ $? -eq 0 ]; then
81795ce3
CE
1858 s390_z196_facilities="yes"
1859 fi
1860fi
484b0b65 1861print_config "s390_z196_facilities" "$s390_z196_facilities"
1b10477b
MM
1862
1863##########################################
1864# Check if we have required environment variables configured for libhdfs
1865if test "$libhdfs" = "yes" ; then
1866 hdfs_conf_error=0
1867 if test "$JAVA_HOME" = "" ; then
1868 echo "configure: JAVA_HOME should be defined to jdk/jvm path"
1869 hdfs_conf_error=1
1870 fi
1871 if test "$FIO_LIBHDFS_INCLUDE" = "" ; then
1872 echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path"
1873 hdfs_conf_error=1
1874 fi
1875 if test "$FIO_LIBHDFS_LIB" = "" ; then
1876 echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path"
1877 hdfs_conf_error=1
1878 fi
1879 if test "$hdfs_conf_error" = "1" ; then
1880 exit 1
1881 fi
247e5436
JA
1882 FIO_HDFS_CPU=$cpu
1883 if test "$FIO_HDFS_CPU" = "x86_64" ; then
1884 FIO_HDFS_CPU="amd64"
1885 fi
1b10477b 1886fi
484b0b65 1887print_config "HDFS engine" "$libhdfs"
1b10477b 1888
b8116a87
DE
1889##########################################
1890# Check whether we have MTD
ca205a75
TK
1891if test "$mtd" != "yes" ; then
1892 mtd="no"
1893fi
b8116a87 1894cat > $TMPC << EOF
0e1c454a 1895#include <string.h>
b8116a87
DE
1896#include <mtd/mtd-user.h>
1897#include <sys/ioctl.h>
1898int main(int argc, char **argv)
1899{
0e1c454a 1900 struct mtd_write_req ops;
b8116a87 1901 struct mtd_info_user info;
0e1c454a 1902 memset(&ops, 0, sizeof(ops));
400cd0ff 1903 info.type = MTD_MLCNANDFLASH;
b8116a87
DE
1904 return ioctl(0, MEMGETINFO, &info);
1905}
1906EOF
1907if compile_prog "" "" "mtd"; then
1908 mtd="yes"
1909fi
484b0b65 1910print_config "MTD" "$mtd"
b8116a87 1911
3ee2a3c1
DJ
1912##########################################
1913# Check whether we have libpmem
ca205a75
TK
1914if test "$libpmem" != "yes" ; then
1915 libpmem="no"
1916fi
3ee2a3c1
DJ
1917cat > $TMPC << EOF
1918#include <libpmem.h>
1919int main(int argc, char **argv)
1920{
1921 int rc;
1922 rc = pmem_is_pmem(0, 0);
1923 return 0;
1924}
1925EOF
1926if compile_prog "" "-lpmem" "libpmem"; then
1927 libpmem="yes"
cf8775b8 1928 LIBS="-lpmem $LIBS"
3ee2a3c1 1929fi
484b0b65 1930print_config "libpmem" "$libpmem"
3ee2a3c1
DJ
1931
1932##########################################
1933# Check whether we have libpmemblk
cf8775b8 1934# libpmem is a prerequisite
ca205a75
TK
1935if test "$libpmemblk" != "yes" ; then
1936 libpmemblk="no"
1937fi
cf8775b8
RE
1938if test "$libpmem" = "yes"; then
1939 cat > $TMPC << EOF
3ee2a3c1
DJ
1940#include <libpmemblk.h>
1941int main(int argc, char **argv)
1942{
cf8775b8
RE
1943 PMEMblkpool *pbp;
1944 pbp = pmemblk_open("", 0);
3ee2a3c1
DJ
1945 return 0;
1946}
1947EOF
cf8775b8
RE
1948 if compile_prog "" "-lpmemblk" "libpmemblk"; then
1949 libpmemblk="yes"
1950 LIBS="-lpmemblk $LIBS"
1951 fi
3ee2a3c1 1952fi
484b0b65 1953print_config "libpmemblk" "$libpmemblk"
3ee2a3c1 1954
cf8775b8 1955# Choose the ioengines
3ee2a3c1 1956if test "$libpmem" = "yes" && test "$disable_pmem" = "no"; then
ae0db592 1957 pmem="yes"
3ee2a3c1
DJ
1958 devdax="yes"
1959 if test "$libpmemblk" = "yes"; then
1960 pmemblk="yes"
1961 fi
1962fi
1963
43f3cec2
BB
1964##########################################
1965# Report whether pmemblk engine is enabled
363a5f65 1966print_config "PMDK pmemblk engine" "$pmemblk"
43f3cec2 1967
cbb15e42
DJ
1968##########################################
1969# Report whether dev-dax engine is enabled
363a5f65 1970print_config "PMDK dev-dax engine" "$devdax"
cbb15e42 1971
ae0db592
TI
1972##########################################
1973# Report whether libpmem engine is enabled
363a5f65 1974print_config "PMDK libpmem engine" "$pmem"
ae0db592 1975
a40e7a59
GB
1976##########################################
1977# Check whether we support DDN's IME
1978if test "$libime" != "yes" ; then
1979 libime="no"
1980fi
1981cat > $TMPC << EOF
1982#include <ime_native.h>
1983int main(int argc, char **argv)
1984{
1985 int rc;
1986 ime_native_init();
1987 rc = ime_native_finalize();
1988 return 0;
1989}
1990EOF
1991if compile_prog "-I${ime_path}/include" "-L${ime_path}/lib -lim_client" "libime"; then
1992 libime="yes"
1993 CFLAGS="-I${ime_path}/include $CFLAGS"
1994 LDFLAGS="-Wl,-rpath ${ime_path}/lib -L${ime_path}/lib $LDFLAGS"
1995 LIBS="-lim_client $LIBS"
1996fi
1997print_config "DDN's Infinite Memory Engine" "$libime"
1998
247ef2aa
KZ
1999##########################################
2000# Check if we have required environment variables configured for libiscsi
2001if test "$libiscsi" = "yes" ; then
2002 if $(pkg-config --atleast-version=1.9.0 libiscsi); then
2003 libiscsi="yes"
2004 libiscsi_cflags=$(pkg-config --cflags libiscsi)
2005 libiscsi_libs=$(pkg-config --libs libiscsi)
2006 else
2007 if test "$libiscsi" = "yes" ; then
2008 echo "libiscsi" "Install libiscsi >= 1.9.0"
2009 fi
2010 libiscsi="no"
2011 fi
2012fi
2013print_config "iscsi engine" "$libiscsi"
2014
bda92394 2015##########################################
b470a02c
SC
2016# Check if we have lex/yacc available
2017yacc="no"
e7b2c7a3 2018yacc_is_bison="no"
b470a02c
SC
2019lex="no"
2020arith="no"
de26b824 2021if test "$disable_lex" = "no" || test -z "$disable_lex" ; then
cf6dd80e 2022if test "$targetos" != "SunOS" ; then
e7b2c7a3 2023LEX=$(which lex 2> /dev/null)
b470a02c
SC
2024if test -x "$LEX" ; then
2025 lex="yes"
2026fi
7e0049e9 2027YACC=$(which bison 2> /dev/null)
b470a02c
SC
2028if test -x "$YACC" ; then
2029 yacc="yes"
7e0049e9 2030 yacc_is_bison="yes"
e7b2c7a3 2031else
7e0049e9 2032 YACC=$(which yacc 2> /dev/null)
e7b2c7a3
JA
2033 if test -x "$YACC" ; then
2034 yacc="yes"
e7b2c7a3 2035 fi
b470a02c
SC
2036fi
2037if test "$yacc" = "yes" && test "$lex" = "yes" ; then
2038 arith="yes"
2039fi
2040
2041if test "$arith" = "yes" ; then
2042cat > $TMPC << EOF
2043extern int yywrap(void);
2044
2045int main(int argc, char **argv)
2046{
2047 yywrap();
2048 return 0;
2049}
2050EOF
719cda03
JA
2051if compile_prog "" "-ll" "lex"; then
2052 LIBS="-ll $LIBS"
b470a02c
SC
2053else
2054 arith="no"
2055fi
2056fi
cf6dd80e 2057fi
a655bbc4 2058fi
b470a02c 2059
63bda378
JA
2060# Check if lex fails using -o
2061if test "$arith" = "yes" ; then
daf705b5
JA
2062if test "$force_no_lex_o" = "yes" ; then
2063 lex_use_o="no"
2064else
63bda378
JA
2065$LEX -o lex.yy.c exp/expression-parser.l 2> /dev/null
2066if test "$?" = "0" ; then
2067 lex_use_o="yes"
2068else
2069 lex_use_o="no"
2070fi
2071fi
daf705b5 2072fi
63bda378 2073
484b0b65 2074print_config "lex/yacc for arithmetic" "$arith"
b470a02c 2075
aae599ba
JA
2076##########################################
2077# Check whether we have setmntent/getmntent
ca205a75
TK
2078if test "$getmntent" != "yes" ; then
2079 getmntent="no"
2080fi
aae599ba
JA
2081cat > $TMPC << EOF
2082#include <stdio.h>
2083#include <mntent.h>
2084int main(int argc, char **argv)
2085{
2086 FILE *mtab = setmntent(NULL, "r");
2087 struct mntent *mnt = getmntent(mtab);
1581b82a 2088 endmntent(mtab);
aae599ba
JA
2089 return 0;
2090}
2091EOF
2092if compile_prog "" "" "getmntent"; then
2093 getmntent="yes"
2094fi
484b0b65 2095print_config "getmntent" "$getmntent"
aae599ba 2096
e7e136da
TK
2097##########################################
2098# Check whether we have getmntinfo
b765bec0
TK
2099# These are originally added for BSDs, but may also work
2100# on other operating systems with getmntinfo(3).
2101
2102# getmntinfo(3) for FreeBSD/DragonFlyBSD/OpenBSD.
2103# Note that NetBSD needs -Werror to catch warning as error.
ca205a75
TK
2104if test "$getmntinfo" != "yes" ; then
2105 getmntinfo="no"
2106fi
e7e136da
TK
2107cat > $TMPC << EOF
2108#include <stdio.h>
2109#include <sys/param.h>
2110#include <sys/mount.h>
2111int main(int argc, char **argv)
2112{
9ada751d 2113 struct statfs *st;
e7e136da
TK
2114 return getmntinfo(&st, MNT_NOWAIT);
2115}
2116EOF
b765bec0 2117if compile_prog "-Werror" "" "getmntinfo"; then
e7e136da
TK
2118 getmntinfo="yes"
2119fi
484b0b65 2120print_config "getmntinfo" "$getmntinfo"
e7e136da 2121
b765bec0 2122# getmntinfo(3) for NetBSD.
ca205a75
TK
2123if test "$getmntinfo_statvfs" != "yes" ; then
2124 getmntinfo_statvfs="no"
2125fi
b765bec0
TK
2126cat > $TMPC << EOF
2127#include <stdio.h>
2128#include <sys/statvfs.h>
2129int main(int argc, char **argv)
2130{
2131 struct statvfs *st;
2132 return getmntinfo(&st, MNT_NOWAIT);
2133}
2134EOF
2135# Skip the test if the one with statfs arg is detected.
2136if test "$getmntinfo" != "yes" && compile_prog "-Werror" "" "getmntinfo_statvfs"; then
2137 getmntinfo_statvfs="yes"
484b0b65 2138 print_config "getmntinfo_statvfs" "$getmntinfo_statvfs"
b765bec0
TK
2139fi
2140
5018f79f
AH
2141##########################################
2142# Check whether we have _Static_assert
ca205a75
TK
2143if test "$static_assert" != "yes" ; then
2144 static_assert="no"
2145fi
5018f79f
AH
2146cat > $TMPC << EOF
2147#include <assert.h>
94815a5c 2148#include <stdlib.h>
51b4c81e 2149#include <stddef.h>
94815a5c
JA
2150
2151struct foo {
2152 int a, b;
2153};
2154
5018f79f
AH
2155int main(int argc, char **argv)
2156{
94815a5c 2157 _Static_assert(offsetof(struct foo, a) == 0 , "Check");
5018f79f
AH
2158 return 0 ;
2159}
2160EOF
2161if compile_prog "" "" "static_assert"; then
2162 static_assert="yes"
2163fi
484b0b65 2164print_config "Static Assert" "$static_assert"
e39c0676
JA
2165
2166##########################################
2167# Check whether we have bool / stdbool.h
ca205a75
TK
2168if test "$have_bool" != "yes" ; then
2169 have_bool="no"
2170fi
e39c0676
JA
2171cat > $TMPC << EOF
2172#include <stdbool.h>
2173int main(int argc, char **argv)
2174{
2175 bool var = true;
2176 return var != false;
2177}
2178EOF
2179if compile_prog "" "" "bool"; then
2180 have_bool="yes"
2181fi
484b0b65 2182print_config "bool" "$have_bool"
e39c0676 2183
b29c71c4
JA
2184##########################################
2185# Check whether we have strndup()
107ad008 2186strndup="no"
b29c71c4
JA
2187cat > $TMPC << EOF
2188#include <string.h>
2189#include <stdlib.h>
2190int main(int argc, char **argv)
2191{
2192 char *res = strndup("test string", 8);
2193
2194 free(res);
2195 return 0;
2196}
2197EOF
2198if compile_prog "" "" "strndup"; then
2199 strndup="yes"
2200fi
2201print_config "strndup" "$strndup"
2202
214e2d56 2203##########################################
0ffccc21
BVA
2204# <valgrind/drd.h> probe
2205# Note: presence of <valgrind/drd.h> implies that <valgrind/valgrind.h> is
2206# also available but not the other way around.
2207if test "$valgrind_dev" != "yes" ; then
2208 valgrind_dev="no"
2209fi
2210cat > $TMPC << EOF
2211#include <valgrind/drd.h>
2212int main(int argc, char **argv)
2213{
2214 return 0;
2215}
2216EOF
2217if compile_prog "" "" "valgrind_dev"; then
2218 valgrind_dev="yes"
2219fi
2220print_config "Valgrind headers" "$valgrind_dev"
2221
a76e1995
BVA
2222##########################################
2223# <linux/blkzoned.h> probe
2224if test "$linux_blkzoned" != "yes" ; then
2225 linux_blkzoned="no"
2226fi
2227cat > $TMPC << EOF
2228#include <linux/blkzoned.h>
2229int main(int argc, char **argv)
2230{
2231 return 0;
2232}
2233EOF
2234if compile_prog "" "" "linux_blkzoned"; then
2235 linux_blkzoned="yes"
2236fi
2237print_config "Zoned block device support" "$linux_blkzoned"
2238
2239##########################################
214e2d56 2240# check march=armv8-a+crc+crypto
ca205a75
TK
2241if test "$march_armv8_a_crc_crypto" != "yes" ; then
2242 march_armv8_a_crc_crypto="no"
2243fi
214e2d56 2244if test "$cpu" = "arm64" ; then
2245 cat > $TMPC <<EOF
9b153dc2
TT
2246#include <arm_acle.h>
2247#include <arm_neon.h>
58828d07 2248#include <sys/auxv.h>
9b153dc2 2249
214e2d56 2250int main(void)
2251{
58828d07
SW
2252 /* Can we also do a runtime probe? */
2253#if __linux__
2254 return getauxval(AT_HWCAP);
2255#else
2256# error "Don't know how to do runtime probe for ARM CRC32c"
2257#endif
214e2d56 2258}
2259EOF
58828d07 2260 if compile_prog "-march=armv8-a+crc+crypto" "" "ARM CRC32c"; then
214e2d56 2261 march_armv8_a_crc_crypto="yes"
58828d07 2262 CFLAGS="$CFLAGS -march=armv8-a+crc+crypto"
9f75af77 2263 march_set="yes"
214e2d56 2264 fi
2265fi
484b0b65 2266print_config "march_armv8_a_crc_crypto" "$march_armv8_a_crc_crypto"
214e2d56 2267
03553853
YR
2268##########################################
2269# cuda probe
d418fa90
TK
2270if test "$cuda" != "yes" ; then
2271 cuda="no"
2272fi
03553853
YR
2273cat > $TMPC << EOF
2274#include <cuda.h>
2275int main(int argc, char **argv)
2276{
2277 return cuInit(0);
2278}
2279EOF
4bd2c8b9 2280if test "$enable_cuda" = "yes" && compile_prog "" "-lcuda" "cuda"; then
03553853
YR
2281 cuda="yes"
2282 LIBS="-lcuda $LIBS"
2283fi
484b0b65 2284print_config "cuda" "$cuda"
214e2d56 2285
4252396e
JA
2286##########################################
2287# mkdir() probe. mingw apparently has a one-argument mkdir :/
2288mkdir_two="no"
2289cat > $TMPC << EOF
2290#include <sys/stat.h>
2291#include <sys/types.h>
2292int main(int argc, char **argv)
2293{
2294 return mkdir("/tmp/bla", 0600);
2295}
2296EOF
2297if compile_prog "" "" "mkdir(a, b)"; then
2298 mkdir_two="yes"
2299fi
2300print_config "mkdir(a, b)" "$mkdir_two"
2301
a817dc3b
JA
2302##########################################
2303# check for cc -march=native
2304build_native="no"
2305cat > $TMPC << EOF
2306int main(int argc, char **argv)
2307{
2308 return 0;
2309}
2310EOF
c922e0b0
SW
2311if test "$disable_native" = "no" && test "$disable_opt" != "yes" && \
2312 compile_prog "-march=native" "" "march=native"; then
a817dc3b
JA
2313 build_native="yes"
2314fi
2315print_config "Build march=native" "$build_native"
2316
b8b0e1ee
TK
2317##########################################
2318# check for -lcunit
2319if test "$cunit" != "yes" ; then
2320 cunit="no"
2321fi
2322cat > $TMPC << EOF
2323#include <CUnit/CUnit.h>
2324#include <CUnit/Basic.h>
2325int main(void)
2326{
2327 if (CU_initialize_registry() != CUE_SUCCESS)
2328 return CU_get_error();
2329 CU_basic_set_mode(CU_BRM_VERBOSE);
2330 CU_basic_run_tests();
2331 CU_cleanup_registry();
2332 return CU_get_error();
2333}
2334EOF
2335if compile_prog "" "-lcunit" "CUnit"; then
2336 cunit="yes"
2337fi
2338print_config "CUnit" "$cunit"
2339
57fa61f0
JA
2340##########################################
2341# check for __kernel_rwf_t
2342__kernel_rwf_t="no"
2343cat > $TMPC << EOF
2344#include <linux/fs.h>
2345int main(int argc, char **argv)
2346{
2347 __kernel_rwf_t x;
2348 x = 0;
2349 return x;
2350}
2351EOF
2352if compile_prog "" "" "__kernel_rwf_t"; then
2353 __kernel_rwf_t="yes"
2354fi
2355print_config "__kernel_rwf_t" "$__kernel_rwf_t"
2356
71144e67
JA
2357##########################################
2358# check if gcc has -Wimplicit-fallthrough
2359fallthrough="no"
2360cat > $TMPC << EOF
2361int main(int argc, char **argv)
2362{
2363 return 0;
2364}
2365EOF
2366if compile_prog "-Wimplicit-fallthrough" "" "-Wimplicit-fallthrough"; then
2367 fallthrough="yes"
2368fi
2369print_config "-Wimplicit-fallthrough" "$fallthrough"
2370
ff547caa
KB
2371##########################################
2372# check for MADV_HUGEPAGE support
2373if test "$thp" != "yes" ; then
2374 thp="no"
2375fi
2376if test "$esx" != "yes" ; then
2377 cat > $TMPC <<EOF
2378#include <sys/mman.h>
2379int main(void)
2380{
2381 return madvise(0, 0x1000, MADV_HUGEPAGE);
2382}
2383EOF
2384 if compile_prog "" "" "thp" ; then
2385 thp=yes
2386 else
2387 if test "$thp" = "yes" ; then
2388 feature_not_found "Transparent Huge Page" ""
2389 fi
2390 thp=no
2391 fi
2392fi
2393print_config "MADV_HUGEPAGE" "$thp"
2394
de5ed0e4
JA
2395##########################################
2396# check for gettid()
2397gettid="no"
2398cat > $TMPC << EOF
2399#include <unistd.h>
2400int main(int argc, char **argv)
2401{
2402 return gettid();
2403}
2404EOF
2405if compile_prog "" "" "gettid"; then
2406 gettid="yes"
2407fi
2408print_config "gettid" "$gettid"
2409
67bf9823
JA
2410#############################################################################
2411
67bf9823 2412if test "$wordsize" = "64" ; then
4feafb1e 2413 output_sym "CONFIG_64BIT"
67bf9823 2414elif test "$wordsize" = "32" ; then
4feafb1e 2415 output_sym "CONFIG_32BIT"
67bf9823 2416else
d7145a78 2417 fatal "Unknown wordsize!"
67bf9823 2418fi
0dcebdf4 2419if test "$bigendian" = "yes" ; then
4feafb1e 2420 output_sym "CONFIG_BIG_ENDIAN"
0dcebdf4 2421else
4feafb1e 2422 output_sym "CONFIG_LITTLE_ENDIAN"
0dcebdf4 2423fi
3989b143
JA
2424if test "$zlib" = "yes" ; then
2425 output_sym "CONFIG_ZLIB"
2426fi
67bf9823 2427if test "$libaio" = "yes" ; then
4feafb1e 2428 output_sym "CONFIG_LIBAIO"
67bf9823
JA
2429fi
2430if test "$posix_aio" = "yes" ; then
4feafb1e 2431 output_sym "CONFIG_POSIXAIO"
67bf9823
JA
2432fi
2433if test "$posix_aio_fsync" = "yes" ; then
4feafb1e 2434 output_sym "CONFIG_POSIXAIO_FSYNC"
67bf9823 2435fi
06eac6b2
SW
2436if test "$posix_pshared" = "yes" ; then
2437 output_sym "CONFIG_PSHARED"
2438fi
44e8e956 2439if test "$have_asprintf" = "yes" ; then
cb3b6806 2440 output_sym "CONFIG_HAVE_ASPRINTF"
44e8e956
BVA
2441fi
2442if test "$have_vasprintf" = "yes" ; then
cb3b6806 2443 output_sym "CONFIG_HAVE_VASPRINTF"
44e8e956 2444fi
67bf9823 2445if test "$linux_fallocate" = "yes" ; then
4feafb1e 2446 output_sym "CONFIG_LINUX_FALLOCATE"
67bf9823
JA
2447fi
2448if test "$posix_fallocate" = "yes" ; then
4feafb1e 2449 output_sym "CONFIG_POSIX_FALLOCATE"
67bf9823
JA
2450fi
2451if test "$fdatasync" = "yes" ; then
4feafb1e 2452 output_sym "CONFIG_FDATASYNC"
67bf9823
JA
2453fi
2454if test "$sync_file_range" = "yes" ; then
4feafb1e 2455 output_sym "CONFIG_SYNC_FILE_RANGE"
67bf9823
JA
2456fi
2457if test "$sfaa" = "yes" ; then
4feafb1e 2458 output_sym "CONFIG_SFAA"
67bf9823 2459fi
a250edd0
JA
2460if test "$sync_sync" = "yes" ; then
2461 output_sym "CONFIG_SYNC_SYNC"
2462fi
2463if test "$cmp_swap" = "yes" ; then
2464 output_sym "CONFIG_CMP_SWAP"
2465fi
954cd73a 2466if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
4feafb1e 2467 output_sym "CONFIG_RDMA"
67bf9823
JA
2468fi
2469if test "$clock_gettime" = "yes" ; then
4feafb1e 2470 output_sym "CONFIG_CLOCK_GETTIME"
67bf9823
JA
2471fi
2472if test "$clock_monotonic" = "yes" ; then
4feafb1e 2473 output_sym "CONFIG_CLOCK_MONOTONIC"
67bf9823 2474fi
c544f604
SN
2475if test "$clock_monotonic_raw" = "yes" ; then
2476 output_sym "CONFIG_CLOCK_MONOTONIC_RAW"
2477fi
67bf9823 2478if test "$clock_monotonic_precise" = "yes" ; then
4feafb1e 2479 output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
67bf9823 2480fi
25f8227d
JA
2481if test "$clockid_t" = "yes"; then
2482 output_sym "CONFIG_CLOCKID_T"
2483fi
67bf9823 2484if test "$gettimeofday" = "yes" ; then
4feafb1e 2485 output_sym "CONFIG_GETTIMEOFDAY"
67bf9823
JA
2486fi
2487if test "$posix_fadvise" = "yes" ; then
4feafb1e 2488 output_sym "CONFIG_POSIX_FADVISE"
67bf9823
JA
2489fi
2490if test "$linux_3arg_affinity" = "yes" ; then
4feafb1e 2491 output_sym "CONFIG_3ARG_AFFINITY"
67bf9823 2492elif test "$linux_2arg_affinity" = "yes" ; then
4feafb1e 2493 output_sym "CONFIG_2ARG_AFFINITY"
67bf9823
JA
2494fi
2495if test "$strsep" = "yes" ; then
4feafb1e 2496 output_sym "CONFIG_STRSEP"
67bf9823 2497fi
9ad8da82
JA
2498if test "$strcasestr" = "yes" ; then
2499 output_sym "CONFIG_STRCASESTR"
2500fi
5ad7be56
KD
2501if test "$strlcat" = "yes" ; then
2502 output_sym "CONFIG_STRLCAT"
2503fi
67bf9823 2504if test "$getopt_long_only" = "yes" ; then
4feafb1e 2505 output_sym "CONFIG_GETOPT_LONG_ONLY"
67bf9823
JA
2506fi
2507if test "$inet_aton" = "yes" ; then
4feafb1e 2508 output_sym "CONFIG_INET_ATON"
67bf9823
JA
2509fi
2510if test "$socklen_t" = "yes" ; then
4feafb1e 2511 output_sym "CONFIG_SOCKLEN_T"
67bf9823
JA
2512fi
2513if test "$ext4_me" = "yes" ; then
4feafb1e 2514 output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
67bf9823
JA
2515fi
2516if test "$linux_splice" = "yes" ; then
4feafb1e 2517 output_sym "CONFIG_LINUX_SPLICE"
67bf9823
JA
2518fi
2519if test "$guasi" = "yes" ; then
4feafb1e 2520 output_sym "CONFIG_GUASI"
67bf9823 2521fi
50206d9b 2522if test "$libnuma_v2" = "yes" ; then
4feafb1e 2523 output_sym "CONFIG_LIBNUMA"
67bf9823
JA
2524fi
2525if test "$solaris_aio" = "yes" ; then
4feafb1e 2526 output_sym "CONFIG_SOLARISAIO"
67bf9823
JA
2527fi
2528if test "$tls_thread" = "yes" ; then
4feafb1e 2529 output_sym "CONFIG_TLS_THREAD"
67bf9823 2530fi
44404c5a 2531if test "$rusage_thread" = "yes" ; then
4feafb1e 2532 output_sym "CONFIG_RUSAGE_THREAD"
67bf9823 2533fi
91f94d5b 2534if test "$gfio" = "yes" ; then
bad7e42c 2535 output_sym "CONFIG_GFIO"
91f94d5b 2536fi
c8931876
JA
2537if test "$esx" = "yes" ; then
2538 output_sym "CONFIG_ESX"
2539 output_sym "CONFIG_NO_SHM"
2540fi
7e09a9f1
JA
2541if test "$sched_idle" = "yes" ; then
2542 output_sym "CONFIG_SCHED_IDLE"
2543fi
1eafa37a
JA
2544if test "$tcp_nodelay" = "yes" ; then
2545 output_sym "CONFIG_TCP_NODELAY"
2546fi
1008602c
JA
2547if test "$window_size" = "yes" ; then
2548 output_sym "CONFIG_NET_WINDOWSIZE"
2549fi
e5f34d95
JA
2550if test "$mss" = "yes" ; then
2551 output_sym "CONFIG_NET_MSS"
2552fi
38b9354a
JA
2553if test "$rlimit_memlock" = "yes" ; then
2554 output_sym "CONFIG_RLIMIT_MEMLOCK"
2555fi
07fc0acd
JA
2556if test "$pwritev" = "yes" ; then
2557 output_sym "CONFIG_PWRITEV"
2558fi
2cafffbe
JA
2559if test "$pwritev2" = "yes" ; then
2560 output_sym "CONFIG_PWRITEV2"
2561fi
ecad55e9
JA
2562if test "$ipv6" = "yes" ; then
2563 output_sym "CONFIG_IPV6"
2564fi
c2f6a13d
LMB
2565if test "$http" = "yes" ; then
2566 output_sym "CONFIG_HTTP"
2567fi
d5f9b0ea
IF
2568if test "$rados" = "yes" ; then
2569 output_sym "CONFIG_RADOS"
2570fi
fc5c0345
DG
2571if test "$rbd" = "yes" ; then
2572 output_sym "CONFIG_RBD"
2573fi
53b6c979
PL
2574if test "$rbd_poll" = "yes" ; then
2575 output_sym "CONFIG_RBD_POLL"
2576fi
903b2812
JA
2577if test "$rbd_inval" = "yes" ; then
2578 output_sym "CONFIG_RBD_INVAL"
2579fi
2e802282
JA
2580if test "$setvbuf" = "yes" ; then
2581 output_sym "CONFIG_SETVBUF"
2582fi
81795ce3
CE
2583if test "$s390_z196_facilities" = "yes" ; then
2584 output_sym "CONFIG_S390_Z196_FACILITIES"
2585 CFLAGS="$CFLAGS -march=z9-109"
9f75af77 2586 march_set="yes"
81795ce3 2587fi
6e7d7dfb 2588if test "$gfapi" = "yes" ; then
2589 output_sym "CONFIG_GFAPI"
2590fi
6fa14b99 2591if test "$gf_fadvise" = "yes" ; then
2592 output_sym "CONFIG_GF_FADVISE"
2593fi
6876c98c
JA
2594if test "$gf_trim" = "yes" ; then
2595 output_sym "CONFIG_GF_TRIM"
2596fi
ce4d13ca
JA
2597if test "$gf_new" = "yes" ; then
2598 output_sym "CONFIG_GF_NEW_API"
2599fi
1b10477b
MM
2600if test "$libhdfs" = "yes" ; then
2601 output_sym "CONFIG_LIBHDFS"
247e5436 2602 echo "FIO_HDFS_CPU=$FIO_HDFS_CPU" >> $config_host_mak
1527dc50
FB
2603 echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak
2604 echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak
2605 echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak
247ef2aa 2606fi
b8116a87
DE
2607if test "$mtd" = "yes" ; then
2608 output_sym "CONFIG_MTD"
2609fi
43f3cec2
BB
2610if test "$pmemblk" = "yes" ; then
2611 output_sym "CONFIG_PMEMBLK"
2612fi
cbb15e42
DJ
2613if test "$devdax" = "yes" ; then
2614 output_sym "CONFIG_LINUX_DEVDAX"
2615fi
ae0db592
TI
2616if test "$pmem" = "yes" ; then
2617 output_sym "CONFIG_LIBPMEM"
2618fi
a40e7a59
GB
2619if test "$libime" = "yes" ; then
2620 output_sym "CONFIG_IME"
2621fi
b470a02c
SC
2622if test "$arith" = "yes" ; then
2623 output_sym "CONFIG_ARITHMETIC"
e7b2c7a3
JA
2624 if test "$yacc_is_bison" = "yes" ; then
2625 echo "YACC=$YACC -y" >> $config_host_mak
2626 else
2627 echo "YACC=$YACC" >> $config_host_mak
2628 fi
63bda378
JA
2629 if test "$lex_use_o" = "yes" ; then
2630 echo "CONFIG_LEX_USE_O=y" >> $config_host_mak
2631 fi
b470a02c 2632fi
aae599ba
JA
2633if test "$getmntent" = "yes" ; then
2634 output_sym "CONFIG_GETMNTENT"
2635fi
e7e136da
TK
2636if test "$getmntinfo" = "yes" ; then
2637 output_sym "CONFIG_GETMNTINFO"
2638fi
b765bec0
TK
2639if test "$getmntinfo_statvfs" = "yes" ; then
2640 output_sym "CONFIG_GETMNTINFO_STATVFS"
2641fi
5018f79f
AH
2642if test "$static_assert" = "yes" ; then
2643 output_sym "CONFIG_STATIC_ASSERT"
2644fi
e39c0676
JA
2645if test "$have_bool" = "yes" ; then
2646 output_sym "CONFIG_HAVE_BOOL"
2647fi
b29c71c4
JA
2648if test "$strndup" = "yes" ; then
2649 output_sym "CONFIG_HAVE_STRNDUP"
2650fi
484817a9
JA
2651if test "$disable_opt" = "yes" ; then
2652 output_sym "CONFIG_DISABLE_OPTIMIZATIONS"
2653fi
0ffccc21
BVA
2654if test "$valgrind_dev" = "yes"; then
2655 output_sym "CONFIG_VALGRIND_DEV"
2656fi
a76e1995
BVA
2657if test "$linux_blkzoned" = "yes" ; then
2658 output_sym "CONFIG_LINUX_BLKZONED"
2659fi
605cf82e 2660if test "$zlib" = "no" ; then
8f909424
JA
2661 echo "Consider installing zlib-dev (zlib-devel, some fio features depend on it."
2662 if test "$build_static" = "yes"; then
2663 echo "Note that some distros have separate packages for static libraries."
2664 fi
605cf82e 2665fi
58828d07
SW
2666if test "$march_armv8_a_crc_crypto" = "yes" ; then
2667 output_sym "ARCH_HAVE_CRC_CRYPTO"
2668fi
03553853
YR
2669if test "$cuda" = "yes" ; then
2670 output_sym "CONFIG_CUDA"
2671fi
4252396e
JA
2672if test "$mkdir_two" = "yes" ; then
2673 output_sym "CONFIG_HAVE_MKDIR_TWO"
2674fi
9f75af77 2675if test "$march_set" = "no" && test "$build_native" = "yes" ; then
a817dc3b
JA
2676 output_sym "CONFIG_BUILD_NATIVE"
2677fi
b8b0e1ee
TK
2678if test "$cunit" = "yes" ; then
2679 output_sym "CONFIG_HAVE_CUNIT"
2680fi
57fa61f0
JA
2681if test "$__kernel_rwf_t" = "yes"; then
2682 output_sym "CONFIG_HAVE_KERNEL_RWF_T"
2683fi
de5ed0e4
JA
2684if test "$gettid" = "yes"; then
2685 output_sym "CONFIG_HAVE_GETTID"
2686fi
71144e67
JA
2687if test "$fallthrough" = "yes"; then
2688 CFLAGS="$CFLAGS -Wimplicit-fallthrough"
2689fi
ff547caa
KB
2690if test "$thp" = "yes" ; then
2691 output_sym "CONFIG_HAVE_THP"
2692fi
247ef2aa
KZ
2693if test "$libiscsi" = "yes" ; then
2694 output_sym "CONFIG_LIBISCSI"
2695 echo "CONFIG_LIBISCSI=m" >> $config_host_mak
2696 echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak
2697 echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak
2698fi
605cf82e 2699
67bf9823 2700echo "LIBS+=$LIBS" >> $config_host_mak
86719845 2701echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak
91f94d5b 2702echo "CFLAGS+=$CFLAGS" >> $config_host_mak
d2aeedb9 2703echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak
67bf9823 2704echo "CC=$cc" >> $config_host_mak
af4862b3 2705echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak
020d54bd 2706echo "INSTALL_PREFIX=$prefix" >> $config_host_mak
c61a3a44 2707
59d8f412 2708if [ `dirname $0` != "." -a ! -e Makefile ]; then
c61a3a44
JF
2709 cat > Makefile <<EOF
2710SRCDIR:=`dirname $0`
2711include \$(SRCDIR)/Makefile
2712EOF
2713fi