blob: 4757d6705e7ef95bac00eb4fbb2865a431703b20 [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 Axboe135be492013-01-29 10:09:55 +0100136gfio="no"
Jens Axboe91f94d52013-01-24 10:25:42 -0700137
Jens Axboecb1125b2013-01-23 13:47:54 -0700138# parse options
139for opt do
140 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
141 case "$opt" in
Jens Axboe8b156d82013-02-10 15:48:34 +0100142 --cpu=*) cpu="$optarg"
143 ;;
Jens Axboecb1125b2013-01-23 13:47:54 -0700144 --cc=*) CC="$optarg"
145 ;;
Jens Axboe208e4c82013-01-29 09:26:07 +0100146 --extra-cflags=*) CFLAGS="$CFLAGS $optarg"
Jens Axboecb1125b2013-01-23 13:47:54 -0700147 ;;
Jens Axboeb7c12792013-05-01 13:00:26 +0200148 --build-32bit-win) build_32bit_win="yes"
Huadong Liu74097112013-02-05 08:43:14 +0100149 ;;
Jens Axboe91f94d52013-01-24 10:25:42 -0700150 --enable-gfio)
Jens Axboe9db01ef2013-02-07 15:45:39 +0100151 gfio="yes"
Jens Axboe899fab32013-01-29 10:06:30 +0100152 ;;
Castor Fu44462512013-10-31 11:00:54 -0600153 --disable-numa) disable_numa="yes"
154 ;;
Jens Axboe827da4f2013-01-24 10:27:26 -0700155 --help)
Jens Axboe47f44632013-01-24 10:34:14 -0700156 show_help="yes"
Jens Axboe827da4f2013-01-24 10:27:26 -0700157 ;;
Jens Axboecb1125b2013-01-23 13:47:54 -0700158 *)
159 echo "Bad option $opt"
Jens Axboe47f44632013-01-24 10:34:14 -0700160 show_help="yes"
161 exit_val=1
Jens Axboecb1125b2013-01-23 13:47:54 -0700162 esac
163done
164
Jens Axboe47f44632013-01-24 10:34:14 -0700165if test "$show_help" = "yes" ; then
Jens Axboe8b156d82013-02-10 15:48:34 +0100166 echo "--cpu= Specify target CPU if auto-detect fails"
Jens Axboeb7a99312013-02-04 12:46:54 +0100167 echo "--cc= Specify compiler to use"
Jens Axboe899fab32013-01-29 10:06:30 +0100168 echo "--extra-cflags= Specify extra CFLAGS to pass to compiler"
Jens Axboeb7c12792013-05-01 13:00:26 +0200169 echo "--build-32bit-win Enable 32-bit build on Windows"
Jens Axboeb7a99312013-02-04 12:46:54 +0100170 echo "--enable-gfio Enable building of gtk gfio"
Castor Fu44462512013-10-31 11:00:54 -0600171 echo "--disable-numa Disable libnuma even if found"
Jens Axboeb7a99312013-02-04 12:46:54 +0100172 exit $exit_val
Jens Axboe47f44632013-01-24 10:34:14 -0700173fi
174
Stefan Hajnoczi47986332014-03-06 18:41:58 +0100175cross_prefix=${cross_prefix-${CROSS_COMPILE}}
176cc="${CC-${cross_prefix}gcc}"
177
Aaron Carroll6d0e9f82013-02-12 09:58:14 +0100178if check_define __ANDROID__ ; then
179 targetos="Android"
180elif check_define __linux__ ; then
Jens Axboe67bf9822013-01-10 11:23:19 +0100181 targetos="Linux"
Jens Axboe67bf9822013-01-10 11:23:19 +0100182elif check_define __OpenBSD__ ; then
183 targetos='OpenBSD'
184elif check_define __sun__ ; then
185 targetos='SunOS'
Jens Axboe7cb024f2013-11-06 15:37:35 -0700186 CFLAGS="$CFLAGS -D_REENTRANT"
Stefan Hajnoczib24f59a2014-03-06 18:41:59 +0100187elif check_define _WIN32 ; then
188 targetos='CYGWIN'
Jens Axboe67bf9822013-01-10 11:23:19 +0100189else
190 targetos=`uname -s`
191fi
192
Aaron Carroll53cd4ee2013-03-14 16:57:38 +1100193echo "# Automatically generated by configure - do not modify" > $config_host_mak
194printf "# Configured with:" >> $config_host_mak
195printf " '%s'" "$0" "$@" >> $config_host_mak
196echo >> $config_host_mak
197echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak
198
Jens Axboe67bf9822013-01-10 11:23:19 +0100199# Some host OSes need non-standard checks for which CPU to use.
200# Note that these checks are broken for cross-compilation: if you're
201# cross-compiling to one of these OSes then you'll need to specify
202# the correct CPU with the --cpu option.
203case $targetos in
204Darwin)
205 # on Leopard most of the system is 32-bit, so we have to ask the kernel if
206 # we can run 64-bit userspace code.
207 # If the user didn't specify a CPU explicitly and the kernel says this is
208 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual
209 # detection code.
210 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
211 cpu="x86_64"
212 fi
213 ;;
214SunOS)
215 # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
216 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
217 cpu="x86_64"
218 fi
Jens Axboeadaa46d2013-02-28 22:10:22 +0100219 LIBS="-lnsl -lsocket"
Jens Axboecfd94f72013-01-23 16:23:48 -0700220 ;;
221CYGWIN*)
222 echo "Forcing known good options on Windows"
Jens Axboe4578d012013-01-23 16:26:12 -0700223 if test -z "$CC" ; then
Huadong Liu74097112013-02-05 08:43:14 +0100224 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
225 CC="i686-w64-mingw32-gcc"
226 else
227 CC="x86_64-w64-mingw32-gcc"
228 fi
Jens Axboe4578d012013-01-23 16:26:12 -0700229 fi
Jens Axboe4feafb12013-01-24 23:07:55 -0700230 output_sym "CONFIG_LITTLE_ENDIAN"
Huadong Liu74097112013-02-05 08:43:14 +0100231 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
232 output_sym "CONFIG_32BIT"
233 else
234 output_sym "CONFIG_64BIT_LLP64"
235 fi
Jens Axboe4feafb12013-01-24 23:07:55 -0700236 output_sym "CONFIG_FADVISE"
237 output_sym "CONFIG_SOCKLEN_T"
Jens Axboe4feafb12013-01-24 23:07:55 -0700238 output_sym "CONFIG_FADVISE"
239 output_sym "CONFIG_SFAA"
240 output_sym "CONFIG_RUSAGE_THREAD"
241 output_sym "CONFIG_WINDOWSAIO"
242 output_sym "CONFIG_FDATASYNC"
Bruce Cran59308a62013-02-02 20:59:31 +0000243 output_sym "CONFIG_CLOCK_MONOTONIC"
Bruce Crandc0518c2013-01-28 16:07:15 +0000244 output_sym "CONFIG_GETTIMEOFDAY"
245 output_sym "CONFIG_CLOCK_GETTIME"
Jens Axboe7e09a9f2013-01-30 13:58:58 +0100246 output_sym "CONFIG_SCHED_IDLE"
Jens Axboe1eafa372013-01-31 10:19:51 +0100247 output_sym "CONFIG_TCP_NODELAY"
Bruce Cran7d6be132013-11-07 14:04:00 +0000248 output_sym "CONFIG_TLS_THREAD"
Bruce Cranef07baa2014-01-28 17:34:08 -0700249 output_sym "CONFIG_IPV6"
Jens Axboe4feafb12013-01-24 23:07:55 -0700250 echo "CC=$CC" >> $config_host_mak
Jens Axboeaf4862b2013-03-29 08:55:32 -0600251 echo "BUILD_CFLAGS=$CFLAGS -include config-host.h -D_GNU_SOURCE" >> $config_host_mak
Jens Axboecfd94f72013-01-23 16:23:48 -0700252 exit 0
Aaron Carroll6d0e9f82013-02-12 09:58:14 +0100253 ;;
Jens Axboe67bf9822013-01-10 11:23:19 +0100254esac
255
256if test ! -z "$cpu" ; then
257 # command line argument
258 :
259elif check_define __i386__ ; then
260 cpu="i386"
261elif check_define __x86_64__ ; then
262 cpu="x86_64"
263elif check_define __sparc__ ; then
264 if check_define __arch64__ ; then
265 cpu="sparc64"
266 else
267 cpu="sparc"
268 fi
269elif check_define _ARCH_PPC ; then
270 if check_define _ARCH_PPC64 ; then
271 cpu="ppc64"
272 else
273 cpu="ppc"
274 fi
275elif check_define __mips__ ; then
276 cpu="mips"
277elif check_define __ia64__ ; then
278 cpu="ia64"
279elif check_define __s390__ ; then
280 if check_define __s390x__ ; then
281 cpu="s390x"
282 else
283 cpu="s390"
284 fi
285elif check_define __arm__ ; then
286 cpu="arm"
287elif check_define __hppa__ ; then
288 cpu="hppa"
289else
290 cpu=`uname -m`
291fi
292
293# Normalise host CPU name and set ARCH.
294case "$cpu" in
295 ia64|ppc|ppc64|s390|s390x|sparc64)
296 cpu="$cpu"
297 ;;
298 i386|i486|i586|i686|i86pc|BePC)
299 cpu="i386"
300 ;;
301 x86_64|amd64)
302 cpu="x86_64"
303 ;;
304 armv*b|armv*l|arm)
305 cpu="arm"
306 ;;
307 hppa|parisc|parisc64)
308 cpu="hppa"
309 ;;
310 mips*)
311 cpu="mips"
312 ;;
313 sparc|sun4[cdmuv])
314 cpu="sparc"
315 ;;
316 *)
Jens Axboe8b156d82013-02-10 15:48:34 +0100317 echo "Unknown CPU"
Jens Axboe67bf9822013-01-10 11:23:19 +0100318 ;;
319esac
320
Jens Axboedcbbf5b2013-01-25 14:35:27 -0700321if test -z "$CC" ; then
Jens Axboe67bf9822013-01-10 11:23:19 +0100322 if test "$targetos" = "FreeBSD"; then
323 if has clang; then
324 CC=clang
325 else
326 CC=gcc
327 fi
Jens Axboe67bf9822013-01-10 11:23:19 +0100328 fi
329fi
330
331cc="${CC-${cross_prefix}gcc}"
332
Jens Axboe0dcebdf2013-01-23 15:42:16 -0700333##########################################
Aaron Carroll1a17cfd2013-03-14 16:57:40 +1100334# check cross compile
335
336cross_compile="no"
337cat > $TMPC <<EOF
338int main(void)
339{
340 return 0;
341}
342EOF
343if compile_prog "" "" "cross"; then
344 $TMPE 2>/dev/null || cross_compile="yes"
345else
346 fatal "compile test failed"
347fi
348
349##########################################
Jens Axboe0dcebdf2013-01-23 15:42:16 -0700350# check endianness
351bigendian="no"
Aaron Carroll1a17cfd2013-03-14 16:57:40 +1100352if test "$cross_compile" = "no" ; then
353 cat > $TMPC <<EOF
Jens Axboe0dcebdf2013-01-23 15:42:16 -0700354#include <inttypes.h>
355int main(void)
356{
357 volatile uint32_t i=0x01234567;
358 return (*((uint8_t*)(&i))) == 0x67;
359}
360EOF
Aaron Carroll1a17cfd2013-03-14 16:57:40 +1100361 if compile_prog "" "" "endian"; then
362 $TMPE && bigendian="yes"
363 fi
364else
365 # If we're cross compiling, try our best to work it out and rely on the
366 # run-time check to fail if we get it wrong.
367 cat > $TMPC <<EOF
368#include <endian.h>
369int main(void)
370{
371#if __BYTE_ORDER != __BIG_ENDIAN
372# error "Unknown endianness"
373#endif
374}
375EOF
376 compile_prog "" "" "endian" && bigendian="yes"
377 check_define "__ARMEB__" && bigendian="yes"
378 check_define "__MIPSEB__" && bigendian="yes"
Jens Axboe0dcebdf2013-01-23 15:42:16 -0700379fi
380
381
Jens Axboe67bf9822013-01-10 11:23:19 +0100382echo "Operating system $targetos"
383echo "CPU $cpu"
Jens Axboe0dcebdf2013-01-23 15:42:16 -0700384echo "Big endian $bigendian"
Jens Axboe67bf9822013-01-10 11:23:19 +0100385echo "Compiler $cc"
Aaron Carroll1a17cfd2013-03-14 16:57:40 +1100386echo "Cross compile $cross_compile"
Jens Axboe67bf9822013-01-10 11:23:19 +0100387echo
388
389##########################################
390# check for wordsize
391wordsize="0"
392cat > $TMPC <<EOF
Aaron Carroll142429e2013-03-14 16:57:39 +1100393#include <limits.h>
394#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
Jens Axboe67bf9822013-01-10 11:23:19 +0100395int main(void)
396{
Aaron Carroll142429e2013-03-14 16:57:39 +1100397 BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE);
Jens Axboe67bf9822013-01-10 11:23:19 +0100398 return 0;
399}
400EOF
Aaron Carroll142429e2013-03-14 16:57:39 +1100401if compile_prog "-DWORDSIZE=32" "" "wordsize"; then
402 wordsize="32"
403elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then
404 wordsize="64"
405else
406 fatal "Unknown wordsize"
Jens Axboe67bf9822013-01-10 11:23:19 +0100407fi
408echo "Wordsize $wordsize"
409
410##########################################
Jens Axboea9bca4a2013-04-05 12:55:42 +0200411# zlib probe
412zlib="no"
413cat > $TMPC <<EOF
414#include <zlib.h>
415int main(void)
416{
417 z_stream stream;
418 if (inflateInit(&stream) != Z_OK)
419 return 1;
420 return 0;
421}
422EOF
423if compile_prog "" "-lz" "zlib" ; then
424 zlib=yes
425 LIBS="-lz $LIBS"
Jens Axboea9bca4a2013-04-05 12:55:42 +0200426fi
427echo "zlib $zlib"
428
429##########################################
Jens Axboe67bf9822013-01-10 11:23:19 +0100430# linux-aio probe
431libaio="no"
432cat > $TMPC <<EOF
433#include <libaio.h>
434#include <stddef.h>
435int main(void)
436{
437 io_setup(0, NULL);
438 return 0;
439}
440EOF
441if compile_prog "" "-laio" "libaio" ; then
442 libaio=yes
443 LIBS="-laio $LIBS"
444else
445 if test "$libaio" = "yes" ; then
Jens Axboec55d7282013-04-12 10:16:43 +0200446 feature_not_found "linux AIO" "libaio-dev or libaio-devel"
Jens Axboe67bf9822013-01-10 11:23:19 +0100447 fi
448 libaio=no
449fi
450echo "Linux AIO support $libaio"
451
452##########################################
453# posix aio probe
454posix_aio="no"
455posix_aio_lrt="no"
456cat > $TMPC <<EOF
457#include <aio.h>
458int main(void)
459{
460 struct aiocb cb;
461 aio_read(&cb);
462 return 0;
463}
464EOF
465if compile_prog "" "" "posixaio" ; then
466 posix_aio="yes"
467elif compile_prog "" "-lrt" "posixaio"; then
468 posix_aio="yes"
469 posix_aio_lrt="yes"
470 LIBS="-lrt $LIBS"
471fi
472echo "POSIX AIO support $posix_aio"
473echo "POSIX AIO support needs -lrt $posix_aio_lrt"
474
475##########################################
476# posix aio fsync probe
477posix_aio_fsync="no"
478if test "$posix_aio" = "yes" ; then
479 cat > $TMPC <<EOF
480#include <fcntl.h>
481#include <aio.h>
482int main(void)
483{
484 struct aiocb cb;
485 return aio_fsync(O_SYNC, &cb);
486 return 0;
487}
488EOF
489 if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
490 posix_aio_fsync=yes
491 fi
492fi
493echo "POSIX AIO fsync $posix_aio_fsync"
494
495##########################################
496# solaris aio probe
497solaris_aio="no"
498cat > $TMPC <<EOF
499#include <sys/types.h>
500#include <sys/asynch.h>
501#include <unistd.h>
502int main(void)
503{
504 aio_result_t res;
505 return aioread(0, NULL, 0, 0, SEEK_SET, &res);
506 return 0;
507}
508EOF
509if compile_prog "" "-laio" "solarisaio" ; then
510 solaris_aio=yes
511 LIBS="-laio $LIBS"
512fi
513echo "Solaris AIO support $solaris_aio"
514
515##########################################
516# __sync_fetch_and_and test
517sfaa="no"
518cat > $TMPC << EOF
519static int sfaa(int *ptr)
520{
Jens Axboe9c639a72013-02-28 22:13:29 +0100521 return __sync_fetch_and_add(ptr, 0);
Jens Axboe67bf9822013-01-10 11:23:19 +0100522}
523
524int main(int argc, char **argv)
525{
526 int val = 42;
527 sfaa(&val);
528 return val;
529}
530EOF
531if compile_prog "" "" "__sync_fetch_and_add()" ; then
532 sfaa="yes"
533fi
Jens Axboe9c639a72013-02-28 22:13:29 +0100534echo "__sync_fetch_and_add $sfaa"
Jens Axboe67bf9822013-01-10 11:23:19 +0100535
536##########################################
537# libverbs probe
538libverbs="no"
539cat > $TMPC << EOF
540#include <stdio.h>
541#include <infiniband/arch.h>
542int main(int argc, char **argv)
543{
544 struct ibv_pd *pd = ibv_alloc_pd(NULL);
545 return 0;
546}
547EOF
548if compile_prog "" "-libverbs" "libverbs" ; then
549 libverbs="yes"
550 LIBS="-libverbs $LIBS"
551fi
552echo "libverbs $libverbs"
553
554##########################################
555# rdmacm probe
556rdmacm="no"
557cat > $TMPC << EOF
558#include <stdio.h>
559#include <rdma/rdma_cma.h>
560int main(int argc, char **argv)
561{
562 rdma_destroy_qp(NULL);
563 return 0;
564}
565EOF
566if compile_prog "" "-lrdmacm" "rdma"; then
567 rdmacm="yes"
568 LIBS="-lrdmacm $LIBS"
569fi
570echo "rdmacm $rdmacm"
571
572##########################################
573# Linux fallocate probe
574linux_fallocate="no"
575cat > $TMPC << EOF
576#include <stdio.h>
Castor Fuaa6738a2013-12-19 23:00:46 -0800577#include <fcntl.h>
Jens Axboe67bf9822013-01-10 11:23:19 +0100578#include <linux/falloc.h>
579int main(int argc, char **argv)
580{
581 int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
582 return r;
583}
584EOF
585if compile_prog "" "" "linux_fallocate"; then
586 linux_fallocate="yes"
587fi
588echo "Linux fallocate $linux_fallocate"
589
590##########################################
591# POSIX fadvise probe
592posix_fadvise="no"
593cat > $TMPC << EOF
594#include <stdio.h>
595#include <fcntl.h>
596int main(int argc, char **argv)
597{
598 int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
599 return r;
600}
601EOF
602if compile_prog "" "" "posix_fadvise"; then
603 posix_fadvise="yes"
604fi
605echo "POSIX fadvise $posix_fadvise"
606
607##########################################
608# POSIX fallocate probe
609posix_fallocate="no"
610cat > $TMPC << EOF
611#include <stdio.h>
612#include <fcntl.h>
613int main(int argc, char **argv)
614{
615 int r = posix_fallocate(0, 0, 1024);
616 return r;
617}
618EOF
619if compile_prog "" "" "posix_fallocate"; then
620 posix_fallocate="yes"
621fi
622echo "POSIX fallocate $posix_fallocate"
623
624##########################################
625# sched_set/getaffinity 2 or 3 argument test
626linux_2arg_affinity="no"
627linux_3arg_affinity="no"
628cat > $TMPC << EOF
Jens Axboe67bf9822013-01-10 11:23:19 +0100629#include <sched.h>
630int main(int argc, char **argv)
631{
632 cpu_set_t mask;
633 return sched_setaffinity(0, sizeof(mask), &mask);
634}
635EOF
636if compile_prog "" "" "sched_setaffinity(,,)"; then
637 linux_3arg_affinity="yes"
638else
639 cat > $TMPC << EOF
Jens Axboe67bf9822013-01-10 11:23:19 +0100640#include <sched.h>
641int main(int argc, char **argv)
642{
643 cpu_set_t mask;
644 return sched_setaffinity(0, &mask);
645}
646EOF
647 if compile_prog "" "" "sched_setaffinity(,)"; then
648 linux_2arg_affinity="yes"
649 fi
650fi
651echo "sched_setaffinity(3 arg) $linux_3arg_affinity"
652echo "sched_setaffinity(2 arg) $linux_2arg_affinity"
653
654##########################################
Jens Axboe6cf71c22014-03-05 15:49:54 -0700655# CPU_COUNT test
656cpu_count="no"
657cat > $TMPC << EOF
658#include <sched.h>
659int main(int argc, char **argv)
660{
661 cpu_set_t mask;
662 return CPU_COUNT(&mask);
663}
664EOF
665if compile_prog "" "" "cpu_count"; then
666 cpu_count="yes"
667fi
668echo "CPU_COUNT $cpu_count"
669
670##########################################
Jens Axboe67bf9822013-01-10 11:23:19 +0100671# clock_gettime probe
672clock_gettime="no"
673cat > $TMPC << EOF
674#include <stdio.h>
675#include <time.h>
676int main(int argc, char **argv)
677{
678 return clock_gettime(0, NULL);
679}
680EOF
681if compile_prog "" "" "clock_gettime"; then
682 clock_gettime="yes"
683elif compile_prog "" "-lrt" "clock_gettime"; then
684 clock_gettime="yes"
685 LIBS="-lrt $LIBS"
686fi
687echo "clock_gettime $clock_gettime"
688
689##########################################
690# CLOCK_MONOTONIC probe
691clock_monotonic="no"
692if test "$clock_gettime" = "yes" ; then
693 cat > $TMPC << EOF
694#include <stdio.h>
695#include <time.h>
696int main(int argc, char **argv)
697{
698 return clock_gettime(CLOCK_MONOTONIC, NULL);
699}
700EOF
701 if compile_prog "" "$LIBS" "clock monotonic"; then
702 clock_monotonic="yes"
703 fi
704fi
705echo "CLOCK_MONOTONIC $clock_monotonic"
706
707##########################################
708# CLOCK_MONOTONIC_PRECISE probe
709clock_monotonic_precise="no"
710if test "$clock_gettime" = "yes" ; then
711 cat > $TMPC << EOF
712#include <stdio.h>
713#include <time.h>
714int main(int argc, char **argv)
715{
716 return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
717}
718EOF
719 if compile_prog "" "$LIBS" "clock monotonic precise"; then
720 clock_monotonic_precise="yes"
721 fi
722fi
723echo "CLOCK_MONOTONIC_PRECISE $clock_monotonic_precise"
724
725##########################################
726# gettimeofday() probe
727gettimeofday="no"
728cat > $TMPC << EOF
729#include <sys/time.h>
730#include <stdio.h>
731int main(int argc, char **argv)
732{
733 struct timeval tv;
734 return gettimeofday(&tv, NULL);
735}
736EOF
737if compile_prog "" "" "gettimeofday"; then
738 gettimeofday="yes"
739fi
740echo "gettimeofday $gettimeofday"
741
742##########################################
743# fdatasync() probe
744fdatasync="no"
745cat > $TMPC << EOF
746#include <stdio.h>
747#include <unistd.h>
748int main(int argc, char **argv)
749{
750 return fdatasync(0);
751}
752EOF
753if compile_prog "" "" "fdatasync"; then
754 fdatasync="yes"
755fi
756echo "fdatasync $fdatasync"
757
758##########################################
759# sync_file_range() probe
760sync_file_range="no"
761cat > $TMPC << EOF
762#include <stdio.h>
763#include <unistd.h>
Jens Axboe67bf9822013-01-10 11:23:19 +0100764#include <fcntl.h>
765#include <linux/fs.h>
766int main(int argc, char **argv)
767{
768 unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
769 SYNC_FILE_RANGE_WAIT_AFTER;
770 return sync_file_range(0, 0, 0, flags);
771}
772EOF
773if compile_prog "" "" "sync_file_range"; then
774 sync_file_range="yes"
775fi
776echo "sync_file_range $sync_file_range"
777
778##########################################
779# ext4 move extent probe
780ext4_me="no"
781cat > $TMPC << EOF
782#include <fcntl.h>
783#include <sys/ioctl.h>
784int main(int argc, char **argv)
785{
786 struct move_extent me;
787 return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
788}
789EOF
Jens Axboec7165b82013-01-12 10:27:53 +0100790if compile_prog "" "" "ext4 move extent" ; then
791 ext4_me="yes"
792elif test $targetos = "Linux" ; then
793 # On Linux, just default to it on and let it error at runtime if we really
794 # don't have it. None of my updated systems have it defined, but it does
795 # work. Takes a while to bubble back.
Jens Axboe67bf9822013-01-10 11:23:19 +0100796 ext4_me="yes"
797fi
798echo "EXT4 move extent $ext4_me"
799
800##########################################
801# splice probe
802linux_splice="no"
803cat > $TMPC << EOF
Jens Axboe67bf9822013-01-10 11:23:19 +0100804#include <stdio.h>
805#include <fcntl.h>
806int main(int argc, char **argv)
807{
808 return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
809}
810EOF
811if compile_prog "" "" "linux splice"; then
812 linux_splice="yes"
813fi
814echo "Linux splice(2) $linux_splice"
815
816##########################################
817# GUASI probe
818guasi="no"
819cat > $TMPC << EOF
820#include <guasi.h>
821#include <guasi_syscalls.h>
822int main(int argc, char **argv)
823{
824 guasi_t ctx = guasi_create(0, 0, 0);
825 return 0;
826}
827EOF
828if compile_prog "" "" "guasi"; then
829 guasi="yes"
830fi
831echo "GUASI $guasi"
832
833##########################################
834# fusion-aw probe
835fusion_aw="no"
836cat > $TMPC << EOF
Santhosh Koundinyab2c77c22013-05-18 08:44:01 +0200837#include <nvm/nvm_primitives.h>
Jens Axboe67bf9822013-01-10 11:23:19 +0100838int main(int argc, char **argv)
839{
Santhosh Koundinyab2c77c22013-05-18 08:44:01 +0200840 nvm_version_t ver_info;
841 nvm_handle_t handle;
842
843 handle = nvm_get_handle(0, &ver_info);
844 return nvm_atomic_write(handle, 0, 0, 0);
Jens Axboe67bf9822013-01-10 11:23:19 +0100845}
846EOF
Santhosh Koundinyab2c77c22013-05-18 08:44:01 +0200847if compile_prog "" "-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -lvsl -ldl" "fusion-aw"; then
848 LIBS="-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -lvsl -ldl $LIBS"
Jens Axboe67bf9822013-01-10 11:23:19 +0100849 fusion_aw="yes"
850fi
851echo "Fusion-io atomic engine $fusion_aw"
852
853##########################################
854# libnuma probe
855libnuma="no"
856cat > $TMPC << EOF
857#include <numa.h>
858int main(int argc, char **argv)
859{
860 return numa_available();
861}
862EOF
Castor Fu44462512013-10-31 11:00:54 -0600863if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then
Jens Axboe67bf9822013-01-10 11:23:19 +0100864 libnuma="yes"
865 LIBS="-lnuma $LIBS"
866fi
867echo "libnuma $libnuma"
868
869##########################################
Jens Axboe50206d92013-03-25 13:20:08 -0600870# libnuma 2.x version API
871if test "$libnuma" = "yes" ; then
872libnuma_v2="no"
873cat > $TMPC << EOF
874#include <numa.h>
875int main(int argc, char **argv)
876{
877 struct bitmask *mask = numa_parse_nodestring(NULL);
878 return 0;
879}
880EOF
881if compile_prog "" "" "libnuma api"; then
882 libnuma_v2="yes"
883fi
884echo "libnuma v2 $libnuma_v2"
885fi
886
887##########################################
Jens Axboe67bf9822013-01-10 11:23:19 +0100888# strsep() probe
889strsep="no"
890cat > $TMPC << EOF
891#include <string.h>
892int main(int argc, char **argv)
893{
894 strsep(NULL, NULL);
895 return 0;
896}
897EOF
898if compile_prog "" "" "strsep"; then
899 strsep="yes"
900fi
901echo "strsep $strsep"
902
903##########################################
Jens Axboe9ad8da82013-04-05 14:44:03 +0200904# strcasestr() probe
905strcasestr="no"
906cat > $TMPC << EOF
907#include <string.h>
908int main(int argc, char **argv)
909{
Castor Fuaa6738a2013-12-19 23:00:46 -0800910 return strcasestr(argv[0], argv[1]) != NULL;
Jens Axboe9ad8da82013-04-05 14:44:03 +0200911}
912EOF
913if compile_prog "" "" "strcasestr"; then
914 strcasestr="yes"
915fi
916echo "strcasestr $strcasestr"
917
918##########################################
Jens Axboe67bf9822013-01-10 11:23:19 +0100919# getopt_long_only() probe
920getopt_long_only="no"
921cat > $TMPC << EOF
922#include <unistd.h>
923#include <stdio.h>
Castor Fuaa6738a2013-12-19 23:00:46 -0800924#include <getopt.h>
Jens Axboe67bf9822013-01-10 11:23:19 +0100925int main(int argc, char **argv)
926{
927 int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
928 return c;
929}
930EOF
931if compile_prog "" "" "getopt_long_only"; then
932 getopt_long_only="yes"
933fi
934echo "getopt_long_only() $getopt_long_only"
935
936##########################################
937# inet_aton() probe
938inet_aton="no"
939cat > $TMPC << EOF
940#include <sys/socket.h>
941#include <arpa/inet.h>
942#include <stdio.h>
943int main(int argc, char **argv)
944{
945 struct in_addr in;
946 return inet_aton(NULL, &in);
947}
948EOF
949if compile_prog "" "" "inet_aton"; then
950 inet_aton="yes"
951fi
952echo "inet_aton $inet_aton"
953
954##########################################
955# socklen_t probe
956socklen_t="no"
957cat > $TMPC << EOF
Aaron Carrollf6482612013-03-14 16:57:41 +1100958#include <sys/socket.h>
Jens Axboe67bf9822013-01-10 11:23:19 +0100959int main(int argc, char **argv)
960{
961 socklen_t len = 0;
962 return len;
963}
964EOF
965if compile_prog "" "" "socklen_t"; then
966 socklen_t="yes"
967fi
968echo "socklen_t $socklen_t"
969
970##########################################
971# Whether or not __thread is supported for TLS
972tls_thread="no"
973cat > $TMPC << EOF
974#include <stdio.h>
Castor Fuaa6738a2013-12-19 23:00:46 -0800975static __thread int ret;
Jens Axboe67bf9822013-01-10 11:23:19 +0100976int main(int argc, char **argv)
977{
978 return ret;
979}
980EOF
981if compile_prog "" "" "__thread"; then
982 tls_thread="yes"
983fi
984echo "__thread $tls_thread"
985
Jens Axboe91f94d52013-01-24 10:25:42 -0700986##########################################
Jens Axboe2639f052013-04-10 14:41:08 +0200987# Check if we have required gtk/glib support for gfio
Jens Axboe91f94d52013-01-24 10:25:42 -0700988if test "$gfio" = "yes" ; then
989 cat > $TMPC << EOF
990#include <glib.h>
991#include <cairo.h>
992#include <gtk/gtk.h>
993int main(void)
994{
995 gdk_threads_enter();
Jens Axboe91f94d52013-01-24 10:25:42 -0700996 gdk_threads_leave();
Jens Axboeb7a99312013-02-04 12:46:54 +0100997
998 printf("%d", GTK_CHECK_VERSION(2, 18, 0));
Jens Axboe91f94d52013-01-24 10:25:42 -0700999}
1000EOF
1001GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0)
1002if test "$?" != "0" ; then
1003 echo "configure: gtk and gthread not found"
1004 exit 1
1005fi
1006GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0)
1007if test "$?" != "0" ; then
1008 echo "configure: gtk and gthread not found"
1009 exit 1
1010fi
Jens Axboeb7a99312013-02-04 12:46:54 +01001011if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
1012 r=$($TMPE)
1013 if test "$r" != "0" ; then
1014 gfio="yes"
1015 LIBS="$LIBS $GTK_LIBS"
1016 CFLAGS="$CFLAGS $GTK_CFLAGS"
1017 else
1018 echo "GTK found, but need version 2.18 or higher"
1019 gfio="no"
1020 fi
Jens Axboe91f94d52013-01-24 10:25:42 -07001021else
1022 echo "Please install gtk and gdk libraries"
1023 gfio="no"
1024fi
1025fi
1026
Jens Axboe2639f052013-04-10 14:41:08 +02001027echo "gtk 2.18 or higher $gfio"
Jens Axboe91f94d52013-01-24 10:25:42 -07001028
Jens Axboe44404c52013-01-24 14:20:09 -07001029# Check whether we have getrusage(RUSAGE_THREAD)
1030rusage_thread="no"
1031cat > $TMPC << EOF
1032#include <sys/time.h>
1033#include <sys/resource.h>
1034int main(int argc, char **argv)
1035{
1036 struct rusage ru;
1037 getrusage(RUSAGE_THREAD, &ru);
1038 return 0;
1039}
1040EOF
1041if compile_prog "" "" "RUSAGE_THREAD"; then
1042 rusage_thread="yes"
1043fi
1044echo "RUSAGE_THREAD $rusage_thread"
1045
Jens Axboe7e09a9f2013-01-30 13:58:58 +01001046##########################################
1047# Check whether we have SCHED_IDLE
1048sched_idle="no"
1049cat > $TMPC << EOF
1050#include <sched.h>
1051int main(int argc, char **argv)
1052{
1053 struct sched_param p;
1054 return sched_setscheduler(0, SCHED_IDLE, &p);
1055}
1056EOF
1057if compile_prog "" "" "SCHED_IDLE"; then
1058 sched_idle="yes"
1059fi
1060echo "SCHED_IDLE $sched_idle"
1061
Jens Axboe1eafa372013-01-31 10:19:51 +01001062##########################################
1063# Check whether we have TCP_NODELAY
1064tcp_nodelay="no"
1065cat > $TMPC << EOF
1066#include <stdio.h>
1067#include <sys/types.h>
1068#include <sys/socket.h>
1069#include <netinet/tcp.h>
1070int main(int argc, char **argv)
1071{
1072 return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
1073}
1074EOF
1075if compile_prog "" "" "TCP_NODELAY"; then
1076 tcp_nodelay="yes"
1077fi
1078echo "TCP_NODELAY $tcp_nodelay"
1079
Jens Axboe38b93542013-02-28 08:28:05 +01001080##########################################
1081# Check whether we have RLIMIT_MEMLOCK
1082rlimit_memlock="no"
1083cat > $TMPC << EOF
1084#include <sys/time.h>
1085#include <sys/resource.h>
1086int main(int argc, char **argv)
1087{
1088 struct rlimit rl;
1089 return getrlimit(RLIMIT_MEMLOCK, &rl);
1090}
1091EOF
1092if compile_prog "" "" "RLIMIT_MEMLOCK"; then
1093 rlimit_memlock="yes"
1094fi
1095echo "RLIMIT_MEMLOCK $rlimit_memlock"
1096
Jens Axboe07fc0ac2013-05-16 20:36:57 +02001097##########################################
1098# Check whether we have pwritev/preadv
1099pwritev="no"
1100cat > $TMPC << EOF
1101#include <stdio.h>
1102#include <sys/uio.h>
1103int main(int argc, char **argv)
1104{
1105 return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0);
1106}
1107EOF
1108if compile_prog "" "" "pwritev"; then
1109 pwritev="yes"
1110fi
1111echo "pwritev/preadv $pwritev"
1112
Jens Axboeecad55e2014-01-24 18:56:34 -08001113##########################################
1114# Check whether we have the required functions for ipv6
1115ipv6="no"
1116cat > $TMPC << EOF
1117#include <sys/types.h>
1118#include <sys/socket.h>
Bruce Crand2190282014-02-13 09:06:20 -07001119#include <netinet/in.h>
Jens Axboeecad55e2014-01-24 18:56:34 -08001120#include <netdb.h>
1121#include <stdio.h>
1122int main(int argc, char **argv)
1123{
1124 struct addrinfo hints;
1125 struct in6_addr addr;
1126 int ret;
1127
1128 ret = getaddrinfo(NULL, NULL, &hints, NULL);
1129 freeaddrinfo(NULL);
1130 printf("%s\n", gai_strerror(ret));
1131 addr = in6addr_any;
1132 return 0;
1133}
1134EOF
1135if compile_prog "" "" "ipv6"; then
1136 ipv6="yes"
1137fi
1138echo "IPv6 helpers $ipv6"
Jens Axboe07fc0ac2013-05-16 20:36:57 +02001139
Daniel Gollubfc5c0342014-02-17 14:35:28 +01001140##########################################
1141# check for rbd
1142rbd="no"
1143cat > $TMPC << EOF
1144#include <rbd/librbd.h>
1145
1146int main(int argc, char **argv)
1147{
1148
1149 rados_t cluster;
1150 rados_ioctx_t io_ctx;
1151 const char pool[] = "rbd";
1152
1153 int major, minor, extra;
1154 rbd_version(&major, &minor, &extra);
1155
1156 rados_ioctx_create(cluster, pool, &io_ctx);
1157 return 0;
1158}
1159EOF
1160if compile_prog "" "-lrbd -lrados" "rbd"; then
1161 LIBS="-lrbd -lrados $LIBS"
1162 rbd="yes"
1163fi
1164echo "Rados Block Device engine $rbd"
1165
Jens Axboe2e802282014-04-02 21:47:27 -06001166##########################################
1167# Check whether we have setvbuf
1168setvbuf="no"
1169cat > $TMPC << EOF
1170#include <stdio.h>
1171int main(int argc, char **argv)
1172{
1173 FILE *f = NULL;
1174 char buf[80];
1175 setvbuf(f, buf, _IOFBF, sizeof(buf));
1176 return 0;
1177}
1178EOF
1179if compile_prog "" "" "setvbuf"; then
1180 setvbuf="yes"
1181fi
1182echo "setvbuf $setvbuf"
Daniel Gollubfc5c0342014-02-17 14:35:28 +01001183
Christian Ehrhardt81795ce2014-04-10 15:09:47 +02001184##########################################
1185# Check if we support stckf on s390
1186s390_z196_facilities="no"
1187cat > $TMPC << EOF
1188#define STFLE_BITS_Z196 45 /* various z196 facilities ... */
1189int main(int argc, char **argv)
1190{
1191 /* We want just 1 double word to be returned. */
1192 register unsigned long reg0 asm("0") = 0;
1193 unsigned long stfle_bits;
1194 asm volatile(".machine push" "\n\t"
1195 ".machine \"z9-109\"" "\n\t"
1196 "stfle %0" "\n\t"
1197 ".machine pop" "\n"
1198 : "=QS" (stfle_bits), "+d" (reg0)
1199 : : "cc");
1200
1201 if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0)
1202 return 0;
1203 else
1204 return -1;
1205}
1206EOF
1207if compile_prog "" "" "s390_z196_facilities"; then
1208 $TMPE
1209 if [[ $? -eq 0 ]]; then
1210 s390_z196_facilities="yes"
1211 fi
1212fi
1213echo "s390_z196_facilities $s390_z196_facilities"
Jens Axboe67bf9822013-01-10 11:23:19 +01001214#############################################################################
1215
Jens Axboe67bf9822013-01-10 11:23:19 +01001216if test "$wordsize" = "64" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001217 output_sym "CONFIG_64BIT"
Jens Axboe67bf9822013-01-10 11:23:19 +01001218elif test "$wordsize" = "32" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001219 output_sym "CONFIG_32BIT"
Jens Axboe67bf9822013-01-10 11:23:19 +01001220else
Jens Axboed7145a72013-02-11 13:21:54 +01001221 fatal "Unknown wordsize!"
Jens Axboe67bf9822013-01-10 11:23:19 +01001222fi
Jens Axboe0dcebdf2013-01-23 15:42:16 -07001223if test "$bigendian" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001224 output_sym "CONFIG_BIG_ENDIAN"
Jens Axboe0dcebdf2013-01-23 15:42:16 -07001225else
Jens Axboe4feafb12013-01-24 23:07:55 -07001226 output_sym "CONFIG_LITTLE_ENDIAN"
Jens Axboe0dcebdf2013-01-23 15:42:16 -07001227fi
Jens Axboe3989b142013-04-12 13:13:24 +02001228if test "$zlib" = "yes" ; then
1229 output_sym "CONFIG_ZLIB"
1230fi
Jens Axboe67bf9822013-01-10 11:23:19 +01001231if test "$libaio" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001232 output_sym "CONFIG_LIBAIO"
Jens Axboe67bf9822013-01-10 11:23:19 +01001233fi
1234if test "$posix_aio" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001235 output_sym "CONFIG_POSIXAIO"
Jens Axboe67bf9822013-01-10 11:23:19 +01001236fi
1237if test "$posix_aio_fsync" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001238 output_sym "CONFIG_POSIXAIO_FSYNC"
Jens Axboe67bf9822013-01-10 11:23:19 +01001239fi
1240if test "$linux_fallocate" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001241 output_sym "CONFIG_LINUX_FALLOCATE"
Jens Axboe67bf9822013-01-10 11:23:19 +01001242fi
1243if test "$posix_fallocate" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001244 output_sym "CONFIG_POSIX_FALLOCATE"
Jens Axboe67bf9822013-01-10 11:23:19 +01001245fi
1246if test "$fdatasync" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001247 output_sym "CONFIG_FDATASYNC"
Jens Axboe67bf9822013-01-10 11:23:19 +01001248fi
1249if test "$sync_file_range" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001250 output_sym "CONFIG_SYNC_FILE_RANGE"
Jens Axboe67bf9822013-01-10 11:23:19 +01001251fi
1252if test "$sfaa" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001253 output_sym "CONFIG_SFAA"
Jens Axboe67bf9822013-01-10 11:23:19 +01001254fi
Yufei Ren954cd732013-07-22 20:58:05 -06001255if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001256 output_sym "CONFIG_RDMA"
Jens Axboe67bf9822013-01-10 11:23:19 +01001257fi
1258if test "$clock_gettime" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001259 output_sym "CONFIG_CLOCK_GETTIME"
Jens Axboe67bf9822013-01-10 11:23:19 +01001260fi
1261if test "$clock_monotonic" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001262 output_sym "CONFIG_CLOCK_MONOTONIC"
Jens Axboe67bf9822013-01-10 11:23:19 +01001263fi
1264if test "$clock_monotonic_precise" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001265 output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
Jens Axboe67bf9822013-01-10 11:23:19 +01001266fi
1267if test "$gettimeofday" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001268 output_sym "CONFIG_GETTIMEOFDAY"
Jens Axboe67bf9822013-01-10 11:23:19 +01001269fi
1270if test "$posix_fadvise" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001271 output_sym "CONFIG_POSIX_FADVISE"
Jens Axboe67bf9822013-01-10 11:23:19 +01001272fi
1273if test "$linux_3arg_affinity" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001274 output_sym "CONFIG_3ARG_AFFINITY"
Jens Axboe67bf9822013-01-10 11:23:19 +01001275elif test "$linux_2arg_affinity" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001276 output_sym "CONFIG_2ARG_AFFINITY"
Jens Axboe67bf9822013-01-10 11:23:19 +01001277fi
1278if test "$strsep" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001279 output_sym "CONFIG_STRSEP"
Jens Axboe67bf9822013-01-10 11:23:19 +01001280fi
Jens Axboe9ad8da82013-04-05 14:44:03 +02001281if test "$strcasestr" = "yes" ; then
1282 output_sym "CONFIG_STRCASESTR"
1283fi
Jens Axboe67bf9822013-01-10 11:23:19 +01001284if test "$getopt_long_only" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001285 output_sym "CONFIG_GETOPT_LONG_ONLY"
Jens Axboe67bf9822013-01-10 11:23:19 +01001286fi
1287if test "$inet_aton" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001288 output_sym "CONFIG_INET_ATON"
Jens Axboe67bf9822013-01-10 11:23:19 +01001289fi
1290if test "$socklen_t" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001291 output_sym "CONFIG_SOCKLEN_T"
Jens Axboe67bf9822013-01-10 11:23:19 +01001292fi
1293if test "$ext4_me" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001294 output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
Jens Axboe67bf9822013-01-10 11:23:19 +01001295fi
1296if test "$linux_splice" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001297 output_sym "CONFIG_LINUX_SPLICE"
Jens Axboe67bf9822013-01-10 11:23:19 +01001298fi
1299if test "$guasi" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001300 output_sym "CONFIG_GUASI"
Jens Axboe67bf9822013-01-10 11:23:19 +01001301fi
1302if test "$fusion_aw" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001303 output_sym "CONFIG_FUSION_AW"
Jens Axboe67bf9822013-01-10 11:23:19 +01001304fi
Jens Axboe50206d92013-03-25 13:20:08 -06001305if test "$libnuma_v2" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001306 output_sym "CONFIG_LIBNUMA"
Jens Axboe67bf9822013-01-10 11:23:19 +01001307fi
1308if test "$solaris_aio" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001309 output_sym "CONFIG_SOLARISAIO"
Jens Axboe67bf9822013-01-10 11:23:19 +01001310fi
1311if test "$tls_thread" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001312 output_sym "CONFIG_TLS_THREAD"
Jens Axboe67bf9822013-01-10 11:23:19 +01001313fi
Jens Axboe44404c52013-01-24 14:20:09 -07001314if test "$rusage_thread" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001315 output_sym "CONFIG_RUSAGE_THREAD"
Jens Axboe67bf9822013-01-10 11:23:19 +01001316fi
Jens Axboe91f94d52013-01-24 10:25:42 -07001317if test "$gfio" = "yes" ; then
1318 echo "CONFIG_GFIO=y" >> $config_host_mak
1319fi
Jens Axboe7e09a9f2013-01-30 13:58:58 +01001320if test "$sched_idle" = "yes" ; then
1321 output_sym "CONFIG_SCHED_IDLE"
1322fi
Jens Axboe1eafa372013-01-31 10:19:51 +01001323if test "$tcp_nodelay" = "yes" ; then
1324 output_sym "CONFIG_TCP_NODELAY"
1325fi
Jens Axboe38b93542013-02-28 08:28:05 +01001326if test "$rlimit_memlock" = "yes" ; then
1327 output_sym "CONFIG_RLIMIT_MEMLOCK"
1328fi
Jens Axboe07fc0ac2013-05-16 20:36:57 +02001329if test "$pwritev" = "yes" ; then
1330 output_sym "CONFIG_PWRITEV"
1331fi
Jens Axboeecad55e2014-01-24 18:56:34 -08001332if test "$ipv6" = "yes" ; then
1333 output_sym "CONFIG_IPV6"
1334fi
Daniel Gollubfc5c0342014-02-17 14:35:28 +01001335if test "$rbd" = "yes" ; then
1336 output_sym "CONFIG_RBD"
1337fi
Jens Axboe6cf71c22014-03-05 15:49:54 -07001338if test "$cpu_count" = "yes" ; then
1339 output_sym "CONFIG_CPU_COUNT"
1340fi
Jens Axboe2e802282014-04-02 21:47:27 -06001341if test "$setvbuf" = "yes" ; then
1342 output_sym "CONFIG_SETVBUF"
1343fi
Christian Ehrhardt81795ce2014-04-10 15:09:47 +02001344if test "$s390_z196_facilities" = "yes" ; then
1345 output_sym "CONFIG_S390_Z196_FACILITIES"
1346 CFLAGS="$CFLAGS -march=z9-109"
1347fi
Jens Axboe67bf9822013-01-10 11:23:19 +01001348
1349echo "LIBS+=$LIBS" >> $config_host_mak
Jens Axboe91f94d52013-01-24 10:25:42 -07001350echo "CFLAGS+=$CFLAGS" >> $config_host_mak
Jens Axboe67bf9822013-01-10 11:23:19 +01001351echo "CC=$cc" >> $config_host_mak
Jens Axboeaf4862b2013-03-29 08:55:32 -06001352echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak