blob: 21bcaf46604980a27ccfbe0f32acceead6067c4e [file] [log] [blame]
Jens Axboe67bf9822013-01-10 11:23:19 +01001#!/bin/sh
2#
3# Fio configure script. Heavily influenced by the manual qemu configure
4# script. Sad this this is easier than autoconf and enemies.
5#
6
7# set temporary file name
8if test ! -z "$TMPDIR" ; then
9 TMPDIR1="${TMPDIR}"
10elif test ! -z "$TEMPDIR" ; then
11 TMPDIR1="${TEMPDIR}"
12else
13 TMPDIR1="/tmp"
14fi
15
16TMPC="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.c"
17TMPO="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.o"
18TMPE="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.exe"
19
20# NB: do not call "exit" in the trap handler; this is buggy with some shells;
21# see <1285349658-3122-1-git-send-email-loic.minier@linaro.org>
22trap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM
23
24rm -rf config.log
25
26config_host_mak="config-host.mak"
Jens Axboe4feafb12013-01-24 23:07:55 -070027config_host_h="config-host.h"
28
29rm -rf $config_host_mak
30rm -rf $config_host_h
Jens Axboe67bf9822013-01-10 11:23:19 +010031
Jens Axboed7145a72013-02-11 13:21:54 +010032fatal() {
33 echo $@
34 echo "Configure failed, check config.log and/or the above output"
35 rm -rf $config_host_mak
36 rm -rf $config_host_h
37 exit 1
38}
39
Jens Axboe44404c52013-01-24 14:20:09 -070040# Default CFLAGS
Jens Axboeaf4862b2013-03-29 08:55:32 -060041CFLAGS="-D_GNU_SOURCE -include config-host.h"
42BUILD_CFLAGS=""
Jens Axboe67bf9822013-01-10 11:23:19 +010043
44# Print a helpful header at the top of config.log
45echo "# FIO configure log $(date)" >> config.log
46printf "# Configured with:" >> config.log
47printf " '%s'" "$0" "$@" >> config.log
48echo >> config.log
49echo "#" >> config.log
50
Jens Axboe7560fe72013-01-25 08:52:28 -070051# Print configure header at the top of $config_host_h
52echo "/*" > $config_host_h
53echo " * Automatically generated by configure - do not modify" >> $config_host_h
54printf " * Configured with:" >> $config_host_h
55printf " * '%s'" "$0" "$@" >> $config_host_h
56echo "" >> $config_host_h
57echo " */" >> $config_host_h
58
Jens Axboe67bf9822013-01-10 11:23:19 +010059do_cc() {
60 # Run the compiler, capturing its output to the log.
61 echo $cc "$@" >> config.log
62 $cc "$@" >> config.log 2>&1 || return $?
63 # Test passed. If this is an --enable-werror build, rerun
64 # the test with -Werror and bail out if it fails. This
65 # makes warning-generating-errors in configure test code
66 # obvious to developers.
67 if test "$werror" != "yes"; then
68 return 0
69 fi
70 # Don't bother rerunning the compile if we were already using -Werror
71 case "$*" in
72 *-Werror*)
73 return 0
74 ;;
75 esac
76 echo $cc -Werror "$@" >> config.log
77 $cc -Werror "$@" >> config.log 2>&1 && return $?
78 echo "ERROR: configure test passed without -Werror but failed with -Werror."
79 echo "This is probably a bug in the configure script. The failing command"
80 echo "will be at the bottom of config.log."
Jens Axboed7145a72013-02-11 13:21:54 +010081 fatal "You can run configure with --disable-werror to bypass this check."
Jens Axboe67bf9822013-01-10 11:23:19 +010082}
83
84compile_object() {
85 do_cc $CFLAGS -c -o $TMPO $TMPC
86}
87
88compile_prog() {
89 local_cflags="$1"
Jens Axboeadaa46d2013-02-28 22:10:22 +010090 local_ldflags="$2 $LIBS"
Jens Axboe67bf9822013-01-10 11:23:19 +010091 echo "Compiling test case $3" >> config.log
92 do_cc $CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
93}
94
95feature_not_found() {
96 feature=$1
Jens Axboec55d7282013-04-12 10:16:43 +020097 packages=$2
Jens Axboe67bf9822013-01-10 11:23:19 +010098
99 echo "ERROR"
100 echo "ERROR: User requested feature $feature"
Jens Axboec55d7282013-04-12 10:16:43 +0200101 if test ! -z "$packages" ; then
102 echo "ERROR: That feature needs $packages installed"
103 fi
Jens Axboe67bf9822013-01-10 11:23:19 +0100104 echo "ERROR: configure was not able to find it"
Jens Axboed7145a72013-02-11 13:21:54 +0100105 fatal "ERROR"
Jens Axboe67bf9822013-01-10 11:23:19 +0100106}
107
108has() {
109 type "$1" >/dev/null 2>&1
110}
111
112check_define() {
113 cat > $TMPC <<EOF
114#if !defined($1)
115#error $1 not defined
116#endif
117int main(void)
118{
119 return 0;
120}
121EOF
122 compile_object
123}
124
Jens Axboe4feafb12013-01-24 23:07:55 -0700125output_sym() {
126 echo "$1=y" >> $config_host_mak
127 echo "#define $1" >> $config_host_h
128}
129
Jens Axboe67bf9822013-01-10 11:23:19 +0100130targetos=""
131cpu=""
132
Jens Axboe91f94d52013-01-24 10:25:42 -0700133# default options
Jens Axboe47f44632013-01-24 10:34:14 -0700134show_help="no"
135exit_val=0
Jens Axboeb9e839c2014-10-09 18:15:36 -0600136gfio_check="no"
Manish Mandlikd60aa362014-08-13 13:36:52 -0600137libhdfs="no"
Elliott Hugheseda3a602017-05-19 18:53:02 -0700138pmemblk="no"
139devdax="no"
140disable_lex=""
141disable_pmem="no"
142prefix=/usr/local
Jens Axboe91f94d52013-01-24 10:25:42 -0700143
Jens Axboecb1125b2013-01-23 13:47:54 -0700144# parse options
145for opt do
146 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
147 case "$opt" in
Elliott Hugheseda3a602017-05-19 18:53:02 -0700148 --prefix=*) prefix="$optarg"
149 ;;
Jens Axboe8b156d82013-02-10 15:48:34 +0100150 --cpu=*) cpu="$optarg"
151 ;;
Jens Axboeef7035a2014-06-18 15:30:09 -0700152 # esx is cross compiled and cannot be detect through simple uname calls
153 --esx)
154 esx="yes"
155 ;;
Jens Axboecb1125b2013-01-23 13:47:54 -0700156 --cc=*) CC="$optarg"
157 ;;
Jens Axboe208e4c82013-01-29 09:26:07 +0100158 --extra-cflags=*) CFLAGS="$CFLAGS $optarg"
Jens Axboecb1125b2013-01-23 13:47:54 -0700159 ;;
Jens Axboeb7c12792013-05-01 13:00:26 +0200160 --build-32bit-win) build_32bit_win="yes"
Huadong Liu74097112013-02-05 08:43:14 +0100161 ;;
Jens Axboe1a9487d2014-11-10 11:18:06 -0700162 --build-static) build_static="yes"
163 ;;
Elliott Hugheseda3a602017-05-19 18:53:02 -0700164 --enable-gfio) gfio_check="yes"
Jens Axboe899fab32013-01-29 10:06:30 +0100165 ;;
Castor Fu44462512013-10-31 11:00:54 -0600166 --disable-numa) disable_numa="yes"
167 ;;
Elliott Hugheseda3a602017-05-19 18:53:02 -0700168 --disable-rdma) disable_rdma="yes"
169 ;;
Tiziano Mülleraa48efe2014-06-26 14:20:20 +0200170 --disable-rbd) disable_rbd="yes"
171 ;;
Elliott Hugheseda3a602017-05-19 18:53:02 -0700172 --disable-rbd-blkin) disable_rbd_blkin="yes"
173 ;;
Tiziano Mülleraa48efe2014-06-26 14:20:20 +0200174 --disable-gfapi) disable_gfapi="yes"
175 ;;
Manish Mandlikd60aa362014-08-13 13:36:52 -0600176 --enable-libhdfs) libhdfs="yes"
177 ;;
Elliott Hugheseda3a602017-05-19 18:53:02 -0700178 --disable-lex) disable_lex="yes"
179 ;;
180 --enable-lex) disable_lex="no"
181 ;;
182 --disable-shm) no_shm="yes"
183 ;;
184 --disable-optimizations) disable_opt="yes"
185 ;;
186 --disable-pmem) disable_pmem="yes"
187 ;;
188 --enable-cuda) enable_cuda="yes"
Jens Axboee77e7be2015-01-20 16:29:33 -0700189 ;;
Jens Axboe827da4f2013-01-24 10:27:26 -0700190 --help)
Jens Axboe47f44632013-01-24 10:34:14 -0700191 show_help="yes"
Jens Axboe827da4f2013-01-24 10:27:26 -0700192 ;;
Jens Axboecb1125b2013-01-23 13:47:54 -0700193 *)
194 echo "Bad option $opt"
Jens Axboe47f44632013-01-24 10:34:14 -0700195 show_help="yes"
196 exit_val=1
Jens Axboecb1125b2013-01-23 13:47:54 -0700197 esac
198done
199
Jens Axboe47f44632013-01-24 10:34:14 -0700200if test "$show_help" = "yes" ; then
Elliott Hugheseda3a602017-05-19 18:53:02 -0700201 echo "--prefix= Use this directory as installation prefix"
202 echo "--cpu= Specify target CPU if auto-detect fails"
203 echo "--cc= Specify compiler to use"
204 echo "--extra-cflags= Specify extra CFLAGS to pass to compiler"
205 echo "--build-32bit-win Enable 32-bit build on Windows"
206 echo "--build-static Build a static fio"
207 echo "--esx Configure build options for esx"
208 echo "--enable-gfio Enable building of gtk gfio"
209 echo "--disable-numa Disable libnuma even if found"
210 echo "--disable-rdma Disable RDMA support even if found"
211 echo "--disable-gfapi Disable gfapi"
212 echo "--enable-libhdfs Enable hdfs support"
213 echo "--disable-lex Disable use of lex/yacc for math"
214 echo "--disable-pmem Disable pmem based engines even if found"
215 echo "--enable-lex Enable use of lex/yacc for math"
216 echo "--disable-shm Disable SHM support"
217 echo "--disable-optimizations Don't enable compiler optimizations"
218 echo "--enable-cuda Enable GPUDirect RDMA support"
Jens Axboeb7a99312013-02-04 12:46:54 +0100219 exit $exit_val
Jens Axboe47f44632013-01-24 10:34:14 -0700220fi
221
Stefan Hajnoczi47986332014-03-06 18:41:58 +0100222cross_prefix=${cross_prefix-${CROSS_COMPILE}}
223cc="${CC-${cross_prefix}gcc}"
224
Aaron Carroll6d0e9f82013-02-12 09:58:14 +0100225if check_define __ANDROID__ ; then
226 targetos="Android"
227elif check_define __linux__ ; then
Jens Axboe67bf9822013-01-10 11:23:19 +0100228 targetos="Linux"
Jens Axboe67bf9822013-01-10 11:23:19 +0100229elif check_define __OpenBSD__ ; then
230 targetos='OpenBSD'
231elif check_define __sun__ ; then
232 targetos='SunOS'
Jens Axboe7cb024f2013-11-06 15:37:35 -0700233 CFLAGS="$CFLAGS -D_REENTRANT"
Stefan Hajnoczib24f59a2014-03-06 18:41:59 +0100234elif check_define _WIN32 ; then
235 targetos='CYGWIN'
Jens Axboe67bf9822013-01-10 11:23:19 +0100236else
237 targetos=`uname -s`
238fi
239
Aaron Carroll53cd4ee2013-03-14 16:57:38 +1100240echo "# Automatically generated by configure - do not modify" > $config_host_mak
241printf "# Configured with:" >> $config_host_mak
242printf " '%s'" "$0" "$@" >> $config_host_mak
243echo >> $config_host_mak
244echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak
245
Elliott Hugheseda3a602017-05-19 18:53:02 -0700246if test "$no_shm" = "yes" ; then
247 output_sym "CONFIG_NO_SHM"
248fi
249
250if test "$disable_opt" = "yes" ; then
251 output_sym "CONFIG_FIO_NO_OPT"
252fi
253
Jens Axboe67bf9822013-01-10 11:23:19 +0100254# Some host OSes need non-standard checks for which CPU to use.
255# Note that these checks are broken for cross-compilation: if you're
256# cross-compiling to one of these OSes then you'll need to specify
257# the correct CPU with the --cpu option.
258case $targetos in
Elliott Hugheseda3a602017-05-19 18:53:02 -0700259AIX|OpenBSD)
260 # Unless explicitly enabled, turn off lex.
261 # OpenBSD will hit syntax error when enabled.
262 if test -z "$disable_lex" ; then
263 disable_lex="yes"
264 else
265 force_no_lex_o="yes"
266 fi
267 ;;
Jens Axboe67bf9822013-01-10 11:23:19 +0100268Darwin)
269 # on Leopard most of the system is 32-bit, so we have to ask the kernel if
270 # we can run 64-bit userspace code.
271 # If the user didn't specify a CPU explicitly and the kernel says this is
272 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual
273 # detection code.
274 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
275 cpu="x86_64"
276 fi
Elliott Hugheseda3a602017-05-19 18:53:02 -0700277 # Error at compile time linking of weak/partial symbols if possible...
278cat > $TMPC <<EOF
279int main(void)
280{
281 return 0;
282}
283EOF
284 if compile_prog "" "-Wl,-no_weak_imports" "disable weak symbols"; then
285 echo "Disabling weak symbols"
286 LDFLAGS="$LDFLAGS -Wl,-no_weak_imports"
287 fi
Jens Axboe67bf9822013-01-10 11:23:19 +0100288 ;;
289SunOS)
290 # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
291 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
292 cpu="x86_64"
293 fi
Jens Axboeadaa46d2013-02-28 22:10:22 +0100294 LIBS="-lnsl -lsocket"
Jens Axboecfd94f72013-01-23 16:23:48 -0700295 ;;
296CYGWIN*)
Elliott Hugheseda3a602017-05-19 18:53:02 -0700297 # We still force some options, so keep this message here.
298 echo "Forcing some known good options on Windows"
Jens Axboe4578d012013-01-23 16:26:12 -0700299 if test -z "$CC" ; then
Huadong Liu74097112013-02-05 08:43:14 +0100300 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
301 CC="i686-w64-mingw32-gcc"
Elliott Hugheseda3a602017-05-19 18:53:02 -0700302 if test -e "../zlib/contrib/vstudio/vc14/x86/ZlibStatReleaseWithoutAsm/zlibstat.lib"; then
303 echo "Building with zlib support"
304 output_sym "CONFIG_ZLIB"
305 echo "LIBS=../zlib/contrib/vstudio/vc14/x86/ZlibStatReleaseWithoutAsm/zlibstat.lib" >> $config_host_mak
306 fi
Huadong Liu74097112013-02-05 08:43:14 +0100307 else
308 CC="x86_64-w64-mingw32-gcc"
Elliott Hugheseda3a602017-05-19 18:53:02 -0700309 if test -e "../zlib/contrib/vstudio/vc14/x64/ZlibStatReleaseWithoutAsm/zlibstat.lib"; then
310 echo "Building with zlib support"
311 output_sym "CONFIG_ZLIB"
312 echo "LIBS=../zlib/contrib/vstudio/vc14/x64/ZlibStatReleaseWithoutAsm/zlibstat.lib" >> $config_host_mak
313 fi
Huadong Liu74097112013-02-05 08:43:14 +0100314 fi
Jens Axboe4578d012013-01-23 16:26:12 -0700315 fi
Huadong Liu74097112013-02-05 08:43:14 +0100316 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
317 output_sym "CONFIG_32BIT"
318 else
319 output_sym "CONFIG_64BIT_LLP64"
320 fi
Elliott Hugheseda3a602017-05-19 18:53:02 -0700321 # We need this to be output_sym'd here because this is Windows specific.
322 # The regular configure path never sets this config.
Jens Axboe4feafb12013-01-24 23:07:55 -0700323 output_sym "CONFIG_WINDOWSAIO"
Elliott Hugheseda3a602017-05-19 18:53:02 -0700324 # We now take the regular configuration path without having exit 0 here.
325 # Flags below are still necessary mostly for MinGW.
326 socklen_t="yes"
327 sfaa="yes"
328 rusage_thread="yes"
329 fdatasync="yes"
330 clock_gettime="yes" # clock_monotonic probe has dependency on this
331 clock_monotonic="yes"
332 gettimeofday="yes"
333 sched_idle="yes"
334 tcp_nodelay="yes"
335 tls_thread="yes"
336 static_assert="yes"
337 ipv6="yes"
Jens Axboe4feafb12013-01-24 23:07:55 -0700338 echo "CC=$CC" >> $config_host_mak
Elliott Hugheseda3a602017-05-19 18:53:02 -0700339 echo "BUILD_CFLAGS=$CFLAGS -I../zlib -include config-host.h -D_GNU_SOURCE" >> $config_host_mak
Aaron Carroll6d0e9f82013-02-12 09:58:14 +0100340 ;;
Jens Axboe67bf9822013-01-10 11:23:19 +0100341esac
342
343if test ! -z "$cpu" ; then
344 # command line argument
345 :
346elif check_define __i386__ ; then
347 cpu="i386"
348elif check_define __x86_64__ ; then
349 cpu="x86_64"
350elif check_define __sparc__ ; then
351 if check_define __arch64__ ; then
352 cpu="sparc64"
353 else
354 cpu="sparc"
355 fi
356elif check_define _ARCH_PPC ; then
357 if check_define _ARCH_PPC64 ; then
358 cpu="ppc64"
359 else
360 cpu="ppc"
361 fi
362elif check_define __mips__ ; then
363 cpu="mips"
364elif check_define __ia64__ ; then
365 cpu="ia64"
366elif check_define __s390__ ; then
367 if check_define __s390x__ ; then
368 cpu="s390x"
369 else
370 cpu="s390"
371 fi
372elif check_define __arm__ ; then
373 cpu="arm"
Elliott Hugheseda3a602017-05-19 18:53:02 -0700374elif check_define __aarch64__ ; then
375 cpu="aarch64"
Jens Axboe67bf9822013-01-10 11:23:19 +0100376elif check_define __hppa__ ; then
377 cpu="hppa"
378else
379 cpu=`uname -m`
380fi
381
382# Normalise host CPU name and set ARCH.
383case "$cpu" in
384 ia64|ppc|ppc64|s390|s390x|sparc64)
385 cpu="$cpu"
386 ;;
387 i386|i486|i586|i686|i86pc|BePC)
Elliott Hugheseda3a602017-05-19 18:53:02 -0700388 cpu="x86"
Jens Axboe67bf9822013-01-10 11:23:19 +0100389 ;;
390 x86_64|amd64)
391 cpu="x86_64"
392 ;;
393 armv*b|armv*l|arm)
394 cpu="arm"
395 ;;
Elliott Hugheseda3a602017-05-19 18:53:02 -0700396 aarch64)
397 cpu="arm64"
398 ;;
Jens Axboe67bf9822013-01-10 11:23:19 +0100399 hppa|parisc|parisc64)
400 cpu="hppa"
401 ;;
402 mips*)
403 cpu="mips"
404 ;;
405 sparc|sun4[cdmuv])
406 cpu="sparc"
407 ;;
408 *)
Jens Axboe8b156d82013-02-10 15:48:34 +0100409 echo "Unknown CPU"
Jens Axboe67bf9822013-01-10 11:23:19 +0100410 ;;
411esac
412
Jens Axboedcbbf5b2013-01-25 14:35:27 -0700413if test -z "$CC" ; then
Jens Axboe67bf9822013-01-10 11:23:19 +0100414 if test "$targetos" = "FreeBSD"; then
415 if has clang; then
416 CC=clang
417 else
418 CC=gcc
419 fi
Jens Axboe67bf9822013-01-10 11:23:19 +0100420 fi
421fi
422
423cc="${CC-${cross_prefix}gcc}"
424
Jens Axboe0dcebdf2013-01-23 15:42:16 -0700425##########################################
Aaron Carroll1a17cfd2013-03-14 16:57:40 +1100426# check cross compile
427
Elliott Hugheseda3a602017-05-19 18:53:02 -0700428if test "$cross_compile" != "yes" ; then
429 cross_compile="no"
430fi
Aaron Carroll1a17cfd2013-03-14 16:57:40 +1100431cat > $TMPC <<EOF
432int main(void)
433{
434 return 0;
435}
436EOF
437if compile_prog "" "" "cross"; then
438 $TMPE 2>/dev/null || cross_compile="yes"
439else
440 fatal "compile test failed"
441fi
442
443##########################################
Jens Axboe0dcebdf2013-01-23 15:42:16 -0700444# check endianness
Elliott Hugheseda3a602017-05-19 18:53:02 -0700445if test "$bigendian" != "yes" ; then
446 bigendian="no"
447fi
Aaron Carroll1a17cfd2013-03-14 16:57:40 +1100448if test "$cross_compile" = "no" ; then
449 cat > $TMPC <<EOF
Jens Axboe0dcebdf2013-01-23 15:42:16 -0700450#include <inttypes.h>
451int main(void)
452{
453 volatile uint32_t i=0x01234567;
454 return (*((uint8_t*)(&i))) == 0x67;
455}
456EOF
Aaron Carroll1a17cfd2013-03-14 16:57:40 +1100457 if compile_prog "" "" "endian"; then
458 $TMPE && bigendian="yes"
459 fi
460else
461 # If we're cross compiling, try our best to work it out and rely on the
462 # run-time check to fail if we get it wrong.
463 cat > $TMPC <<EOF
464#include <endian.h>
465int main(void)
466{
467#if __BYTE_ORDER != __BIG_ENDIAN
468# error "Unknown endianness"
469#endif
470}
471EOF
472 compile_prog "" "" "endian" && bigendian="yes"
473 check_define "__ARMEB__" && bigendian="yes"
474 check_define "__MIPSEB__" && bigendian="yes"
Jens Axboe0dcebdf2013-01-23 15:42:16 -0700475fi
476
477
Jens Axboe67bf9822013-01-10 11:23:19 +0100478echo "Operating system $targetos"
479echo "CPU $cpu"
Jens Axboe0dcebdf2013-01-23 15:42:16 -0700480echo "Big endian $bigendian"
Jens Axboe67bf9822013-01-10 11:23:19 +0100481echo "Compiler $cc"
Aaron Carroll1a17cfd2013-03-14 16:57:40 +1100482echo "Cross compile $cross_compile"
Jens Axboe67bf9822013-01-10 11:23:19 +0100483echo
484
485##########################################
Jens Axboe1a9487d2014-11-10 11:18:06 -0700486# See if we need to build a static build
487if test "$build_static" = "yes" ; then
488 CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
489 LDFLAGS="$LDFLAGS -static -Wl,--gc-sections"
490else
491 build_static="no"
492fi
493echo "Static build $build_static"
494
495##########################################
Jens Axboe67bf9822013-01-10 11:23:19 +0100496# check for wordsize
497wordsize="0"
498cat > $TMPC <<EOF
Aaron Carroll142429e2013-03-14 16:57:39 +1100499#include <limits.h>
500#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
Jens Axboe67bf9822013-01-10 11:23:19 +0100501int main(void)
502{
Aaron Carroll142429e2013-03-14 16:57:39 +1100503 BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE);
Jens Axboe67bf9822013-01-10 11:23:19 +0100504 return 0;
505}
506EOF
Aaron Carroll142429e2013-03-14 16:57:39 +1100507if compile_prog "-DWORDSIZE=32" "" "wordsize"; then
508 wordsize="32"
509elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then
510 wordsize="64"
511else
512 fatal "Unknown wordsize"
Jens Axboe67bf9822013-01-10 11:23:19 +0100513fi
514echo "Wordsize $wordsize"
515
516##########################################
Jens Axboea9bca4a2013-04-05 12:55:42 +0200517# zlib probe
Elliott Hugheseda3a602017-05-19 18:53:02 -0700518if test "$zlib" != "yes" ; then
519 zlib="no"
520fi
Jens Axboea9bca4a2013-04-05 12:55:42 +0200521cat > $TMPC <<EOF
Jens Axboe31c9cd42014-07-03 14:17:02 -0600522#include <zlib.h>
Jens Axboea9bca4a2013-04-05 12:55:42 +0200523int main(void)
524{
525 z_stream stream;
526 if (inflateInit(&stream) != Z_OK)
527 return 1;
528 return 0;
529}
530EOF
531if compile_prog "" "-lz" "zlib" ; then
532 zlib=yes
533 LIBS="-lz $LIBS"
Jens Axboea9bca4a2013-04-05 12:55:42 +0200534fi
535echo "zlib $zlib"
536
537##########################################
Jens Axboe67bf9822013-01-10 11:23:19 +0100538# linux-aio probe
Elliott Hugheseda3a602017-05-19 18:53:02 -0700539if test "$libaio" != "yes" ; then
540 libaio="no"
541fi
542if test "$esx" != "yes" ; then
543 cat > $TMPC <<EOF
Jens Axboe67bf9822013-01-10 11:23:19 +0100544#include <libaio.h>
545#include <stddef.h>
546int main(void)
547{
548 io_setup(0, NULL);
549 return 0;
550}
551EOF
Elliott Hugheseda3a602017-05-19 18:53:02 -0700552 if compile_prog "" "-laio" "libaio" ; then
553 libaio=yes
554 LIBS="-laio $LIBS"
555 else
556 if test "$libaio" = "yes" ; then
557 feature_not_found "linux AIO" "libaio-dev or libaio-devel"
558 fi
559 libaio=no
Jens Axboe67bf9822013-01-10 11:23:19 +0100560 fi
Jens Axboe67bf9822013-01-10 11:23:19 +0100561fi
562echo "Linux AIO support $libaio"
563
564##########################################
565# posix aio probe
Elliott Hugheseda3a602017-05-19 18:53:02 -0700566if test "$posix_aio" != "yes" ; then
567 posix_aio="no"
568fi
569if test "$posix_aio_lrt" != "yes" ; then
570 posix_aio_lrt="no"
571fi
Jens Axboe67bf9822013-01-10 11:23:19 +0100572cat > $TMPC <<EOF
573#include <aio.h>
574int main(void)
575{
576 struct aiocb cb;
577 aio_read(&cb);
578 return 0;
579}
580EOF
581if compile_prog "" "" "posixaio" ; then
582 posix_aio="yes"
583elif compile_prog "" "-lrt" "posixaio"; then
584 posix_aio="yes"
585 posix_aio_lrt="yes"
586 LIBS="-lrt $LIBS"
587fi
588echo "POSIX AIO support $posix_aio"
589echo "POSIX AIO support needs -lrt $posix_aio_lrt"
590
591##########################################
592# posix aio fsync probe
Elliott Hugheseda3a602017-05-19 18:53:02 -0700593if test "$posix_aio_fsync" != "yes" ; then
594 posix_aio_fsync="no"
595fi
Jens Axboe67bf9822013-01-10 11:23:19 +0100596if test "$posix_aio" = "yes" ; then
597 cat > $TMPC <<EOF
598#include <fcntl.h>
599#include <aio.h>
600int main(void)
601{
602 struct aiocb cb;
603 return aio_fsync(O_SYNC, &cb);
604 return 0;
605}
606EOF
607 if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
608 posix_aio_fsync=yes
609 fi
610fi
611echo "POSIX AIO fsync $posix_aio_fsync"
612
613##########################################
Elliott Hugheseda3a602017-05-19 18:53:02 -0700614# POSIX pshared attribute probe
615if test "$posix_pshared" != "yes" ; then
616 posix_pshared="no"
617fi
618cat > $TMPC <<EOF
619#include <unistd.h>
620int main(void)
621{
622#if defined(_POSIX_THREAD_PROCESS_SHARED) && ((_POSIX_THREAD_PROCESS_SHARED + 0) > 0)
623# if defined(__CYGWIN__)
624# error "_POSIX_THREAD_PROCESS_SHARED is buggy on Cygwin"
625# elif defined(__APPLE__)
626# include <AvailabilityMacros.h>
627# include <TargetConditionals.h>
628# if TARGET_OS_MAC && MAC_OS_X_VERSION_MIN_REQUIRED < 1070
629# error "_POSIX_THREAD_PROCESS_SHARED is buggy/unsupported prior to OSX 10.7"
630# endif
631# endif
632#else
633# error "_POSIX_THREAD_PROCESS_SHARED is unsupported"
634#endif
635 return 0;
636}
637EOF
638if compile_prog "" "$LIBS" "posix_pshared" ; then
639 posix_pshared=yes
640fi
641echo "POSIX pshared support $posix_pshared"
642
643##########################################
Jens Axboe67bf9822013-01-10 11:23:19 +0100644# solaris aio probe
Elliott Hugheseda3a602017-05-19 18:53:02 -0700645if test "$solaris_aio" != "yes" ; then
646 solaris_aio="no"
647fi
Jens Axboe67bf9822013-01-10 11:23:19 +0100648cat > $TMPC <<EOF
649#include <sys/types.h>
650#include <sys/asynch.h>
651#include <unistd.h>
652int main(void)
653{
654 aio_result_t res;
655 return aioread(0, NULL, 0, 0, SEEK_SET, &res);
656 return 0;
657}
658EOF
659if compile_prog "" "-laio" "solarisaio" ; then
660 solaris_aio=yes
661 LIBS="-laio $LIBS"
662fi
663echo "Solaris AIO support $solaris_aio"
664
665##########################################
Elliott Hugheseda3a602017-05-19 18:53:02 -0700666# __sync_fetch_and_add test
667if test "$sfaa" != "yes" ; then
668 sfaa="no"
669fi
Jens Axboe67bf9822013-01-10 11:23:19 +0100670cat > $TMPC << EOF
Elliott Hugheseda3a602017-05-19 18:53:02 -0700671#include <inttypes.h>
672static int sfaa(uint64_t *ptr)
Jens Axboe67bf9822013-01-10 11:23:19 +0100673{
Jens Axboe9c639a72013-02-28 22:13:29 +0100674 return __sync_fetch_and_add(ptr, 0);
Jens Axboe67bf9822013-01-10 11:23:19 +0100675}
676
677int main(int argc, char **argv)
678{
Elliott Hugheseda3a602017-05-19 18:53:02 -0700679 uint64_t val = 42;
Jens Axboe67bf9822013-01-10 11:23:19 +0100680 sfaa(&val);
681 return val;
682}
683EOF
684if compile_prog "" "" "__sync_fetch_and_add()" ; then
685 sfaa="yes"
686fi
Jens Axboe9c639a72013-02-28 22:13:29 +0100687echo "__sync_fetch_and_add $sfaa"
Jens Axboe67bf9822013-01-10 11:23:19 +0100688
689##########################################
690# libverbs probe
Elliott Hugheseda3a602017-05-19 18:53:02 -0700691if test "$libverbs" != "yes" ; then
692 libverbs="no"
693fi
Jens Axboe67bf9822013-01-10 11:23:19 +0100694cat > $TMPC << EOF
695#include <stdio.h>
696#include <infiniband/arch.h>
697int main(int argc, char **argv)
698{
699 struct ibv_pd *pd = ibv_alloc_pd(NULL);
700 return 0;
701}
702EOF
Elliott Hugheseda3a602017-05-19 18:53:02 -0700703if test "$disable_rdma" != "yes" && compile_prog "" "-libverbs" "libverbs" ; then
Jens Axboe67bf9822013-01-10 11:23:19 +0100704 libverbs="yes"
705 LIBS="-libverbs $LIBS"
706fi
707echo "libverbs $libverbs"
708
709##########################################
710# rdmacm probe
Elliott Hugheseda3a602017-05-19 18:53:02 -0700711if test "$rdmacm" != "yes" ; then
712 rdmacm="no"
713fi
Jens Axboe67bf9822013-01-10 11:23:19 +0100714cat > $TMPC << EOF
715#include <stdio.h>
716#include <rdma/rdma_cma.h>
717int main(int argc, char **argv)
718{
719 rdma_destroy_qp(NULL);
720 return 0;
721}
722EOF
Elliott Hugheseda3a602017-05-19 18:53:02 -0700723if test "$disable_rdma" != "yes" && compile_prog "" "-lrdmacm" "rdma"; then
Jens Axboe67bf9822013-01-10 11:23:19 +0100724 rdmacm="yes"
725 LIBS="-lrdmacm $LIBS"
726fi
727echo "rdmacm $rdmacm"
728
729##########################################
730# Linux fallocate probe
Elliott Hugheseda3a602017-05-19 18:53:02 -0700731if test "$linux_fallocate" != "yes" ; then
732 linux_fallocate="no"
733fi
Jens Axboe67bf9822013-01-10 11:23:19 +0100734cat > $TMPC << EOF
735#include <stdio.h>
Castor Fuaa6738a2013-12-19 23:00:46 -0800736#include <fcntl.h>
Jens Axboe67bf9822013-01-10 11:23:19 +0100737#include <linux/falloc.h>
738int main(int argc, char **argv)
739{
740 int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
741 return r;
742}
743EOF
744if compile_prog "" "" "linux_fallocate"; then
745 linux_fallocate="yes"
746fi
747echo "Linux fallocate $linux_fallocate"
748
749##########################################
750# POSIX fadvise probe
Elliott Hugheseda3a602017-05-19 18:53:02 -0700751if test "$posix_fadvise" != "yes" ; then
752 posix_fadvise="no"
753fi
Jens Axboe67bf9822013-01-10 11:23:19 +0100754cat > $TMPC << EOF
755#include <stdio.h>
756#include <fcntl.h>
757int main(int argc, char **argv)
758{
759 int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
760 return r;
761}
762EOF
763if compile_prog "" "" "posix_fadvise"; then
764 posix_fadvise="yes"
765fi
766echo "POSIX fadvise $posix_fadvise"
767
768##########################################
769# POSIX fallocate probe
Elliott Hugheseda3a602017-05-19 18:53:02 -0700770if test "$posix_fallocate" != "yes" ; then
771 posix_fallocate="no"
772fi
Jens Axboe67bf9822013-01-10 11:23:19 +0100773cat > $TMPC << EOF
774#include <stdio.h>
775#include <fcntl.h>
776int main(int argc, char **argv)
777{
778 int r = posix_fallocate(0, 0, 1024);
779 return r;
780}
781EOF
782if compile_prog "" "" "posix_fallocate"; then
783 posix_fallocate="yes"
784fi
785echo "POSIX fallocate $posix_fallocate"
786
787##########################################
788# sched_set/getaffinity 2 or 3 argument test
Elliott Hugheseda3a602017-05-19 18:53:02 -0700789if test "$linux_2arg_affinity" != "yes" ; then
790 linux_2arg_affinity="no"
791fi
792if test "$linux_3arg_affinity" != "yes" ; then
793 linux_3arg_affinity="no"
794fi
Jens Axboe67bf9822013-01-10 11:23:19 +0100795cat > $TMPC << EOF
Jens Axboe67bf9822013-01-10 11:23:19 +0100796#include <sched.h>
797int main(int argc, char **argv)
798{
799 cpu_set_t mask;
800 return sched_setaffinity(0, sizeof(mask), &mask);
801}
802EOF
803if compile_prog "" "" "sched_setaffinity(,,)"; then
804 linux_3arg_affinity="yes"
805else
806 cat > $TMPC << EOF
Jens Axboe67bf9822013-01-10 11:23:19 +0100807#include <sched.h>
808int main(int argc, char **argv)
809{
810 cpu_set_t mask;
811 return sched_setaffinity(0, &mask);
812}
813EOF
814 if compile_prog "" "" "sched_setaffinity(,)"; then
815 linux_2arg_affinity="yes"
816 fi
817fi
818echo "sched_setaffinity(3 arg) $linux_3arg_affinity"
819echo "sched_setaffinity(2 arg) $linux_2arg_affinity"
820
821##########################################
822# clock_gettime probe
Elliott Hugheseda3a602017-05-19 18:53:02 -0700823if test "$clock_gettime" != "yes" ; then
824 clock_gettime="no"
825fi
Jens Axboe67bf9822013-01-10 11:23:19 +0100826cat > $TMPC << EOF
827#include <stdio.h>
828#include <time.h>
829int main(int argc, char **argv)
830{
831 return clock_gettime(0, NULL);
832}
833EOF
834if compile_prog "" "" "clock_gettime"; then
835 clock_gettime="yes"
836elif compile_prog "" "-lrt" "clock_gettime"; then
837 clock_gettime="yes"
838 LIBS="-lrt $LIBS"
839fi
840echo "clock_gettime $clock_gettime"
841
842##########################################
843# CLOCK_MONOTONIC probe
Elliott Hugheseda3a602017-05-19 18:53:02 -0700844if test "$clock_monotonic" != "yes" ; then
845 clock_monotonic="no"
846fi
Jens Axboe67bf9822013-01-10 11:23:19 +0100847if test "$clock_gettime" = "yes" ; then
848 cat > $TMPC << EOF
849#include <stdio.h>
850#include <time.h>
851int main(int argc, char **argv)
852{
853 return clock_gettime(CLOCK_MONOTONIC, NULL);
854}
855EOF
856 if compile_prog "" "$LIBS" "clock monotonic"; then
857 clock_monotonic="yes"
858 fi
859fi
860echo "CLOCK_MONOTONIC $clock_monotonic"
861
862##########################################
Elliott Hugheseda3a602017-05-19 18:53:02 -0700863# CLOCK_MONOTONIC_RAW probe
864if test "$clock_monotonic_raw" != "yes" ; then
865 clock_monotonic_raw="no"
866fi
867if test "$clock_gettime" = "yes" ; then
868 cat > $TMPC << EOF
869#include <stdio.h>
870#include <time.h>
871int main(int argc, char **argv)
872{
873 return clock_gettime(CLOCK_MONOTONIC_RAW, NULL);
874}
875EOF
876 if compile_prog "" "$LIBS" "clock monotonic"; then
877 clock_monotonic_raw="yes"
878 fi
879fi
880echo "CLOCK_MONOTONIC_RAW $clock_monotonic_raw"
881
882##########################################
Jens Axboe67bf9822013-01-10 11:23:19 +0100883# CLOCK_MONOTONIC_PRECISE probe
Elliott Hugheseda3a602017-05-19 18:53:02 -0700884if test "$clock_monotonic_precise" != "yes" ; then
885 clock_monotonic_precise="no"
886fi
Jens Axboe67bf9822013-01-10 11:23:19 +0100887if test "$clock_gettime" = "yes" ; then
888 cat > $TMPC << EOF
889#include <stdio.h>
890#include <time.h>
891int main(int argc, char **argv)
892{
893 return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
894}
895EOF
896 if compile_prog "" "$LIBS" "clock monotonic precise"; then
897 clock_monotonic_precise="yes"
898 fi
899fi
900echo "CLOCK_MONOTONIC_PRECISE $clock_monotonic_precise"
901
902##########################################
Elliott Hugheseda3a602017-05-19 18:53:02 -0700903# clockid_t probe
904if test "$clockid_t" != "yes" ; then
905 clockid_t="no"
906fi
907cat > $TMPC << EOF
908#include <time.h>
909#include <string.h>
910int main(int argc, char **argv)
911{
912 volatile clockid_t cid;
913 memset((void*)&cid, 0, sizeof(cid));
914 return 0;
915}
916EOF
917if compile_prog "" "$LIBS" "clockid_t"; then
918 clockid_t="yes"
919fi
920echo "clockid_t $clockid_t"
921
922##########################################
Jens Axboe67bf9822013-01-10 11:23:19 +0100923# gettimeofday() probe
Elliott Hugheseda3a602017-05-19 18:53:02 -0700924if test "$gettimeofday" != "yes" ; then
925 gettimeofday="no"
926fi
Jens Axboe67bf9822013-01-10 11:23:19 +0100927cat > $TMPC << EOF
928#include <sys/time.h>
929#include <stdio.h>
930int main(int argc, char **argv)
931{
932 struct timeval tv;
933 return gettimeofday(&tv, NULL);
934}
935EOF
936if compile_prog "" "" "gettimeofday"; then
937 gettimeofday="yes"
938fi
939echo "gettimeofday $gettimeofday"
940
941##########################################
942# fdatasync() probe
Elliott Hugheseda3a602017-05-19 18:53:02 -0700943if test "$fdatasync" != "yes" ; then
944 fdatasync="no"
945fi
Jens Axboe67bf9822013-01-10 11:23:19 +0100946cat > $TMPC << EOF
947#include <stdio.h>
948#include <unistd.h>
949int main(int argc, char **argv)
950{
951 return fdatasync(0);
952}
953EOF
954if compile_prog "" "" "fdatasync"; then
955 fdatasync="yes"
956fi
957echo "fdatasync $fdatasync"
958
959##########################################
960# sync_file_range() probe
Elliott Hugheseda3a602017-05-19 18:53:02 -0700961if test "$sync_file_range" != "yes" ; then
962 sync_file_range="no"
963fi
Jens Axboe67bf9822013-01-10 11:23:19 +0100964cat > $TMPC << EOF
965#include <stdio.h>
966#include <unistd.h>
Jens Axboe67bf9822013-01-10 11:23:19 +0100967#include <fcntl.h>
968#include <linux/fs.h>
969int main(int argc, char **argv)
970{
971 unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
972 SYNC_FILE_RANGE_WAIT_AFTER;
973 return sync_file_range(0, 0, 0, flags);
974}
975EOF
976if compile_prog "" "" "sync_file_range"; then
977 sync_file_range="yes"
978fi
979echo "sync_file_range $sync_file_range"
980
981##########################################
982# ext4 move extent probe
Elliott Hugheseda3a602017-05-19 18:53:02 -0700983if test "$ext4_me" != "yes" ; then
984 ext4_me="no"
985fi
Jens Axboe67bf9822013-01-10 11:23:19 +0100986cat > $TMPC << EOF
987#include <fcntl.h>
988#include <sys/ioctl.h>
989int main(int argc, char **argv)
990{
991 struct move_extent me;
992 return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
993}
994EOF
Jens Axboec7165b82013-01-12 10:27:53 +0100995if compile_prog "" "" "ext4 move extent" ; then
996 ext4_me="yes"
997elif test $targetos = "Linux" ; then
998 # On Linux, just default to it on and let it error at runtime if we really
999 # don't have it. None of my updated systems have it defined, but it does
1000 # work. Takes a while to bubble back.
Jens Axboe67bf9822013-01-10 11:23:19 +01001001 ext4_me="yes"
1002fi
1003echo "EXT4 move extent $ext4_me"
1004
1005##########################################
1006# splice probe
Elliott Hugheseda3a602017-05-19 18:53:02 -07001007if test "$linux_splice" != "yes" ; then
1008 linux_splice="no"
1009fi
Jens Axboe67bf9822013-01-10 11:23:19 +01001010cat > $TMPC << EOF
Jens Axboe67bf9822013-01-10 11:23:19 +01001011#include <stdio.h>
1012#include <fcntl.h>
1013int main(int argc, char **argv)
1014{
1015 return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
1016}
1017EOF
1018if compile_prog "" "" "linux splice"; then
1019 linux_splice="yes"
1020fi
1021echo "Linux splice(2) $linux_splice"
1022
1023##########################################
1024# GUASI probe
Elliott Hugheseda3a602017-05-19 18:53:02 -07001025if test "$guasi" != "yes" ; then
1026 guasi="no"
1027fi
Jens Axboe67bf9822013-01-10 11:23:19 +01001028cat > $TMPC << EOF
1029#include <guasi.h>
1030#include <guasi_syscalls.h>
1031int main(int argc, char **argv)
1032{
1033 guasi_t ctx = guasi_create(0, 0, 0);
1034 return 0;
1035}
1036EOF
1037if compile_prog "" "" "guasi"; then
1038 guasi="yes"
1039fi
1040echo "GUASI $guasi"
1041
1042##########################################
1043# fusion-aw probe
Elliott Hugheseda3a602017-05-19 18:53:02 -07001044if test "$fusion_aw" != "yes" ; then
1045 fusion_aw="no"
1046fi
Jens Axboe67bf9822013-01-10 11:23:19 +01001047cat > $TMPC << EOF
Santhosh Koundinyab2c77c22013-05-18 08:44:01 +02001048#include <nvm/nvm_primitives.h>
Jens Axboe67bf9822013-01-10 11:23:19 +01001049int main(int argc, char **argv)
1050{
Santhosh Koundinyab2c77c22013-05-18 08:44:01 +02001051 nvm_version_t ver_info;
1052 nvm_handle_t handle;
1053
1054 handle = nvm_get_handle(0, &ver_info);
1055 return nvm_atomic_write(handle, 0, 0, 0);
Jens Axboe67bf9822013-01-10 11:23:19 +01001056}
1057EOF
Elliott Hugheseda3a602017-05-19 18:53:02 -07001058if compile_prog "" "-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread" "fusion-aw"; then
1059 LIBS="-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread $LIBS"
Jens Axboe67bf9822013-01-10 11:23:19 +01001060 fusion_aw="yes"
1061fi
1062echo "Fusion-io atomic engine $fusion_aw"
1063
1064##########################################
1065# libnuma probe
Elliott Hugheseda3a602017-05-19 18:53:02 -07001066if test "$libnuma" != "yes" ; then
1067 libnuma="no"
1068fi
Jens Axboe67bf9822013-01-10 11:23:19 +01001069cat > $TMPC << EOF
1070#include <numa.h>
1071int main(int argc, char **argv)
1072{
1073 return numa_available();
1074}
1075EOF
Castor Fu44462512013-10-31 11:00:54 -06001076if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then
Jens Axboe67bf9822013-01-10 11:23:19 +01001077 libnuma="yes"
1078 LIBS="-lnuma $LIBS"
1079fi
1080echo "libnuma $libnuma"
1081
1082##########################################
Elliott Hugheseda3a602017-05-19 18:53:02 -07001083# libnuma 2.x version API, initialize with "no" only if $libnuma is set to "yes"
Jens Axboe50206d92013-03-25 13:20:08 -06001084if test "$libnuma" = "yes" ; then
1085libnuma_v2="no"
1086cat > $TMPC << EOF
1087#include <numa.h>
1088int main(int argc, char **argv)
1089{
1090 struct bitmask *mask = numa_parse_nodestring(NULL);
Castor Fu25d4dfe2015-01-29 10:07:36 -08001091 return mask->size == 0;
Jens Axboe50206d92013-03-25 13:20:08 -06001092}
1093EOF
1094if compile_prog "" "" "libnuma api"; then
1095 libnuma_v2="yes"
1096fi
1097echo "libnuma v2 $libnuma_v2"
1098fi
1099
1100##########################################
Jens Axboe67bf9822013-01-10 11:23:19 +01001101# strsep() probe
Elliott Hugheseda3a602017-05-19 18:53:02 -07001102if test "$strsep" != "yes" ; then
1103 strsep="no"
1104fi
Jens Axboe67bf9822013-01-10 11:23:19 +01001105cat > $TMPC << EOF
1106#include <string.h>
1107int main(int argc, char **argv)
1108{
Elliott Hugheseda3a602017-05-19 18:53:02 -07001109 static char *string = "This is a string";
1110 strsep(&string, "needle");
Jens Axboe67bf9822013-01-10 11:23:19 +01001111 return 0;
1112}
1113EOF
1114if compile_prog "" "" "strsep"; then
1115 strsep="yes"
1116fi
1117echo "strsep $strsep"
1118
1119##########################################
Jens Axboe9ad8da82013-04-05 14:44:03 +02001120# strcasestr() probe
Elliott Hugheseda3a602017-05-19 18:53:02 -07001121if test "$strcasestr" != "yes" ; then
1122 strcasestr="no"
1123fi
Jens Axboe9ad8da82013-04-05 14:44:03 +02001124cat > $TMPC << EOF
1125#include <string.h>
1126int main(int argc, char **argv)
1127{
Castor Fuaa6738a2013-12-19 23:00:46 -08001128 return strcasestr(argv[0], argv[1]) != NULL;
Jens Axboe9ad8da82013-04-05 14:44:03 +02001129}
1130EOF
1131if compile_prog "" "" "strcasestr"; then
1132 strcasestr="yes"
1133fi
1134echo "strcasestr $strcasestr"
1135
1136##########################################
Elliott Hugheseda3a602017-05-19 18:53:02 -07001137# strlcat() probe
1138if test "$strlcat" != "yes" ; then
1139 strlcat="no"
1140fi
1141cat > $TMPC << EOF
1142#include <string.h>
1143int main(int argc, char **argv)
1144{
1145 static char dst[64];
1146 static char *string = "This is a string";
1147 memset(dst, 0, sizeof(dst));
1148 strlcat(dst, string, sizeof(dst));
1149 return 0;
1150}
1151EOF
1152if compile_prog "" "" "strlcat"; then
1153 strlcat="yes"
1154fi
1155echo "strlcat $strlcat"
1156
1157##########################################
Jens Axboe67bf9822013-01-10 11:23:19 +01001158# getopt_long_only() probe
Elliott Hugheseda3a602017-05-19 18:53:02 -07001159if test "$getopt_long_only" != "yes" ; then
1160 getopt_long_only="no"
1161fi
Jens Axboe67bf9822013-01-10 11:23:19 +01001162cat > $TMPC << EOF
1163#include <unistd.h>
1164#include <stdio.h>
Castor Fuaa6738a2013-12-19 23:00:46 -08001165#include <getopt.h>
Jens Axboe67bf9822013-01-10 11:23:19 +01001166int main(int argc, char **argv)
1167{
1168 int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
1169 return c;
1170}
1171EOF
1172if compile_prog "" "" "getopt_long_only"; then
1173 getopt_long_only="yes"
1174fi
1175echo "getopt_long_only() $getopt_long_only"
1176
1177##########################################
1178# inet_aton() probe
Elliott Hugheseda3a602017-05-19 18:53:02 -07001179if test "$inet_aton" != "yes" ; then
1180 inet_aton="no"
1181fi
Jens Axboe67bf9822013-01-10 11:23:19 +01001182cat > $TMPC << EOF
1183#include <sys/socket.h>
1184#include <arpa/inet.h>
1185#include <stdio.h>
1186int main(int argc, char **argv)
1187{
1188 struct in_addr in;
1189 return inet_aton(NULL, &in);
1190}
1191EOF
1192if compile_prog "" "" "inet_aton"; then
1193 inet_aton="yes"
1194fi
1195echo "inet_aton $inet_aton"
1196
1197##########################################
1198# socklen_t probe
Elliott Hugheseda3a602017-05-19 18:53:02 -07001199if test "$socklen_t" != "yes" ; then
1200 socklen_t="no"
1201fi
Jens Axboe67bf9822013-01-10 11:23:19 +01001202cat > $TMPC << EOF
Aaron Carrollf6482612013-03-14 16:57:41 +11001203#include <sys/socket.h>
Jens Axboe67bf9822013-01-10 11:23:19 +01001204int main(int argc, char **argv)
1205{
1206 socklen_t len = 0;
1207 return len;
1208}
1209EOF
1210if compile_prog "" "" "socklen_t"; then
1211 socklen_t="yes"
1212fi
1213echo "socklen_t $socklen_t"
1214
1215##########################################
1216# Whether or not __thread is supported for TLS
Elliott Hugheseda3a602017-05-19 18:53:02 -07001217if test "$tls_thread" != "yes" ; then
1218 tls_thread="no"
1219fi
Jens Axboe67bf9822013-01-10 11:23:19 +01001220cat > $TMPC << EOF
1221#include <stdio.h>
Castor Fuaa6738a2013-12-19 23:00:46 -08001222static __thread int ret;
Jens Axboe67bf9822013-01-10 11:23:19 +01001223int main(int argc, char **argv)
1224{
1225 return ret;
1226}
1227EOF
1228if compile_prog "" "" "__thread"; then
1229 tls_thread="yes"
1230fi
1231echo "__thread $tls_thread"
1232
Jens Axboe91f94d52013-01-24 10:25:42 -07001233##########################################
Jens Axboe2639f052013-04-10 14:41:08 +02001234# Check if we have required gtk/glib support for gfio
Elliott Hugheseda3a602017-05-19 18:53:02 -07001235if test "$gfio" != "yes" ; then
1236 gfio="no"
1237fi
Jens Axboeb9e839c2014-10-09 18:15:36 -06001238if test "$gfio_check" = "yes" ; then
Jens Axboe91f94d52013-01-24 10:25:42 -07001239 cat > $TMPC << EOF
1240#include <glib.h>
1241#include <cairo.h>
1242#include <gtk/gtk.h>
1243int main(void)
1244{
1245 gdk_threads_enter();
Jens Axboe91f94d52013-01-24 10:25:42 -07001246 gdk_threads_leave();
Jens Axboeb7a99312013-02-04 12:46:54 +01001247
Elliott Hugheseda3a602017-05-19 18:53:02 -07001248 return GTK_CHECK_VERSION(2, 18, 0) ? 0 : 1; /* 0 on success */
Jens Axboe91f94d52013-01-24 10:25:42 -07001249}
1250EOF
1251GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0)
Jens Axboe9aba7b72014-11-25 16:02:52 -07001252ORG_LDFLAGS=$LDFLAGS
1253LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g)
Jens Axboe91f94d52013-01-24 10:25:42 -07001254if test "$?" != "0" ; then
1255 echo "configure: gtk and gthread not found"
1256 exit 1
1257fi
1258GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0)
1259if test "$?" != "0" ; then
1260 echo "configure: gtk and gthread not found"
1261 exit 1
1262fi
Jens Axboeb7a99312013-02-04 12:46:54 +01001263if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
Elliott Hugheseda3a602017-05-19 18:53:02 -07001264 $TMPE
1265 if test "$?" = "0" ; then
Jens Axboeb7a99312013-02-04 12:46:54 +01001266 gfio="yes"
Jens Axboe9aba7b72014-11-25 16:02:52 -07001267 GFIO_LIBS="$LIBS $GTK_LIBS"
Jens Axboeb7a99312013-02-04 12:46:54 +01001268 CFLAGS="$CFLAGS $GTK_CFLAGS"
1269 else
1270 echo "GTK found, but need version 2.18 or higher"
1271 gfio="no"
1272 fi
Jens Axboe91f94d52013-01-24 10:25:42 -07001273else
1274 echo "Please install gtk and gdk libraries"
1275 gfio="no"
1276fi
Jens Axboe9aba7b72014-11-25 16:02:52 -07001277LDFLAGS=$ORG_LDFLAGS
Jens Axboe91f94d52013-01-24 10:25:42 -07001278fi
1279
Jens Axboeb9e839c2014-10-09 18:15:36 -06001280if test "$gfio_check" = "yes" ; then
1281 echo "gtk 2.18 or higher $gfio"
1282fi
Jens Axboe91f94d52013-01-24 10:25:42 -07001283
Elliott Hugheseda3a602017-05-19 18:53:02 -07001284##########################################
Jens Axboe44404c52013-01-24 14:20:09 -07001285# Check whether we have getrusage(RUSAGE_THREAD)
Elliott Hugheseda3a602017-05-19 18:53:02 -07001286if test "$rusage_thread" != "yes" ; then
1287 rusage_thread="no"
1288fi
Jens Axboe44404c52013-01-24 14:20:09 -07001289cat > $TMPC << EOF
1290#include <sys/time.h>
1291#include <sys/resource.h>
1292int main(int argc, char **argv)
1293{
1294 struct rusage ru;
1295 getrusage(RUSAGE_THREAD, &ru);
1296 return 0;
1297}
1298EOF
1299if compile_prog "" "" "RUSAGE_THREAD"; then
1300 rusage_thread="yes"
1301fi
1302echo "RUSAGE_THREAD $rusage_thread"
1303
Jens Axboe7e09a9f2013-01-30 13:58:58 +01001304##########################################
1305# Check whether we have SCHED_IDLE
Elliott Hugheseda3a602017-05-19 18:53:02 -07001306if test "$sched_idle" != "yes" ; then
1307 sched_idle="no"
1308fi
Jens Axboe7e09a9f2013-01-30 13:58:58 +01001309cat > $TMPC << EOF
1310#include <sched.h>
1311int main(int argc, char **argv)
1312{
1313 struct sched_param p;
1314 return sched_setscheduler(0, SCHED_IDLE, &p);
1315}
1316EOF
1317if compile_prog "" "" "SCHED_IDLE"; then
1318 sched_idle="yes"
1319fi
1320echo "SCHED_IDLE $sched_idle"
1321
Jens Axboe1eafa372013-01-31 10:19:51 +01001322##########################################
1323# Check whether we have TCP_NODELAY
Elliott Hugheseda3a602017-05-19 18:53:02 -07001324if test "$tcp_nodelay" != "yes" ; then
1325 tcp_nodelay="no"
1326fi
Jens Axboe1eafa372013-01-31 10:19:51 +01001327cat > $TMPC << EOF
1328#include <stdio.h>
1329#include <sys/types.h>
1330#include <sys/socket.h>
1331#include <netinet/tcp.h>
1332int main(int argc, char **argv)
1333{
1334 return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
1335}
1336EOF
1337if compile_prog "" "" "TCP_NODELAY"; then
1338 tcp_nodelay="yes"
1339fi
1340echo "TCP_NODELAY $tcp_nodelay"
1341
Jens Axboe38b93542013-02-28 08:28:05 +01001342##########################################
Jens Axboe531e67a2014-10-09 11:55:16 -06001343# Check whether we have SO_SNDBUF
Elliott Hugheseda3a602017-05-19 18:53:02 -07001344if test "$window_size" != "yes" ; then
1345 window_size="no"
1346fi
Jens Axboe531e67a2014-10-09 11:55:16 -06001347cat > $TMPC << EOF
1348#include <stdio.h>
1349#include <sys/types.h>
1350#include <sys/socket.h>
1351#include <netinet/tcp.h>
1352int main(int argc, char **argv)
1353{
1354 setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0);
1355 setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0);
1356}
1357EOF
1358if compile_prog "" "" "SO_SNDBUF"; then
1359 window_size="yes"
1360fi
1361echo "Net engine window_size $window_size"
1362
1363##########################################
Jens Axboe5e34cea2014-10-09 12:05:44 -06001364# Check whether we have TCP_MAXSEG
Elliott Hugheseda3a602017-05-19 18:53:02 -07001365if test "$mss" != "yes" ; then
1366 mss="no"
1367fi
Jens Axboe5e34cea2014-10-09 12:05:44 -06001368cat > $TMPC << EOF
1369#include <stdio.h>
1370#include <sys/types.h>
1371#include <sys/socket.h>
1372#include <netinet/tcp.h>
1373#include <arpa/inet.h>
1374#include <netinet/in.h>
1375int main(int argc, char **argv)
1376{
1377 return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0);
1378}
1379EOF
1380if compile_prog "" "" "TCP_MAXSEG"; then
1381 mss="yes"
1382fi
1383echo "TCP_MAXSEG $mss"
1384
1385##########################################
Jens Axboe38b93542013-02-28 08:28:05 +01001386# Check whether we have RLIMIT_MEMLOCK
Elliott Hugheseda3a602017-05-19 18:53:02 -07001387if test "$rlimit_memlock" != "yes" ; then
1388 rlimit_memlock="no"
1389fi
Jens Axboe38b93542013-02-28 08:28:05 +01001390cat > $TMPC << EOF
1391#include <sys/time.h>
1392#include <sys/resource.h>
1393int main(int argc, char **argv)
1394{
1395 struct rlimit rl;
1396 return getrlimit(RLIMIT_MEMLOCK, &rl);
1397}
1398EOF
1399if compile_prog "" "" "RLIMIT_MEMLOCK"; then
1400 rlimit_memlock="yes"
1401fi
1402echo "RLIMIT_MEMLOCK $rlimit_memlock"
1403
Jens Axboe07fc0ac2013-05-16 20:36:57 +02001404##########################################
1405# Check whether we have pwritev/preadv
Elliott Hugheseda3a602017-05-19 18:53:02 -07001406if test "$pwritev" != "yes" ; then
1407 pwritev="no"
1408fi
Jens Axboe07fc0ac2013-05-16 20:36:57 +02001409cat > $TMPC << EOF
1410#include <stdio.h>
1411#include <sys/uio.h>
1412int main(int argc, char **argv)
1413{
1414 return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0);
1415}
1416EOF
1417if compile_prog "" "" "pwritev"; then
1418 pwritev="yes"
1419fi
1420echo "pwritev/preadv $pwritev"
1421
Jens Axboeecad55e2014-01-24 18:56:34 -08001422##########################################
Elliott Hugheseda3a602017-05-19 18:53:02 -07001423# Check whether we have pwritev2/preadv2
1424if test "$pwritev2" != "yes" ; then
1425 pwritev2="no"
1426fi
1427cat > $TMPC << EOF
1428#include <stdio.h>
1429#include <sys/uio.h>
1430int main(int argc, char **argv)
1431{
1432 return pwritev2(0, NULL, 1, 0, 0) + preadv2(0, NULL, 1, 0, 0);
1433}
1434EOF
1435if compile_prog "" "" "pwritev2"; then
1436 pwritev2="yes"
1437fi
1438echo "pwritev2/preadv2 $pwritev2"
1439
1440##########################################
Jens Axboeecad55e2014-01-24 18:56:34 -08001441# Check whether we have the required functions for ipv6
Elliott Hugheseda3a602017-05-19 18:53:02 -07001442if test "$ipv6" != "yes" ; then
1443 ipv6="no"
1444fi
Jens Axboeecad55e2014-01-24 18:56:34 -08001445cat > $TMPC << EOF
1446#include <sys/types.h>
1447#include <sys/socket.h>
Bruce Crand2190282014-02-13 09:06:20 -07001448#include <netinet/in.h>
Jens Axboeecad55e2014-01-24 18:56:34 -08001449#include <netdb.h>
1450#include <stdio.h>
1451int main(int argc, char **argv)
1452{
1453 struct addrinfo hints;
1454 struct in6_addr addr;
1455 int ret;
1456
1457 ret = getaddrinfo(NULL, NULL, &hints, NULL);
1458 freeaddrinfo(NULL);
1459 printf("%s\n", gai_strerror(ret));
1460 addr = in6addr_any;
1461 return 0;
1462}
1463EOF
1464if compile_prog "" "" "ipv6"; then
1465 ipv6="yes"
1466fi
1467echo "IPv6 helpers $ipv6"
Jens Axboe07fc0ac2013-05-16 20:36:57 +02001468
Daniel Gollubfc5c0342014-02-17 14:35:28 +01001469##########################################
1470# check for rbd
Elliott Hugheseda3a602017-05-19 18:53:02 -07001471if test "$rbd" != "yes" ; then
1472 rbd="no"
1473fi
Daniel Gollubfc5c0342014-02-17 14:35:28 +01001474cat > $TMPC << EOF
1475#include <rbd/librbd.h>
1476
1477int main(int argc, char **argv)
1478{
Daniel Gollubfc5c0342014-02-17 14:35:28 +01001479 rados_t cluster;
1480 rados_ioctx_t io_ctx;
1481 const char pool[] = "rbd";
1482
1483 int major, minor, extra;
1484 rbd_version(&major, &minor, &extra);
1485
1486 rados_ioctx_create(cluster, pool, &io_ctx);
1487 return 0;
1488}
1489EOF
Tiziano Mülleraa48efe2014-06-26 14:20:20 +02001490if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then
Daniel Gollubfc5c0342014-02-17 14:35:28 +01001491 LIBS="-lrbd -lrados $LIBS"
1492 rbd="yes"
1493fi
1494echo "Rados Block Device engine $rbd"
1495
Jens Axboe2e802282014-04-02 21:47:27 -06001496##########################################
Elliott Hugheseda3a602017-05-19 18:53:02 -07001497# check for rbd_poll
1498if test "$rbd_poll" != "yes" ; then
1499 rbd_poll="no"
1500fi
1501if test "$rbd" = "yes"; then
1502cat > $TMPC << EOF
1503#include <rbd/librbd.h>
1504#include <sys/eventfd.h>
1505
1506int main(int argc, char **argv)
1507{
1508 rbd_image_t image;
1509 rbd_completion_t comp;
1510
1511 int fd = eventfd(0, EFD_NONBLOCK);
1512 rbd_set_image_notification(image, fd, EVENT_TYPE_EVENTFD);
1513 rbd_poll_io_events(image, comp, 1);
1514
1515 return 0;
1516}
1517EOF
1518if compile_prog "" "-lrbd -lrados" "rbd"; then
1519 rbd_poll="yes"
1520fi
1521echo "rbd_poll $rbd_poll"
1522fi
1523
1524##########################################
Jens Axboe9c1e0472014-10-28 09:00:06 -06001525# check for rbd_invaidate_cache()
Elliott Hugheseda3a602017-05-19 18:53:02 -07001526if test "$rbd_inval" != "yes" ; then
1527 rbd_inval="no"
1528fi
Jens Axboe9c1e0472014-10-28 09:00:06 -06001529if test "$rbd" = "yes"; then
1530cat > $TMPC << EOF
1531#include <rbd/librbd.h>
1532
1533int main(int argc, char **argv)
1534{
1535 rbd_image_t image;
1536
1537 return rbd_invalidate_cache(image);
1538}
1539EOF
1540if compile_prog "" "-lrbd -lrados" "rbd"; then
1541 rbd_inval="yes"
1542fi
1543echo "rbd_invalidate_cache $rbd_inval"
1544fi
1545
1546##########################################
Elliott Hugheseda3a602017-05-19 18:53:02 -07001547# check for blkin
1548if test "$rbd_blkin" != "yes" ; then
1549 rbd_blkin="no"
1550fi
1551cat > $TMPC << EOF
1552#include <rbd/librbd.h>
1553#include <zipkin_c.h>
1554
1555int main(int argc, char **argv)
1556{
1557 int r;
1558 struct blkin_trace_info t_info;
1559 blkin_init_trace_info(&t_info);
1560 rbd_completion_t completion;
1561 rbd_image_t image;
1562 uint64_t off;
1563 size_t len;
1564 const char *buf;
1565 r = rbd_aio_write_traced(image, off, len, buf, completion, &t_info);
1566 return 0;
1567}
1568EOF
1569if test "$disable_rbd" != "yes" && test "$disable_rbd_blkin" != "yes" \
1570 && compile_prog "" "-lrbd -lrados -lblkin" "rbd_blkin"; then
1571 LIBS="-lblkin $LIBS"
1572 rbd_blkin="yes"
1573fi
1574echo "rbd blkin tracing $rbd_blkin"
1575
1576##########################################
Jens Axboe9c1e0472014-10-28 09:00:06 -06001577# Check whether we have setvbuf
Elliott Hugheseda3a602017-05-19 18:53:02 -07001578if test "$setvbuf" != "yes" ; then
1579 setvbuf="no"
1580fi
Jens Axboe9c1e0472014-10-28 09:00:06 -06001581cat > $TMPC << EOF
1582#include <stdio.h>
1583int main(int argc, char **argv)
1584{
1585 FILE *f = NULL;
1586 char buf[80];
1587 setvbuf(f, buf, _IOFBF, sizeof(buf));
1588 return 0;
1589}
1590EOF
1591if compile_prog "" "" "setvbuf"; then
1592 setvbuf="yes"
1593fi
1594echo "setvbuf $setvbuf"
1595
Elliott Hugheseda3a602017-05-19 18:53:02 -07001596##########################################
chenh0e55d6b2014-03-27 15:19:43 -04001597# check for gfapi
Elliott Hugheseda3a602017-05-19 18:53:02 -07001598if test "$gfapi" != "yes" ; then
1599 gfapi="no"
1600fi
Jens Axboe2e802282014-04-02 21:47:27 -06001601cat > $TMPC << EOF
chenh0e55d6b2014-03-27 15:19:43 -04001602#include <glusterfs/api/glfs.h>
1603
Jens Axboe2e802282014-04-02 21:47:27 -06001604int main(int argc, char **argv)
1605{
chenh0e55d6b2014-03-27 15:19:43 -04001606 glfs_t *g = glfs_new("foo");
1607
Jens Axboe2e802282014-04-02 21:47:27 -06001608 return 0;
1609}
1610EOF
Tiziano Mülleraa48efe2014-06-26 14:20:20 +02001611if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
chenh0e55d6b2014-03-27 15:19:43 -04001612 LIBS="-lgfapi -lglusterfs $LIBS"
1613 gfapi="yes"
Jens Axboe2e802282014-04-02 21:47:27 -06001614fi
chenh54fe20f2014-04-08 13:02:26 -04001615 echo "Gluster API engine $gfapi"
chenh0e55d6b2014-03-27 15:19:43 -04001616
chenh54fe20f2014-04-08 13:02:26 -04001617##########################################
Elliott Hugheseda3a602017-05-19 18:53:02 -07001618# check for gfapi fadvise support, initialize with "no" only if $gfapi is set to "yes"
Jens Axboe25393fa2014-10-28 20:40:21 -06001619if test "$gfapi" = "yes" ; then
chenh54fe20f2014-04-08 13:02:26 -04001620gf_fadvise="no"
1621cat > $TMPC << EOF
1622#include <glusterfs/api/glfs.h>
1623
1624int main(int argc, char **argv)
1625{
1626 struct glfs_fd *fd;
1627 int ret = glfs_fadvise(fd, 0, 0, 1);
1628
1629 return 0;
1630}
1631EOF
chenh54fe20f2014-04-08 13:02:26 -04001632if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1633 gf_fadvise="yes"
1634fi
1635echo "Gluster API use fadvise $gf_fadvise"
Jens Axboe25393fa2014-10-28 20:40:21 -06001636fi
1637
1638##########################################
1639# check for gfapi trim support
Elliott Hugheseda3a602017-05-19 18:53:02 -07001640if test "$gf_trim" != "yes" ; then
1641 gf_trim="no"
1642fi
Jens Axboe25393fa2014-10-28 20:40:21 -06001643if test "$gfapi" = "yes" ; then
1644cat > $TMPC << EOF
1645#include <glusterfs/api/glfs.h>
1646
1647int main(int argc, char **argv)
1648{
1649 return glfs_discard_async(NULL, 0, 0);
1650}
1651EOF
1652if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then
1653 gf_trim="yes"
1654fi
1655echo "Gluster API trim support $gf_trim"
1656fi
Daniel Gollubfc5c0342014-02-17 14:35:28 +01001657
Christian Ehrhardt81795ce2014-04-10 15:09:47 +02001658##########################################
1659# Check if we support stckf on s390
Elliott Hugheseda3a602017-05-19 18:53:02 -07001660if test "$s390_z196_facilities" != "yes" ; then
1661 s390_z196_facilities="no"
1662fi
Christian Ehrhardt81795ce2014-04-10 15:09:47 +02001663cat > $TMPC << EOF
1664#define STFLE_BITS_Z196 45 /* various z196 facilities ... */
1665int main(int argc, char **argv)
1666{
1667 /* We want just 1 double word to be returned. */
1668 register unsigned long reg0 asm("0") = 0;
1669 unsigned long stfle_bits;
1670 asm volatile(".machine push" "\n\t"
1671 ".machine \"z9-109\"" "\n\t"
1672 "stfle %0" "\n\t"
1673 ".machine pop" "\n"
1674 : "=QS" (stfle_bits), "+d" (reg0)
1675 : : "cc");
1676
1677 if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0)
1678 return 0;
1679 else
1680 return -1;
1681}
1682EOF
1683if compile_prog "" "" "s390_z196_facilities"; then
1684 $TMPE
1685 if [[ $? -eq 0 ]]; then
1686 s390_z196_facilities="yes"
1687 fi
1688fi
1689echo "s390_z196_facilities $s390_z196_facilities"
Manish Mandlikd60aa362014-08-13 13:36:52 -06001690
1691##########################################
1692# Check if we have required environment variables configured for libhdfs
1693if test "$libhdfs" = "yes" ; then
1694 hdfs_conf_error=0
1695 if test "$JAVA_HOME" = "" ; then
1696 echo "configure: JAVA_HOME should be defined to jdk/jvm path"
1697 hdfs_conf_error=1
1698 fi
1699 if test "$FIO_LIBHDFS_INCLUDE" = "" ; then
1700 echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path"
1701 hdfs_conf_error=1
1702 fi
1703 if test "$FIO_LIBHDFS_LIB" = "" ; then
1704 echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path"
1705 hdfs_conf_error=1
1706 fi
1707 if test "$hdfs_conf_error" = "1" ; then
1708 exit 1
1709 fi
Elliott Hugheseda3a602017-05-19 18:53:02 -07001710 FIO_HDFS_CPU=$cpu
1711 if test "$FIO_HDFS_CPU" = "x86_64" ; then
1712 FIO_HDFS_CPU="amd64"
1713 fi
Manish Mandlikd60aa362014-08-13 13:36:52 -06001714fi
1715echo "HDFS engine $libhdfs"
1716
Elliott Hugheseda3a602017-05-19 18:53:02 -07001717##########################################
1718# Check whether we have MTD
1719if test "$mtd" != "yes" ; then
1720 mtd="no"
1721fi
1722cat > $TMPC << EOF
1723#include <string.h>
1724#include <mtd/mtd-user.h>
1725#include <sys/ioctl.h>
1726int main(int argc, char **argv)
1727{
1728 struct mtd_write_req ops;
1729 struct mtd_info_user info;
1730 memset(&ops, 0, sizeof(ops));
1731 info.type = MTD_MLCNANDFLASH;
1732 return ioctl(0, MEMGETINFO, &info);
1733}
1734EOF
1735if compile_prog "" "" "mtd"; then
1736 mtd="yes"
1737fi
1738echo "MTD $mtd"
1739
1740##########################################
1741# Check whether we have libpmem
1742if test "$libpmem" != "yes" ; then
1743 libpmem="no"
1744fi
1745cat > $TMPC << EOF
1746#include <libpmem.h>
1747int main(int argc, char **argv)
1748{
1749 int rc;
1750 rc = pmem_is_pmem(0, 0);
1751 return 0;
1752}
1753EOF
1754if compile_prog "" "-lpmem" "libpmem"; then
1755 libpmem="yes"
1756 LIBS="-lpmem $LIBS"
1757fi
1758echo "libpmem $libpmem"
1759
1760##########################################
1761# Check whether we have libpmemblk
1762# libpmem is a prerequisite
1763if test "$libpmemblk" != "yes" ; then
1764 libpmemblk="no"
1765fi
1766if test "$libpmem" = "yes"; then
1767 cat > $TMPC << EOF
1768#include <libpmemblk.h>
1769int main(int argc, char **argv)
1770{
1771 PMEMblkpool *pbp;
1772 pbp = pmemblk_open("", 0);
1773 return 0;
1774}
1775EOF
1776 if compile_prog "" "-lpmemblk" "libpmemblk"; then
1777 libpmemblk="yes"
1778 LIBS="-lpmemblk $LIBS"
1779 fi
1780fi
1781echo "libpmemblk $libpmemblk"
1782
1783# Choose the ioengines
1784if test "$libpmem" = "yes" && test "$disable_pmem" = "no"; then
1785 devdax="yes"
1786 if test "$libpmemblk" = "yes"; then
1787 pmemblk="yes"
1788 fi
1789fi
1790
1791##########################################
1792# Report whether pmemblk engine is enabled
1793echo "NVML pmemblk engine $pmemblk"
1794
1795##########################################
1796# Report whether dev-dax engine is enabled
1797echo "NVML dev-dax engine $devdax"
1798
1799##########################################
Stephen M. Cameron88b635b2014-09-29 12:10:49 -06001800# Check if we have lex/yacc available
1801yacc="no"
Jens Axboeb50afc42014-09-29 16:44:31 -06001802yacc_is_bison="no"
Stephen M. Cameron88b635b2014-09-29 12:10:49 -06001803lex="no"
1804arith="no"
Elliott Hugheseda3a602017-05-19 18:53:02 -07001805if test "$disable_lex" = "no" || test -z "$disable_lex" ; then
Jens Axboe3fdf8742014-10-30 10:11:32 -06001806if test "$targetos" != "SunOS" ; then
Jens Axboeb50afc42014-09-29 16:44:31 -06001807LEX=$(which lex 2> /dev/null)
Stephen M. Cameron88b635b2014-09-29 12:10:49 -06001808if test -x "$LEX" ; then
1809 lex="yes"
1810fi
Stephen M. Cameron56a0f462014-10-06 20:18:57 -06001811YACC=$(which bison 2> /dev/null)
Stephen M. Cameron88b635b2014-09-29 12:10:49 -06001812if test -x "$YACC" ; then
1813 yacc="yes"
Stephen M. Cameron56a0f462014-10-06 20:18:57 -06001814 yacc_is_bison="yes"
Jens Axboeb50afc42014-09-29 16:44:31 -06001815else
Stephen M. Cameron56a0f462014-10-06 20:18:57 -06001816 YACC=$(which yacc 2> /dev/null)
Jens Axboeb50afc42014-09-29 16:44:31 -06001817 if test -x "$YACC" ; then
1818 yacc="yes"
Jens Axboeb50afc42014-09-29 16:44:31 -06001819 fi
Stephen M. Cameron88b635b2014-09-29 12:10:49 -06001820fi
1821if test "$yacc" = "yes" && test "$lex" = "yes" ; then
1822 arith="yes"
1823fi
1824
1825if test "$arith" = "yes" ; then
1826cat > $TMPC << EOF
1827extern int yywrap(void);
1828
1829int main(int argc, char **argv)
1830{
1831 yywrap();
1832 return 0;
1833}
1834EOF
Jens Axboe8602b0a2014-09-30 22:16:05 -06001835if compile_prog "" "-ll" "lex"; then
1836 LIBS="-ll $LIBS"
Stephen M. Cameron88b635b2014-09-29 12:10:49 -06001837else
1838 arith="no"
1839fi
1840fi
Jens Axboe3fdf8742014-10-30 10:11:32 -06001841fi
Elliott Hugheseda3a602017-05-19 18:53:02 -07001842fi
1843
1844# Check if lex fails using -o
1845if test "$arith" = "yes" ; then
1846if test "$force_no_lex_o" = "yes" ; then
1847 lex_use_o="no"
1848else
1849$LEX -o lex.yy.c exp/expression-parser.l 2> /dev/null
1850if test "$?" = "0" ; then
1851 lex_use_o="yes"
1852else
1853 lex_use_o="no"
1854fi
1855fi
1856fi
Stephen M. Cameron88b635b2014-09-29 12:10:49 -06001857
1858echo "lex/yacc for arithmetic $arith"
1859
Elliott Hugheseda3a602017-05-19 18:53:02 -07001860##########################################
1861# Check whether we have setmntent/getmntent
1862if test "$getmntent" != "yes" ; then
1863 getmntent="no"
1864fi
1865cat > $TMPC << EOF
1866#include <stdio.h>
1867#include <mntent.h>
1868int main(int argc, char **argv)
1869{
1870 FILE *mtab = setmntent(NULL, "r");
1871 struct mntent *mnt = getmntent(mtab);
1872 endmntent(mtab);
1873 return 0;
1874}
1875EOF
1876if compile_prog "" "" "getmntent"; then
1877 getmntent="yes"
1878fi
1879echo "getmntent $getmntent"
1880
1881##########################################
1882# Check whether we have getmntinfo
1883# These are originally added for BSDs, but may also work
1884# on other operating systems with getmntinfo(3).
1885
1886# getmntinfo(3) for FreeBSD/DragonFlyBSD/OpenBSD.
1887# Note that NetBSD needs -Werror to catch warning as error.
1888if test "$getmntinfo" != "yes" ; then
1889 getmntinfo="no"
1890fi
1891cat > $TMPC << EOF
1892#include <stdio.h>
1893#include <sys/param.h>
1894#include <sys/mount.h>
1895int main(int argc, char **argv)
1896{
1897 struct statfs *st;
1898 return getmntinfo(&st, MNT_NOWAIT);
1899}
1900EOF
1901if compile_prog "-Werror" "" "getmntinfo"; then
1902 getmntinfo="yes"
1903fi
1904echo "getmntinfo $getmntinfo"
1905
1906# getmntinfo(3) for NetBSD.
1907if test "$getmntinfo_statvfs" != "yes" ; then
1908 getmntinfo_statvfs="no"
1909fi
1910cat > $TMPC << EOF
1911#include <stdio.h>
1912#include <sys/statvfs.h>
1913int main(int argc, char **argv)
1914{
1915 struct statvfs *st;
1916 return getmntinfo(&st, MNT_NOWAIT);
1917}
1918EOF
1919# Skip the test if the one with statfs arg is detected.
1920if test "$getmntinfo" != "yes" && compile_prog "-Werror" "" "getmntinfo_statvfs"; then
1921 getmntinfo_statvfs="yes"
1922 echo "getmntinfo_statvfs $getmntinfo_statvfs"
1923fi
1924
1925##########################################
1926# Check whether we have _Static_assert
1927if test "$static_assert" != "yes" ; then
1928 static_assert="no"
1929fi
1930cat > $TMPC << EOF
1931#include <assert.h>
1932#include <stdlib.h>
1933#undef offsetof
1934#ifdef __compiler_offsetof
1935#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
1936#else
1937#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
1938#endif
1939
1940#define container_of(ptr, type, member) ({ \
1941 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
1942 (type *)( (char *)__mptr - offsetof(type,member) );})
1943
1944struct foo {
1945 int a, b;
1946};
1947
1948int main(int argc, char **argv)
1949{
1950 _Static_assert(offsetof(struct foo, a) == 0 , "Check");
1951 return 0 ;
1952}
1953EOF
1954if compile_prog "" "" "static_assert"; then
1955 static_assert="yes"
1956fi
1957echo "Static Assert $static_assert"
1958
1959##########################################
1960# Check whether we have bool / stdbool.h
1961if test "$have_bool" != "yes" ; then
1962 have_bool="no"
1963fi
1964cat > $TMPC << EOF
1965#include <stdbool.h>
1966int main(int argc, char **argv)
1967{
1968 bool var = true;
1969 return var != false;
1970}
1971EOF
1972if compile_prog "" "" "bool"; then
1973 have_bool="yes"
1974fi
1975echo "bool $have_bool"
1976
1977##########################################
1978# check march=armv8-a+crc+crypto
1979if test "$march_armv8_a_crc_crypto" != "yes" ; then
1980 march_armv8_a_crc_crypto="no"
1981fi
1982if test "$cpu" = "arm64" ; then
1983 cat > $TMPC <<EOF
1984#include <sys/auxv.h>
1985#include <arm_acle.h>
1986#include <arm_neon.h>
1987
1988int main(void)
1989{
1990 return 0;
1991}
1992EOF
1993 if compile_prog "-march=armv8-a+crc+crypto" "" ""; then
1994 march_armv8_a_crc_crypto="yes"
1995 CFLAGS="$CFLAGS -march=armv8-a+crc+crypto -DARCH_HAVE_CRC_CRYPTO"
1996 fi
1997fi
1998echo "march_armv8_a_crc_crypto $march_armv8_a_crc_crypto"
1999
2000##########################################
2001# cuda probe
2002if test "$cuda" != "yes" ; then
2003 cuda="no"
2004fi
2005cat > $TMPC << EOF
2006#include <cuda.h>
2007int main(int argc, char **argv)
2008{
2009 return cuInit(0);
2010}
2011EOF
2012if test "$enable_cuda" = "yes" && compile_prog "" "-lcuda" "cuda"; then
2013 cuda="yes"
2014 LIBS="-lcuda $LIBS"
2015fi
2016echo "cuda $cuda"
2017
Jens Axboe67bf9822013-01-10 11:23:19 +01002018#############################################################################
2019
Jens Axboe67bf9822013-01-10 11:23:19 +01002020if test "$wordsize" = "64" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07002021 output_sym "CONFIG_64BIT"
Jens Axboe67bf9822013-01-10 11:23:19 +01002022elif test "$wordsize" = "32" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07002023 output_sym "CONFIG_32BIT"
Jens Axboe67bf9822013-01-10 11:23:19 +01002024else
Jens Axboed7145a72013-02-11 13:21:54 +01002025 fatal "Unknown wordsize!"
Jens Axboe67bf9822013-01-10 11:23:19 +01002026fi
Jens Axboe0dcebdf2013-01-23 15:42:16 -07002027if test "$bigendian" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07002028 output_sym "CONFIG_BIG_ENDIAN"
Jens Axboe0dcebdf2013-01-23 15:42:16 -07002029else
Jens Axboe4feafb12013-01-24 23:07:55 -07002030 output_sym "CONFIG_LITTLE_ENDIAN"
Jens Axboe0dcebdf2013-01-23 15:42:16 -07002031fi
Jens Axboe3989b142013-04-12 13:13:24 +02002032if test "$zlib" = "yes" ; then
2033 output_sym "CONFIG_ZLIB"
2034fi
Jens Axboe67bf9822013-01-10 11:23:19 +01002035if test "$libaio" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07002036 output_sym "CONFIG_LIBAIO"
Jens Axboe67bf9822013-01-10 11:23:19 +01002037fi
2038if test "$posix_aio" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07002039 output_sym "CONFIG_POSIXAIO"
Jens Axboe67bf9822013-01-10 11:23:19 +01002040fi
2041if test "$posix_aio_fsync" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07002042 output_sym "CONFIG_POSIXAIO_FSYNC"
Jens Axboe67bf9822013-01-10 11:23:19 +01002043fi
Elliott Hugheseda3a602017-05-19 18:53:02 -07002044if test "$posix_pshared" = "yes" ; then
2045 output_sym "CONFIG_PSHARED"
2046fi
Jens Axboe67bf9822013-01-10 11:23:19 +01002047if test "$linux_fallocate" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07002048 output_sym "CONFIG_LINUX_FALLOCATE"
Jens Axboe67bf9822013-01-10 11:23:19 +01002049fi
2050if test "$posix_fallocate" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07002051 output_sym "CONFIG_POSIX_FALLOCATE"
Jens Axboe67bf9822013-01-10 11:23:19 +01002052fi
2053if test "$fdatasync" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07002054 output_sym "CONFIG_FDATASYNC"
Jens Axboe67bf9822013-01-10 11:23:19 +01002055fi
2056if test "$sync_file_range" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07002057 output_sym "CONFIG_SYNC_FILE_RANGE"
Jens Axboe67bf9822013-01-10 11:23:19 +01002058fi
2059if test "$sfaa" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07002060 output_sym "CONFIG_SFAA"
Jens Axboe67bf9822013-01-10 11:23:19 +01002061fi
Yufei Ren954cd732013-07-22 20:58:05 -06002062if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07002063 output_sym "CONFIG_RDMA"
Jens Axboe67bf9822013-01-10 11:23:19 +01002064fi
2065if test "$clock_gettime" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07002066 output_sym "CONFIG_CLOCK_GETTIME"
Jens Axboe67bf9822013-01-10 11:23:19 +01002067fi
2068if test "$clock_monotonic" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07002069 output_sym "CONFIG_CLOCK_MONOTONIC"
Jens Axboe67bf9822013-01-10 11:23:19 +01002070fi
Elliott Hugheseda3a602017-05-19 18:53:02 -07002071if test "$clock_monotonic_raw" = "yes" ; then
2072 output_sym "CONFIG_CLOCK_MONOTONIC_RAW"
2073fi
Jens Axboe67bf9822013-01-10 11:23:19 +01002074if test "$clock_monotonic_precise" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07002075 output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
Jens Axboe67bf9822013-01-10 11:23:19 +01002076fi
Elliott Hugheseda3a602017-05-19 18:53:02 -07002077if test "$clockid_t" = "yes"; then
2078 output_sym "CONFIG_CLOCKID_T"
2079fi
Jens Axboe67bf9822013-01-10 11:23:19 +01002080if test "$gettimeofday" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07002081 output_sym "CONFIG_GETTIMEOFDAY"
Jens Axboe67bf9822013-01-10 11:23:19 +01002082fi
2083if test "$posix_fadvise" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07002084 output_sym "CONFIG_POSIX_FADVISE"
Jens Axboe67bf9822013-01-10 11:23:19 +01002085fi
2086if test "$linux_3arg_affinity" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07002087 output_sym "CONFIG_3ARG_AFFINITY"
Jens Axboe67bf9822013-01-10 11:23:19 +01002088elif test "$linux_2arg_affinity" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07002089 output_sym "CONFIG_2ARG_AFFINITY"
Jens Axboe67bf9822013-01-10 11:23:19 +01002090fi
2091if test "$strsep" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07002092 output_sym "CONFIG_STRSEP"
Jens Axboe67bf9822013-01-10 11:23:19 +01002093fi
Jens Axboe9ad8da82013-04-05 14:44:03 +02002094if test "$strcasestr" = "yes" ; then
2095 output_sym "CONFIG_STRCASESTR"
2096fi
Elliott Hugheseda3a602017-05-19 18:53:02 -07002097if test "$strlcat" = "yes" ; then
2098 output_sym "CONFIG_STRLCAT"
2099fi
Jens Axboe67bf9822013-01-10 11:23:19 +01002100if test "$getopt_long_only" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07002101 output_sym "CONFIG_GETOPT_LONG_ONLY"
Jens Axboe67bf9822013-01-10 11:23:19 +01002102fi
2103if test "$inet_aton" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07002104 output_sym "CONFIG_INET_ATON"
Jens Axboe67bf9822013-01-10 11:23:19 +01002105fi
2106if test "$socklen_t" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07002107 output_sym "CONFIG_SOCKLEN_T"
Jens Axboe67bf9822013-01-10 11:23:19 +01002108fi
2109if test "$ext4_me" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07002110 output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
Jens Axboe67bf9822013-01-10 11:23:19 +01002111fi
2112if test "$linux_splice" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07002113 output_sym "CONFIG_LINUX_SPLICE"
Jens Axboe67bf9822013-01-10 11:23:19 +01002114fi
2115if test "$guasi" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07002116 output_sym "CONFIG_GUASI"
Jens Axboe67bf9822013-01-10 11:23:19 +01002117fi
2118if test "$fusion_aw" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07002119 output_sym "CONFIG_FUSION_AW"
Jens Axboe67bf9822013-01-10 11:23:19 +01002120fi
Jens Axboe50206d92013-03-25 13:20:08 -06002121if test "$libnuma_v2" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07002122 output_sym "CONFIG_LIBNUMA"
Jens Axboe67bf9822013-01-10 11:23:19 +01002123fi
2124if test "$solaris_aio" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07002125 output_sym "CONFIG_SOLARISAIO"
Jens Axboe67bf9822013-01-10 11:23:19 +01002126fi
2127if test "$tls_thread" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07002128 output_sym "CONFIG_TLS_THREAD"
Jens Axboe67bf9822013-01-10 11:23:19 +01002129fi
Jens Axboe44404c52013-01-24 14:20:09 -07002130if test "$rusage_thread" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07002131 output_sym "CONFIG_RUSAGE_THREAD"
Jens Axboe67bf9822013-01-10 11:23:19 +01002132fi
Jens Axboe91f94d52013-01-24 10:25:42 -07002133if test "$gfio" = "yes" ; then
Elliott Hugheseda3a602017-05-19 18:53:02 -07002134 output_sym "CONFIG_GFIO"
Jens Axboe91f94d52013-01-24 10:25:42 -07002135fi
Jens Axboeef7035a2014-06-18 15:30:09 -07002136if test "$esx" = "yes" ; then
2137 output_sym "CONFIG_ESX"
2138 output_sym "CONFIG_NO_SHM"
2139fi
Jens Axboe7e09a9f2013-01-30 13:58:58 +01002140if test "$sched_idle" = "yes" ; then
2141 output_sym "CONFIG_SCHED_IDLE"
2142fi
Jens Axboe1eafa372013-01-31 10:19:51 +01002143if test "$tcp_nodelay" = "yes" ; then
2144 output_sym "CONFIG_TCP_NODELAY"
2145fi
Jens Axboe531e67a2014-10-09 11:55:16 -06002146if test "$window_size" = "yes" ; then
2147 output_sym "CONFIG_NET_WINDOWSIZE"
2148fi
Jens Axboe5e34cea2014-10-09 12:05:44 -06002149if test "$mss" = "yes" ; then
2150 output_sym "CONFIG_NET_MSS"
2151fi
Jens Axboe38b93542013-02-28 08:28:05 +01002152if test "$rlimit_memlock" = "yes" ; then
2153 output_sym "CONFIG_RLIMIT_MEMLOCK"
2154fi
Jens Axboe07fc0ac2013-05-16 20:36:57 +02002155if test "$pwritev" = "yes" ; then
2156 output_sym "CONFIG_PWRITEV"
2157fi
Elliott Hugheseda3a602017-05-19 18:53:02 -07002158if test "$pwritev2" = "yes" ; then
2159 output_sym "CONFIG_PWRITEV2"
2160fi
Jens Axboeecad55e2014-01-24 18:56:34 -08002161if test "$ipv6" = "yes" ; then
2162 output_sym "CONFIG_IPV6"
2163fi
Daniel Gollubfc5c0342014-02-17 14:35:28 +01002164if test "$rbd" = "yes" ; then
2165 output_sym "CONFIG_RBD"
2166fi
Elliott Hugheseda3a602017-05-19 18:53:02 -07002167if test "$rbd_poll" = "yes" ; then
2168 output_sym "CONFIG_RBD_POLL"
2169fi
Jens Axboe9c1e0472014-10-28 09:00:06 -06002170if test "$rbd_inval" = "yes" ; then
2171 output_sym "CONFIG_RBD_INVAL"
2172fi
Elliott Hugheseda3a602017-05-19 18:53:02 -07002173if test "$rbd_blkin" = "yes" ; then
2174 output_sym "CONFIG_RBD_BLKIN"
2175fi
Jens Axboe2e802282014-04-02 21:47:27 -06002176if test "$setvbuf" = "yes" ; then
2177 output_sym "CONFIG_SETVBUF"
2178fi
Christian Ehrhardt81795ce2014-04-10 15:09:47 +02002179if test "$s390_z196_facilities" = "yes" ; then
2180 output_sym "CONFIG_S390_Z196_FACILITIES"
2181 CFLAGS="$CFLAGS -march=z9-109"
2182fi
chenh0e55d6b2014-03-27 15:19:43 -04002183if test "$gfapi" = "yes" ; then
2184 output_sym "CONFIG_GFAPI"
2185fi
chenh54fe20f2014-04-08 13:02:26 -04002186if test "$gf_fadvise" = "yes" ; then
2187 output_sym "CONFIG_GF_FADVISE"
2188fi
Jens Axboe25393fa2014-10-28 20:40:21 -06002189if test "$gf_trim" = "yes" ; then
2190 output_sym "CONFIG_GF_TRIM"
2191fi
Manish Mandlikd60aa362014-08-13 13:36:52 -06002192if test "$libhdfs" = "yes" ; then
2193 output_sym "CONFIG_LIBHDFS"
Elliott Hugheseda3a602017-05-19 18:53:02 -07002194 echo "FIO_HDFS_CPU=$FIO_HDFS_CPU" >> $config_host_mak
Fabrice Bacchella468a18c2014-12-10 17:39:48 +01002195 echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak
2196 echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak
2197 echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak
2198 fi
Elliott Hugheseda3a602017-05-19 18:53:02 -07002199if test "$mtd" = "yes" ; then
2200 output_sym "CONFIG_MTD"
2201fi
2202if test "$pmemblk" = "yes" ; then
2203 output_sym "CONFIG_PMEMBLK"
2204fi
2205if test "$devdax" = "yes" ; then
2206 output_sym "CONFIG_LINUX_DEVDAX"
2207fi
Stephen M. Cameron88b635b2014-09-29 12:10:49 -06002208if test "$arith" = "yes" ; then
2209 output_sym "CONFIG_ARITHMETIC"
Jens Axboeb50afc42014-09-29 16:44:31 -06002210 if test "$yacc_is_bison" = "yes" ; then
2211 echo "YACC=$YACC -y" >> $config_host_mak
2212 else
2213 echo "YACC=$YACC" >> $config_host_mak
2214 fi
Elliott Hugheseda3a602017-05-19 18:53:02 -07002215 if test "$lex_use_o" = "yes" ; then
2216 echo "CONFIG_LEX_USE_O=y" >> $config_host_mak
2217 fi
Stephen M. Cameron88b635b2014-09-29 12:10:49 -06002218fi
Elliott Hugheseda3a602017-05-19 18:53:02 -07002219if test "$getmntent" = "yes" ; then
2220 output_sym "CONFIG_GETMNTENT"
2221fi
2222if test "$getmntinfo" = "yes" ; then
2223 output_sym "CONFIG_GETMNTINFO"
2224fi
2225if test "$getmntinfo_statvfs" = "yes" ; then
2226 output_sym "CONFIG_GETMNTINFO_STATVFS"
2227fi
2228if test "$static_assert" = "yes" ; then
2229 output_sym "CONFIG_STATIC_ASSERT"
2230fi
2231if test "$have_bool" = "yes" ; then
2232 output_sym "CONFIG_HAVE_BOOL"
2233fi
2234if test "$disable_opt" = "yes" ; then
2235 output_sym "CONFIG_DISABLE_OPTIMIZATIONS"
2236fi
Jens Axboe49986602014-07-03 16:20:27 -06002237if test "$zlib" = "no" ; then
2238 echo "Consider installing zlib-dev (zlib-devel), some fio features depend on it."
2239fi
Elliott Hugheseda3a602017-05-19 18:53:02 -07002240if test "$cuda" = "yes" ; then
2241 output_sym "CONFIG_CUDA"
2242fi
Jens Axboe49986602014-07-03 16:20:27 -06002243
Jens Axboe67bf9822013-01-10 11:23:19 +01002244echo "LIBS+=$LIBS" >> $config_host_mak
Jens Axboe9aba7b72014-11-25 16:02:52 -07002245echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak
Jens Axboe91f94d52013-01-24 10:25:42 -07002246echo "CFLAGS+=$CFLAGS" >> $config_host_mak
Jens Axboe1a9487d2014-11-10 11:18:06 -07002247echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak
Jens Axboe67bf9822013-01-10 11:23:19 +01002248echo "CC=$cc" >> $config_host_mak
Jens Axboeaf4862b2013-03-29 08:55:32 -06002249echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak
Elliott Hugheseda3a602017-05-19 18:53:02 -07002250echo "INSTALL_PREFIX=$prefix" >> $config_host_mak
2251
2252if [ `dirname $0` != "." -a ! -e Makefile ]; then
2253 cat > Makefile <<EOF
2254SRCDIR:=`dirname $0`
2255include \$(SRCDIR)/Makefile
2256EOF
2257fi