blob: 7b1d79a458a7cadcde21e821e19c34f11d7f9386 [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"
Jens Axboe67bf9822013-01-10 11:23:19 +0100187else
188 targetos=`uname -s`
189fi
190
Aaron Carroll53cd4ee2013-03-14 16:57:38 +1100191echo "# Automatically generated by configure - do not modify" > $config_host_mak
192printf "# Configured with:" >> $config_host_mak
193printf " '%s'" "$0" "$@" >> $config_host_mak
194echo >> $config_host_mak
195echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak
196
Jens Axboe67bf9822013-01-10 11:23:19 +0100197# Some host OSes need non-standard checks for which CPU to use.
198# Note that these checks are broken for cross-compilation: if you're
199# cross-compiling to one of these OSes then you'll need to specify
200# the correct CPU with the --cpu option.
201case $targetos in
202Darwin)
203 # on Leopard most of the system is 32-bit, so we have to ask the kernel if
204 # we can run 64-bit userspace code.
205 # If the user didn't specify a CPU explicitly and the kernel says this is
206 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual
207 # detection code.
208 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
209 cpu="x86_64"
210 fi
211 ;;
212SunOS)
213 # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
214 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
215 cpu="x86_64"
216 fi
Jens Axboeadaa46d2013-02-28 22:10:22 +0100217 LIBS="-lnsl -lsocket"
Jens Axboecfd94f72013-01-23 16:23:48 -0700218 ;;
219CYGWIN*)
220 echo "Forcing known good options on Windows"
Jens Axboe4578d012013-01-23 16:26:12 -0700221 if test -z "$CC" ; then
Huadong Liu74097112013-02-05 08:43:14 +0100222 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
223 CC="i686-w64-mingw32-gcc"
224 else
225 CC="x86_64-w64-mingw32-gcc"
226 fi
Jens Axboe4578d012013-01-23 16:26:12 -0700227 fi
Jens Axboe4feafb12013-01-24 23:07:55 -0700228 output_sym "CONFIG_LITTLE_ENDIAN"
Huadong Liu74097112013-02-05 08:43:14 +0100229 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
230 output_sym "CONFIG_32BIT"
231 else
232 output_sym "CONFIG_64BIT_LLP64"
233 fi
Jens Axboe4feafb12013-01-24 23:07:55 -0700234 output_sym "CONFIG_FADVISE"
235 output_sym "CONFIG_SOCKLEN_T"
Jens Axboe4feafb12013-01-24 23:07:55 -0700236 output_sym "CONFIG_FADVISE"
237 output_sym "CONFIG_SFAA"
238 output_sym "CONFIG_RUSAGE_THREAD"
239 output_sym "CONFIG_WINDOWSAIO"
240 output_sym "CONFIG_FDATASYNC"
Bruce Cran59308a62013-02-02 20:59:31 +0000241 output_sym "CONFIG_CLOCK_MONOTONIC"
Bruce Crandc0518c2013-01-28 16:07:15 +0000242 output_sym "CONFIG_GETTIMEOFDAY"
243 output_sym "CONFIG_CLOCK_GETTIME"
Jens Axboe7e09a9f2013-01-30 13:58:58 +0100244 output_sym "CONFIG_SCHED_IDLE"
Jens Axboe1eafa372013-01-31 10:19:51 +0100245 output_sym "CONFIG_TCP_NODELAY"
Bruce Cran7d6be132013-11-07 14:04:00 +0000246 output_sym "CONFIG_TLS_THREAD"
Bruce Cranef07baa2014-01-28 17:34:08 -0700247 output_sym "CONFIG_IPV6"
Jens Axboe4feafb12013-01-24 23:07:55 -0700248 echo "CC=$CC" >> $config_host_mak
Jens Axboeaf4862b2013-03-29 08:55:32 -0600249 echo "BUILD_CFLAGS=$CFLAGS -include config-host.h -D_GNU_SOURCE" >> $config_host_mak
Jens Axboecfd94f72013-01-23 16:23:48 -0700250 exit 0
Aaron Carroll6d0e9f82013-02-12 09:58:14 +0100251 ;;
Jens Axboe67bf9822013-01-10 11:23:19 +0100252esac
253
254if test ! -z "$cpu" ; then
255 # command line argument
256 :
257elif check_define __i386__ ; then
258 cpu="i386"
259elif check_define __x86_64__ ; then
260 cpu="x86_64"
261elif check_define __sparc__ ; then
262 if check_define __arch64__ ; then
263 cpu="sparc64"
264 else
265 cpu="sparc"
266 fi
267elif check_define _ARCH_PPC ; then
268 if check_define _ARCH_PPC64 ; then
269 cpu="ppc64"
270 else
271 cpu="ppc"
272 fi
273elif check_define __mips__ ; then
274 cpu="mips"
275elif check_define __ia64__ ; then
276 cpu="ia64"
277elif check_define __s390__ ; then
278 if check_define __s390x__ ; then
279 cpu="s390x"
280 else
281 cpu="s390"
282 fi
283elif check_define __arm__ ; then
284 cpu="arm"
285elif check_define __hppa__ ; then
286 cpu="hppa"
287else
288 cpu=`uname -m`
289fi
290
291# Normalise host CPU name and set ARCH.
292case "$cpu" in
293 ia64|ppc|ppc64|s390|s390x|sparc64)
294 cpu="$cpu"
295 ;;
296 i386|i486|i586|i686|i86pc|BePC)
297 cpu="i386"
298 ;;
299 x86_64|amd64)
300 cpu="x86_64"
301 ;;
302 armv*b|armv*l|arm)
303 cpu="arm"
304 ;;
305 hppa|parisc|parisc64)
306 cpu="hppa"
307 ;;
308 mips*)
309 cpu="mips"
310 ;;
311 sparc|sun4[cdmuv])
312 cpu="sparc"
313 ;;
314 *)
Jens Axboe8b156d82013-02-10 15:48:34 +0100315 echo "Unknown CPU"
Jens Axboe67bf9822013-01-10 11:23:19 +0100316 ;;
317esac
318
Jens Axboedcbbf5b2013-01-25 14:35:27 -0700319if test -z "$CC" ; then
Jens Axboe67bf9822013-01-10 11:23:19 +0100320 if test "$targetos" = "FreeBSD"; then
321 if has clang; then
322 CC=clang
323 else
324 CC=gcc
325 fi
Jens Axboe67bf9822013-01-10 11:23:19 +0100326 fi
327fi
328
329cc="${CC-${cross_prefix}gcc}"
330
Jens Axboe0dcebdf2013-01-23 15:42:16 -0700331##########################################
Aaron Carroll1a17cfd2013-03-14 16:57:40 +1100332# check cross compile
333
334cross_compile="no"
335cat > $TMPC <<EOF
336int main(void)
337{
338 return 0;
339}
340EOF
341if compile_prog "" "" "cross"; then
342 $TMPE 2>/dev/null || cross_compile="yes"
343else
344 fatal "compile test failed"
345fi
346
347##########################################
Jens Axboe0dcebdf2013-01-23 15:42:16 -0700348# check endianness
349bigendian="no"
Aaron Carroll1a17cfd2013-03-14 16:57:40 +1100350if test "$cross_compile" = "no" ; then
351 cat > $TMPC <<EOF
Jens Axboe0dcebdf2013-01-23 15:42:16 -0700352#include <inttypes.h>
353int main(void)
354{
355 volatile uint32_t i=0x01234567;
356 return (*((uint8_t*)(&i))) == 0x67;
357}
358EOF
Aaron Carroll1a17cfd2013-03-14 16:57:40 +1100359 if compile_prog "" "" "endian"; then
360 $TMPE && bigendian="yes"
361 fi
362else
363 # If we're cross compiling, try our best to work it out and rely on the
364 # run-time check to fail if we get it wrong.
365 cat > $TMPC <<EOF
366#include <endian.h>
367int main(void)
368{
369#if __BYTE_ORDER != __BIG_ENDIAN
370# error "Unknown endianness"
371#endif
372}
373EOF
374 compile_prog "" "" "endian" && bigendian="yes"
375 check_define "__ARMEB__" && bigendian="yes"
376 check_define "__MIPSEB__" && bigendian="yes"
Jens Axboe0dcebdf2013-01-23 15:42:16 -0700377fi
378
379
Jens Axboe67bf9822013-01-10 11:23:19 +0100380echo "Operating system $targetos"
381echo "CPU $cpu"
Jens Axboe0dcebdf2013-01-23 15:42:16 -0700382echo "Big endian $bigendian"
Jens Axboe67bf9822013-01-10 11:23:19 +0100383echo "Compiler $cc"
Aaron Carroll1a17cfd2013-03-14 16:57:40 +1100384echo "Cross compile $cross_compile"
Jens Axboe67bf9822013-01-10 11:23:19 +0100385echo
386
387##########################################
388# check for wordsize
389wordsize="0"
390cat > $TMPC <<EOF
Aaron Carroll142429e2013-03-14 16:57:39 +1100391#include <limits.h>
392#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
Jens Axboe67bf9822013-01-10 11:23:19 +0100393int main(void)
394{
Aaron Carroll142429e2013-03-14 16:57:39 +1100395 BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE);
Jens Axboe67bf9822013-01-10 11:23:19 +0100396 return 0;
397}
398EOF
Aaron Carroll142429e2013-03-14 16:57:39 +1100399if compile_prog "-DWORDSIZE=32" "" "wordsize"; then
400 wordsize="32"
401elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then
402 wordsize="64"
403else
404 fatal "Unknown wordsize"
Jens Axboe67bf9822013-01-10 11:23:19 +0100405fi
406echo "Wordsize $wordsize"
407
408##########################################
Jens Axboea9bca4a2013-04-05 12:55:42 +0200409# zlib probe
410zlib="no"
411cat > $TMPC <<EOF
412#include <zlib.h>
413int main(void)
414{
415 z_stream stream;
416 if (inflateInit(&stream) != Z_OK)
417 return 1;
418 return 0;
419}
420EOF
421if compile_prog "" "-lz" "zlib" ; then
422 zlib=yes
423 LIBS="-lz $LIBS"
Jens Axboea9bca4a2013-04-05 12:55:42 +0200424fi
425echo "zlib $zlib"
426
427##########################################
Jens Axboe67bf9822013-01-10 11:23:19 +0100428# linux-aio probe
429libaio="no"
430cat > $TMPC <<EOF
431#include <libaio.h>
432#include <stddef.h>
433int main(void)
434{
435 io_setup(0, NULL);
436 return 0;
437}
438EOF
439if compile_prog "" "-laio" "libaio" ; then
440 libaio=yes
441 LIBS="-laio $LIBS"
442else
443 if test "$libaio" = "yes" ; then
Jens Axboec55d7282013-04-12 10:16:43 +0200444 feature_not_found "linux AIO" "libaio-dev or libaio-devel"
Jens Axboe67bf9822013-01-10 11:23:19 +0100445 fi
446 libaio=no
447fi
448echo "Linux AIO support $libaio"
449
450##########################################
451# posix aio probe
452posix_aio="no"
453posix_aio_lrt="no"
454cat > $TMPC <<EOF
455#include <aio.h>
456int main(void)
457{
458 struct aiocb cb;
459 aio_read(&cb);
460 return 0;
461}
462EOF
463if compile_prog "" "" "posixaio" ; then
464 posix_aio="yes"
465elif compile_prog "" "-lrt" "posixaio"; then
466 posix_aio="yes"
467 posix_aio_lrt="yes"
468 LIBS="-lrt $LIBS"
469fi
470echo "POSIX AIO support $posix_aio"
471echo "POSIX AIO support needs -lrt $posix_aio_lrt"
472
473##########################################
474# posix aio fsync probe
475posix_aio_fsync="no"
476if test "$posix_aio" = "yes" ; then
477 cat > $TMPC <<EOF
478#include <fcntl.h>
479#include <aio.h>
480int main(void)
481{
482 struct aiocb cb;
483 return aio_fsync(O_SYNC, &cb);
484 return 0;
485}
486EOF
487 if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
488 posix_aio_fsync=yes
489 fi
490fi
491echo "POSIX AIO fsync $posix_aio_fsync"
492
493##########################################
494# solaris aio probe
495solaris_aio="no"
496cat > $TMPC <<EOF
497#include <sys/types.h>
498#include <sys/asynch.h>
499#include <unistd.h>
500int main(void)
501{
502 aio_result_t res;
503 return aioread(0, NULL, 0, 0, SEEK_SET, &res);
504 return 0;
505}
506EOF
507if compile_prog "" "-laio" "solarisaio" ; then
508 solaris_aio=yes
509 LIBS="-laio $LIBS"
510fi
511echo "Solaris AIO support $solaris_aio"
512
513##########################################
514# __sync_fetch_and_and test
515sfaa="no"
516cat > $TMPC << EOF
517static int sfaa(int *ptr)
518{
Jens Axboe9c639a72013-02-28 22:13:29 +0100519 return __sync_fetch_and_add(ptr, 0);
Jens Axboe67bf9822013-01-10 11:23:19 +0100520}
521
522int main(int argc, char **argv)
523{
524 int val = 42;
525 sfaa(&val);
526 return val;
527}
528EOF
529if compile_prog "" "" "__sync_fetch_and_add()" ; then
530 sfaa="yes"
531fi
Jens Axboe9c639a72013-02-28 22:13:29 +0100532echo "__sync_fetch_and_add $sfaa"
Jens Axboe67bf9822013-01-10 11:23:19 +0100533
534##########################################
535# libverbs probe
536libverbs="no"
537cat > $TMPC << EOF
538#include <stdio.h>
539#include <infiniband/arch.h>
540int main(int argc, char **argv)
541{
542 struct ibv_pd *pd = ibv_alloc_pd(NULL);
543 return 0;
544}
545EOF
546if compile_prog "" "-libverbs" "libverbs" ; then
547 libverbs="yes"
548 LIBS="-libverbs $LIBS"
549fi
550echo "libverbs $libverbs"
551
552##########################################
553# rdmacm probe
554rdmacm="no"
555cat > $TMPC << EOF
556#include <stdio.h>
557#include <rdma/rdma_cma.h>
558int main(int argc, char **argv)
559{
560 rdma_destroy_qp(NULL);
561 return 0;
562}
563EOF
564if compile_prog "" "-lrdmacm" "rdma"; then
565 rdmacm="yes"
566 LIBS="-lrdmacm $LIBS"
567fi
568echo "rdmacm $rdmacm"
569
570##########################################
571# Linux fallocate probe
572linux_fallocate="no"
573cat > $TMPC << EOF
574#include <stdio.h>
Castor Fuaa6738a2013-12-19 23:00:46 -0800575#include <fcntl.h>
Jens Axboe67bf9822013-01-10 11:23:19 +0100576#include <linux/falloc.h>
577int main(int argc, char **argv)
578{
579 int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
580 return r;
581}
582EOF
583if compile_prog "" "" "linux_fallocate"; then
584 linux_fallocate="yes"
585fi
586echo "Linux fallocate $linux_fallocate"
587
588##########################################
589# POSIX fadvise probe
590posix_fadvise="no"
591cat > $TMPC << EOF
592#include <stdio.h>
593#include <fcntl.h>
594int main(int argc, char **argv)
595{
596 int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
597 return r;
598}
599EOF
600if compile_prog "" "" "posix_fadvise"; then
601 posix_fadvise="yes"
602fi
603echo "POSIX fadvise $posix_fadvise"
604
605##########################################
606# POSIX fallocate probe
607posix_fallocate="no"
608cat > $TMPC << EOF
609#include <stdio.h>
610#include <fcntl.h>
611int main(int argc, char **argv)
612{
613 int r = posix_fallocate(0, 0, 1024);
614 return r;
615}
616EOF
617if compile_prog "" "" "posix_fallocate"; then
618 posix_fallocate="yes"
619fi
620echo "POSIX fallocate $posix_fallocate"
621
622##########################################
623# sched_set/getaffinity 2 or 3 argument test
624linux_2arg_affinity="no"
625linux_3arg_affinity="no"
626cat > $TMPC << EOF
Jens Axboe67bf9822013-01-10 11:23:19 +0100627#include <sched.h>
628int main(int argc, char **argv)
629{
630 cpu_set_t mask;
631 return sched_setaffinity(0, sizeof(mask), &mask);
632}
633EOF
634if compile_prog "" "" "sched_setaffinity(,,)"; then
635 linux_3arg_affinity="yes"
636else
637 cat > $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, &mask);
643}
644EOF
645 if compile_prog "" "" "sched_setaffinity(,)"; then
646 linux_2arg_affinity="yes"
647 fi
648fi
649echo "sched_setaffinity(3 arg) $linux_3arg_affinity"
650echo "sched_setaffinity(2 arg) $linux_2arg_affinity"
651
652##########################################
Jens Axboe6cf71c22014-03-05 15:49:54 -0700653# CPU_COUNT test
654cpu_count="no"
655cat > $TMPC << EOF
656#include <sched.h>
657int main(int argc, char **argv)
658{
659 cpu_set_t mask;
660 return CPU_COUNT(&mask);
661}
662EOF
663if compile_prog "" "" "cpu_count"; then
664 cpu_count="yes"
665fi
666echo "CPU_COUNT $cpu_count"
667
668##########################################
Jens Axboe67bf9822013-01-10 11:23:19 +0100669# clock_gettime probe
670clock_gettime="no"
671cat > $TMPC << EOF
672#include <stdio.h>
673#include <time.h>
674int main(int argc, char **argv)
675{
676 return clock_gettime(0, NULL);
677}
678EOF
679if compile_prog "" "" "clock_gettime"; then
680 clock_gettime="yes"
681elif compile_prog "" "-lrt" "clock_gettime"; then
682 clock_gettime="yes"
683 LIBS="-lrt $LIBS"
684fi
685echo "clock_gettime $clock_gettime"
686
687##########################################
688# CLOCK_MONOTONIC probe
689clock_monotonic="no"
690if test "$clock_gettime" = "yes" ; then
691 cat > $TMPC << EOF
692#include <stdio.h>
693#include <time.h>
694int main(int argc, char **argv)
695{
696 return clock_gettime(CLOCK_MONOTONIC, NULL);
697}
698EOF
699 if compile_prog "" "$LIBS" "clock monotonic"; then
700 clock_monotonic="yes"
701 fi
702fi
703echo "CLOCK_MONOTONIC $clock_monotonic"
704
705##########################################
706# CLOCK_MONOTONIC_PRECISE probe
707clock_monotonic_precise="no"
708if test "$clock_gettime" = "yes" ; then
709 cat > $TMPC << EOF
710#include <stdio.h>
711#include <time.h>
712int main(int argc, char **argv)
713{
714 return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
715}
716EOF
717 if compile_prog "" "$LIBS" "clock monotonic precise"; then
718 clock_monotonic_precise="yes"
719 fi
720fi
721echo "CLOCK_MONOTONIC_PRECISE $clock_monotonic_precise"
722
723##########################################
724# gettimeofday() probe
725gettimeofday="no"
726cat > $TMPC << EOF
727#include <sys/time.h>
728#include <stdio.h>
729int main(int argc, char **argv)
730{
731 struct timeval tv;
732 return gettimeofday(&tv, NULL);
733}
734EOF
735if compile_prog "" "" "gettimeofday"; then
736 gettimeofday="yes"
737fi
738echo "gettimeofday $gettimeofday"
739
740##########################################
741# fdatasync() probe
742fdatasync="no"
743cat > $TMPC << EOF
744#include <stdio.h>
745#include <unistd.h>
746int main(int argc, char **argv)
747{
748 return fdatasync(0);
749}
750EOF
751if compile_prog "" "" "fdatasync"; then
752 fdatasync="yes"
753fi
754echo "fdatasync $fdatasync"
755
756##########################################
757# sync_file_range() probe
758sync_file_range="no"
759cat > $TMPC << EOF
760#include <stdio.h>
761#include <unistd.h>
Jens Axboe67bf9822013-01-10 11:23:19 +0100762#include <fcntl.h>
763#include <linux/fs.h>
764int main(int argc, char **argv)
765{
766 unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
767 SYNC_FILE_RANGE_WAIT_AFTER;
768 return sync_file_range(0, 0, 0, flags);
769}
770EOF
771if compile_prog "" "" "sync_file_range"; then
772 sync_file_range="yes"
773fi
774echo "sync_file_range $sync_file_range"
775
776##########################################
777# ext4 move extent probe
778ext4_me="no"
779cat > $TMPC << EOF
780#include <fcntl.h>
781#include <sys/ioctl.h>
782int main(int argc, char **argv)
783{
784 struct move_extent me;
785 return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
786}
787EOF
Jens Axboec7165b82013-01-12 10:27:53 +0100788if compile_prog "" "" "ext4 move extent" ; then
789 ext4_me="yes"
790elif test $targetos = "Linux" ; then
791 # On Linux, just default to it on and let it error at runtime if we really
792 # don't have it. None of my updated systems have it defined, but it does
793 # work. Takes a while to bubble back.
Jens Axboe67bf9822013-01-10 11:23:19 +0100794 ext4_me="yes"
795fi
796echo "EXT4 move extent $ext4_me"
797
798##########################################
799# splice probe
800linux_splice="no"
801cat > $TMPC << EOF
Jens Axboe67bf9822013-01-10 11:23:19 +0100802#include <stdio.h>
803#include <fcntl.h>
804int main(int argc, char **argv)
805{
806 return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
807}
808EOF
809if compile_prog "" "" "linux splice"; then
810 linux_splice="yes"
811fi
812echo "Linux splice(2) $linux_splice"
813
814##########################################
815# GUASI probe
816guasi="no"
817cat > $TMPC << EOF
818#include <guasi.h>
819#include <guasi_syscalls.h>
820int main(int argc, char **argv)
821{
822 guasi_t ctx = guasi_create(0, 0, 0);
823 return 0;
824}
825EOF
826if compile_prog "" "" "guasi"; then
827 guasi="yes"
828fi
829echo "GUASI $guasi"
830
831##########################################
832# fusion-aw probe
833fusion_aw="no"
834cat > $TMPC << EOF
Santhosh Koundinyab2c77c22013-05-18 08:44:01 +0200835#include <nvm/nvm_primitives.h>
Jens Axboe67bf9822013-01-10 11:23:19 +0100836int main(int argc, char **argv)
837{
Santhosh Koundinyab2c77c22013-05-18 08:44:01 +0200838 nvm_version_t ver_info;
839 nvm_handle_t handle;
840
841 handle = nvm_get_handle(0, &ver_info);
842 return nvm_atomic_write(handle, 0, 0, 0);
Jens Axboe67bf9822013-01-10 11:23:19 +0100843}
844EOF
Santhosh Koundinyab2c77c22013-05-18 08:44:01 +0200845if compile_prog "" "-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -lvsl -ldl" "fusion-aw"; then
846 LIBS="-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -lvsl -ldl $LIBS"
Jens Axboe67bf9822013-01-10 11:23:19 +0100847 fusion_aw="yes"
848fi
849echo "Fusion-io atomic engine $fusion_aw"
850
851##########################################
852# libnuma probe
853libnuma="no"
854cat > $TMPC << EOF
855#include <numa.h>
856int main(int argc, char **argv)
857{
858 return numa_available();
859}
860EOF
Castor Fu44462512013-10-31 11:00:54 -0600861if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then
Jens Axboe67bf9822013-01-10 11:23:19 +0100862 libnuma="yes"
863 LIBS="-lnuma $LIBS"
864fi
865echo "libnuma $libnuma"
866
867##########################################
Jens Axboe50206d92013-03-25 13:20:08 -0600868# libnuma 2.x version API
869if test "$libnuma" = "yes" ; then
870libnuma_v2="no"
871cat > $TMPC << EOF
872#include <numa.h>
873int main(int argc, char **argv)
874{
875 struct bitmask *mask = numa_parse_nodestring(NULL);
876 return 0;
877}
878EOF
879if compile_prog "" "" "libnuma api"; then
880 libnuma_v2="yes"
881fi
882echo "libnuma v2 $libnuma_v2"
883fi
884
885##########################################
Jens Axboe67bf9822013-01-10 11:23:19 +0100886# strsep() probe
887strsep="no"
888cat > $TMPC << EOF
889#include <string.h>
890int main(int argc, char **argv)
891{
892 strsep(NULL, NULL);
893 return 0;
894}
895EOF
896if compile_prog "" "" "strsep"; then
897 strsep="yes"
898fi
899echo "strsep $strsep"
900
901##########################################
Jens Axboe9ad8da82013-04-05 14:44:03 +0200902# strcasestr() probe
903strcasestr="no"
904cat > $TMPC << EOF
905#include <string.h>
906int main(int argc, char **argv)
907{
Castor Fuaa6738a2013-12-19 23:00:46 -0800908 return strcasestr(argv[0], argv[1]) != NULL;
Jens Axboe9ad8da82013-04-05 14:44:03 +0200909}
910EOF
911if compile_prog "" "" "strcasestr"; then
912 strcasestr="yes"
913fi
914echo "strcasestr $strcasestr"
915
916##########################################
Jens Axboe67bf9822013-01-10 11:23:19 +0100917# getopt_long_only() probe
918getopt_long_only="no"
919cat > $TMPC << EOF
920#include <unistd.h>
921#include <stdio.h>
Castor Fuaa6738a2013-12-19 23:00:46 -0800922#include <getopt.h>
Jens Axboe67bf9822013-01-10 11:23:19 +0100923int main(int argc, char **argv)
924{
925 int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
926 return c;
927}
928EOF
929if compile_prog "" "" "getopt_long_only"; then
930 getopt_long_only="yes"
931fi
932echo "getopt_long_only() $getopt_long_only"
933
934##########################################
935# inet_aton() probe
936inet_aton="no"
937cat > $TMPC << EOF
938#include <sys/socket.h>
939#include <arpa/inet.h>
940#include <stdio.h>
941int main(int argc, char **argv)
942{
943 struct in_addr in;
944 return inet_aton(NULL, &in);
945}
946EOF
947if compile_prog "" "" "inet_aton"; then
948 inet_aton="yes"
949fi
950echo "inet_aton $inet_aton"
951
952##########################################
953# socklen_t probe
954socklen_t="no"
955cat > $TMPC << EOF
Aaron Carrollf6482612013-03-14 16:57:41 +1100956#include <sys/socket.h>
Jens Axboe67bf9822013-01-10 11:23:19 +0100957int main(int argc, char **argv)
958{
959 socklen_t len = 0;
960 return len;
961}
962EOF
963if compile_prog "" "" "socklen_t"; then
964 socklen_t="yes"
965fi
966echo "socklen_t $socklen_t"
967
968##########################################
969# Whether or not __thread is supported for TLS
970tls_thread="no"
971cat > $TMPC << EOF
972#include <stdio.h>
Castor Fuaa6738a2013-12-19 23:00:46 -0800973static __thread int ret;
Jens Axboe67bf9822013-01-10 11:23:19 +0100974int main(int argc, char **argv)
975{
976 return ret;
977}
978EOF
979if compile_prog "" "" "__thread"; then
980 tls_thread="yes"
981fi
982echo "__thread $tls_thread"
983
Jens Axboe91f94d52013-01-24 10:25:42 -0700984##########################################
Jens Axboe2639f052013-04-10 14:41:08 +0200985# Check if we have required gtk/glib support for gfio
Jens Axboe91f94d52013-01-24 10:25:42 -0700986if test "$gfio" = "yes" ; then
987 cat > $TMPC << EOF
988#include <glib.h>
989#include <cairo.h>
990#include <gtk/gtk.h>
991int main(void)
992{
993 gdk_threads_enter();
Jens Axboe91f94d52013-01-24 10:25:42 -0700994 gdk_threads_leave();
Jens Axboeb7a99312013-02-04 12:46:54 +0100995
996 printf("%d", GTK_CHECK_VERSION(2, 18, 0));
Jens Axboe91f94d52013-01-24 10:25:42 -0700997}
998EOF
999GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0)
1000if test "$?" != "0" ; then
1001 echo "configure: gtk and gthread not found"
1002 exit 1
1003fi
1004GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0)
1005if test "$?" != "0" ; then
1006 echo "configure: gtk and gthread not found"
1007 exit 1
1008fi
Jens Axboeb7a99312013-02-04 12:46:54 +01001009if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
1010 r=$($TMPE)
1011 if test "$r" != "0" ; then
1012 gfio="yes"
1013 LIBS="$LIBS $GTK_LIBS"
1014 CFLAGS="$CFLAGS $GTK_CFLAGS"
1015 else
1016 echo "GTK found, but need version 2.18 or higher"
1017 gfio="no"
1018 fi
Jens Axboe91f94d52013-01-24 10:25:42 -07001019else
1020 echo "Please install gtk and gdk libraries"
1021 gfio="no"
1022fi
1023fi
1024
Jens Axboe2639f052013-04-10 14:41:08 +02001025echo "gtk 2.18 or higher $gfio"
Jens Axboe91f94d52013-01-24 10:25:42 -07001026
Jens Axboe44404c52013-01-24 14:20:09 -07001027# Check whether we have getrusage(RUSAGE_THREAD)
1028rusage_thread="no"
1029cat > $TMPC << EOF
1030#include <sys/time.h>
1031#include <sys/resource.h>
1032int main(int argc, char **argv)
1033{
1034 struct rusage ru;
1035 getrusage(RUSAGE_THREAD, &ru);
1036 return 0;
1037}
1038EOF
1039if compile_prog "" "" "RUSAGE_THREAD"; then
1040 rusage_thread="yes"
1041fi
1042echo "RUSAGE_THREAD $rusage_thread"
1043
Jens Axboe7e09a9f2013-01-30 13:58:58 +01001044##########################################
1045# Check whether we have SCHED_IDLE
1046sched_idle="no"
1047cat > $TMPC << EOF
1048#include <sched.h>
1049int main(int argc, char **argv)
1050{
1051 struct sched_param p;
1052 return sched_setscheduler(0, SCHED_IDLE, &p);
1053}
1054EOF
1055if compile_prog "" "" "SCHED_IDLE"; then
1056 sched_idle="yes"
1057fi
1058echo "SCHED_IDLE $sched_idle"
1059
Jens Axboe1eafa372013-01-31 10:19:51 +01001060##########################################
1061# Check whether we have TCP_NODELAY
1062tcp_nodelay="no"
1063cat > $TMPC << EOF
1064#include <stdio.h>
1065#include <sys/types.h>
1066#include <sys/socket.h>
1067#include <netinet/tcp.h>
1068int main(int argc, char **argv)
1069{
1070 return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
1071}
1072EOF
1073if compile_prog "" "" "TCP_NODELAY"; then
1074 tcp_nodelay="yes"
1075fi
1076echo "TCP_NODELAY $tcp_nodelay"
1077
Jens Axboe38b93542013-02-28 08:28:05 +01001078##########################################
1079# Check whether we have RLIMIT_MEMLOCK
1080rlimit_memlock="no"
1081cat > $TMPC << EOF
1082#include <sys/time.h>
1083#include <sys/resource.h>
1084int main(int argc, char **argv)
1085{
1086 struct rlimit rl;
1087 return getrlimit(RLIMIT_MEMLOCK, &rl);
1088}
1089EOF
1090if compile_prog "" "" "RLIMIT_MEMLOCK"; then
1091 rlimit_memlock="yes"
1092fi
1093echo "RLIMIT_MEMLOCK $rlimit_memlock"
1094
Jens Axboe07fc0ac2013-05-16 20:36:57 +02001095##########################################
1096# Check whether we have pwritev/preadv
1097pwritev="no"
1098cat > $TMPC << EOF
1099#include <stdio.h>
1100#include <sys/uio.h>
1101int main(int argc, char **argv)
1102{
1103 return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0);
1104}
1105EOF
1106if compile_prog "" "" "pwritev"; then
1107 pwritev="yes"
1108fi
1109echo "pwritev/preadv $pwritev"
1110
Jens Axboeecad55e2014-01-24 18:56:34 -08001111##########################################
1112# Check whether we have the required functions for ipv6
1113ipv6="no"
1114cat > $TMPC << EOF
1115#include <sys/types.h>
1116#include <sys/socket.h>
Bruce Crand2190282014-02-13 09:06:20 -07001117#include <netinet/in.h>
Jens Axboeecad55e2014-01-24 18:56:34 -08001118#include <netdb.h>
1119#include <stdio.h>
1120int main(int argc, char **argv)
1121{
1122 struct addrinfo hints;
1123 struct in6_addr addr;
1124 int ret;
1125
1126 ret = getaddrinfo(NULL, NULL, &hints, NULL);
1127 freeaddrinfo(NULL);
1128 printf("%s\n", gai_strerror(ret));
1129 addr = in6addr_any;
1130 return 0;
1131}
1132EOF
1133if compile_prog "" "" "ipv6"; then
1134 ipv6="yes"
1135fi
1136echo "IPv6 helpers $ipv6"
Jens Axboe07fc0ac2013-05-16 20:36:57 +02001137
Daniel Gollubfc5c0342014-02-17 14:35:28 +01001138##########################################
1139# check for rbd
1140rbd="no"
1141cat > $TMPC << EOF
1142#include <rbd/librbd.h>
1143
1144int main(int argc, char **argv)
1145{
1146
1147 rados_t cluster;
1148 rados_ioctx_t io_ctx;
1149 const char pool[] = "rbd";
1150
1151 int major, minor, extra;
1152 rbd_version(&major, &minor, &extra);
1153
1154 rados_ioctx_create(cluster, pool, &io_ctx);
1155 return 0;
1156}
1157EOF
1158if compile_prog "" "-lrbd -lrados" "rbd"; then
1159 LIBS="-lrbd -lrados $LIBS"
1160 rbd="yes"
1161fi
1162echo "Rados Block Device engine $rbd"
1163
1164
Jens Axboe67bf9822013-01-10 11:23:19 +01001165#############################################################################
1166
Jens Axboe67bf9822013-01-10 11:23:19 +01001167if test "$wordsize" = "64" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001168 output_sym "CONFIG_64BIT"
Jens Axboe67bf9822013-01-10 11:23:19 +01001169elif test "$wordsize" = "32" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001170 output_sym "CONFIG_32BIT"
Jens Axboe67bf9822013-01-10 11:23:19 +01001171else
Jens Axboed7145a72013-02-11 13:21:54 +01001172 fatal "Unknown wordsize!"
Jens Axboe67bf9822013-01-10 11:23:19 +01001173fi
Jens Axboe0dcebdf2013-01-23 15:42:16 -07001174if test "$bigendian" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001175 output_sym "CONFIG_BIG_ENDIAN"
Jens Axboe0dcebdf2013-01-23 15:42:16 -07001176else
Jens Axboe4feafb12013-01-24 23:07:55 -07001177 output_sym "CONFIG_LITTLE_ENDIAN"
Jens Axboe0dcebdf2013-01-23 15:42:16 -07001178fi
Jens Axboe3989b142013-04-12 13:13:24 +02001179if test "$zlib" = "yes" ; then
1180 output_sym "CONFIG_ZLIB"
1181fi
Jens Axboe67bf9822013-01-10 11:23:19 +01001182if test "$libaio" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001183 output_sym "CONFIG_LIBAIO"
Jens Axboe67bf9822013-01-10 11:23:19 +01001184fi
1185if test "$posix_aio" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001186 output_sym "CONFIG_POSIXAIO"
Jens Axboe67bf9822013-01-10 11:23:19 +01001187fi
1188if test "$posix_aio_fsync" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001189 output_sym "CONFIG_POSIXAIO_FSYNC"
Jens Axboe67bf9822013-01-10 11:23:19 +01001190fi
1191if test "$linux_fallocate" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001192 output_sym "CONFIG_LINUX_FALLOCATE"
Jens Axboe67bf9822013-01-10 11:23:19 +01001193fi
1194if test "$posix_fallocate" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001195 output_sym "CONFIG_POSIX_FALLOCATE"
Jens Axboe67bf9822013-01-10 11:23:19 +01001196fi
1197if test "$fdatasync" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001198 output_sym "CONFIG_FDATASYNC"
Jens Axboe67bf9822013-01-10 11:23:19 +01001199fi
1200if test "$sync_file_range" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001201 output_sym "CONFIG_SYNC_FILE_RANGE"
Jens Axboe67bf9822013-01-10 11:23:19 +01001202fi
1203if test "$sfaa" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001204 output_sym "CONFIG_SFAA"
Jens Axboe67bf9822013-01-10 11:23:19 +01001205fi
Yufei Ren954cd732013-07-22 20:58:05 -06001206if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001207 output_sym "CONFIG_RDMA"
Jens Axboe67bf9822013-01-10 11:23:19 +01001208fi
1209if test "$clock_gettime" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001210 output_sym "CONFIG_CLOCK_GETTIME"
Jens Axboe67bf9822013-01-10 11:23:19 +01001211fi
1212if test "$clock_monotonic" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001213 output_sym "CONFIG_CLOCK_MONOTONIC"
Jens Axboe67bf9822013-01-10 11:23:19 +01001214fi
1215if test "$clock_monotonic_precise" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001216 output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
Jens Axboe67bf9822013-01-10 11:23:19 +01001217fi
1218if test "$gettimeofday" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001219 output_sym "CONFIG_GETTIMEOFDAY"
Jens Axboe67bf9822013-01-10 11:23:19 +01001220fi
1221if test "$posix_fadvise" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001222 output_sym "CONFIG_POSIX_FADVISE"
Jens Axboe67bf9822013-01-10 11:23:19 +01001223fi
1224if test "$linux_3arg_affinity" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001225 output_sym "CONFIG_3ARG_AFFINITY"
Jens Axboe67bf9822013-01-10 11:23:19 +01001226elif test "$linux_2arg_affinity" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001227 output_sym "CONFIG_2ARG_AFFINITY"
Jens Axboe67bf9822013-01-10 11:23:19 +01001228fi
1229if test "$strsep" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001230 output_sym "CONFIG_STRSEP"
Jens Axboe67bf9822013-01-10 11:23:19 +01001231fi
Jens Axboe9ad8da82013-04-05 14:44:03 +02001232if test "$strcasestr" = "yes" ; then
1233 output_sym "CONFIG_STRCASESTR"
1234fi
Jens Axboe67bf9822013-01-10 11:23:19 +01001235if test "$getopt_long_only" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001236 output_sym "CONFIG_GETOPT_LONG_ONLY"
Jens Axboe67bf9822013-01-10 11:23:19 +01001237fi
1238if test "$inet_aton" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001239 output_sym "CONFIG_INET_ATON"
Jens Axboe67bf9822013-01-10 11:23:19 +01001240fi
1241if test "$socklen_t" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001242 output_sym "CONFIG_SOCKLEN_T"
Jens Axboe67bf9822013-01-10 11:23:19 +01001243fi
1244if test "$ext4_me" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001245 output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
Jens Axboe67bf9822013-01-10 11:23:19 +01001246fi
1247if test "$linux_splice" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001248 output_sym "CONFIG_LINUX_SPLICE"
Jens Axboe67bf9822013-01-10 11:23:19 +01001249fi
1250if test "$guasi" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001251 output_sym "CONFIG_GUASI"
Jens Axboe67bf9822013-01-10 11:23:19 +01001252fi
1253if test "$fusion_aw" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001254 output_sym "CONFIG_FUSION_AW"
Jens Axboe67bf9822013-01-10 11:23:19 +01001255fi
Jens Axboe50206d92013-03-25 13:20:08 -06001256if test "$libnuma_v2" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001257 output_sym "CONFIG_LIBNUMA"
Jens Axboe67bf9822013-01-10 11:23:19 +01001258fi
1259if test "$solaris_aio" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001260 output_sym "CONFIG_SOLARISAIO"
Jens Axboe67bf9822013-01-10 11:23:19 +01001261fi
1262if test "$tls_thread" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001263 output_sym "CONFIG_TLS_THREAD"
Jens Axboe67bf9822013-01-10 11:23:19 +01001264fi
Jens Axboe44404c52013-01-24 14:20:09 -07001265if test "$rusage_thread" = "yes" ; then
Jens Axboe4feafb12013-01-24 23:07:55 -07001266 output_sym "CONFIG_RUSAGE_THREAD"
Jens Axboe67bf9822013-01-10 11:23:19 +01001267fi
Jens Axboe91f94d52013-01-24 10:25:42 -07001268if test "$gfio" = "yes" ; then
1269 echo "CONFIG_GFIO=y" >> $config_host_mak
1270fi
Jens Axboe7e09a9f2013-01-30 13:58:58 +01001271if test "$sched_idle" = "yes" ; then
1272 output_sym "CONFIG_SCHED_IDLE"
1273fi
Jens Axboe1eafa372013-01-31 10:19:51 +01001274if test "$tcp_nodelay" = "yes" ; then
1275 output_sym "CONFIG_TCP_NODELAY"
1276fi
Jens Axboe38b93542013-02-28 08:28:05 +01001277if test "$rlimit_memlock" = "yes" ; then
1278 output_sym "CONFIG_RLIMIT_MEMLOCK"
1279fi
Jens Axboe07fc0ac2013-05-16 20:36:57 +02001280if test "$pwritev" = "yes" ; then
1281 output_sym "CONFIG_PWRITEV"
1282fi
Jens Axboeecad55e2014-01-24 18:56:34 -08001283if test "$ipv6" = "yes" ; then
1284 output_sym "CONFIG_IPV6"
1285fi
Daniel Gollubfc5c0342014-02-17 14:35:28 +01001286if test "$rbd" = "yes" ; then
1287 output_sym "CONFIG_RBD"
1288fi
Jens Axboe6cf71c22014-03-05 15:49:54 -07001289if test "$cpu_count" = "yes" ; then
1290 output_sym "CONFIG_CPU_COUNT"
1291fi
Jens Axboe67bf9822013-01-10 11:23:19 +01001292
1293echo "LIBS+=$LIBS" >> $config_host_mak
Jens Axboe91f94d52013-01-24 10:25:42 -07001294echo "CFLAGS+=$CFLAGS" >> $config_host_mak
Jens Axboe67bf9822013-01-10 11:23:19 +01001295echo "CC=$cc" >> $config_host_mak
Jens Axboeaf4862b2013-03-29 08:55:32 -06001296echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak