blob: 5fd0c50c4beece572769b0aa5fa49c3e094ed0e2 [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 ;;
Tiziano Mülleraa48efe2014-06-26 14:20:20 +0200159 --disable-rbd) disable_rbd="yes"
160 ;;
161 --disable-gfapi) disable_gfapi="yes"
162 ;;
Jens Axboe827da4f2013-01-24 10:27:26 -0700163 --help)
Jens Axboe47f44632013-01-24 10:34:14 -0700164 show_help="yes"
Jens Axboe827da4f2013-01-24 10:27:26 -0700165 ;;
Jens Axboecb1125b2013-01-23 13:47:54 -0700166 *)
167 echo "Bad option $opt"
Jens Axboe47f44632013-01-24 10:34:14 -0700168 show_help="yes"
169 exit_val=1
Jens Axboecb1125b2013-01-23 13:47:54 -0700170 esac
171done
172
Jens Axboe47f44632013-01-24 10:34:14 -0700173if test "$show_help" = "yes" ; then
Jens Axboe8b156d82013-02-10 15:48:34 +0100174 echo "--cpu= Specify target CPU if auto-detect fails"
Jens Axboeb7a99312013-02-04 12:46:54 +0100175 echo "--cc= Specify compiler to use"
Jens Axboe899fab32013-01-29 10:06:30 +0100176 echo "--extra-cflags= Specify extra CFLAGS to pass to compiler"
Jens Axboeb7c12792013-05-01 13:00:26 +0200177 echo "--build-32bit-win Enable 32-bit build on Windows"
Jens Axboeef7035a2014-06-18 15:30:09 -0700178 echo "--esx Configure build options for esx"
Jens Axboeb7a99312013-02-04 12:46:54 +0100179 echo "--enable-gfio Enable building of gtk gfio"
Castor Fu44462512013-10-31 11:00:54 -0600180 echo "--disable-numa Disable libnuma even if found"
Jens Axboeb7a99312013-02-04 12:46:54 +0100181 exit $exit_val
Jens Axboe47f44632013-01-24 10:34:14 -0700182fi
183
Stefan Hajnoczi47986332014-03-06 18:41:58 +0100184cross_prefix=${cross_prefix-${CROSS_COMPILE}}
185cc="${CC-${cross_prefix}gcc}"
186
Aaron Carroll6d0e9f82013-02-12 09:58:14 +0100187if check_define __ANDROID__ ; then
188 targetos="Android"
189elif check_define __linux__ ; then
Jens Axboe67bf9822013-01-10 11:23:19 +0100190 targetos="Linux"
Jens Axboe67bf9822013-01-10 11:23:19 +0100191elif check_define __OpenBSD__ ; then
192 targetos='OpenBSD'
193elif check_define __sun__ ; then
194 targetos='SunOS'
Jens Axboe7cb024f2013-11-06 15:37:35 -0700195 CFLAGS="$CFLAGS -D_REENTRANT"
Stefan Hajnoczib24f59a2014-03-06 18:41:59 +0100196elif check_define _WIN32 ; then
197 targetos='CYGWIN'
Jens Axboe67bf9822013-01-10 11:23:19 +0100198else
199 targetos=`uname -s`
200fi
201
Aaron Carroll53cd4ee2013-03-14 16:57:38 +1100202echo "# Automatically generated by configure - do not modify" > $config_host_mak
203printf "# Configured with:" >> $config_host_mak
204printf " '%s'" "$0" "$@" >> $config_host_mak
205echo >> $config_host_mak
206echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak
207
Jens Axboe67bf9822013-01-10 11:23:19 +0100208# Some host OSes need non-standard checks for which CPU to use.
209# Note that these checks are broken for cross-compilation: if you're
210# cross-compiling to one of these OSes then you'll need to specify
211# the correct CPU with the --cpu option.
212case $targetos in
213Darwin)
214 # on Leopard most of the system is 32-bit, so we have to ask the kernel if
215 # we can run 64-bit userspace code.
216 # If the user didn't specify a CPU explicitly and the kernel says this is
217 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual
218 # detection code.
219 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
220 cpu="x86_64"
221 fi
222 ;;
223SunOS)
224 # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
225 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
226 cpu="x86_64"
227 fi
Jens Axboeadaa46d2013-02-28 22:10:22 +0100228 LIBS="-lnsl -lsocket"
Jens Axboecfd94f72013-01-23 16:23:48 -0700229 ;;
230CYGWIN*)
231 echo "Forcing known good options on Windows"
Jens Axboe4578d012013-01-23 16:26:12 -0700232 if test -z "$CC" ; then
Huadong Liu74097112013-02-05 08:43:14 +0100233 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
234 CC="i686-w64-mingw32-gcc"
235 else
236 CC="x86_64-w64-mingw32-gcc"
237 fi
Jens Axboe4578d012013-01-23 16:26:12 -0700238 fi
Jens Axboe4feafb12013-01-24 23:07:55 -0700239 output_sym "CONFIG_LITTLE_ENDIAN"
Huadong Liu74097112013-02-05 08:43:14 +0100240 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
241 output_sym "CONFIG_32BIT"
242 else
243 output_sym "CONFIG_64BIT_LLP64"
244 fi
Jens Axboe4feafb12013-01-24 23:07:55 -0700245 output_sym "CONFIG_FADVISE"
246 output_sym "CONFIG_SOCKLEN_T"
Jens Axboe4feafb12013-01-24 23:07:55 -0700247 output_sym "CONFIG_FADVISE"
248 output_sym "CONFIG_SFAA"
249 output_sym "CONFIG_RUSAGE_THREAD"
250 output_sym "CONFIG_WINDOWSAIO"
251 output_sym "CONFIG_FDATASYNC"
Bruce Cran59308a62013-02-02 20:59:31 +0000252 output_sym "CONFIG_CLOCK_MONOTONIC"
Bruce Crandc0518c2013-01-28 16:07:15 +0000253 output_sym "CONFIG_GETTIMEOFDAY"
254 output_sym "CONFIG_CLOCK_GETTIME"
Jens Axboe7e09a9f2013-01-30 13:58:58 +0100255 output_sym "CONFIG_SCHED_IDLE"
Jens Axboe1eafa372013-01-31 10:19:51 +0100256 output_sym "CONFIG_TCP_NODELAY"
Bruce Cran7d6be132013-11-07 14:04:00 +0000257 output_sym "CONFIG_TLS_THREAD"
Bruce Cranef07baa2014-01-28 17:34:08 -0700258 output_sym "CONFIG_IPV6"
Jens Axboe4feafb12013-01-24 23:07:55 -0700259 echo "CC=$CC" >> $config_host_mak
Jens Axboeaf4862b2013-03-29 08:55:32 -0600260 echo "BUILD_CFLAGS=$CFLAGS -include config-host.h -D_GNU_SOURCE" >> $config_host_mak
Jens Axboecfd94f72013-01-23 16:23:48 -0700261 exit 0
Aaron Carroll6d0e9f82013-02-12 09:58:14 +0100262 ;;
Jens Axboe67bf9822013-01-10 11:23:19 +0100263esac
264
265if test ! -z "$cpu" ; then
266 # command line argument
267 :
268elif check_define __i386__ ; then
269 cpu="i386"
270elif check_define __x86_64__ ; then
271 cpu="x86_64"
272elif check_define __sparc__ ; then
273 if check_define __arch64__ ; then
274 cpu="sparc64"
275 else
276 cpu="sparc"
277 fi
278elif check_define _ARCH_PPC ; then
279 if check_define _ARCH_PPC64 ; then
280 cpu="ppc64"
281 else
282 cpu="ppc"
283 fi
284elif check_define __mips__ ; then
285 cpu="mips"
286elif check_define __ia64__ ; then
287 cpu="ia64"
288elif check_define __s390__ ; then
289 if check_define __s390x__ ; then
290 cpu="s390x"
291 else
292 cpu="s390"
293 fi
294elif check_define __arm__ ; then
295 cpu="arm"
296elif check_define __hppa__ ; then
297 cpu="hppa"
298else
299 cpu=`uname -m`
300fi
301
302# Normalise host CPU name and set ARCH.
303case "$cpu" in
304 ia64|ppc|ppc64|s390|s390x|sparc64)
305 cpu="$cpu"
306 ;;
307 i386|i486|i586|i686|i86pc|BePC)
308 cpu="i386"
309 ;;
310 x86_64|amd64)
311 cpu="x86_64"
312 ;;
313 armv*b|armv*l|arm)
314 cpu="arm"
315 ;;
316 hppa|parisc|parisc64)
317 cpu="hppa"
318 ;;
319 mips*)
320 cpu="mips"
321 ;;
322 sparc|sun4[cdmuv])
323 cpu="sparc"
324 ;;
325 *)
Jens Axboe8b156d82013-02-10 15:48:34 +0100326 echo "Unknown CPU"
Jens Axboe67bf9822013-01-10 11:23:19 +0100327 ;;
328esac
329
Jens Axboedcbbf5b2013-01-25 14:35:27 -0700330if test -z "$CC" ; then
Jens Axboe67bf9822013-01-10 11:23:19 +0100331 if test "$targetos" = "FreeBSD"; then
332 if has clang; then
333 CC=clang
334 else
335 CC=gcc
336 fi
Jens Axboe67bf9822013-01-10 11:23:19 +0100337 fi
338fi
339
340cc="${CC-${cross_prefix}gcc}"
341
Jens Axboe0dcebdf2013-01-23 15:42:16 -0700342##########################################
Aaron Carroll1a17cfd2013-03-14 16:57:40 +1100343# check cross compile
344
345cross_compile="no"
346cat > $TMPC <<EOF
347int main(void)
348{
349 return 0;
350}
351EOF
352if compile_prog "" "" "cross"; then
353 $TMPE 2>/dev/null || cross_compile="yes"
354else
355 fatal "compile test failed"
356fi
357
358##########################################
Jens Axboe0dcebdf2013-01-23 15:42:16 -0700359# check endianness
360bigendian="no"
Aaron Carroll1a17cfd2013-03-14 16:57:40 +1100361if test "$cross_compile" = "no" ; then
362 cat > $TMPC <<EOF
Jens Axboe0dcebdf2013-01-23 15:42:16 -0700363#include <inttypes.h>
364int main(void)
365{
366 volatile uint32_t i=0x01234567;
367 return (*((uint8_t*)(&i))) == 0x67;
368}
369EOF
Aaron Carroll1a17cfd2013-03-14 16:57:40 +1100370 if compile_prog "" "" "endian"; then
371 $TMPE && bigendian="yes"
372 fi
373else
374 # If we're cross compiling, try our best to work it out and rely on the
375 # run-time check to fail if we get it wrong.
376 cat > $TMPC <<EOF
377#include <endian.h>
378int main(void)
379{
380#if __BYTE_ORDER != __BIG_ENDIAN
381# error "Unknown endianness"
382#endif
383}
384EOF
385 compile_prog "" "" "endian" && bigendian="yes"
386 check_define "__ARMEB__" && bigendian="yes"
387 check_define "__MIPSEB__" && bigendian="yes"
Jens Axboe0dcebdf2013-01-23 15:42:16 -0700388fi
389
390
Jens Axboe67bf9822013-01-10 11:23:19 +0100391echo "Operating system $targetos"
392echo "CPU $cpu"
Jens Axboe0dcebdf2013-01-23 15:42:16 -0700393echo "Big endian $bigendian"
Jens Axboe67bf9822013-01-10 11:23:19 +0100394echo "Compiler $cc"
Aaron Carroll1a17cfd2013-03-14 16:57:40 +1100395echo "Cross compile $cross_compile"
Jens Axboe67bf9822013-01-10 11:23:19 +0100396echo
397
398##########################################
399# check for wordsize
400wordsize="0"
401cat > $TMPC <<EOF
Aaron Carroll142429e2013-03-14 16:57:39 +1100402#include <limits.h>
403#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
Jens Axboe67bf9822013-01-10 11:23:19 +0100404int main(void)
405{
Aaron Carroll142429e2013-03-14 16:57:39 +1100406 BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE);
Jens Axboe67bf9822013-01-10 11:23:19 +0100407 return 0;
408}
409EOF
Aaron Carroll142429e2013-03-14 16:57:39 +1100410if compile_prog "-DWORDSIZE=32" "" "wordsize"; then
411 wordsize="32"
412elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then
413 wordsize="64"
414else
415 fatal "Unknown wordsize"
Jens Axboe67bf9822013-01-10 11:23:19 +0100416fi
417echo "Wordsize $wordsize"
418
419##########################################
Jens Axboea9bca4a2013-04-05 12:55:42 +0200420# zlib probe
421zlib="no"
422cat > $TMPC <<EOF
Jens Axboe31c9cd42014-07-03 14:17:02 -0600423#include <zlib.h>
Jens Axboea9bca4a2013-04-05 12:55:42 +0200424int main(void)
425{
426 z_stream stream;
427 if (inflateInit(&stream) != Z_OK)
428 return 1;
429 return 0;
430}
431EOF
432if compile_prog "" "-lz" "zlib" ; then
433 zlib=yes
434 LIBS="-lz $LIBS"
Jens Axboea9bca4a2013-04-05 12:55:42 +0200435fi
436echo "zlib $zlib"
437
438##########################################
Jens Axboe67bf9822013-01-10 11:23:19 +0100439# linux-aio probe
440libaio="no"
441cat > $TMPC <<EOF
442#include <libaio.h>
443#include <stddef.h>
444int main(void)
445{
446 io_setup(0, NULL);
447 return 0;
448}
449EOF
450if compile_prog "" "-laio" "libaio" ; then
451 libaio=yes
452 LIBS="-laio $LIBS"
453else
454 if test "$libaio" = "yes" ; then
Jens Axboec55d7282013-04-12 10:16:43 +0200455 feature_not_found "linux AIO" "libaio-dev or libaio-devel"
Jens Axboe67bf9822013-01-10 11:23:19 +0100456 fi
457 libaio=no
458fi
459echo "Linux AIO support $libaio"
460
461##########################################
462# posix aio probe
463posix_aio="no"
464posix_aio_lrt="no"
465cat > $TMPC <<EOF
466#include <aio.h>
467int main(void)
468{
469 struct aiocb cb;
470 aio_read(&cb);
471 return 0;
472}
473EOF
474if compile_prog "" "" "posixaio" ; then
475 posix_aio="yes"
476elif compile_prog "" "-lrt" "posixaio"; then
477 posix_aio="yes"
478 posix_aio_lrt="yes"
479 LIBS="-lrt $LIBS"
480fi
481echo "POSIX AIO support $posix_aio"
482echo "POSIX AIO support needs -lrt $posix_aio_lrt"
483
484##########################################
485# posix aio fsync probe
486posix_aio_fsync="no"
487if test "$posix_aio" = "yes" ; then
488 cat > $TMPC <<EOF
489#include <fcntl.h>
490#include <aio.h>
491int main(void)
492{
493 struct aiocb cb;
494 return aio_fsync(O_SYNC, &cb);
495 return 0;
496}
497EOF
498 if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
499 posix_aio_fsync=yes
500 fi
501fi
502echo "POSIX AIO fsync $posix_aio_fsync"
503
504##########################################
505# solaris aio probe
506solaris_aio="no"
507cat > $TMPC <<EOF
508#include <sys/types.h>
509#include <sys/asynch.h>
510#include <unistd.h>
511int main(void)
512{
513 aio_result_t res;
514 return aioread(0, NULL, 0, 0, SEEK_SET, &res);
515 return 0;
516}
517EOF
518if compile_prog "" "-laio" "solarisaio" ; then
519 solaris_aio=yes
520 LIBS="-laio $LIBS"
521fi
522echo "Solaris AIO support $solaris_aio"
523
524##########################################
525# __sync_fetch_and_and test
526sfaa="no"
527cat > $TMPC << EOF
528static int sfaa(int *ptr)
529{
Jens Axboe9c639a72013-02-28 22:13:29 +0100530 return __sync_fetch_and_add(ptr, 0);
Jens Axboe67bf9822013-01-10 11:23:19 +0100531}
532
533int main(int argc, char **argv)
534{
535 int val = 42;
536 sfaa(&val);
537 return val;
538}
539EOF
540if compile_prog "" "" "__sync_fetch_and_add()" ; then
541 sfaa="yes"
542fi
Jens Axboe9c639a72013-02-28 22:13:29 +0100543echo "__sync_fetch_and_add $sfaa"
Jens Axboe67bf9822013-01-10 11:23:19 +0100544
545##########################################
546# libverbs probe
547libverbs="no"
548cat > $TMPC << EOF
549#include <stdio.h>
550#include <infiniband/arch.h>
551int main(int argc, char **argv)
552{
553 struct ibv_pd *pd = ibv_alloc_pd(NULL);
554 return 0;
555}
556EOF
557if compile_prog "" "-libverbs" "libverbs" ; then
558 libverbs="yes"
559 LIBS="-libverbs $LIBS"
560fi
561echo "libverbs $libverbs"
562
563##########################################
564# rdmacm probe
565rdmacm="no"
566cat > $TMPC << EOF
567#include <stdio.h>
568#include <rdma/rdma_cma.h>
569int main(int argc, char **argv)
570{
571 rdma_destroy_qp(NULL);
572 return 0;
573}
574EOF
575if compile_prog "" "-lrdmacm" "rdma"; then
576 rdmacm="yes"
577 LIBS="-lrdmacm $LIBS"
578fi
579echo "rdmacm $rdmacm"
580
581##########################################
582# Linux fallocate probe
583linux_fallocate="no"
584cat > $TMPC << EOF
585#include <stdio.h>
Castor Fuaa6738a2013-12-19 23:00:46 -0800586#include <fcntl.h>
Jens Axboe67bf9822013-01-10 11:23:19 +0100587#include <linux/falloc.h>
588int main(int argc, char **argv)
589{
590 int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
591 return r;
592}
593EOF
594if compile_prog "" "" "linux_fallocate"; then
595 linux_fallocate="yes"
596fi
597echo "Linux fallocate $linux_fallocate"
598
599##########################################
600# POSIX fadvise probe
601posix_fadvise="no"
602cat > $TMPC << EOF
603#include <stdio.h>
604#include <fcntl.h>
605int main(int argc, char **argv)
606{
607 int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
608 return r;
609}
610EOF
611if compile_prog "" "" "posix_fadvise"; then
612 posix_fadvise="yes"
613fi
614echo "POSIX fadvise $posix_fadvise"
615
616##########################################
617# POSIX fallocate probe
618posix_fallocate="no"
619cat > $TMPC << EOF
620#include <stdio.h>
621#include <fcntl.h>
622int main(int argc, char **argv)
623{
624 int r = posix_fallocate(0, 0, 1024);
625 return r;
626}
627EOF
628if compile_prog "" "" "posix_fallocate"; then
629 posix_fallocate="yes"
630fi
631echo "POSIX fallocate $posix_fallocate"
632
633##########################################
634# sched_set/getaffinity 2 or 3 argument test
635linux_2arg_affinity="no"
636linux_3arg_affinity="no"
637cat > $TMPC << EOF
Jens Axboe67bf9822013-01-10 11:23:19 +0100638#include <sched.h>
639int main(int argc, char **argv)
640{
641 cpu_set_t mask;
642 return sched_setaffinity(0, sizeof(mask), &mask);
643}
644EOF
645if compile_prog "" "" "sched_setaffinity(,,)"; then
646 linux_3arg_affinity="yes"
647else
648 cat > $TMPC << EOF
Jens Axboe67bf9822013-01-10 11:23:19 +0100649#include <sched.h>
650int main(int argc, char **argv)
651{
652 cpu_set_t mask;
653 return sched_setaffinity(0, &mask);
654}
655EOF
656 if compile_prog "" "" "sched_setaffinity(,)"; then
657 linux_2arg_affinity="yes"
658 fi
659fi
660echo "sched_setaffinity(3 arg) $linux_3arg_affinity"
661echo "sched_setaffinity(2 arg) $linux_2arg_affinity"
662
663##########################################
664# clock_gettime probe
665clock_gettime="no"
666cat > $TMPC << EOF
667#include <stdio.h>
668#include <time.h>
669int main(int argc, char **argv)
670{
671 return clock_gettime(0, NULL);
672}
673EOF
674if compile_prog "" "" "clock_gettime"; then
675 clock_gettime="yes"
676elif compile_prog "" "-lrt" "clock_gettime"; then
677 clock_gettime="yes"
678 LIBS="-lrt $LIBS"
679fi
680echo "clock_gettime $clock_gettime"
681
682##########################################
683# CLOCK_MONOTONIC probe
684clock_monotonic="no"
685if test "$clock_gettime" = "yes" ; then
686 cat > $TMPC << EOF
687#include <stdio.h>
688#include <time.h>
689int main(int argc, char **argv)
690{
691 return clock_gettime(CLOCK_MONOTONIC, NULL);
692}
693EOF
694 if compile_prog "" "$LIBS" "clock monotonic"; then
695 clock_monotonic="yes"
696 fi
697fi
698echo "CLOCK_MONOTONIC $clock_monotonic"
699
700##########################################
701# CLOCK_MONOTONIC_PRECISE probe
702clock_monotonic_precise="no"
703if test "$clock_gettime" = "yes" ; then
704 cat > $TMPC << EOF
705#include <stdio.h>
706#include <time.h>
707int main(int argc, char **argv)
708{
709 return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
710}
711EOF
712 if compile_prog "" "$LIBS" "clock monotonic precise"; then
713 clock_monotonic_precise="yes"
714 fi
715fi
716echo "CLOCK_MONOTONIC_PRECISE $clock_monotonic_precise"
717
718##########################################
719# gettimeofday() probe
720gettimeofday="no"
721cat > $TMPC << EOF
722#include <sys/time.h>
723#include <stdio.h>
724int main(int argc, char **argv)
725{
726 struct timeval tv;
727 return gettimeofday(&tv, NULL);
728}
729EOF
730if compile_prog "" "" "gettimeofday"; then
731 gettimeofday="yes"
732fi
733echo "gettimeofday $gettimeofday"
734
735##########################################
736# fdatasync() probe
737fdatasync="no"
738cat > $TMPC << EOF
739#include <stdio.h>
740#include <unistd.h>
741int main(int argc, char **argv)
742{
743 return fdatasync(0);
744}
745EOF
746if compile_prog "" "" "fdatasync"; then
747 fdatasync="yes"
748fi
749echo "fdatasync $fdatasync"
750
751##########################################
752# sync_file_range() probe
753sync_file_range="no"
754cat > $TMPC << EOF
755#include <stdio.h>
756#include <unistd.h>
Jens Axboe67bf9822013-01-10 11:23:19 +0100757#include <fcntl.h>
758#include <linux/fs.h>
759int main(int argc, char **argv)
760{
761 unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
762 SYNC_FILE_RANGE_WAIT_AFTER;
763 return sync_file_range(0, 0, 0, flags);
764}
765EOF
766if compile_prog "" "" "sync_file_range"; then
767 sync_file_range="yes"
768fi
769echo "sync_file_range $sync_file_range"
770
771##########################################
772# ext4 move extent probe
773ext4_me="no"
774cat > $TMPC << EOF
775#include <fcntl.h>
776#include <sys/ioctl.h>
777int main(int argc, char **argv)
778{
779 struct move_extent me;
780 return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
781}
782EOF
Jens Axboec7165b82013-01-12 10:27:53 +0100783if compile_prog "" "" "ext4 move extent" ; then
784 ext4_me="yes"
785elif test $targetos = "Linux" ; then
786 # On Linux, just default to it on and let it error at runtime if we really
787 # don't have it. None of my updated systems have it defined, but it does
788 # work. Takes a while to bubble back.
Jens Axboe67bf9822013-01-10 11:23:19 +0100789 ext4_me="yes"
790fi
791echo "EXT4 move extent $ext4_me"
792
793##########################################
794# splice probe
795linux_splice="no"
796cat > $TMPC << EOF
Jens Axboe67bf9822013-01-10 11:23:19 +0100797#include <stdio.h>
798#include <fcntl.h>
799int main(int argc, char **argv)
800{
801 return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
802}
803EOF
804if compile_prog "" "" "linux splice"; then
805 linux_splice="yes"
806fi
807echo "Linux splice(2) $linux_splice"
808
809##########################################
810# GUASI probe
811guasi="no"
812cat > $TMPC << EOF
813#include <guasi.h>
814#include <guasi_syscalls.h>
815int main(int argc, char **argv)
816{
817 guasi_t ctx = guasi_create(0, 0, 0);
818 return 0;
819}
820EOF
821if compile_prog "" "" "guasi"; then
822 guasi="yes"
823fi
824echo "GUASI $guasi"
825
826##########################################
827# fusion-aw probe
828fusion_aw="no"
829cat > $TMPC << EOF
Santhosh Koundinyab2c77c22013-05-18 08:44:01 +0200830#include <nvm/nvm_primitives.h>
Jens Axboe67bf9822013-01-10 11:23:19 +0100831int main(int argc, char **argv)
832{
Santhosh Koundinyab2c77c22013-05-18 08:44:01 +0200833 nvm_version_t ver_info;
834 nvm_handle_t handle;
835
836 handle = nvm_get_handle(0, &ver_info);
837 return nvm_atomic_write(handle, 0, 0, 0);
Jens Axboe67bf9822013-01-10 11:23:19 +0100838}
839EOF
Santhosh Koundinyab2c77c22013-05-18 08:44:01 +0200840if compile_prog "" "-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -lvsl -ldl" "fusion-aw"; then
841 LIBS="-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -lvsl -ldl $LIBS"
Jens Axboe67bf9822013-01-10 11:23:19 +0100842 fusion_aw="yes"
843fi
844echo "Fusion-io atomic engine $fusion_aw"
845
846##########################################
847# libnuma probe
848libnuma="no"
849cat > $TMPC << EOF
850#include <numa.h>
851int main(int argc, char **argv)
852{
853 return numa_available();
854}
855EOF
Castor Fu44462512013-10-31 11:00:54 -0600856if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then
Jens Axboe67bf9822013-01-10 11:23:19 +0100857 libnuma="yes"
858 LIBS="-lnuma $LIBS"
859fi
860echo "libnuma $libnuma"
861
862##########################################
Jens Axboe50206d92013-03-25 13:20:08 -0600863# libnuma 2.x version API
864if test "$libnuma" = "yes" ; then
865libnuma_v2="no"
866cat > $TMPC << EOF
867#include <numa.h>
868int main(int argc, char **argv)
869{
870 struct bitmask *mask = numa_parse_nodestring(NULL);
871 return 0;
872}
873EOF
874if compile_prog "" "" "libnuma api"; then
875 libnuma_v2="yes"
876fi
877echo "libnuma v2 $libnuma_v2"
878fi
879
880##########################################
Jens Axboe67bf9822013-01-10 11:23:19 +0100881# strsep() probe
882strsep="no"
883cat > $TMPC << EOF
884#include <string.h>
885int main(int argc, char **argv)
886{
887 strsep(NULL, NULL);
888 return 0;
889}
890EOF
891if compile_prog "" "" "strsep"; then
892 strsep="yes"
893fi
894echo "strsep $strsep"
895
896##########################################
Jens Axboe9ad8da82013-04-05 14:44:03 +0200897# strcasestr() probe
898strcasestr="no"
899cat > $TMPC << EOF
900#include <string.h>
901int main(int argc, char **argv)
902{
Castor Fuaa6738a2013-12-19 23:00:46 -0800903 return strcasestr(argv[0], argv[1]) != NULL;
Jens Axboe9ad8da82013-04-05 14:44:03 +0200904}
905EOF
906if compile_prog "" "" "strcasestr"; then
907 strcasestr="yes"
908fi
909echo "strcasestr $strcasestr"
910
911##########################################
Jens Axboe67bf9822013-01-10 11:23:19 +0100912# getopt_long_only() probe
913getopt_long_only="no"
914cat > $TMPC << EOF
915#include <unistd.h>
916#include <stdio.h>
Castor Fuaa6738a2013-12-19 23:00:46 -0800917#include <getopt.h>
Jens Axboe67bf9822013-01-10 11:23:19 +0100918int main(int argc, char **argv)
919{
920 int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
921 return c;
922}
923EOF
924if compile_prog "" "" "getopt_long_only"; then
925 getopt_long_only="yes"
926fi
927echo "getopt_long_only() $getopt_long_only"
928
929##########################################
930# inet_aton() probe
931inet_aton="no"
932cat > $TMPC << EOF
933#include <sys/socket.h>
934#include <arpa/inet.h>
935#include <stdio.h>
936int main(int argc, char **argv)
937{
938 struct in_addr in;
939 return inet_aton(NULL, &in);
940}
941EOF
942if compile_prog "" "" "inet_aton"; then
943 inet_aton="yes"
944fi
945echo "inet_aton $inet_aton"
946
947##########################################
948# socklen_t probe
949socklen_t="no"
950cat > $TMPC << EOF
Aaron Carrollf6482612013-03-14 16:57:41 +1100951#include <sys/socket.h>
Jens Axboe67bf9822013-01-10 11:23:19 +0100952int main(int argc, char **argv)
953{
954 socklen_t len = 0;
955 return len;
956}
957EOF
958if compile_prog "" "" "socklen_t"; then
959 socklen_t="yes"
960fi
961echo "socklen_t $socklen_t"
962
963##########################################
964# Whether or not __thread is supported for TLS
965tls_thread="no"
966cat > $TMPC << EOF
967#include <stdio.h>
Castor Fuaa6738a2013-12-19 23:00:46 -0800968static __thread int ret;
Jens Axboe67bf9822013-01-10 11:23:19 +0100969int main(int argc, char **argv)
970{
971 return ret;
972}
973EOF
974if compile_prog "" "" "__thread"; then
975 tls_thread="yes"
976fi
977echo "__thread $tls_thread"
978
Jens Axboe91f94d52013-01-24 10:25:42 -0700979##########################################
Jens Axboe2639f052013-04-10 14:41:08 +0200980# Check if we have required gtk/glib support for gfio
Jens Axboe91f94d52013-01-24 10:25:42 -0700981if test "$gfio" = "yes" ; then
982 cat > $TMPC << EOF
983#include <glib.h>
984#include <cairo.h>
985#include <gtk/gtk.h>
986int main(void)
987{
988 gdk_threads_enter();
Jens Axboe91f94d52013-01-24 10:25:42 -0700989 gdk_threads_leave();
Jens Axboeb7a99312013-02-04 12:46:54 +0100990
991 printf("%d", GTK_CHECK_VERSION(2, 18, 0));
Jens Axboe91f94d52013-01-24 10:25:42 -0700992}
993EOF
994GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0)
995if test "$?" != "0" ; then
996 echo "configure: gtk and gthread not found"
997 exit 1
998fi
999GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0)
1000if test "$?" != "0" ; then
1001 echo "configure: gtk and gthread not found"
1002 exit 1
1003fi
Jens Axboeb7a99312013-02-04 12:46:54 +01001004if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
1005 r=$($TMPE)
1006 if test "$r" != "0" ; then
1007 gfio="yes"
1008 LIBS="$LIBS $GTK_LIBS"
1009 CFLAGS="$CFLAGS $GTK_CFLAGS"
1010 else
1011 echo "GTK found, but need version 2.18 or higher"
1012 gfio="no"
1013 fi
Jens Axboe91f94d52013-01-24 10:25:42 -07001014else
1015 echo "Please install gtk and gdk libraries"
1016 gfio="no"
1017fi
1018fi
1019
Jens Axboe2639f052013-04-10 14:41:08 +02001020echo "gtk 2.18 or higher $gfio"
Jens Axboe91f94d52013-01-24 10:25:42 -07001021
Jens Axboe44404c52013-01-24 14:20:09 -07001022# Check whether we have getrusage(RUSAGE_THREAD)
1023rusage_thread="no"
1024cat > $TMPC << EOF
1025#include <sys/time.h>
1026#include <sys/resource.h>
1027int main(int argc, char **argv)
1028{
1029 struct rusage ru;
1030 getrusage(RUSAGE_THREAD, &ru);
1031 return 0;
1032}
1033EOF
1034if compile_prog "" "" "RUSAGE_THREAD"; then
1035 rusage_thread="yes"
1036fi
1037echo "RUSAGE_THREAD $rusage_thread"
1038
Jens Axboe7e09a9f2013-01-30 13:58:58 +01001039##########################################
1040# Check whether we have SCHED_IDLE
1041sched_idle="no"
1042cat > $TMPC << EOF
1043#include <sched.h>
1044int main(int argc, char **argv)
1045{
1046 struct sched_param p;
1047 return sched_setscheduler(0, SCHED_IDLE, &p);
1048}
1049EOF
1050if compile_prog "" "" "SCHED_IDLE"; then
1051 sched_idle="yes"
1052fi
1053echo "SCHED_IDLE $sched_idle"
1054
Jens Axboe1eafa372013-01-31 10:19:51 +01001055##########################################
1056# Check whether we have TCP_NODELAY
1057tcp_nodelay="no"
1058cat > $TMPC << EOF
1059#include <stdio.h>
1060#include <sys/types.h>
1061#include <sys/socket.h>
1062#include <netinet/tcp.h>
1063int main(int argc, char **argv)
1064{
1065 return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
1066}
1067EOF
1068if compile_prog "" "" "TCP_NODELAY"; then
1069 tcp_nodelay="yes"
1070fi
1071echo "TCP_NODELAY $tcp_nodelay"
1072
Jens Axboe38b93542013-02-28 08:28:05 +01001073##########################################
1074# Check whether we have RLIMIT_MEMLOCK
1075rlimit_memlock="no"
1076cat > $TMPC << EOF
1077#include <sys/time.h>
1078#include <sys/resource.h>
1079int main(int argc, char **argv)
1080{
1081 struct rlimit rl;
1082 return getrlimit(RLIMIT_MEMLOCK, &rl);
1083}
1084EOF
1085if compile_prog "" "" "RLIMIT_MEMLOCK"; then
1086 rlimit_memlock="yes"
1087fi
1088echo "RLIMIT_MEMLOCK $rlimit_memlock"
1089
Jens Axboe07fc0ac2013-05-16 20:36:57 +02001090##########################################
1091# Check whether we have pwritev/preadv
1092pwritev="no"
1093cat > $TMPC << EOF
1094#include <stdio.h>
1095#include <sys/uio.h>
1096int main(int argc, char **argv)
1097{
1098 return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0);
1099}
1100EOF
1101if compile_prog "" "" "pwritev"; then
1102 pwritev="yes"
1103fi
1104echo "pwritev/preadv $pwritev"
1105
Jens Axboeecad55e2014-01-24 18:56:34 -08001106##########################################
1107# Check whether we have the required functions for ipv6
1108ipv6="no"
1109cat > $TMPC << EOF
1110#include <sys/types.h>
1111#include <sys/socket.h>
Bruce Crand2190282014-02-13 09:06:20 -07001112#include <netinet/in.h>
Jens Axboeecad55e2014-01-24 18:56:34 -08001113#include <netdb.h>
1114#include <stdio.h>
1115int main(int argc, char **argv)
1116{
1117 struct addrinfo hints;
1118 struct in6_addr addr;
1119 int ret;
1120
1121 ret = getaddrinfo(NULL, NULL, &hints, NULL);
1122 freeaddrinfo(NULL);
1123 printf("%s\n", gai_strerror(ret));
1124 addr = in6addr_any;
1125 return 0;
1126}
1127EOF
1128if compile_prog "" "" "ipv6"; then
1129 ipv6="yes"
1130fi
1131echo "IPv6 helpers $ipv6"
Jens Axboe07fc0ac2013-05-16 20:36:57 +02001132
Daniel Gollubfc5c0342014-02-17 14:35:28 +01001133##########################################
1134# check for rbd
1135rbd="no"
1136cat > $TMPC << EOF
1137#include <rbd/librbd.h>
1138
1139int main(int argc, char **argv)
1140{
1141
1142 rados_t cluster;
1143 rados_ioctx_t io_ctx;
1144 const char pool[] = "rbd";
1145
1146 int major, minor, extra;
1147 rbd_version(&major, &minor, &extra);
1148
1149 rados_ioctx_create(cluster, pool, &io_ctx);
1150 return 0;
1151}
1152EOF
Tiziano Mülleraa48efe2014-06-26 14:20:20 +02001153if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then
Daniel Gollubfc5c0342014-02-17 14:35:28 +01001154 LIBS="-lrbd -lrados $LIBS"
1155 rbd="yes"
1156fi
1157echo "Rados Block Device engine $rbd"
1158
Jens Axboe2e802282014-04-02 21:47:27 -06001159##########################################
chenh0e55d6b2014-03-27 15:19:43 -04001160# check for gfapi
1161gfapi="no"
Jens Axboe2e802282014-04-02 21:47:27 -06001162cat > $TMPC << EOF
chenh0e55d6b2014-03-27 15:19:43 -04001163#include <glusterfs/api/glfs.h>
1164
Jens Axboe2e802282014-04-02 21:47:27 -06001165int main(int argc, char **argv)
1166{
chenh0e55d6b2014-03-27 15:19:43 -04001167
1168 glfs_t *g = glfs_new("foo");
1169
Jens Axboe2e802282014-04-02 21:47:27 -06001170 return 0;
1171}
1172EOF
Tiziano Mülleraa48efe2014-06-26 14:20:20 +02001173if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
chenh0e55d6b2014-03-27 15:19:43 -04001174 LIBS="-lgfapi -lglusterfs $LIBS"
1175 gfapi="yes"
Jens Axboe2e802282014-04-02 21:47:27 -06001176fi
chenh54fe20f2014-04-08 13:02:26 -04001177 echo "Gluster API engine $gfapi"
chenh0e55d6b2014-03-27 15:19:43 -04001178
chenh54fe20f2014-04-08 13:02:26 -04001179##########################################
1180# check for gfapi fadvise support
1181gf_fadvise="no"
1182cat > $TMPC << EOF
1183#include <glusterfs/api/glfs.h>
1184
1185int main(int argc, char **argv)
1186{
1187 struct glfs_fd *fd;
1188 int ret = glfs_fadvise(fd, 0, 0, 1);
1189
1190 return 0;
1191}
1192EOF
1193
1194if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1195 gf_fadvise="yes"
1196fi
1197echo "Gluster API use fadvise $gf_fadvise"
Daniel Gollubfc5c0342014-02-17 14:35:28 +01001198
Christian Ehrhardt81795ce2014-04-10 15:09:47 +02001199##########################################
1200# Check if we support stckf on s390
1201s390_z196_facilities="no"
1202cat > $TMPC << EOF
1203#define STFLE_BITS_Z196 45 /* various z196 facilities ... */
1204int main(int argc, char **argv)
1205{
1206 /* We want just 1 double word to be returned. */
1207 register unsigned long reg0 asm("0") = 0;
1208 unsigned long stfle_bits;
1209 asm volatile(".machine push" "\n\t"
1210 ".machine \"z9-109\"" "\n\t"
1211 "stfle %0" "\n\t"
1212 ".machine pop" "\n"
1213 : "=QS" (stfle_bits), "+d" (reg0)
1214 : : "cc");
1215
1216 if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0)
1217 return 0;
1218 else
1219 return -1;
1220}
1221EOF
1222if compile_prog "" "" "s390_z196_facilities"; then
1223 $TMPE
1224 if [[ $? -eq 0 ]]; then
1225 s390_z196_facilities="yes"
1226 fi
1227fi
1228echo "s390_z196_facilities $s390_z196_facilities"
Jens Axboe67bf9822013-01-10 11:23:19 +01001229#############################################################################
1230
Jens Axboe67bf9822013-01-10 11:23:19 +01001231if test "$wordsize" = "64" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001232 output_sym "CONFIG_64BIT"
Jens Axboe67bf9822013-01-10 11:23:19 +01001233elif test "$wordsize" = "32" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001234 output_sym "CONFIG_32BIT"
Jens Axboe67bf9822013-01-10 11:23:19 +01001235else
Jens Axboed7145a72013-02-11 13:21:54 +01001236 fatal "Unknown wordsize!"
Jens Axboe67bf9822013-01-10 11:23:19 +01001237fi
Jens Axboe0dcebdf2013-01-23 15:42:16 -07001238if test "$bigendian" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001239 output_sym "CONFIG_BIG_ENDIAN"
Jens Axboe0dcebdf2013-01-23 15:42:16 -07001240else
Jens Axboe4feafb12013-01-24 23:07:55 -07001241 output_sym "CONFIG_LITTLE_ENDIAN"
Jens Axboe0dcebdf2013-01-23 15:42:16 -07001242fi
Jens Axboe3989b142013-04-12 13:13:24 +02001243if test "$zlib" = "yes" ; then
1244 output_sym "CONFIG_ZLIB"
1245fi
Jens Axboe67bf9822013-01-10 11:23:19 +01001246if test "$libaio" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001247 output_sym "CONFIG_LIBAIO"
Jens Axboe67bf9822013-01-10 11:23:19 +01001248fi
1249if test "$posix_aio" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001250 output_sym "CONFIG_POSIXAIO"
Jens Axboe67bf9822013-01-10 11:23:19 +01001251fi
1252if test "$posix_aio_fsync" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001253 output_sym "CONFIG_POSIXAIO_FSYNC"
Jens Axboe67bf9822013-01-10 11:23:19 +01001254fi
1255if test "$linux_fallocate" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001256 output_sym "CONFIG_LINUX_FALLOCATE"
Jens Axboe67bf9822013-01-10 11:23:19 +01001257fi
1258if test "$posix_fallocate" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001259 output_sym "CONFIG_POSIX_FALLOCATE"
Jens Axboe67bf9822013-01-10 11:23:19 +01001260fi
1261if test "$fdatasync" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001262 output_sym "CONFIG_FDATASYNC"
Jens Axboe67bf9822013-01-10 11:23:19 +01001263fi
1264if test "$sync_file_range" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001265 output_sym "CONFIG_SYNC_FILE_RANGE"
Jens Axboe67bf9822013-01-10 11:23:19 +01001266fi
1267if test "$sfaa" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001268 output_sym "CONFIG_SFAA"
Jens Axboe67bf9822013-01-10 11:23:19 +01001269fi
Yufei Ren954cd732013-07-22 20:58:05 -06001270if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001271 output_sym "CONFIG_RDMA"
Jens Axboe67bf9822013-01-10 11:23:19 +01001272fi
1273if test "$clock_gettime" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001274 output_sym "CONFIG_CLOCK_GETTIME"
Jens Axboe67bf9822013-01-10 11:23:19 +01001275fi
1276if test "$clock_monotonic" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001277 output_sym "CONFIG_CLOCK_MONOTONIC"
Jens Axboe67bf9822013-01-10 11:23:19 +01001278fi
1279if test "$clock_monotonic_precise" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001280 output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
Jens Axboe67bf9822013-01-10 11:23:19 +01001281fi
1282if test "$gettimeofday" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001283 output_sym "CONFIG_GETTIMEOFDAY"
Jens Axboe67bf9822013-01-10 11:23:19 +01001284fi
1285if test "$posix_fadvise" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001286 output_sym "CONFIG_POSIX_FADVISE"
Jens Axboe67bf9822013-01-10 11:23:19 +01001287fi
1288if test "$linux_3arg_affinity" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001289 output_sym "CONFIG_3ARG_AFFINITY"
Jens Axboe67bf9822013-01-10 11:23:19 +01001290elif test "$linux_2arg_affinity" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001291 output_sym "CONFIG_2ARG_AFFINITY"
Jens Axboe67bf9822013-01-10 11:23:19 +01001292fi
1293if test "$strsep" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001294 output_sym "CONFIG_STRSEP"
Jens Axboe67bf9822013-01-10 11:23:19 +01001295fi
Jens Axboe9ad8da82013-04-05 14:44:03 +02001296if test "$strcasestr" = "yes" ; then
1297 output_sym "CONFIG_STRCASESTR"
1298fi
Jens Axboe67bf9822013-01-10 11:23:19 +01001299if test "$getopt_long_only" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001300 output_sym "CONFIG_GETOPT_LONG_ONLY"
Jens Axboe67bf9822013-01-10 11:23:19 +01001301fi
1302if test "$inet_aton" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001303 output_sym "CONFIG_INET_ATON"
Jens Axboe67bf9822013-01-10 11:23:19 +01001304fi
1305if test "$socklen_t" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001306 output_sym "CONFIG_SOCKLEN_T"
Jens Axboe67bf9822013-01-10 11:23:19 +01001307fi
1308if test "$ext4_me" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001309 output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
Jens Axboe67bf9822013-01-10 11:23:19 +01001310fi
1311if test "$linux_splice" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001312 output_sym "CONFIG_LINUX_SPLICE"
Jens Axboe67bf9822013-01-10 11:23:19 +01001313fi
1314if test "$guasi" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001315 output_sym "CONFIG_GUASI"
Jens Axboe67bf9822013-01-10 11:23:19 +01001316fi
1317if test "$fusion_aw" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001318 output_sym "CONFIG_FUSION_AW"
Jens Axboe67bf9822013-01-10 11:23:19 +01001319fi
Jens Axboe50206d92013-03-25 13:20:08 -06001320if test "$libnuma_v2" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001321 output_sym "CONFIG_LIBNUMA"
Jens Axboe67bf9822013-01-10 11:23:19 +01001322fi
1323if test "$solaris_aio" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001324 output_sym "CONFIG_SOLARISAIO"
Jens Axboe67bf9822013-01-10 11:23:19 +01001325fi
1326if test "$tls_thread" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001327 output_sym "CONFIG_TLS_THREAD"
Jens Axboe67bf9822013-01-10 11:23:19 +01001328fi
Jens Axboe44404c52013-01-24 14:20:09 -07001329if test "$rusage_thread" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001330 output_sym "CONFIG_RUSAGE_THREAD"
Jens Axboe67bf9822013-01-10 11:23:19 +01001331fi
Jens Axboe91f94d52013-01-24 10:25:42 -07001332if test "$gfio" = "yes" ; then
1333 echo "CONFIG_GFIO=y" >> $config_host_mak
1334fi
Jens Axboeef7035a2014-06-18 15:30:09 -07001335if test "$esx" = "yes" ; then
1336 output_sym "CONFIG_ESX"
1337 output_sym "CONFIG_NO_SHM"
1338fi
Jens Axboe7e09a9f2013-01-30 13:58:58 +01001339if test "$sched_idle" = "yes" ; then
1340 output_sym "CONFIG_SCHED_IDLE"
1341fi
Jens Axboe1eafa372013-01-31 10:19:51 +01001342if test "$tcp_nodelay" = "yes" ; then
1343 output_sym "CONFIG_TCP_NODELAY"
1344fi
Jens Axboe38b93542013-02-28 08:28:05 +01001345if test "$rlimit_memlock" = "yes" ; then
1346 output_sym "CONFIG_RLIMIT_MEMLOCK"
1347fi
Jens Axboe07fc0ac2013-05-16 20:36:57 +02001348if test "$pwritev" = "yes" ; then
1349 output_sym "CONFIG_PWRITEV"
1350fi
Jens Axboeecad55e2014-01-24 18:56:34 -08001351if test "$ipv6" = "yes" ; then
1352 output_sym "CONFIG_IPV6"
1353fi
Daniel Gollubfc5c0342014-02-17 14:35:28 +01001354if test "$rbd" = "yes" ; then
1355 output_sym "CONFIG_RBD"
1356fi
Jens Axboe2e802282014-04-02 21:47:27 -06001357if test "$setvbuf" = "yes" ; then
1358 output_sym "CONFIG_SETVBUF"
1359fi
Christian Ehrhardt81795ce2014-04-10 15:09:47 +02001360if test "$s390_z196_facilities" = "yes" ; then
1361 output_sym "CONFIG_S390_Z196_FACILITIES"
1362 CFLAGS="$CFLAGS -march=z9-109"
1363fi
chenh0e55d6b2014-03-27 15:19:43 -04001364if test "$gfapi" = "yes" ; then
1365 output_sym "CONFIG_GFAPI"
1366fi
chenh54fe20f2014-04-08 13:02:26 -04001367if test "$gf_fadvise" = "yes" ; then
1368 output_sym "CONFIG_GF_FADVISE"
1369fi
Jens Axboe67bf9822013-01-10 11:23:19 +01001370
1371echo "LIBS+=$LIBS" >> $config_host_mak
Jens Axboe91f94d52013-01-24 10:25:42 -07001372echo "CFLAGS+=$CFLAGS" >> $config_host_mak
Jens Axboe67bf9822013-01-10 11:23:19 +01001373echo "CC=$cc" >> $config_host_mak
Jens Axboeaf4862b2013-03-29 08:55:32 -06001374echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak