blob: aa15c5bc4ac2d46365830ebfb70e0f2029361a44 [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 Axboeef7035a2014-06-18 15:30:09 -0700144 # esx is cross compiled and cannot be detect through simple uname calls
145 --esx)
146 esx="yes"
147 ;;
Jens Axboecb1125b2013-01-23 13:47:54 -0700148 --cc=*) CC="$optarg"
149 ;;
Jens Axboe208e4c82013-01-29 09:26:07 +0100150 --extra-cflags=*) CFLAGS="$CFLAGS $optarg"
Jens Axboecb1125b2013-01-23 13:47:54 -0700151 ;;
Jens Axboeb7c12792013-05-01 13:00:26 +0200152 --build-32bit-win) build_32bit_win="yes"
Huadong Liu74097112013-02-05 08:43:14 +0100153 ;;
Jens Axboe91f94d52013-01-24 10:25:42 -0700154 --enable-gfio)
Jens Axboe9db01ef2013-02-07 15:45:39 +0100155 gfio="yes"
Jens Axboe899fab32013-01-29 10:06:30 +0100156 ;;
Castor Fu44462512013-10-31 11:00:54 -0600157 --disable-numa) disable_numa="yes"
158 ;;
Jens Axboe827da4f2013-01-24 10:27:26 -0700159 --help)
Jens Axboe47f44632013-01-24 10:34:14 -0700160 show_help="yes"
Jens Axboe827da4f2013-01-24 10:27:26 -0700161 ;;
Jens Axboecb1125b2013-01-23 13:47:54 -0700162 *)
163 echo "Bad option $opt"
Jens Axboe47f44632013-01-24 10:34:14 -0700164 show_help="yes"
165 exit_val=1
Jens Axboecb1125b2013-01-23 13:47:54 -0700166 esac
167done
168
Jens Axboe47f44632013-01-24 10:34:14 -0700169if test "$show_help" = "yes" ; then
Jens Axboe8b156d82013-02-10 15:48:34 +0100170 echo "--cpu= Specify target CPU if auto-detect fails"
Jens Axboeb7a99312013-02-04 12:46:54 +0100171 echo "--cc= Specify compiler to use"
Jens Axboe899fab32013-01-29 10:06:30 +0100172 echo "--extra-cflags= Specify extra CFLAGS to pass to compiler"
Jens Axboeb7c12792013-05-01 13:00:26 +0200173 echo "--build-32bit-win Enable 32-bit build on Windows"
Jens Axboeef7035a2014-06-18 15:30:09 -0700174 echo "--esx Configure build options for esx"
Jens Axboeb7a99312013-02-04 12:46:54 +0100175 echo "--enable-gfio Enable building of gtk gfio"
Castor Fu44462512013-10-31 11:00:54 -0600176 echo "--disable-numa Disable libnuma even if found"
Jens Axboeb7a99312013-02-04 12:46:54 +0100177 exit $exit_val
Jens Axboe47f44632013-01-24 10:34:14 -0700178fi
179
Stefan Hajnoczi47986332014-03-06 18:41:58 +0100180cross_prefix=${cross_prefix-${CROSS_COMPILE}}
181cc="${CC-${cross_prefix}gcc}"
182
Aaron Carroll6d0e9f82013-02-12 09:58:14 +0100183if check_define __ANDROID__ ; then
184 targetos="Android"
185elif check_define __linux__ ; then
Jens Axboe67bf9822013-01-10 11:23:19 +0100186 targetos="Linux"
Jens Axboe67bf9822013-01-10 11:23:19 +0100187elif check_define __OpenBSD__ ; then
188 targetos='OpenBSD'
189elif check_define __sun__ ; then
190 targetos='SunOS'
Jens Axboe7cb024f2013-11-06 15:37:35 -0700191 CFLAGS="$CFLAGS -D_REENTRANT"
Stefan Hajnoczib24f59a2014-03-06 18:41:59 +0100192elif check_define _WIN32 ; then
193 targetos='CYGWIN'
Jens Axboe67bf9822013-01-10 11:23:19 +0100194else
195 targetos=`uname -s`
196fi
197
Aaron Carroll53cd4ee2013-03-14 16:57:38 +1100198echo "# Automatically generated by configure - do not modify" > $config_host_mak
199printf "# Configured with:" >> $config_host_mak
200printf " '%s'" "$0" "$@" >> $config_host_mak
201echo >> $config_host_mak
202echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak
203
Jens Axboe67bf9822013-01-10 11:23:19 +0100204# Some host OSes need non-standard checks for which CPU to use.
205# Note that these checks are broken for cross-compilation: if you're
206# cross-compiling to one of these OSes then you'll need to specify
207# the correct CPU with the --cpu option.
208case $targetos in
209Darwin)
210 # on Leopard most of the system is 32-bit, so we have to ask the kernel if
211 # we can run 64-bit userspace code.
212 # If the user didn't specify a CPU explicitly and the kernel says this is
213 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual
214 # detection code.
215 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
216 cpu="x86_64"
217 fi
218 ;;
219SunOS)
220 # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
221 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
222 cpu="x86_64"
223 fi
Jens Axboeadaa46d2013-02-28 22:10:22 +0100224 LIBS="-lnsl -lsocket"
Jens Axboecfd94f72013-01-23 16:23:48 -0700225 ;;
226CYGWIN*)
227 echo "Forcing known good options on Windows"
Jens Axboe4578d012013-01-23 16:26:12 -0700228 if test -z "$CC" ; then
Huadong Liu74097112013-02-05 08:43:14 +0100229 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
230 CC="i686-w64-mingw32-gcc"
231 else
232 CC="x86_64-w64-mingw32-gcc"
233 fi
Jens Axboe4578d012013-01-23 16:26:12 -0700234 fi
Jens Axboe4feafb12013-01-24 23:07:55 -0700235 output_sym "CONFIG_LITTLE_ENDIAN"
Huadong Liu74097112013-02-05 08:43:14 +0100236 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
237 output_sym "CONFIG_32BIT"
238 else
239 output_sym "CONFIG_64BIT_LLP64"
240 fi
Jens Axboe4feafb12013-01-24 23:07:55 -0700241 output_sym "CONFIG_FADVISE"
242 output_sym "CONFIG_SOCKLEN_T"
Jens Axboe4feafb12013-01-24 23:07:55 -0700243 output_sym "CONFIG_FADVISE"
244 output_sym "CONFIG_SFAA"
245 output_sym "CONFIG_RUSAGE_THREAD"
246 output_sym "CONFIG_WINDOWSAIO"
247 output_sym "CONFIG_FDATASYNC"
Bruce Cran59308a62013-02-02 20:59:31 +0000248 output_sym "CONFIG_CLOCK_MONOTONIC"
Bruce Crandc0518c2013-01-28 16:07:15 +0000249 output_sym "CONFIG_GETTIMEOFDAY"
250 output_sym "CONFIG_CLOCK_GETTIME"
Jens Axboe7e09a9f2013-01-30 13:58:58 +0100251 output_sym "CONFIG_SCHED_IDLE"
Jens Axboe1eafa372013-01-31 10:19:51 +0100252 output_sym "CONFIG_TCP_NODELAY"
Bruce Cran7d6be132013-11-07 14:04:00 +0000253 output_sym "CONFIG_TLS_THREAD"
Bruce Cranef07baa2014-01-28 17:34:08 -0700254 output_sym "CONFIG_IPV6"
Jens Axboe4feafb12013-01-24 23:07:55 -0700255 echo "CC=$CC" >> $config_host_mak
Jens Axboeaf4862b2013-03-29 08:55:32 -0600256 echo "BUILD_CFLAGS=$CFLAGS -include config-host.h -D_GNU_SOURCE" >> $config_host_mak
Jens Axboecfd94f72013-01-23 16:23:48 -0700257 exit 0
Aaron Carroll6d0e9f82013-02-12 09:58:14 +0100258 ;;
Jens Axboe67bf9822013-01-10 11:23:19 +0100259esac
260
261if test ! -z "$cpu" ; then
262 # command line argument
263 :
264elif check_define __i386__ ; then
265 cpu="i386"
266elif check_define __x86_64__ ; then
267 cpu="x86_64"
268elif check_define __sparc__ ; then
269 if check_define __arch64__ ; then
270 cpu="sparc64"
271 else
272 cpu="sparc"
273 fi
274elif check_define _ARCH_PPC ; then
275 if check_define _ARCH_PPC64 ; then
276 cpu="ppc64"
277 else
278 cpu="ppc"
279 fi
280elif check_define __mips__ ; then
281 cpu="mips"
282elif check_define __ia64__ ; then
283 cpu="ia64"
284elif check_define __s390__ ; then
285 if check_define __s390x__ ; then
286 cpu="s390x"
287 else
288 cpu="s390"
289 fi
290elif check_define __arm__ ; then
291 cpu="arm"
292elif check_define __hppa__ ; then
293 cpu="hppa"
294else
295 cpu=`uname -m`
296fi
297
298# Normalise host CPU name and set ARCH.
299case "$cpu" in
300 ia64|ppc|ppc64|s390|s390x|sparc64)
301 cpu="$cpu"
302 ;;
303 i386|i486|i586|i686|i86pc|BePC)
304 cpu="i386"
305 ;;
306 x86_64|amd64)
307 cpu="x86_64"
308 ;;
309 armv*b|armv*l|arm)
310 cpu="arm"
311 ;;
312 hppa|parisc|parisc64)
313 cpu="hppa"
314 ;;
315 mips*)
316 cpu="mips"
317 ;;
318 sparc|sun4[cdmuv])
319 cpu="sparc"
320 ;;
321 *)
Jens Axboe8b156d82013-02-10 15:48:34 +0100322 echo "Unknown CPU"
Jens Axboe67bf9822013-01-10 11:23:19 +0100323 ;;
324esac
325
Jens Axboedcbbf5b2013-01-25 14:35:27 -0700326if test -z "$CC" ; then
Jens Axboe67bf9822013-01-10 11:23:19 +0100327 if test "$targetos" = "FreeBSD"; then
328 if has clang; then
329 CC=clang
330 else
331 CC=gcc
332 fi
Jens Axboe67bf9822013-01-10 11:23:19 +0100333 fi
334fi
335
336cc="${CC-${cross_prefix}gcc}"
337
Jens Axboe0dcebdf2013-01-23 15:42:16 -0700338##########################################
Aaron Carroll1a17cfd2013-03-14 16:57:40 +1100339# check cross compile
340
341cross_compile="no"
342cat > $TMPC <<EOF
343int main(void)
344{
345 return 0;
346}
347EOF
348if compile_prog "" "" "cross"; then
349 $TMPE 2>/dev/null || cross_compile="yes"
350else
351 fatal "compile test failed"
352fi
353
354##########################################
Jens Axboe0dcebdf2013-01-23 15:42:16 -0700355# check endianness
356bigendian="no"
Aaron Carroll1a17cfd2013-03-14 16:57:40 +1100357if test "$cross_compile" = "no" ; then
358 cat > $TMPC <<EOF
Jens Axboe0dcebdf2013-01-23 15:42:16 -0700359#include <inttypes.h>
360int main(void)
361{
362 volatile uint32_t i=0x01234567;
363 return (*((uint8_t*)(&i))) == 0x67;
364}
365EOF
Aaron Carroll1a17cfd2013-03-14 16:57:40 +1100366 if compile_prog "" "" "endian"; then
367 $TMPE && bigendian="yes"
368 fi
369else
370 # If we're cross compiling, try our best to work it out and rely on the
371 # run-time check to fail if we get it wrong.
372 cat > $TMPC <<EOF
373#include <endian.h>
374int main(void)
375{
376#if __BYTE_ORDER != __BIG_ENDIAN
377# error "Unknown endianness"
378#endif
379}
380EOF
381 compile_prog "" "" "endian" && bigendian="yes"
382 check_define "__ARMEB__" && bigendian="yes"
383 check_define "__MIPSEB__" && bigendian="yes"
Jens Axboe0dcebdf2013-01-23 15:42:16 -0700384fi
385
386
Jens Axboe67bf9822013-01-10 11:23:19 +0100387echo "Operating system $targetos"
388echo "CPU $cpu"
Jens Axboe0dcebdf2013-01-23 15:42:16 -0700389echo "Big endian $bigendian"
Jens Axboe67bf9822013-01-10 11:23:19 +0100390echo "Compiler $cc"
Aaron Carroll1a17cfd2013-03-14 16:57:40 +1100391echo "Cross compile $cross_compile"
Jens Axboe67bf9822013-01-10 11:23:19 +0100392echo
393
394##########################################
395# check for wordsize
396wordsize="0"
397cat > $TMPC <<EOF
Aaron Carroll142429e2013-03-14 16:57:39 +1100398#include <limits.h>
399#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
Jens Axboe67bf9822013-01-10 11:23:19 +0100400int main(void)
401{
Aaron Carroll142429e2013-03-14 16:57:39 +1100402 BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE);
Jens Axboe67bf9822013-01-10 11:23:19 +0100403 return 0;
404}
405EOF
Aaron Carroll142429e2013-03-14 16:57:39 +1100406if compile_prog "-DWORDSIZE=32" "" "wordsize"; then
407 wordsize="32"
408elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then
409 wordsize="64"
410else
411 fatal "Unknown wordsize"
Jens Axboe67bf9822013-01-10 11:23:19 +0100412fi
413echo "Wordsize $wordsize"
414
415##########################################
Jens Axboea9bca4a2013-04-05 12:55:42 +0200416# zlib probe
417zlib="no"
418cat > $TMPC <<EOF
419#include <zlib.h>
420int main(void)
421{
422 z_stream stream;
423 if (inflateInit(&stream) != Z_OK)
424 return 1;
425 return 0;
426}
427EOF
428if compile_prog "" "-lz" "zlib" ; then
429 zlib=yes
430 LIBS="-lz $LIBS"
Jens Axboea9bca4a2013-04-05 12:55:42 +0200431fi
432echo "zlib $zlib"
433
434##########################################
Jens Axboe67bf9822013-01-10 11:23:19 +0100435# linux-aio probe
436libaio="no"
437cat > $TMPC <<EOF
438#include <libaio.h>
439#include <stddef.h>
440int main(void)
441{
442 io_setup(0, NULL);
443 return 0;
444}
445EOF
446if compile_prog "" "-laio" "libaio" ; then
447 libaio=yes
448 LIBS="-laio $LIBS"
449else
450 if test "$libaio" = "yes" ; then
Jens Axboec55d7282013-04-12 10:16:43 +0200451 feature_not_found "linux AIO" "libaio-dev or libaio-devel"
Jens Axboe67bf9822013-01-10 11:23:19 +0100452 fi
453 libaio=no
454fi
455echo "Linux AIO support $libaio"
456
457##########################################
458# posix aio probe
459posix_aio="no"
460posix_aio_lrt="no"
461cat > $TMPC <<EOF
462#include <aio.h>
463int main(void)
464{
465 struct aiocb cb;
466 aio_read(&cb);
467 return 0;
468}
469EOF
470if compile_prog "" "" "posixaio" ; then
471 posix_aio="yes"
472elif compile_prog "" "-lrt" "posixaio"; then
473 posix_aio="yes"
474 posix_aio_lrt="yes"
475 LIBS="-lrt $LIBS"
476fi
477echo "POSIX AIO support $posix_aio"
478echo "POSIX AIO support needs -lrt $posix_aio_lrt"
479
480##########################################
481# posix aio fsync probe
482posix_aio_fsync="no"
483if test "$posix_aio" = "yes" ; then
484 cat > $TMPC <<EOF
485#include <fcntl.h>
486#include <aio.h>
487int main(void)
488{
489 struct aiocb cb;
490 return aio_fsync(O_SYNC, &cb);
491 return 0;
492}
493EOF
494 if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
495 posix_aio_fsync=yes
496 fi
497fi
498echo "POSIX AIO fsync $posix_aio_fsync"
499
500##########################################
501# solaris aio probe
502solaris_aio="no"
503cat > $TMPC <<EOF
504#include <sys/types.h>
505#include <sys/asynch.h>
506#include <unistd.h>
507int main(void)
508{
509 aio_result_t res;
510 return aioread(0, NULL, 0, 0, SEEK_SET, &res);
511 return 0;
512}
513EOF
514if compile_prog "" "-laio" "solarisaio" ; then
515 solaris_aio=yes
516 LIBS="-laio $LIBS"
517fi
518echo "Solaris AIO support $solaris_aio"
519
520##########################################
521# __sync_fetch_and_and test
522sfaa="no"
523cat > $TMPC << EOF
524static int sfaa(int *ptr)
525{
Jens Axboe9c639a72013-02-28 22:13:29 +0100526 return __sync_fetch_and_add(ptr, 0);
Jens Axboe67bf9822013-01-10 11:23:19 +0100527}
528
529int main(int argc, char **argv)
530{
531 int val = 42;
532 sfaa(&val);
533 return val;
534}
535EOF
536if compile_prog "" "" "__sync_fetch_and_add()" ; then
537 sfaa="yes"
538fi
Jens Axboe9c639a72013-02-28 22:13:29 +0100539echo "__sync_fetch_and_add $sfaa"
Jens Axboe67bf9822013-01-10 11:23:19 +0100540
541##########################################
542# libverbs probe
543libverbs="no"
544cat > $TMPC << EOF
545#include <stdio.h>
546#include <infiniband/arch.h>
547int main(int argc, char **argv)
548{
549 struct ibv_pd *pd = ibv_alloc_pd(NULL);
550 return 0;
551}
552EOF
553if compile_prog "" "-libverbs" "libverbs" ; then
554 libverbs="yes"
555 LIBS="-libverbs $LIBS"
556fi
557echo "libverbs $libverbs"
558
559##########################################
560# rdmacm probe
561rdmacm="no"
562cat > $TMPC << EOF
563#include <stdio.h>
564#include <rdma/rdma_cma.h>
565int main(int argc, char **argv)
566{
567 rdma_destroy_qp(NULL);
568 return 0;
569}
570EOF
571if compile_prog "" "-lrdmacm" "rdma"; then
572 rdmacm="yes"
573 LIBS="-lrdmacm $LIBS"
574fi
575echo "rdmacm $rdmacm"
576
577##########################################
578# Linux fallocate probe
579linux_fallocate="no"
580cat > $TMPC << EOF
581#include <stdio.h>
Castor Fuaa6738a2013-12-19 23:00:46 -0800582#include <fcntl.h>
Jens Axboe67bf9822013-01-10 11:23:19 +0100583#include <linux/falloc.h>
584int main(int argc, char **argv)
585{
586 int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
587 return r;
588}
589EOF
590if compile_prog "" "" "linux_fallocate"; then
591 linux_fallocate="yes"
592fi
593echo "Linux fallocate $linux_fallocate"
594
595##########################################
596# POSIX fadvise probe
597posix_fadvise="no"
598cat > $TMPC << EOF
599#include <stdio.h>
600#include <fcntl.h>
601int main(int argc, char **argv)
602{
603 int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
604 return r;
605}
606EOF
607if compile_prog "" "" "posix_fadvise"; then
608 posix_fadvise="yes"
609fi
610echo "POSIX fadvise $posix_fadvise"
611
612##########################################
613# POSIX fallocate probe
614posix_fallocate="no"
615cat > $TMPC << EOF
616#include <stdio.h>
617#include <fcntl.h>
618int main(int argc, char **argv)
619{
620 int r = posix_fallocate(0, 0, 1024);
621 return r;
622}
623EOF
624if compile_prog "" "" "posix_fallocate"; then
625 posix_fallocate="yes"
626fi
627echo "POSIX fallocate $posix_fallocate"
628
629##########################################
630# sched_set/getaffinity 2 or 3 argument test
631linux_2arg_affinity="no"
632linux_3arg_affinity="no"
633cat > $TMPC << EOF
Jens Axboe67bf9822013-01-10 11:23:19 +0100634#include <sched.h>
635int main(int argc, char **argv)
636{
637 cpu_set_t mask;
638 return sched_setaffinity(0, sizeof(mask), &mask);
639}
640EOF
641if compile_prog "" "" "sched_setaffinity(,,)"; then
642 linux_3arg_affinity="yes"
643else
644 cat > $TMPC << EOF
Jens Axboe67bf9822013-01-10 11:23:19 +0100645#include <sched.h>
646int main(int argc, char **argv)
647{
648 cpu_set_t mask;
649 return sched_setaffinity(0, &mask);
650}
651EOF
652 if compile_prog "" "" "sched_setaffinity(,)"; then
653 linux_2arg_affinity="yes"
654 fi
655fi
656echo "sched_setaffinity(3 arg) $linux_3arg_affinity"
657echo "sched_setaffinity(2 arg) $linux_2arg_affinity"
658
659##########################################
660# clock_gettime probe
661clock_gettime="no"
662cat > $TMPC << EOF
663#include <stdio.h>
664#include <time.h>
665int main(int argc, char **argv)
666{
667 return clock_gettime(0, NULL);
668}
669EOF
670if compile_prog "" "" "clock_gettime"; then
671 clock_gettime="yes"
672elif compile_prog "" "-lrt" "clock_gettime"; then
673 clock_gettime="yes"
674 LIBS="-lrt $LIBS"
675fi
676echo "clock_gettime $clock_gettime"
677
678##########################################
679# CLOCK_MONOTONIC probe
680clock_monotonic="no"
681if test "$clock_gettime" = "yes" ; then
682 cat > $TMPC << EOF
683#include <stdio.h>
684#include <time.h>
685int main(int argc, char **argv)
686{
687 return clock_gettime(CLOCK_MONOTONIC, NULL);
688}
689EOF
690 if compile_prog "" "$LIBS" "clock monotonic"; then
691 clock_monotonic="yes"
692 fi
693fi
694echo "CLOCK_MONOTONIC $clock_monotonic"
695
696##########################################
697# CLOCK_MONOTONIC_PRECISE probe
698clock_monotonic_precise="no"
699if test "$clock_gettime" = "yes" ; then
700 cat > $TMPC << EOF
701#include <stdio.h>
702#include <time.h>
703int main(int argc, char **argv)
704{
705 return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
706}
707EOF
708 if compile_prog "" "$LIBS" "clock monotonic precise"; then
709 clock_monotonic_precise="yes"
710 fi
711fi
712echo "CLOCK_MONOTONIC_PRECISE $clock_monotonic_precise"
713
714##########################################
715# gettimeofday() probe
716gettimeofday="no"
717cat > $TMPC << EOF
718#include <sys/time.h>
719#include <stdio.h>
720int main(int argc, char **argv)
721{
722 struct timeval tv;
723 return gettimeofday(&tv, NULL);
724}
725EOF
726if compile_prog "" "" "gettimeofday"; then
727 gettimeofday="yes"
728fi
729echo "gettimeofday $gettimeofday"
730
731##########################################
732# fdatasync() probe
733fdatasync="no"
734cat > $TMPC << EOF
735#include <stdio.h>
736#include <unistd.h>
737int main(int argc, char **argv)
738{
739 return fdatasync(0);
740}
741EOF
742if compile_prog "" "" "fdatasync"; then
743 fdatasync="yes"
744fi
745echo "fdatasync $fdatasync"
746
747##########################################
748# sync_file_range() probe
749sync_file_range="no"
750cat > $TMPC << EOF
751#include <stdio.h>
752#include <unistd.h>
Jens Axboe67bf9822013-01-10 11:23:19 +0100753#include <fcntl.h>
754#include <linux/fs.h>
755int main(int argc, char **argv)
756{
757 unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
758 SYNC_FILE_RANGE_WAIT_AFTER;
759 return sync_file_range(0, 0, 0, flags);
760}
761EOF
762if compile_prog "" "" "sync_file_range"; then
763 sync_file_range="yes"
764fi
765echo "sync_file_range $sync_file_range"
766
767##########################################
768# ext4 move extent probe
769ext4_me="no"
770cat > $TMPC << EOF
771#include <fcntl.h>
772#include <sys/ioctl.h>
773int main(int argc, char **argv)
774{
775 struct move_extent me;
776 return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
777}
778EOF
Jens Axboec7165b82013-01-12 10:27:53 +0100779if compile_prog "" "" "ext4 move extent" ; then
780 ext4_me="yes"
781elif test $targetos = "Linux" ; then
782 # On Linux, just default to it on and let it error at runtime if we really
783 # don't have it. None of my updated systems have it defined, but it does
784 # work. Takes a while to bubble back.
Jens Axboe67bf9822013-01-10 11:23:19 +0100785 ext4_me="yes"
786fi
787echo "EXT4 move extent $ext4_me"
788
789##########################################
790# splice probe
791linux_splice="no"
792cat > $TMPC << EOF
Jens Axboe67bf9822013-01-10 11:23:19 +0100793#include <stdio.h>
794#include <fcntl.h>
795int main(int argc, char **argv)
796{
797 return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
798}
799EOF
800if compile_prog "" "" "linux splice"; then
801 linux_splice="yes"
802fi
803echo "Linux splice(2) $linux_splice"
804
805##########################################
806# GUASI probe
807guasi="no"
808cat > $TMPC << EOF
809#include <guasi.h>
810#include <guasi_syscalls.h>
811int main(int argc, char **argv)
812{
813 guasi_t ctx = guasi_create(0, 0, 0);
814 return 0;
815}
816EOF
817if compile_prog "" "" "guasi"; then
818 guasi="yes"
819fi
820echo "GUASI $guasi"
821
822##########################################
823# fusion-aw probe
824fusion_aw="no"
825cat > $TMPC << EOF
Santhosh Koundinyab2c77c22013-05-18 08:44:01 +0200826#include <nvm/nvm_primitives.h>
Jens Axboe67bf9822013-01-10 11:23:19 +0100827int main(int argc, char **argv)
828{
Santhosh Koundinyab2c77c22013-05-18 08:44:01 +0200829 nvm_version_t ver_info;
830 nvm_handle_t handle;
831
832 handle = nvm_get_handle(0, &ver_info);
833 return nvm_atomic_write(handle, 0, 0, 0);
Jens Axboe67bf9822013-01-10 11:23:19 +0100834}
835EOF
Santhosh Koundinyab2c77c22013-05-18 08:44:01 +0200836if compile_prog "" "-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -lvsl -ldl" "fusion-aw"; then
837 LIBS="-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -lvsl -ldl $LIBS"
Jens Axboe67bf9822013-01-10 11:23:19 +0100838 fusion_aw="yes"
839fi
840echo "Fusion-io atomic engine $fusion_aw"
841
842##########################################
843# libnuma probe
844libnuma="no"
845cat > $TMPC << EOF
846#include <numa.h>
847int main(int argc, char **argv)
848{
849 return numa_available();
850}
851EOF
Castor Fu44462512013-10-31 11:00:54 -0600852if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then
Jens Axboe67bf9822013-01-10 11:23:19 +0100853 libnuma="yes"
854 LIBS="-lnuma $LIBS"
855fi
856echo "libnuma $libnuma"
857
858##########################################
Jens Axboe50206d92013-03-25 13:20:08 -0600859# libnuma 2.x version API
860if test "$libnuma" = "yes" ; then
861libnuma_v2="no"
862cat > $TMPC << EOF
863#include <numa.h>
864int main(int argc, char **argv)
865{
866 struct bitmask *mask = numa_parse_nodestring(NULL);
867 return 0;
868}
869EOF
870if compile_prog "" "" "libnuma api"; then
871 libnuma_v2="yes"
872fi
873echo "libnuma v2 $libnuma_v2"
874fi
875
876##########################################
Jens Axboe67bf9822013-01-10 11:23:19 +0100877# strsep() probe
878strsep="no"
879cat > $TMPC << EOF
880#include <string.h>
881int main(int argc, char **argv)
882{
883 strsep(NULL, NULL);
884 return 0;
885}
886EOF
887if compile_prog "" "" "strsep"; then
888 strsep="yes"
889fi
890echo "strsep $strsep"
891
892##########################################
Jens Axboe9ad8da82013-04-05 14:44:03 +0200893# strcasestr() probe
894strcasestr="no"
895cat > $TMPC << EOF
896#include <string.h>
897int main(int argc, char **argv)
898{
Castor Fuaa6738a2013-12-19 23:00:46 -0800899 return strcasestr(argv[0], argv[1]) != NULL;
Jens Axboe9ad8da82013-04-05 14:44:03 +0200900}
901EOF
902if compile_prog "" "" "strcasestr"; then
903 strcasestr="yes"
904fi
905echo "strcasestr $strcasestr"
906
907##########################################
Jens Axboe67bf9822013-01-10 11:23:19 +0100908# getopt_long_only() probe
909getopt_long_only="no"
910cat > $TMPC << EOF
911#include <unistd.h>
912#include <stdio.h>
Castor Fuaa6738a2013-12-19 23:00:46 -0800913#include <getopt.h>
Jens Axboe67bf9822013-01-10 11:23:19 +0100914int main(int argc, char **argv)
915{
916 int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
917 return c;
918}
919EOF
920if compile_prog "" "" "getopt_long_only"; then
921 getopt_long_only="yes"
922fi
923echo "getopt_long_only() $getopt_long_only"
924
925##########################################
926# inet_aton() probe
927inet_aton="no"
928cat > $TMPC << EOF
929#include <sys/socket.h>
930#include <arpa/inet.h>
931#include <stdio.h>
932int main(int argc, char **argv)
933{
934 struct in_addr in;
935 return inet_aton(NULL, &in);
936}
937EOF
938if compile_prog "" "" "inet_aton"; then
939 inet_aton="yes"
940fi
941echo "inet_aton $inet_aton"
942
943##########################################
944# socklen_t probe
945socklen_t="no"
946cat > $TMPC << EOF
Aaron Carrollf6482612013-03-14 16:57:41 +1100947#include <sys/socket.h>
Jens Axboe67bf9822013-01-10 11:23:19 +0100948int main(int argc, char **argv)
949{
950 socklen_t len = 0;
951 return len;
952}
953EOF
954if compile_prog "" "" "socklen_t"; then
955 socklen_t="yes"
956fi
957echo "socklen_t $socklen_t"
958
959##########################################
960# Whether or not __thread is supported for TLS
961tls_thread="no"
962cat > $TMPC << EOF
963#include <stdio.h>
Castor Fuaa6738a2013-12-19 23:00:46 -0800964static __thread int ret;
Jens Axboe67bf9822013-01-10 11:23:19 +0100965int main(int argc, char **argv)
966{
967 return ret;
968}
969EOF
970if compile_prog "" "" "__thread"; then
971 tls_thread="yes"
972fi
973echo "__thread $tls_thread"
974
Jens Axboe91f94d52013-01-24 10:25:42 -0700975##########################################
Jens Axboe2639f052013-04-10 14:41:08 +0200976# Check if we have required gtk/glib support for gfio
Jens Axboe91f94d52013-01-24 10:25:42 -0700977if test "$gfio" = "yes" ; then
978 cat > $TMPC << EOF
979#include <glib.h>
980#include <cairo.h>
981#include <gtk/gtk.h>
982int main(void)
983{
984 gdk_threads_enter();
Jens Axboe91f94d52013-01-24 10:25:42 -0700985 gdk_threads_leave();
Jens Axboeb7a99312013-02-04 12:46:54 +0100986
987 printf("%d", GTK_CHECK_VERSION(2, 18, 0));
Jens Axboe91f94d52013-01-24 10:25:42 -0700988}
989EOF
990GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0)
991if test "$?" != "0" ; then
992 echo "configure: gtk and gthread not found"
993 exit 1
994fi
995GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0)
996if test "$?" != "0" ; then
997 echo "configure: gtk and gthread not found"
998 exit 1
999fi
Jens Axboeb7a99312013-02-04 12:46:54 +01001000if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
1001 r=$($TMPE)
1002 if test "$r" != "0" ; then
1003 gfio="yes"
1004 LIBS="$LIBS $GTK_LIBS"
1005 CFLAGS="$CFLAGS $GTK_CFLAGS"
1006 else
1007 echo "GTK found, but need version 2.18 or higher"
1008 gfio="no"
1009 fi
Jens Axboe91f94d52013-01-24 10:25:42 -07001010else
1011 echo "Please install gtk and gdk libraries"
1012 gfio="no"
1013fi
1014fi
1015
Jens Axboe2639f052013-04-10 14:41:08 +02001016echo "gtk 2.18 or higher $gfio"
Jens Axboe91f94d52013-01-24 10:25:42 -07001017
Jens Axboe44404c52013-01-24 14:20:09 -07001018# Check whether we have getrusage(RUSAGE_THREAD)
1019rusage_thread="no"
1020cat > $TMPC << EOF
1021#include <sys/time.h>
1022#include <sys/resource.h>
1023int main(int argc, char **argv)
1024{
1025 struct rusage ru;
1026 getrusage(RUSAGE_THREAD, &ru);
1027 return 0;
1028}
1029EOF
1030if compile_prog "" "" "RUSAGE_THREAD"; then
1031 rusage_thread="yes"
1032fi
1033echo "RUSAGE_THREAD $rusage_thread"
1034
Jens Axboe7e09a9f2013-01-30 13:58:58 +01001035##########################################
1036# Check whether we have SCHED_IDLE
1037sched_idle="no"
1038cat > $TMPC << EOF
1039#include <sched.h>
1040int main(int argc, char **argv)
1041{
1042 struct sched_param p;
1043 return sched_setscheduler(0, SCHED_IDLE, &p);
1044}
1045EOF
1046if compile_prog "" "" "SCHED_IDLE"; then
1047 sched_idle="yes"
1048fi
1049echo "SCHED_IDLE $sched_idle"
1050
Jens Axboe1eafa372013-01-31 10:19:51 +01001051##########################################
1052# Check whether we have TCP_NODELAY
1053tcp_nodelay="no"
1054cat > $TMPC << EOF
1055#include <stdio.h>
1056#include <sys/types.h>
1057#include <sys/socket.h>
1058#include <netinet/tcp.h>
1059int main(int argc, char **argv)
1060{
1061 return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
1062}
1063EOF
1064if compile_prog "" "" "TCP_NODELAY"; then
1065 tcp_nodelay="yes"
1066fi
1067echo "TCP_NODELAY $tcp_nodelay"
1068
Jens Axboe38b93542013-02-28 08:28:05 +01001069##########################################
1070# Check whether we have RLIMIT_MEMLOCK
1071rlimit_memlock="no"
1072cat > $TMPC << EOF
1073#include <sys/time.h>
1074#include <sys/resource.h>
1075int main(int argc, char **argv)
1076{
1077 struct rlimit rl;
1078 return getrlimit(RLIMIT_MEMLOCK, &rl);
1079}
1080EOF
1081if compile_prog "" "" "RLIMIT_MEMLOCK"; then
1082 rlimit_memlock="yes"
1083fi
1084echo "RLIMIT_MEMLOCK $rlimit_memlock"
1085
Jens Axboe07fc0ac2013-05-16 20:36:57 +02001086##########################################
1087# Check whether we have pwritev/preadv
1088pwritev="no"
1089cat > $TMPC << EOF
1090#include <stdio.h>
1091#include <sys/uio.h>
1092int main(int argc, char **argv)
1093{
1094 return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0);
1095}
1096EOF
1097if compile_prog "" "" "pwritev"; then
1098 pwritev="yes"
1099fi
1100echo "pwritev/preadv $pwritev"
1101
Jens Axboeecad55e2014-01-24 18:56:34 -08001102##########################################
1103# Check whether we have the required functions for ipv6
1104ipv6="no"
1105cat > $TMPC << EOF
1106#include <sys/types.h>
1107#include <sys/socket.h>
Bruce Crand2190282014-02-13 09:06:20 -07001108#include <netinet/in.h>
Jens Axboeecad55e2014-01-24 18:56:34 -08001109#include <netdb.h>
1110#include <stdio.h>
1111int main(int argc, char **argv)
1112{
1113 struct addrinfo hints;
1114 struct in6_addr addr;
1115 int ret;
1116
1117 ret = getaddrinfo(NULL, NULL, &hints, NULL);
1118 freeaddrinfo(NULL);
1119 printf("%s\n", gai_strerror(ret));
1120 addr = in6addr_any;
1121 return 0;
1122}
1123EOF
1124if compile_prog "" "" "ipv6"; then
1125 ipv6="yes"
1126fi
1127echo "IPv6 helpers $ipv6"
Jens Axboe07fc0ac2013-05-16 20:36:57 +02001128
Daniel Gollubfc5c0342014-02-17 14:35:28 +01001129##########################################
1130# check for rbd
1131rbd="no"
1132cat > $TMPC << EOF
1133#include <rbd/librbd.h>
1134
1135int main(int argc, char **argv)
1136{
1137
1138 rados_t cluster;
1139 rados_ioctx_t io_ctx;
1140 const char pool[] = "rbd";
1141
1142 int major, minor, extra;
1143 rbd_version(&major, &minor, &extra);
1144
1145 rados_ioctx_create(cluster, pool, &io_ctx);
1146 return 0;
1147}
1148EOF
1149if compile_prog "" "-lrbd -lrados" "rbd"; then
1150 LIBS="-lrbd -lrados $LIBS"
1151 rbd="yes"
1152fi
1153echo "Rados Block Device engine $rbd"
1154
Jens Axboe2e802282014-04-02 21:47:27 -06001155##########################################
chenh0e55d6b2014-03-27 15:19:43 -04001156# check for gfapi
1157gfapi="no"
Jens Axboe2e802282014-04-02 21:47:27 -06001158cat > $TMPC << EOF
chenh0e55d6b2014-03-27 15:19:43 -04001159#include <glusterfs/api/glfs.h>
1160
Jens Axboe2e802282014-04-02 21:47:27 -06001161int main(int argc, char **argv)
1162{
chenh0e55d6b2014-03-27 15:19:43 -04001163
1164 glfs_t *g = glfs_new("foo");
1165
Jens Axboe2e802282014-04-02 21:47:27 -06001166 return 0;
1167}
1168EOF
chenh0e55d6b2014-03-27 15:19:43 -04001169if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1170 LIBS="-lgfapi -lglusterfs $LIBS"
1171 gfapi="yes"
Jens Axboe2e802282014-04-02 21:47:27 -06001172fi
chenh54fe20f2014-04-08 13:02:26 -04001173 echo "Gluster API engine $gfapi"
chenh0e55d6b2014-03-27 15:19:43 -04001174
chenh54fe20f2014-04-08 13:02:26 -04001175##########################################
1176# check for gfapi fadvise support
1177gf_fadvise="no"
1178cat > $TMPC << EOF
1179#include <glusterfs/api/glfs.h>
1180
1181int main(int argc, char **argv)
1182{
1183 struct glfs_fd *fd;
1184 int ret = glfs_fadvise(fd, 0, 0, 1);
1185
1186 return 0;
1187}
1188EOF
1189
1190if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1191 gf_fadvise="yes"
1192fi
1193echo "Gluster API use fadvise $gf_fadvise"
Daniel Gollubfc5c0342014-02-17 14:35:28 +01001194
Christian Ehrhardt81795ce2014-04-10 15:09:47 +02001195##########################################
1196# Check if we support stckf on s390
1197s390_z196_facilities="no"
1198cat > $TMPC << EOF
1199#define STFLE_BITS_Z196 45 /* various z196 facilities ... */
1200int main(int argc, char **argv)
1201{
1202 /* We want just 1 double word to be returned. */
1203 register unsigned long reg0 asm("0") = 0;
1204 unsigned long stfle_bits;
1205 asm volatile(".machine push" "\n\t"
1206 ".machine \"z9-109\"" "\n\t"
1207 "stfle %0" "\n\t"
1208 ".machine pop" "\n"
1209 : "=QS" (stfle_bits), "+d" (reg0)
1210 : : "cc");
1211
1212 if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0)
1213 return 0;
1214 else
1215 return -1;
1216}
1217EOF
1218if compile_prog "" "" "s390_z196_facilities"; then
1219 $TMPE
1220 if [[ $? -eq 0 ]]; then
1221 s390_z196_facilities="yes"
1222 fi
1223fi
1224echo "s390_z196_facilities $s390_z196_facilities"
Jens Axboe67bf9822013-01-10 11:23:19 +01001225#############################################################################
1226
Jens Axboe67bf9822013-01-10 11:23:19 +01001227if test "$wordsize" = "64" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001228 output_sym "CONFIG_64BIT"
Jens Axboe67bf9822013-01-10 11:23:19 +01001229elif test "$wordsize" = "32" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001230 output_sym "CONFIG_32BIT"
Jens Axboe67bf9822013-01-10 11:23:19 +01001231else
Jens Axboed7145a72013-02-11 13:21:54 +01001232 fatal "Unknown wordsize!"
Jens Axboe67bf9822013-01-10 11:23:19 +01001233fi
Jens Axboe0dcebdf2013-01-23 15:42:16 -07001234if test "$bigendian" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001235 output_sym "CONFIG_BIG_ENDIAN"
Jens Axboe0dcebdf2013-01-23 15:42:16 -07001236else
Jens Axboe4feafb12013-01-24 23:07:55 -07001237 output_sym "CONFIG_LITTLE_ENDIAN"
Jens Axboe0dcebdf2013-01-23 15:42:16 -07001238fi
Jens Axboe3989b142013-04-12 13:13:24 +02001239if test "$zlib" = "yes" ; then
1240 output_sym "CONFIG_ZLIB"
1241fi
Jens Axboe67bf9822013-01-10 11:23:19 +01001242if test "$libaio" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001243 output_sym "CONFIG_LIBAIO"
Jens Axboe67bf9822013-01-10 11:23:19 +01001244fi
1245if test "$posix_aio" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001246 output_sym "CONFIG_POSIXAIO"
Jens Axboe67bf9822013-01-10 11:23:19 +01001247fi
1248if test "$posix_aio_fsync" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001249 output_sym "CONFIG_POSIXAIO_FSYNC"
Jens Axboe67bf9822013-01-10 11:23:19 +01001250fi
1251if test "$linux_fallocate" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001252 output_sym "CONFIG_LINUX_FALLOCATE"
Jens Axboe67bf9822013-01-10 11:23:19 +01001253fi
1254if test "$posix_fallocate" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001255 output_sym "CONFIG_POSIX_FALLOCATE"
Jens Axboe67bf9822013-01-10 11:23:19 +01001256fi
1257if test "$fdatasync" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001258 output_sym "CONFIG_FDATASYNC"
Jens Axboe67bf9822013-01-10 11:23:19 +01001259fi
1260if test "$sync_file_range" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001261 output_sym "CONFIG_SYNC_FILE_RANGE"
Jens Axboe67bf9822013-01-10 11:23:19 +01001262fi
1263if test "$sfaa" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001264 output_sym "CONFIG_SFAA"
Jens Axboe67bf9822013-01-10 11:23:19 +01001265fi
Yufei Ren954cd732013-07-22 20:58:05 -06001266if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001267 output_sym "CONFIG_RDMA"
Jens Axboe67bf9822013-01-10 11:23:19 +01001268fi
1269if test "$clock_gettime" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001270 output_sym "CONFIG_CLOCK_GETTIME"
Jens Axboe67bf9822013-01-10 11:23:19 +01001271fi
1272if test "$clock_monotonic" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001273 output_sym "CONFIG_CLOCK_MONOTONIC"
Jens Axboe67bf9822013-01-10 11:23:19 +01001274fi
1275if test "$clock_monotonic_precise" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001276 output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
Jens Axboe67bf9822013-01-10 11:23:19 +01001277fi
1278if test "$gettimeofday" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001279 output_sym "CONFIG_GETTIMEOFDAY"
Jens Axboe67bf9822013-01-10 11:23:19 +01001280fi
1281if test "$posix_fadvise" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001282 output_sym "CONFIG_POSIX_FADVISE"
Jens Axboe67bf9822013-01-10 11:23:19 +01001283fi
1284if test "$linux_3arg_affinity" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001285 output_sym "CONFIG_3ARG_AFFINITY"
Jens Axboe67bf9822013-01-10 11:23:19 +01001286elif test "$linux_2arg_affinity" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001287 output_sym "CONFIG_2ARG_AFFINITY"
Jens Axboe67bf9822013-01-10 11:23:19 +01001288fi
1289if test "$strsep" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001290 output_sym "CONFIG_STRSEP"
Jens Axboe67bf9822013-01-10 11:23:19 +01001291fi
Jens Axboe9ad8da82013-04-05 14:44:03 +02001292if test "$strcasestr" = "yes" ; then
1293 output_sym "CONFIG_STRCASESTR"
1294fi
Jens Axboe67bf9822013-01-10 11:23:19 +01001295if test "$getopt_long_only" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001296 output_sym "CONFIG_GETOPT_LONG_ONLY"
Jens Axboe67bf9822013-01-10 11:23:19 +01001297fi
1298if test "$inet_aton" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001299 output_sym "CONFIG_INET_ATON"
Jens Axboe67bf9822013-01-10 11:23:19 +01001300fi
1301if test "$socklen_t" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001302 output_sym "CONFIG_SOCKLEN_T"
Jens Axboe67bf9822013-01-10 11:23:19 +01001303fi
1304if test "$ext4_me" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001305 output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
Jens Axboe67bf9822013-01-10 11:23:19 +01001306fi
1307if test "$linux_splice" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001308 output_sym "CONFIG_LINUX_SPLICE"
Jens Axboe67bf9822013-01-10 11:23:19 +01001309fi
1310if test "$guasi" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001311 output_sym "CONFIG_GUASI"
Jens Axboe67bf9822013-01-10 11:23:19 +01001312fi
1313if test "$fusion_aw" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001314 output_sym "CONFIG_FUSION_AW"
Jens Axboe67bf9822013-01-10 11:23:19 +01001315fi
Jens Axboe50206d92013-03-25 13:20:08 -06001316if test "$libnuma_v2" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001317 output_sym "CONFIG_LIBNUMA"
Jens Axboe67bf9822013-01-10 11:23:19 +01001318fi
1319if test "$solaris_aio" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001320 output_sym "CONFIG_SOLARISAIO"
Jens Axboe67bf9822013-01-10 11:23:19 +01001321fi
1322if test "$tls_thread" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001323 output_sym "CONFIG_TLS_THREAD"
Jens Axboe67bf9822013-01-10 11:23:19 +01001324fi
Jens Axboe44404c52013-01-24 14:20:09 -07001325if test "$rusage_thread" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001326 output_sym "CONFIG_RUSAGE_THREAD"
Jens Axboe67bf9822013-01-10 11:23:19 +01001327fi
Jens Axboe91f94d52013-01-24 10:25:42 -07001328if test "$gfio" = "yes" ; then
1329 echo "CONFIG_GFIO=y" >> $config_host_mak
1330fi
Jens Axboeef7035a2014-06-18 15:30:09 -07001331if test "$esx" = "yes" ; then
1332 output_sym "CONFIG_ESX"
1333 output_sym "CONFIG_NO_SHM"
1334fi
Jens Axboe7e09a9f2013-01-30 13:58:58 +01001335if test "$sched_idle" = "yes" ; then
1336 output_sym "CONFIG_SCHED_IDLE"
1337fi
Jens Axboe1eafa372013-01-31 10:19:51 +01001338if test "$tcp_nodelay" = "yes" ; then
1339 output_sym "CONFIG_TCP_NODELAY"
1340fi
Jens Axboe38b93542013-02-28 08:28:05 +01001341if test "$rlimit_memlock" = "yes" ; then
1342 output_sym "CONFIG_RLIMIT_MEMLOCK"
1343fi
Jens Axboe07fc0ac2013-05-16 20:36:57 +02001344if test "$pwritev" = "yes" ; then
1345 output_sym "CONFIG_PWRITEV"
1346fi
Jens Axboeecad55e2014-01-24 18:56:34 -08001347if test "$ipv6" = "yes" ; then
1348 output_sym "CONFIG_IPV6"
1349fi
Daniel Gollubfc5c0342014-02-17 14:35:28 +01001350if test "$rbd" = "yes" ; then
1351 output_sym "CONFIG_RBD"
1352fi
Jens Axboe2e802282014-04-02 21:47:27 -06001353if test "$setvbuf" = "yes" ; then
1354 output_sym "CONFIG_SETVBUF"
1355fi
Christian Ehrhardt81795ce2014-04-10 15:09:47 +02001356if test "$s390_z196_facilities" = "yes" ; then
1357 output_sym "CONFIG_S390_Z196_FACILITIES"
1358 CFLAGS="$CFLAGS -march=z9-109"
1359fi
chenh0e55d6b2014-03-27 15:19:43 -04001360if test "$gfapi" = "yes" ; then
1361 output_sym "CONFIG_GFAPI"
1362fi
chenh54fe20f2014-04-08 13:02:26 -04001363if test "$gf_fadvise" = "yes" ; then
1364 output_sym "CONFIG_GF_FADVISE"
1365fi
Jens Axboe67bf9822013-01-10 11:23:19 +01001366
1367echo "LIBS+=$LIBS" >> $config_host_mak
Jens Axboe91f94d52013-01-24 10:25:42 -07001368echo "CFLAGS+=$CFLAGS" >> $config_host_mak
Jens Axboe67bf9822013-01-10 11:23:19 +01001369echo "CC=$cc" >> $config_host_mak
Jens Axboeaf4862b2013-03-29 08:55:32 -06001370echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak