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