Commit | Line | Data |
---|---|---|
67bf9823 JA |
1 | #!/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 | |
8 | if test ! -z "$TMPDIR" ; then | |
9 | TMPDIR1="${TMPDIR}" | |
10 | elif test ! -z "$TEMPDIR" ; then | |
11 | TMPDIR1="${TEMPDIR}" | |
12 | else | |
13 | TMPDIR1="/tmp" | |
14 | fi | |
15 | ||
16 | TMPC="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.c" | |
17 | TMPO="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.o" | |
18 | TMPE="${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> | |
22 | trap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM | |
23 | ||
24 | rm -rf config.log | |
25 | ||
26 | config_host_mak="config-host.mak" | |
4feafb1e JA |
27 | config_host_h="config-host.h" |
28 | ||
29 | rm -rf $config_host_mak | |
30 | rm -rf $config_host_h | |
67bf9823 | 31 | |
d7145a78 JA |
32 | fatal() { |
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 | ||
44404c5a | 40 | # Default CFLAGS |
af4862b3 JA |
41 | CFLAGS="-D_GNU_SOURCE -include config-host.h" |
42 | BUILD_CFLAGS="" | |
67bf9823 JA |
43 | |
44 | # Print a helpful header at the top of config.log | |
45 | echo "# FIO configure log $(date)" >> config.log | |
46 | printf "# Configured with:" >> config.log | |
47 | printf " '%s'" "$0" "$@" >> config.log | |
48 | echo >> config.log | |
49 | echo "#" >> config.log | |
50 | ||
7560fe7c JA |
51 | # Print configure header at the top of $config_host_h |
52 | echo "/*" > $config_host_h | |
53 | echo " * Automatically generated by configure - do not modify" >> $config_host_h | |
54 | printf " * Configured with:" >> $config_host_h | |
55 | printf " * '%s'" "$0" "$@" >> $config_host_h | |
56 | echo "" >> $config_host_h | |
57 | echo " */" >> $config_host_h | |
58 | ||
67bf9823 JA |
59 | do_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." | |
d7145a78 | 81 | fatal "You can run configure with --disable-werror to bypass this check." |
67bf9823 JA |
82 | } |
83 | ||
84 | compile_object() { | |
85 | do_cc $CFLAGS -c -o $TMPO $TMPC | |
86 | } | |
87 | ||
88 | compile_prog() { | |
89 | local_cflags="$1" | |
adaa46d8 | 90 | local_ldflags="$2 $LIBS" |
67bf9823 JA |
91 | echo "Compiling test case $3" >> config.log |
92 | do_cc $CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags | |
93 | } | |
94 | ||
95 | feature_not_found() { | |
96 | feature=$1 | |
c55d728b | 97 | packages=$2 |
67bf9823 JA |
98 | |
99 | echo "ERROR" | |
100 | echo "ERROR: User requested feature $feature" | |
c55d728b JA |
101 | if test ! -z "$packages" ; then |
102 | echo "ERROR: That feature needs $packages installed" | |
103 | fi | |
67bf9823 | 104 | echo "ERROR: configure was not able to find it" |
d7145a78 | 105 | fatal "ERROR" |
67bf9823 JA |
106 | } |
107 | ||
108 | has() { | |
109 | type "$1" >/dev/null 2>&1 | |
110 | } | |
111 | ||
112 | check_define() { | |
113 | cat > $TMPC <<EOF | |
114 | #if !defined($1) | |
115 | #error $1 not defined | |
116 | #endif | |
117 | int main(void) | |
118 | { | |
119 | return 0; | |
120 | } | |
121 | EOF | |
122 | compile_object | |
123 | } | |
124 | ||
4feafb1e JA |
125 | output_sym() { |
126 | echo "$1=y" >> $config_host_mak | |
127 | echo "#define $1" >> $config_host_h | |
128 | } | |
129 | ||
67bf9823 JA |
130 | targetos="" |
131 | cpu="" | |
132 | ||
91f94d5b | 133 | # default options |
47f44635 JA |
134 | show_help="no" |
135 | exit_val=0 | |
ebec2094 | 136 | gfio_check="no" |
1b10477b | 137 | libhdfs="no" |
43f3cec2 | 138 | pmemblk="no" |
cbb15e42 | 139 | devdax="no" |
de26b824 | 140 | disable_lex="" |
3ee2a3c1 | 141 | disable_pmem="no" |
020d54bd | 142 | prefix=/usr/local |
91f94d5b | 143 | |
cb1125b0 JA |
144 | # parse options |
145 | for opt do | |
146 | optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` | |
147 | case "$opt" in | |
020d54bd JA |
148 | --prefix=*) prefix="$optarg" |
149 | ;; | |
8b156d8e JA |
150 | --cpu=*) cpu="$optarg" |
151 | ;; | |
c8931876 JA |
152 | # esx is cross compiled and cannot be detect through simple uname calls |
153 | --esx) | |
154 | esx="yes" | |
155 | ;; | |
cb1125b0 JA |
156 | --cc=*) CC="$optarg" |
157 | ;; | |
208e4c8b JA |
158 | --extra-cflags=*) CFLAGS="$CFLAGS $optarg" |
159 | ;; | |
b7c12794 | 160 | --build-32bit-win) build_32bit_win="yes" |
7409711b | 161 | ;; |
d2aeedb9 JA |
162 | --build-static) build_static="yes" |
163 | ;; | |
91f94d5b | 164 | --enable-gfio) |
ebec2094 | 165 | gfio_check="yes" |
899fab33 | 166 | ;; |
44462517 CF |
167 | --disable-numa) disable_numa="yes" |
168 | ;; | |
ce18290e TM |
169 | --disable-rbd) disable_rbd="yes" |
170 | ;; | |
a4c4c346 | 171 | --disable-rbd-blkin) disable_rbd_blkin="yes" |
172 | ;; | |
ce18290e TM |
173 | --disable-gfapi) disable_gfapi="yes" |
174 | ;; | |
1b10477b MM |
175 | --enable-libhdfs) libhdfs="yes" |
176 | ;; | |
a655bbc4 JA |
177 | --disable-lex) disable_lex="yes" |
178 | ;; | |
de26b824 JA |
179 | --enable-lex) disable_lex="no" |
180 | ;; | |
61054f0d JA |
181 | --disable-shm) no_shm="yes" |
182 | ;; | |
183 | --disable-optimizations) disable_opt="yes" | |
ba40757e | 184 | ;; |
3ee2a3c1 DJ |
185 | --disable-pmem) disable_pmem="yes" |
186 | ;; | |
827da4f5 | 187 | --help) |
47f44635 | 188 | show_help="yes" |
827da4f5 | 189 | ;; |
cb1125b0 JA |
190 | *) |
191 | echo "Bad option $opt" | |
47f44635 JA |
192 | show_help="yes" |
193 | exit_val=1 | |
cb1125b0 JA |
194 | esac |
195 | done | |
196 | ||
47f44635 | 197 | if test "$show_help" = "yes" ; then |
020d54bd | 198 | echo "--prefix= Use this directory as installation prefix" |
8b156d8e | 199 | echo "--cpu= Specify target CPU if auto-detect fails" |
b7a99316 | 200 | echo "--cc= Specify compiler to use" |
899fab33 | 201 | echo "--extra-cflags= Specify extra CFLAGS to pass to compiler" |
b7c12794 | 202 | echo "--build-32bit-win Enable 32-bit build on Windows" |
d2aeedb9 | 203 | echo "--build-static Build a static fio" |
c8931876 | 204 | echo "--esx Configure build options for esx" |
b7a99316 | 205 | echo "--enable-gfio Enable building of gtk gfio" |
44462517 | 206 | echo "--disable-numa Disable libnuma even if found" |
c44ff511 | 207 | echo "--disable-gfapi Disable gfapi" |
1b10477b | 208 | echo "--enable-libhdfs Enable hdfs support" |
a655bbc4 | 209 | echo "--disable-lex Disable use of lex/yacc for math" |
3ee2a3c1 | 210 | echo "--disable-pmem Disable pmem based engines even if found" |
de26b824 | 211 | echo "--enable-lex Enable use of lex/yacc for math" |
c44ff511 | 212 | echo "--disable-shm Disable SHM support" |
61054f0d | 213 | echo "--disable-optimizations Don't enable compiler optimizations" |
b7a99316 | 214 | exit $exit_val |
47f44635 JA |
215 | fi |
216 | ||
47986339 SH |
217 | cross_prefix=${cross_prefix-${CROSS_COMPILE}} |
218 | cc="${CC-${cross_prefix}gcc}" | |
219 | ||
6d0e9f83 AC |
220 | if check_define __ANDROID__ ; then |
221 | targetos="Android" | |
222 | elif check_define __linux__ ; then | |
67bf9823 | 223 | targetos="Linux" |
67bf9823 JA |
224 | elif check_define __OpenBSD__ ; then |
225 | targetos='OpenBSD' | |
226 | elif check_define __sun__ ; then | |
227 | targetos='SunOS' | |
7cb024f8 | 228 | CFLAGS="$CFLAGS -D_REENTRANT" |
b24f59ab SH |
229 | elif check_define _WIN32 ; then |
230 | targetos='CYGWIN' | |
67bf9823 JA |
231 | else |
232 | targetos=`uname -s` | |
233 | fi | |
234 | ||
53cd4eee AC |
235 | echo "# Automatically generated by configure - do not modify" > $config_host_mak |
236 | printf "# Configured with:" >> $config_host_mak | |
237 | printf " '%s'" "$0" "$@" >> $config_host_mak | |
238 | echo >> $config_host_mak | |
239 | echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak | |
240 | ||
61054f0d JA |
241 | if test "$no_shm" = "yes" ; then |
242 | output_sym "CONFIG_NO_SHM" | |
243 | fi | |
244 | ||
245 | if test "$disable_opt" = "yes" ; then | |
246 | output_sym "CONFIG_FIO_NO_OPT" | |
247 | fi | |
248 | ||
67bf9823 JA |
249 | # Some host OSes need non-standard checks for which CPU to use. |
250 | # Note that these checks are broken for cross-compilation: if you're | |
251 | # cross-compiling to one of these OSes then you'll need to specify | |
252 | # the correct CPU with the --cpu option. | |
253 | case $targetos in | |
de26b824 JA |
254 | AIX) |
255 | # Unless explicitly enabled, turn off lex. | |
256 | if test -z "$disable_lex" ; then | |
257 | disable_lex="yes" | |
daf705b5 JA |
258 | else |
259 | force_no_lex_o="yes" | |
de26b824 JA |
260 | fi |
261 | ;; | |
67bf9823 JA |
262 | Darwin) |
263 | # on Leopard most of the system is 32-bit, so we have to ask the kernel if | |
264 | # we can run 64-bit userspace code. | |
265 | # If the user didn't specify a CPU explicitly and the kernel says this is | |
266 | # 64 bit hw, then assume x86_64. Otherwise fall through to the usual | |
267 | # detection code. | |
268 | if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then | |
269 | cpu="x86_64" | |
270 | fi | |
271 | ;; | |
272 | SunOS) | |
273 | # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo | |
274 | if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then | |
275 | cpu="x86_64" | |
276 | fi | |
adaa46d8 | 277 | LIBS="-lnsl -lsocket" |
cfd94f79 JA |
278 | ;; |
279 | CYGWIN*) | |
280 | echo "Forcing known good options on Windows" | |
4578d01f | 281 | if test -z "$CC" ; then |
7409711b HL |
282 | if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then |
283 | CC="i686-w64-mingw32-gcc" | |
284 | else | |
285 | CC="x86_64-w64-mingw32-gcc" | |
286 | fi | |
4578d01f | 287 | fi |
4feafb1e | 288 | output_sym "CONFIG_LITTLE_ENDIAN" |
7409711b HL |
289 | if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then |
290 | output_sym "CONFIG_32BIT" | |
291 | else | |
292 | output_sym "CONFIG_64BIT_LLP64" | |
293 | fi | |
4feafb1e JA |
294 | output_sym "CONFIG_FADVISE" |
295 | output_sym "CONFIG_SOCKLEN_T" | |
4feafb1e JA |
296 | output_sym "CONFIG_FADVISE" |
297 | output_sym "CONFIG_SFAA" | |
298 | output_sym "CONFIG_RUSAGE_THREAD" | |
299 | output_sym "CONFIG_WINDOWSAIO" | |
300 | output_sym "CONFIG_FDATASYNC" | |
59308a64 | 301 | output_sym "CONFIG_CLOCK_MONOTONIC" |
dc0518ca BC |
302 | output_sym "CONFIG_GETTIMEOFDAY" |
303 | output_sym "CONFIG_CLOCK_GETTIME" | |
7e09a9f1 | 304 | output_sym "CONFIG_SCHED_IDLE" |
1eafa37a | 305 | output_sym "CONFIG_TCP_NODELAY" |
7d6be13a | 306 | output_sym "CONFIG_TLS_THREAD" |
ef07baa1 | 307 | output_sym "CONFIG_IPV6" |
4feafb1e | 308 | echo "CC=$CC" >> $config_host_mak |
af4862b3 | 309 | echo "BUILD_CFLAGS=$CFLAGS -include config-host.h -D_GNU_SOURCE" >> $config_host_mak |
cfd94f79 | 310 | exit 0 |
6d0e9f83 | 311 | ;; |
67bf9823 JA |
312 | esac |
313 | ||
314 | if test ! -z "$cpu" ; then | |
315 | # command line argument | |
316 | : | |
317 | elif check_define __i386__ ; then | |
318 | cpu="i386" | |
319 | elif check_define __x86_64__ ; then | |
320 | cpu="x86_64" | |
321 | elif check_define __sparc__ ; then | |
322 | if check_define __arch64__ ; then | |
323 | cpu="sparc64" | |
324 | else | |
325 | cpu="sparc" | |
326 | fi | |
327 | elif check_define _ARCH_PPC ; then | |
328 | if check_define _ARCH_PPC64 ; then | |
329 | cpu="ppc64" | |
330 | else | |
331 | cpu="ppc" | |
332 | fi | |
333 | elif check_define __mips__ ; then | |
334 | cpu="mips" | |
335 | elif check_define __ia64__ ; then | |
336 | cpu="ia64" | |
337 | elif check_define __s390__ ; then | |
338 | if check_define __s390x__ ; then | |
339 | cpu="s390x" | |
340 | else | |
341 | cpu="s390" | |
342 | fi | |
343 | elif check_define __arm__ ; then | |
344 | cpu="arm" | |
214e2d56 | 345 | elif check_define __aarch64__ ; then |
346 | cpu="aarch64" | |
67bf9823 JA |
347 | elif check_define __hppa__ ; then |
348 | cpu="hppa" | |
349 | else | |
350 | cpu=`uname -m` | |
351 | fi | |
352 | ||
353 | # Normalise host CPU name and set ARCH. | |
354 | case "$cpu" in | |
355 | ia64|ppc|ppc64|s390|s390x|sparc64) | |
356 | cpu="$cpu" | |
357 | ;; | |
358 | i386|i486|i586|i686|i86pc|BePC) | |
359 | cpu="i386" | |
360 | ;; | |
361 | x86_64|amd64) | |
362 | cpu="x86_64" | |
363 | ;; | |
364 | armv*b|armv*l|arm) | |
365 | cpu="arm" | |
366 | ;; | |
214e2d56 | 367 | aarch64) |
368 | cpu="arm64" | |
369 | ;; | |
67bf9823 JA |
370 | hppa|parisc|parisc64) |
371 | cpu="hppa" | |
372 | ;; | |
373 | mips*) | |
374 | cpu="mips" | |
375 | ;; | |
376 | sparc|sun4[cdmuv]) | |
377 | cpu="sparc" | |
378 | ;; | |
379 | *) | |
8b156d8e | 380 | echo "Unknown CPU" |
67bf9823 JA |
381 | ;; |
382 | esac | |
383 | ||
dcbbf5b0 | 384 | if test -z "$CC" ; then |
67bf9823 JA |
385 | if test "$targetos" = "FreeBSD"; then |
386 | if has clang; then | |
387 | CC=clang | |
388 | else | |
389 | CC=gcc | |
390 | fi | |
67bf9823 JA |
391 | fi |
392 | fi | |
393 | ||
394 | cc="${CC-${cross_prefix}gcc}" | |
395 | ||
1a17cfdb AC |
396 | ########################################## |
397 | # check cross compile | |
398 | ||
399 | cross_compile="no" | |
400 | cat > $TMPC <<EOF | |
401 | int main(void) | |
402 | { | |
403 | return 0; | |
404 | } | |
405 | EOF | |
406 | if compile_prog "" "" "cross"; then | |
407 | $TMPE 2>/dev/null || cross_compile="yes" | |
408 | else | |
409 | fatal "compile test failed" | |
410 | fi | |
411 | ||
0dcebdf4 JA |
412 | ########################################## |
413 | # check endianness | |
414 | bigendian="no" | |
1a17cfdb AC |
415 | if test "$cross_compile" = "no" ; then |
416 | cat > $TMPC <<EOF | |
0dcebdf4 JA |
417 | #include <inttypes.h> |
418 | int main(void) | |
419 | { | |
420 | volatile uint32_t i=0x01234567; | |
421 | return (*((uint8_t*)(&i))) == 0x67; | |
422 | } | |
423 | EOF | |
1a17cfdb AC |
424 | if compile_prog "" "" "endian"; then |
425 | $TMPE && bigendian="yes" | |
426 | fi | |
427 | else | |
428 | # If we're cross compiling, try our best to work it out and rely on the | |
429 | # run-time check to fail if we get it wrong. | |
430 | cat > $TMPC <<EOF | |
431 | #include <endian.h> | |
432 | int main(void) | |
433 | { | |
434 | #if __BYTE_ORDER != __BIG_ENDIAN | |
435 | # error "Unknown endianness" | |
436 | #endif | |
437 | } | |
438 | EOF | |
439 | compile_prog "" "" "endian" && bigendian="yes" | |
440 | check_define "__ARMEB__" && bigendian="yes" | |
441 | check_define "__MIPSEB__" && bigendian="yes" | |
0dcebdf4 JA |
442 | fi |
443 | ||
444 | ||
67bf9823 JA |
445 | echo "Operating system $targetos" |
446 | echo "CPU $cpu" | |
0dcebdf4 | 447 | echo "Big endian $bigendian" |
67bf9823 | 448 | echo "Compiler $cc" |
1a17cfdb | 449 | echo "Cross compile $cross_compile" |
67bf9823 JA |
450 | echo |
451 | ||
d2aeedb9 JA |
452 | ########################################## |
453 | # See if we need to build a static build | |
454 | if test "$build_static" = "yes" ; then | |
455 | CFLAGS="$CFLAGS -ffunction-sections -fdata-sections" | |
456 | LDFLAGS="$LDFLAGS -static -Wl,--gc-sections" | |
457 | else | |
458 | build_static="no" | |
459 | fi | |
460 | echo "Static build $build_static" | |
461 | ||
67bf9823 JA |
462 | ########################################## |
463 | # check for wordsize | |
464 | wordsize="0" | |
465 | cat > $TMPC <<EOF | |
142429e5 AC |
466 | #include <limits.h> |
467 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) | |
67bf9823 JA |
468 | int main(void) |
469 | { | |
142429e5 | 470 | BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE); |
67bf9823 JA |
471 | return 0; |
472 | } | |
473 | EOF | |
142429e5 AC |
474 | if compile_prog "-DWORDSIZE=32" "" "wordsize"; then |
475 | wordsize="32" | |
476 | elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then | |
477 | wordsize="64" | |
478 | else | |
479 | fatal "Unknown wordsize" | |
67bf9823 JA |
480 | fi |
481 | echo "Wordsize $wordsize" | |
482 | ||
a9bca4aa JA |
483 | ########################################## |
484 | # zlib probe | |
485 | zlib="no" | |
486 | cat > $TMPC <<EOF | |
804a1e05 | 487 | #include <zlib.h> |
a9bca4aa JA |
488 | int main(void) |
489 | { | |
490 | z_stream stream; | |
491 | if (inflateInit(&stream) != Z_OK) | |
492 | return 1; | |
493 | return 0; | |
494 | } | |
495 | EOF | |
496 | if compile_prog "" "-lz" "zlib" ; then | |
497 | zlib=yes | |
498 | LIBS="-lz $LIBS" | |
a9bca4aa JA |
499 | fi |
500 | echo "zlib $zlib" | |
501 | ||
67bf9823 JA |
502 | ########################################## |
503 | # linux-aio probe | |
504 | libaio="no" | |
7c77ebef | 505 | if test "$esx" != "yes" ; then |
506 | cat > $TMPC <<EOF | |
67bf9823 JA |
507 | #include <libaio.h> |
508 | #include <stddef.h> | |
509 | int main(void) | |
510 | { | |
511 | io_setup(0, NULL); | |
512 | return 0; | |
513 | } | |
514 | EOF | |
7c77ebef | 515 | if compile_prog "" "-laio" "libaio" ; then |
516 | libaio=yes | |
517 | LIBS="-laio $LIBS" | |
518 | else | |
519 | if test "$libaio" = "yes" ; then | |
520 | feature_not_found "linux AIO" "libaio-dev or libaio-devel" | |
521 | fi | |
522 | libaio=no | |
67bf9823 | 523 | fi |
67bf9823 JA |
524 | fi |
525 | echo "Linux AIO support $libaio" | |
526 | ||
527 | ########################################## | |
528 | # posix aio probe | |
529 | posix_aio="no" | |
530 | posix_aio_lrt="no" | |
531 | cat > $TMPC <<EOF | |
532 | #include <aio.h> | |
533 | int main(void) | |
534 | { | |
535 | struct aiocb cb; | |
536 | aio_read(&cb); | |
537 | return 0; | |
538 | } | |
539 | EOF | |
540 | if compile_prog "" "" "posixaio" ; then | |
541 | posix_aio="yes" | |
542 | elif compile_prog "" "-lrt" "posixaio"; then | |
543 | posix_aio="yes" | |
544 | posix_aio_lrt="yes" | |
545 | LIBS="-lrt $LIBS" | |
546 | fi | |
547 | echo "POSIX AIO support $posix_aio" | |
548 | echo "POSIX AIO support needs -lrt $posix_aio_lrt" | |
549 | ||
550 | ########################################## | |
551 | # posix aio fsync probe | |
552 | posix_aio_fsync="no" | |
553 | if test "$posix_aio" = "yes" ; then | |
554 | cat > $TMPC <<EOF | |
555 | #include <fcntl.h> | |
556 | #include <aio.h> | |
557 | int main(void) | |
558 | { | |
559 | struct aiocb cb; | |
560 | return aio_fsync(O_SYNC, &cb); | |
561 | return 0; | |
562 | } | |
563 | EOF | |
564 | if compile_prog "" "$LIBS" "posix_aio_fsync" ; then | |
565 | posix_aio_fsync=yes | |
566 | fi | |
567 | fi | |
568 | echo "POSIX AIO fsync $posix_aio_fsync" | |
569 | ||
570 | ########################################## | |
571 | # solaris aio probe | |
572 | solaris_aio="no" | |
573 | cat > $TMPC <<EOF | |
574 | #include <sys/types.h> | |
575 | #include <sys/asynch.h> | |
576 | #include <unistd.h> | |
577 | int main(void) | |
578 | { | |
579 | aio_result_t res; | |
580 | return aioread(0, NULL, 0, 0, SEEK_SET, &res); | |
581 | return 0; | |
582 | } | |
583 | EOF | |
584 | if compile_prog "" "-laio" "solarisaio" ; then | |
585 | solaris_aio=yes | |
586 | LIBS="-laio $LIBS" | |
587 | fi | |
588 | echo "Solaris AIO support $solaris_aio" | |
589 | ||
590 | ########################################## | |
f5cd2907 | 591 | # __sync_fetch_and_add test |
67bf9823 JA |
592 | sfaa="no" |
593 | cat > $TMPC << EOF | |
958886d8 JA |
594 | #include <inttypes.h> |
595 | static int sfaa(uint64_t *ptr) | |
67bf9823 | 596 | { |
9c639a76 | 597 | return __sync_fetch_and_add(ptr, 0); |
67bf9823 JA |
598 | } |
599 | ||
600 | int main(int argc, char **argv) | |
601 | { | |
958886d8 | 602 | uint64_t val = 42; |
67bf9823 JA |
603 | sfaa(&val); |
604 | return val; | |
605 | } | |
606 | EOF | |
607 | if compile_prog "" "" "__sync_fetch_and_add()" ; then | |
608 | sfaa="yes" | |
609 | fi | |
9c639a76 | 610 | echo "__sync_fetch_and_add $sfaa" |
67bf9823 JA |
611 | |
612 | ########################################## | |
613 | # libverbs probe | |
614 | libverbs="no" | |
615 | cat > $TMPC << EOF | |
616 | #include <stdio.h> | |
617 | #include <infiniband/arch.h> | |
618 | int main(int argc, char **argv) | |
619 | { | |
620 | struct ibv_pd *pd = ibv_alloc_pd(NULL); | |
621 | return 0; | |
622 | } | |
623 | EOF | |
624 | if compile_prog "" "-libverbs" "libverbs" ; then | |
625 | libverbs="yes" | |
626 | LIBS="-libverbs $LIBS" | |
627 | fi | |
628 | echo "libverbs $libverbs" | |
629 | ||
630 | ########################################## | |
631 | # rdmacm probe | |
632 | rdmacm="no" | |
633 | cat > $TMPC << EOF | |
634 | #include <stdio.h> | |
635 | #include <rdma/rdma_cma.h> | |
636 | int main(int argc, char **argv) | |
637 | { | |
638 | rdma_destroy_qp(NULL); | |
639 | return 0; | |
640 | } | |
641 | EOF | |
642 | if compile_prog "" "-lrdmacm" "rdma"; then | |
643 | rdmacm="yes" | |
644 | LIBS="-lrdmacm $LIBS" | |
645 | fi | |
646 | echo "rdmacm $rdmacm" | |
647 | ||
648 | ########################################## | |
649 | # Linux fallocate probe | |
650 | linux_fallocate="no" | |
651 | cat > $TMPC << EOF | |
652 | #include <stdio.h> | |
aa6738a5 | 653 | #include <fcntl.h> |
67bf9823 JA |
654 | #include <linux/falloc.h> |
655 | int main(int argc, char **argv) | |
656 | { | |
657 | int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024); | |
658 | return r; | |
659 | } | |
660 | EOF | |
661 | if compile_prog "" "" "linux_fallocate"; then | |
662 | linux_fallocate="yes" | |
663 | fi | |
664 | echo "Linux fallocate $linux_fallocate" | |
665 | ||
666 | ########################################## | |
667 | # POSIX fadvise probe | |
668 | posix_fadvise="no" | |
669 | cat > $TMPC << EOF | |
670 | #include <stdio.h> | |
671 | #include <fcntl.h> | |
672 | int main(int argc, char **argv) | |
673 | { | |
674 | int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL); | |
675 | return r; | |
676 | } | |
677 | EOF | |
678 | if compile_prog "" "" "posix_fadvise"; then | |
679 | posix_fadvise="yes" | |
680 | fi | |
681 | echo "POSIX fadvise $posix_fadvise" | |
682 | ||
683 | ########################################## | |
684 | # POSIX fallocate probe | |
685 | posix_fallocate="no" | |
686 | cat > $TMPC << EOF | |
687 | #include <stdio.h> | |
688 | #include <fcntl.h> | |
689 | int main(int argc, char **argv) | |
690 | { | |
691 | int r = posix_fallocate(0, 0, 1024); | |
692 | return r; | |
693 | } | |
694 | EOF | |
695 | if compile_prog "" "" "posix_fallocate"; then | |
696 | posix_fallocate="yes" | |
697 | fi | |
698 | echo "POSIX fallocate $posix_fallocate" | |
699 | ||
700 | ########################################## | |
701 | # sched_set/getaffinity 2 or 3 argument test | |
702 | linux_2arg_affinity="no" | |
703 | linux_3arg_affinity="no" | |
704 | cat > $TMPC << EOF | |
67bf9823 JA |
705 | #include <sched.h> |
706 | int main(int argc, char **argv) | |
707 | { | |
708 | cpu_set_t mask; | |
709 | return sched_setaffinity(0, sizeof(mask), &mask); | |
710 | } | |
711 | EOF | |
712 | if compile_prog "" "" "sched_setaffinity(,,)"; then | |
713 | linux_3arg_affinity="yes" | |
714 | else | |
715 | cat > $TMPC << EOF | |
67bf9823 JA |
716 | #include <sched.h> |
717 | int main(int argc, char **argv) | |
718 | { | |
719 | cpu_set_t mask; | |
720 | return sched_setaffinity(0, &mask); | |
721 | } | |
722 | EOF | |
723 | if compile_prog "" "" "sched_setaffinity(,)"; then | |
724 | linux_2arg_affinity="yes" | |
725 | fi | |
726 | fi | |
727 | echo "sched_setaffinity(3 arg) $linux_3arg_affinity" | |
728 | echo "sched_setaffinity(2 arg) $linux_2arg_affinity" | |
729 | ||
730 | ########################################## | |
731 | # clock_gettime probe | |
732 | clock_gettime="no" | |
733 | cat > $TMPC << EOF | |
734 | #include <stdio.h> | |
735 | #include <time.h> | |
736 | int main(int argc, char **argv) | |
737 | { | |
738 | return clock_gettime(0, NULL); | |
739 | } | |
740 | EOF | |
741 | if compile_prog "" "" "clock_gettime"; then | |
742 | clock_gettime="yes" | |
743 | elif compile_prog "" "-lrt" "clock_gettime"; then | |
744 | clock_gettime="yes" | |
745 | LIBS="-lrt $LIBS" | |
746 | fi | |
747 | echo "clock_gettime $clock_gettime" | |
748 | ||
749 | ########################################## | |
750 | # CLOCK_MONOTONIC probe | |
751 | clock_monotonic="no" | |
752 | if test "$clock_gettime" = "yes" ; then | |
753 | cat > $TMPC << EOF | |
754 | #include <stdio.h> | |
755 | #include <time.h> | |
756 | int main(int argc, char **argv) | |
757 | { | |
758 | return clock_gettime(CLOCK_MONOTONIC, NULL); | |
759 | } | |
760 | EOF | |
761 | if compile_prog "" "$LIBS" "clock monotonic"; then | |
762 | clock_monotonic="yes" | |
763 | fi | |
764 | fi | |
765 | echo "CLOCK_MONOTONIC $clock_monotonic" | |
766 | ||
c544f604 SN |
767 | ########################################## |
768 | # CLOCK_MONOTONIC_RAW probe | |
769 | clock_monotonic_raw="no" | |
770 | if test "$clock_gettime" = "yes" ; then | |
771 | cat > $TMPC << EOF | |
772 | #include <stdio.h> | |
773 | #include <time.h> | |
774 | int main(int argc, char **argv) | |
775 | { | |
776 | return clock_gettime(CLOCK_MONOTONIC_RAW, NULL); | |
777 | } | |
778 | EOF | |
779 | if compile_prog "" "$LIBS" "clock monotonic"; then | |
780 | clock_monotonic_raw="yes" | |
781 | fi | |
782 | fi | |
783 | echo "CLOCK_MONOTONIC_RAW $clock_monotonic_raw" | |
784 | ||
67bf9823 JA |
785 | ########################################## |
786 | # CLOCK_MONOTONIC_PRECISE probe | |
787 | clock_monotonic_precise="no" | |
788 | if test "$clock_gettime" = "yes" ; then | |
789 | cat > $TMPC << EOF | |
790 | #include <stdio.h> | |
791 | #include <time.h> | |
792 | int main(int argc, char **argv) | |
793 | { | |
794 | return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL); | |
795 | } | |
796 | EOF | |
797 | if compile_prog "" "$LIBS" "clock monotonic precise"; then | |
798 | clock_monotonic_precise="yes" | |
799 | fi | |
800 | fi | |
801 | echo "CLOCK_MONOTONIC_PRECISE $clock_monotonic_precise" | |
802 | ||
25f8227d JA |
803 | ########################################## |
804 | # clockid_t probe | |
805 | clockid_t="no" | |
806 | cat > $TMPC << EOF | |
807 | #include <stdio.h> | |
a214d131 | 808 | #include <string.h> |
25f8227d JA |
809 | #include <time.h> |
810 | int main(int argc, char **argv) | |
811 | { | |
a214d131 JA |
812 | clockid_t cid; |
813 | memset(&cid, 0, sizeof(cid)); | |
25f8227d JA |
814 | return clock_gettime(cid, NULL); |
815 | } | |
816 | EOF | |
817 | if compile_prog "" "$LIBS" "clockid_t"; then | |
818 | clockid_t="yes" | |
819 | fi | |
820 | echo "clockid_t $clockid_t" | |
821 | ||
67bf9823 JA |
822 | ########################################## |
823 | # gettimeofday() probe | |
824 | gettimeofday="no" | |
825 | cat > $TMPC << EOF | |
826 | #include <sys/time.h> | |
827 | #include <stdio.h> | |
828 | int main(int argc, char **argv) | |
829 | { | |
830 | struct timeval tv; | |
831 | return gettimeofday(&tv, NULL); | |
832 | } | |
833 | EOF | |
834 | if compile_prog "" "" "gettimeofday"; then | |
835 | gettimeofday="yes" | |
836 | fi | |
837 | echo "gettimeofday $gettimeofday" | |
838 | ||
839 | ########################################## | |
840 | # fdatasync() probe | |
841 | fdatasync="no" | |
842 | cat > $TMPC << EOF | |
843 | #include <stdio.h> | |
844 | #include <unistd.h> | |
845 | int main(int argc, char **argv) | |
846 | { | |
847 | return fdatasync(0); | |
848 | } | |
849 | EOF | |
850 | if compile_prog "" "" "fdatasync"; then | |
851 | fdatasync="yes" | |
852 | fi | |
853 | echo "fdatasync $fdatasync" | |
854 | ||
855 | ########################################## | |
856 | # sync_file_range() probe | |
857 | sync_file_range="no" | |
858 | cat > $TMPC << EOF | |
859 | #include <stdio.h> | |
860 | #include <unistd.h> | |
67bf9823 JA |
861 | #include <fcntl.h> |
862 | #include <linux/fs.h> | |
863 | int main(int argc, char **argv) | |
864 | { | |
865 | unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE | | |
866 | SYNC_FILE_RANGE_WAIT_AFTER; | |
867 | return sync_file_range(0, 0, 0, flags); | |
868 | } | |
869 | EOF | |
870 | if compile_prog "" "" "sync_file_range"; then | |
871 | sync_file_range="yes" | |
872 | fi | |
873 | echo "sync_file_range $sync_file_range" | |
874 | ||
875 | ########################################## | |
876 | # ext4 move extent probe | |
877 | ext4_me="no" | |
878 | cat > $TMPC << EOF | |
879 | #include <fcntl.h> | |
880 | #include <sys/ioctl.h> | |
881 | int main(int argc, char **argv) | |
882 | { | |
883 | struct move_extent me; | |
884 | return ioctl(0, EXT4_IOC_MOVE_EXT, &me); | |
885 | } | |
886 | EOF | |
c7165b8d JA |
887 | if compile_prog "" "" "ext4 move extent" ; then |
888 | ext4_me="yes" | |
889 | elif test $targetos = "Linux" ; then | |
890 | # On Linux, just default to it on and let it error at runtime if we really | |
891 | # don't have it. None of my updated systems have it defined, but it does | |
892 | # work. Takes a while to bubble back. | |
67bf9823 JA |
893 | ext4_me="yes" |
894 | fi | |
895 | echo "EXT4 move extent $ext4_me" | |
896 | ||
897 | ########################################## | |
898 | # splice probe | |
899 | linux_splice="no" | |
900 | cat > $TMPC << EOF | |
67bf9823 JA |
901 | #include <stdio.h> |
902 | #include <fcntl.h> | |
903 | int main(int argc, char **argv) | |
904 | { | |
905 | return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK); | |
906 | } | |
907 | EOF | |
908 | if compile_prog "" "" "linux splice"; then | |
909 | linux_splice="yes" | |
910 | fi | |
911 | echo "Linux splice(2) $linux_splice" | |
912 | ||
913 | ########################################## | |
914 | # GUASI probe | |
915 | guasi="no" | |
916 | cat > $TMPC << EOF | |
917 | #include <guasi.h> | |
918 | #include <guasi_syscalls.h> | |
919 | int main(int argc, char **argv) | |
920 | { | |
921 | guasi_t ctx = guasi_create(0, 0, 0); | |
922 | return 0; | |
923 | } | |
924 | EOF | |
925 | if compile_prog "" "" "guasi"; then | |
926 | guasi="yes" | |
927 | fi | |
928 | echo "GUASI $guasi" | |
929 | ||
930 | ########################################## | |
931 | # fusion-aw probe | |
932 | fusion_aw="no" | |
933 | cat > $TMPC << EOF | |
b2c77c25 | 934 | #include <nvm/nvm_primitives.h> |
67bf9823 JA |
935 | int main(int argc, char **argv) |
936 | { | |
b2c77c25 SK |
937 | nvm_version_t ver_info; |
938 | nvm_handle_t handle; | |
939 | ||
940 | handle = nvm_get_handle(0, &ver_info); | |
941 | return nvm_atomic_write(handle, 0, 0, 0); | |
67bf9823 JA |
942 | } |
943 | EOF | |
92aef550 ARJ |
944 | if compile_prog "" "-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread" "fusion-aw"; then |
945 | LIBS="-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread $LIBS" | |
67bf9823 JA |
946 | fusion_aw="yes" |
947 | fi | |
948 | echo "Fusion-io atomic engine $fusion_aw" | |
949 | ||
950 | ########################################## | |
951 | # libnuma probe | |
952 | libnuma="no" | |
953 | cat > $TMPC << EOF | |
954 | #include <numa.h> | |
955 | int main(int argc, char **argv) | |
956 | { | |
957 | return numa_available(); | |
958 | } | |
959 | EOF | |
44462517 | 960 | if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then |
67bf9823 JA |
961 | libnuma="yes" |
962 | LIBS="-lnuma $LIBS" | |
963 | fi | |
964 | echo "libnuma $libnuma" | |
965 | ||
50206d9b JA |
966 | ########################################## |
967 | # libnuma 2.x version API | |
968 | if test "$libnuma" = "yes" ; then | |
969 | libnuma_v2="no" | |
970 | cat > $TMPC << EOF | |
971 | #include <numa.h> | |
972 | int main(int argc, char **argv) | |
973 | { | |
974 | struct bitmask *mask = numa_parse_nodestring(NULL); | |
61bde962 | 975 | return mask->size == 0; |
50206d9b JA |
976 | } |
977 | EOF | |
978 | if compile_prog "" "" "libnuma api"; then | |
979 | libnuma_v2="yes" | |
980 | fi | |
981 | echo "libnuma v2 $libnuma_v2" | |
982 | fi | |
983 | ||
67bf9823 JA |
984 | ########################################## |
985 | # strsep() probe | |
986 | strsep="no" | |
987 | cat > $TMPC << EOF | |
988 | #include <string.h> | |
989 | int main(int argc, char **argv) | |
990 | { | |
ae156be6 JA |
991 | static char *string = "This is a string"; |
992 | strsep(&string, "needle"); | |
67bf9823 JA |
993 | return 0; |
994 | } | |
995 | EOF | |
996 | if compile_prog "" "" "strsep"; then | |
997 | strsep="yes" | |
998 | fi | |
999 | echo "strsep $strsep" | |
1000 | ||
9ad8da82 JA |
1001 | ########################################## |
1002 | # strcasestr() probe | |
1003 | strcasestr="no" | |
1004 | cat > $TMPC << EOF | |
1005 | #include <string.h> | |
1006 | int main(int argc, char **argv) | |
1007 | { | |
aa6738a5 | 1008 | return strcasestr(argv[0], argv[1]) != NULL; |
9ad8da82 JA |
1009 | } |
1010 | EOF | |
1011 | if compile_prog "" "" "strcasestr"; then | |
1012 | strcasestr="yes" | |
1013 | fi | |
1014 | echo "strcasestr $strcasestr" | |
1015 | ||
5ad7be56 KD |
1016 | ########################################## |
1017 | # strlcat() probe | |
1018 | strlcat="no" | |
1019 | cat > $TMPC << EOF | |
1020 | #include <string.h> | |
1021 | int main(int argc, char **argv) | |
1022 | { | |
1023 | static char dst[64]; | |
1024 | static char *string = "This is a string"; | |
1025 | memset(dst, 0, sizeof(dst)); | |
1026 | strlcat(dst, string, sizeof(dst)); | |
1027 | return 0; | |
1028 | } | |
1029 | EOF | |
1030 | if compile_prog "" "" "strlcat"; then | |
1031 | strlcat="yes" | |
1032 | fi | |
1033 | echo "strlcat $strlcat" | |
1034 | ||
67bf9823 JA |
1035 | ########################################## |
1036 | # getopt_long_only() probe | |
1037 | getopt_long_only="no" | |
1038 | cat > $TMPC << EOF | |
1039 | #include <unistd.h> | |
1040 | #include <stdio.h> | |
aa6738a5 | 1041 | #include <getopt.h> |
67bf9823 JA |
1042 | int main(int argc, char **argv) |
1043 | { | |
1044 | int c = getopt_long_only(argc, argv, NULL, NULL, NULL); | |
1045 | return c; | |
1046 | } | |
1047 | EOF | |
1048 | if compile_prog "" "" "getopt_long_only"; then | |
1049 | getopt_long_only="yes" | |
1050 | fi | |
1051 | echo "getopt_long_only() $getopt_long_only" | |
1052 | ||
1053 | ########################################## | |
1054 | # inet_aton() probe | |
1055 | inet_aton="no" | |
1056 | cat > $TMPC << EOF | |
1057 | #include <sys/socket.h> | |
1058 | #include <arpa/inet.h> | |
1059 | #include <stdio.h> | |
1060 | int main(int argc, char **argv) | |
1061 | { | |
1062 | struct in_addr in; | |
1063 | return inet_aton(NULL, &in); | |
1064 | } | |
1065 | EOF | |
1066 | if compile_prog "" "" "inet_aton"; then | |
1067 | inet_aton="yes" | |
1068 | fi | |
1069 | echo "inet_aton $inet_aton" | |
1070 | ||
1071 | ########################################## | |
1072 | # socklen_t probe | |
1073 | socklen_t="no" | |
1074 | cat > $TMPC << EOF | |
f6482613 | 1075 | #include <sys/socket.h> |
67bf9823 JA |
1076 | int main(int argc, char **argv) |
1077 | { | |
1078 | socklen_t len = 0; | |
1079 | return len; | |
1080 | } | |
1081 | EOF | |
1082 | if compile_prog "" "" "socklen_t"; then | |
1083 | socklen_t="yes" | |
1084 | fi | |
1085 | echo "socklen_t $socklen_t" | |
1086 | ||
1087 | ########################################## | |
1088 | # Whether or not __thread is supported for TLS | |
1089 | tls_thread="no" | |
1090 | cat > $TMPC << EOF | |
1091 | #include <stdio.h> | |
aa6738a5 | 1092 | static __thread int ret; |
67bf9823 JA |
1093 | int main(int argc, char **argv) |
1094 | { | |
1095 | return ret; | |
1096 | } | |
1097 | EOF | |
1098 | if compile_prog "" "" "__thread"; then | |
1099 | tls_thread="yes" | |
1100 | fi | |
1101 | echo "__thread $tls_thread" | |
1102 | ||
91f94d5b | 1103 | ########################################## |
2639f056 | 1104 | # Check if we have required gtk/glib support for gfio |
ebec2094 JA |
1105 | gfio="no" |
1106 | if test "$gfio_check" = "yes" ; then | |
91f94d5b JA |
1107 | cat > $TMPC << EOF |
1108 | #include <glib.h> | |
1109 | #include <cairo.h> | |
1110 | #include <gtk/gtk.h> | |
1111 | int main(void) | |
1112 | { | |
1113 | gdk_threads_enter(); | |
91f94d5b | 1114 | gdk_threads_leave(); |
b7a99316 JA |
1115 | |
1116 | printf("%d", GTK_CHECK_VERSION(2, 18, 0)); | |
91f94d5b JA |
1117 | } |
1118 | EOF | |
1119 | GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0) | |
86719845 JA |
1120 | ORG_LDFLAGS=$LDFLAGS |
1121 | LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g) | |
91f94d5b JA |
1122 | if test "$?" != "0" ; then |
1123 | echo "configure: gtk and gthread not found" | |
1124 | exit 1 | |
1125 | fi | |
1126 | GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0) | |
1127 | if test "$?" != "0" ; then | |
1128 | echo "configure: gtk and gthread not found" | |
1129 | exit 1 | |
1130 | fi | |
b7a99316 JA |
1131 | if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then |
1132 | r=$($TMPE) | |
1133 | if test "$r" != "0" ; then | |
1134 | gfio="yes" | |
86719845 | 1135 | GFIO_LIBS="$LIBS $GTK_LIBS" |
b7a99316 JA |
1136 | CFLAGS="$CFLAGS $GTK_CFLAGS" |
1137 | else | |
1138 | echo "GTK found, but need version 2.18 or higher" | |
1139 | gfio="no" | |
1140 | fi | |
91f94d5b JA |
1141 | else |
1142 | echo "Please install gtk and gdk libraries" | |
1143 | gfio="no" | |
1144 | fi | |
86719845 | 1145 | LDFLAGS=$ORG_LDFLAGS |
91f94d5b JA |
1146 | fi |
1147 | ||
ebec2094 JA |
1148 | if test "$gfio_check" = "yes" ; then |
1149 | echo "gtk 2.18 or higher $gfio" | |
1150 | fi | |
91f94d5b | 1151 | |
44404c5a JA |
1152 | # Check whether we have getrusage(RUSAGE_THREAD) |
1153 | rusage_thread="no" | |
1154 | cat > $TMPC << EOF | |
1155 | #include <sys/time.h> | |
1156 | #include <sys/resource.h> | |
1157 | int main(int argc, char **argv) | |
1158 | { | |
1159 | struct rusage ru; | |
1160 | getrusage(RUSAGE_THREAD, &ru); | |
1161 | return 0; | |
1162 | } | |
1163 | EOF | |
1164 | if compile_prog "" "" "RUSAGE_THREAD"; then | |
1165 | rusage_thread="yes" | |
1166 | fi | |
1167 | echo "RUSAGE_THREAD $rusage_thread" | |
1168 | ||
7e09a9f1 JA |
1169 | ########################################## |
1170 | # Check whether we have SCHED_IDLE | |
1171 | sched_idle="no" | |
1172 | cat > $TMPC << EOF | |
1173 | #include <sched.h> | |
1174 | int main(int argc, char **argv) | |
1175 | { | |
1176 | struct sched_param p; | |
1177 | return sched_setscheduler(0, SCHED_IDLE, &p); | |
1178 | } | |
1179 | EOF | |
1180 | if compile_prog "" "" "SCHED_IDLE"; then | |
1181 | sched_idle="yes" | |
1182 | fi | |
1183 | echo "SCHED_IDLE $sched_idle" | |
1184 | ||
1eafa37a JA |
1185 | ########################################## |
1186 | # Check whether we have TCP_NODELAY | |
1187 | tcp_nodelay="no" | |
1188 | cat > $TMPC << EOF | |
1189 | #include <stdio.h> | |
1190 | #include <sys/types.h> | |
1191 | #include <sys/socket.h> | |
1192 | #include <netinet/tcp.h> | |
1193 | int main(int argc, char **argv) | |
1194 | { | |
1195 | return getsockopt(0, 0, TCP_NODELAY, NULL, NULL); | |
1196 | } | |
1197 | EOF | |
1198 | if compile_prog "" "" "TCP_NODELAY"; then | |
1199 | tcp_nodelay="yes" | |
1200 | fi | |
1201 | echo "TCP_NODELAY $tcp_nodelay" | |
1202 | ||
1008602c JA |
1203 | ########################################## |
1204 | # Check whether we have SO_SNDBUF | |
1205 | window_size="no" | |
1206 | cat > $TMPC << EOF | |
1207 | #include <stdio.h> | |
1208 | #include <sys/types.h> | |
1209 | #include <sys/socket.h> | |
1210 | #include <netinet/tcp.h> | |
1211 | int main(int argc, char **argv) | |
1212 | { | |
1213 | setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0); | |
1214 | setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0); | |
1215 | } | |
1216 | EOF | |
1217 | if compile_prog "" "" "SO_SNDBUF"; then | |
1218 | window_size="yes" | |
1219 | fi | |
1220 | echo "Net engine window_size $window_size" | |
1221 | ||
e5f34d95 JA |
1222 | ########################################## |
1223 | # Check whether we have TCP_MAXSEG | |
1224 | mss="no" | |
1225 | cat > $TMPC << EOF | |
1226 | #include <stdio.h> | |
1227 | #include <sys/types.h> | |
1228 | #include <sys/socket.h> | |
1229 | #include <netinet/tcp.h> | |
1230 | #include <arpa/inet.h> | |
1231 | #include <netinet/in.h> | |
1232 | int main(int argc, char **argv) | |
1233 | { | |
1234 | return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0); | |
1235 | } | |
1236 | EOF | |
1237 | if compile_prog "" "" "TCP_MAXSEG"; then | |
1238 | mss="yes" | |
1239 | fi | |
1240 | echo "TCP_MAXSEG $mss" | |
1241 | ||
38b9354a JA |
1242 | ########################################## |
1243 | # Check whether we have RLIMIT_MEMLOCK | |
1244 | rlimit_memlock="no" | |
1245 | cat > $TMPC << EOF | |
1246 | #include <sys/time.h> | |
1247 | #include <sys/resource.h> | |
1248 | int main(int argc, char **argv) | |
1249 | { | |
1250 | struct rlimit rl; | |
1251 | return getrlimit(RLIMIT_MEMLOCK, &rl); | |
1252 | } | |
1253 | EOF | |
1254 | if compile_prog "" "" "RLIMIT_MEMLOCK"; then | |
1255 | rlimit_memlock="yes" | |
1256 | fi | |
1257 | echo "RLIMIT_MEMLOCK $rlimit_memlock" | |
1258 | ||
07fc0acd JA |
1259 | ########################################## |
1260 | # Check whether we have pwritev/preadv | |
1261 | pwritev="no" | |
1262 | cat > $TMPC << EOF | |
1263 | #include <stdio.h> | |
1264 | #include <sys/uio.h> | |
1265 | int main(int argc, char **argv) | |
1266 | { | |
1267 | return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0); | |
1268 | } | |
1269 | EOF | |
1270 | if compile_prog "" "" "pwritev"; then | |
1271 | pwritev="yes" | |
1272 | fi | |
1273 | echo "pwritev/preadv $pwritev" | |
1274 | ||
2cafffbe JA |
1275 | ########################################## |
1276 | # Check whether we have pwritev2/preadv2 | |
1277 | pwritev2="no" | |
1278 | cat > $TMPC << EOF | |
1279 | #include <stdio.h> | |
1280 | #include <sys/uio.h> | |
1281 | int main(int argc, char **argv) | |
1282 | { | |
1283 | return pwritev2(0, NULL, 1, 0, 0) + preadv2(0, NULL, 1, 0, 0); | |
1284 | } | |
1285 | EOF | |
1286 | if compile_prog "" "" "pwritev2"; then | |
1287 | pwritev2="yes" | |
1288 | fi | |
1289 | echo "pwritev2/preadv2 $pwritev2" | |
1290 | ||
ecad55e9 JA |
1291 | ########################################## |
1292 | # Check whether we have the required functions for ipv6 | |
1293 | ipv6="no" | |
1294 | cat > $TMPC << EOF | |
1295 | #include <sys/types.h> | |
1296 | #include <sys/socket.h> | |
d219028d | 1297 | #include <netinet/in.h> |
ecad55e9 JA |
1298 | #include <netdb.h> |
1299 | #include <stdio.h> | |
1300 | int main(int argc, char **argv) | |
1301 | { | |
1302 | struct addrinfo hints; | |
1303 | struct in6_addr addr; | |
1304 | int ret; | |
1305 | ||
1306 | ret = getaddrinfo(NULL, NULL, &hints, NULL); | |
1307 | freeaddrinfo(NULL); | |
1308 | printf("%s\n", gai_strerror(ret)); | |
1309 | addr = in6addr_any; | |
1310 | return 0; | |
1311 | } | |
1312 | EOF | |
1313 | if compile_prog "" "" "ipv6"; then | |
1314 | ipv6="yes" | |
1315 | fi | |
1316 | echo "IPv6 helpers $ipv6" | |
07fc0acd | 1317 | |
fc5c0345 DG |
1318 | ########################################## |
1319 | # check for rbd | |
1320 | rbd="no" | |
1321 | cat > $TMPC << EOF | |
1322 | #include <rbd/librbd.h> | |
1323 | ||
1324 | int main(int argc, char **argv) | |
1325 | { | |
1326 | ||
1327 | rados_t cluster; | |
1328 | rados_ioctx_t io_ctx; | |
1329 | const char pool[] = "rbd"; | |
1330 | ||
1331 | int major, minor, extra; | |
1332 | rbd_version(&major, &minor, &extra); | |
1333 | ||
1334 | rados_ioctx_create(cluster, pool, &io_ctx); | |
1335 | return 0; | |
1336 | } | |
1337 | EOF | |
ce18290e | 1338 | if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then |
fc5c0345 DG |
1339 | LIBS="-lrbd -lrados $LIBS" |
1340 | rbd="yes" | |
1341 | fi | |
1342 | echo "Rados Block Device engine $rbd" | |
1343 | ||
53b6c979 PL |
1344 | ########################################## |
1345 | # check for rbd_poll | |
1346 | rbd_poll="no" | |
1347 | if test "$rbd" = "yes"; then | |
1348 | cat > $TMPC << EOF | |
1349 | #include <rbd/librbd.h> | |
1350 | #include <sys/eventfd.h> | |
1351 | ||
1352 | int main(int argc, char **argv) | |
1353 | { | |
1354 | rbd_image_t image; | |
1355 | rbd_completion_t comp; | |
1356 | ||
1357 | int fd = eventfd(0, EFD_NONBLOCK); | |
1358 | rbd_set_image_notification(image, fd, EVENT_TYPE_EVENTFD); | |
1359 | rbd_poll_io_events(image, comp, 1); | |
1360 | ||
1361 | return 0; | |
1362 | } | |
1363 | EOF | |
1364 | if compile_prog "" "-lrbd -lrados" "rbd"; then | |
1365 | rbd_poll="yes" | |
1366 | fi | |
1367 | echo "rbd_poll $rbd_poll" | |
1368 | fi | |
1369 | ||
903b2812 JA |
1370 | ########################################## |
1371 | # check for rbd_invaidate_cache() | |
1372 | rbd_inval="no" | |
1373 | if test "$rbd" = "yes"; then | |
1374 | cat > $TMPC << EOF | |
1375 | #include <rbd/librbd.h> | |
1376 | ||
1377 | int main(int argc, char **argv) | |
1378 | { | |
1379 | rbd_image_t image; | |
1380 | ||
1381 | return rbd_invalidate_cache(image); | |
1382 | } | |
1383 | EOF | |
1384 | if compile_prog "" "-lrbd -lrados" "rbd"; then | |
1385 | rbd_inval="yes" | |
1386 | fi | |
1387 | echo "rbd_invalidate_cache $rbd_inval" | |
1388 | fi | |
1389 | ||
a4c4c346 | 1390 | ########################################## |
1391 | # check for blkin | |
1392 | rbd_blkin="no" | |
1393 | cat > $TMPC << EOF | |
1394 | #include <rbd/librbd.h> | |
1395 | #include <zipkin_c.h> | |
1396 | ||
1397 | int main(int argc, char **argv) | |
1398 | { | |
1399 | int r; | |
1400 | struct blkin_trace_info t_info; | |
1401 | blkin_init_trace_info(&t_info); | |
1402 | rbd_completion_t completion; | |
1403 | rbd_image_t image; | |
1404 | uint64_t off; | |
1405 | size_t len; | |
1406 | const char *buf; | |
1407 | r = rbd_aio_write_traced(image, off, len, buf, completion, &t_info); | |
1408 | return 0; | |
1409 | } | |
1410 | EOF | |
1411 | if test "$disable_rbd" != "yes" && test "$disable_rbd_blkin" != "yes" \ | |
1412 | && compile_prog "" "-lrbd -lrados -lblkin" "rbd_blkin"; then | |
1413 | LIBS="-lblkin $LIBS" | |
1414 | rbd_blkin="yes" | |
1415 | fi | |
1416 | echo "rbd blkin tracing $rbd_blkin" | |
1417 | ||
2e802282 JA |
1418 | ########################################## |
1419 | # Check whether we have setvbuf | |
1420 | setvbuf="no" | |
1421 | cat > $TMPC << EOF | |
1422 | #include <stdio.h> | |
1423 | int main(int argc, char **argv) | |
1424 | { | |
1425 | FILE *f = NULL; | |
1426 | char buf[80]; | |
1427 | setvbuf(f, buf, _IOFBF, sizeof(buf)); | |
1428 | return 0; | |
1429 | } | |
1430 | EOF | |
1431 | if compile_prog "" "" "setvbuf"; then | |
1432 | setvbuf="yes" | |
1433 | fi | |
1434 | echo "setvbuf $setvbuf" | |
fc5c0345 | 1435 | |
6e7d7dfb | 1436 | # check for gfapi |
1437 | gfapi="no" | |
1438 | cat > $TMPC << EOF | |
1439 | #include <glusterfs/api/glfs.h> | |
1440 | ||
1441 | int main(int argc, char **argv) | |
1442 | { | |
1443 | ||
1444 | glfs_t *g = glfs_new("foo"); | |
1445 | ||
1446 | return 0; | |
1447 | } | |
1448 | EOF | |
ce18290e | 1449 | if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then |
6e7d7dfb | 1450 | LIBS="-lgfapi -lglusterfs $LIBS" |
1451 | gfapi="yes" | |
1452 | fi | |
6fa14b99 | 1453 | echo "Gluster API engine $gfapi" |
6e7d7dfb | 1454 | |
6fa14b99 | 1455 | ########################################## |
1456 | # check for gfapi fadvise support | |
6876c98c | 1457 | if test "$gfapi" = "yes" ; then |
6fa14b99 | 1458 | gf_fadvise="no" |
1459 | cat > $TMPC << EOF | |
1460 | #include <glusterfs/api/glfs.h> | |
1461 | ||
1462 | int main(int argc, char **argv) | |
1463 | { | |
1464 | struct glfs_fd *fd; | |
1465 | int ret = glfs_fadvise(fd, 0, 0, 1); | |
1466 | ||
1467 | return 0; | |
1468 | } | |
1469 | EOF | |
6fa14b99 | 1470 | if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then |
1471 | gf_fadvise="yes" | |
1472 | fi | |
1473 | echo "Gluster API use fadvise $gf_fadvise" | |
6876c98c JA |
1474 | fi |
1475 | ||
1476 | ########################################## | |
1477 | # check for gfapi trim support | |
1478 | gf_trim="no" | |
1479 | if test "$gfapi" = "yes" ; then | |
1480 | cat > $TMPC << EOF | |
1481 | #include <glusterfs/api/glfs.h> | |
1482 | ||
1483 | int main(int argc, char **argv) | |
1484 | { | |
1485 | return glfs_discard_async(NULL, 0, 0); | |
1486 | } | |
1487 | EOF | |
1488 | if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then | |
1489 | gf_trim="yes" | |
1490 | fi | |
1491 | echo "Gluster API trim support $gf_trim" | |
1492 | fi | |
fc5c0345 | 1493 | |
81795ce3 CE |
1494 | ########################################## |
1495 | # Check if we support stckf on s390 | |
1496 | s390_z196_facilities="no" | |
1497 | cat > $TMPC << EOF | |
1498 | #define STFLE_BITS_Z196 45 /* various z196 facilities ... */ | |
1499 | int main(int argc, char **argv) | |
1500 | { | |
1501 | /* We want just 1 double word to be returned. */ | |
1502 | register unsigned long reg0 asm("0") = 0; | |
1503 | unsigned long stfle_bits; | |
1504 | asm volatile(".machine push" "\n\t" | |
1505 | ".machine \"z9-109\"" "\n\t" | |
1506 | "stfle %0" "\n\t" | |
1507 | ".machine pop" "\n" | |
1508 | : "=QS" (stfle_bits), "+d" (reg0) | |
1509 | : : "cc"); | |
1510 | ||
1511 | if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0) | |
1512 | return 0; | |
1513 | else | |
1514 | return -1; | |
1515 | } | |
1516 | EOF | |
1517 | if compile_prog "" "" "s390_z196_facilities"; then | |
1518 | $TMPE | |
1519 | if [[ $? -eq 0 ]]; then | |
1520 | s390_z196_facilities="yes" | |
1521 | fi | |
1522 | fi | |
1523 | echo "s390_z196_facilities $s390_z196_facilities" | |
1b10477b MM |
1524 | |
1525 | ########################################## | |
1526 | # Check if we have required environment variables configured for libhdfs | |
1527 | if test "$libhdfs" = "yes" ; then | |
1528 | hdfs_conf_error=0 | |
1529 | if test "$JAVA_HOME" = "" ; then | |
1530 | echo "configure: JAVA_HOME should be defined to jdk/jvm path" | |
1531 | hdfs_conf_error=1 | |
1532 | fi | |
1533 | if test "$FIO_LIBHDFS_INCLUDE" = "" ; then | |
1534 | echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path" | |
1535 | hdfs_conf_error=1 | |
1536 | fi | |
1537 | if test "$FIO_LIBHDFS_LIB" = "" ; then | |
1538 | echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path" | |
1539 | hdfs_conf_error=1 | |
1540 | fi | |
1541 | if test "$hdfs_conf_error" = "1" ; then | |
1542 | exit 1 | |
1543 | fi | |
247e5436 JA |
1544 | FIO_HDFS_CPU=$cpu |
1545 | if test "$FIO_HDFS_CPU" = "x86_64" ; then | |
1546 | FIO_HDFS_CPU="amd64" | |
1547 | fi | |
1b10477b MM |
1548 | fi |
1549 | echo "HDFS engine $libhdfs" | |
1550 | ||
b8116a87 DE |
1551 | ########################################## |
1552 | # Check whether we have MTD | |
1553 | mtd="no" | |
1554 | cat > $TMPC << EOF | |
0e1c454a | 1555 | #include <string.h> |
b8116a87 DE |
1556 | #include <mtd/mtd-user.h> |
1557 | #include <sys/ioctl.h> | |
1558 | int main(int argc, char **argv) | |
1559 | { | |
0e1c454a | 1560 | struct mtd_write_req ops; |
b8116a87 | 1561 | struct mtd_info_user info; |
0e1c454a | 1562 | memset(&ops, 0, sizeof(ops)); |
400cd0ff | 1563 | info.type = MTD_MLCNANDFLASH; |
b8116a87 DE |
1564 | return ioctl(0, MEMGETINFO, &info); |
1565 | } | |
1566 | EOF | |
1567 | if compile_prog "" "" "mtd"; then | |
1568 | mtd="yes" | |
1569 | fi | |
1570 | echo "MTD $mtd" | |
1571 | ||
3ee2a3c1 DJ |
1572 | ########################################## |
1573 | # Check whether we have libpmem | |
1574 | libpmem="no" | |
1575 | cat > $TMPC << EOF | |
1576 | #include <libpmem.h> | |
1577 | int main(int argc, char **argv) | |
1578 | { | |
1579 | int rc; | |
1580 | rc = pmem_is_pmem(0, 0); | |
1581 | return 0; | |
1582 | } | |
1583 | EOF | |
1584 | if compile_prog "" "-lpmem" "libpmem"; then | |
1585 | libpmem="yes" | |
cf8775b8 | 1586 | LIBS="-lpmem $LIBS" |
3ee2a3c1 DJ |
1587 | fi |
1588 | echo "libpmem $libpmem" | |
1589 | ||
1590 | ########################################## | |
1591 | # Check whether we have libpmemblk | |
cf8775b8 | 1592 | # libpmem is a prerequisite |
3ee2a3c1 | 1593 | libpmemblk="no" |
cf8775b8 RE |
1594 | if test "$libpmem" = "yes"; then |
1595 | cat > $TMPC << EOF | |
3ee2a3c1 DJ |
1596 | #include <libpmemblk.h> |
1597 | int main(int argc, char **argv) | |
1598 | { | |
cf8775b8 RE |
1599 | PMEMblkpool *pbp; |
1600 | pbp = pmemblk_open("", 0); | |
3ee2a3c1 DJ |
1601 | return 0; |
1602 | } | |
1603 | EOF | |
cf8775b8 RE |
1604 | if compile_prog "" "-lpmemblk" "libpmemblk"; then |
1605 | libpmemblk="yes" | |
1606 | LIBS="-lpmemblk $LIBS" | |
1607 | fi | |
3ee2a3c1 DJ |
1608 | fi |
1609 | echo "libpmemblk $libpmemblk" | |
1610 | ||
cf8775b8 | 1611 | # Choose the ioengines |
3ee2a3c1 DJ |
1612 | if test "$libpmem" = "yes" && test "$disable_pmem" = "no"; then |
1613 | devdax="yes" | |
1614 | if test "$libpmemblk" = "yes"; then | |
1615 | pmemblk="yes" | |
1616 | fi | |
1617 | fi | |
1618 | ||
43f3cec2 BB |
1619 | ########################################## |
1620 | # Report whether pmemblk engine is enabled | |
cf8775b8 | 1621 | echo "NVML pmemblk engine $pmemblk" |
43f3cec2 | 1622 | |
cbb15e42 DJ |
1623 | ########################################## |
1624 | # Report whether dev-dax engine is enabled | |
cf8775b8 | 1625 | echo "NVML dev-dax engine $devdax" |
cbb15e42 | 1626 | |
b470a02c SC |
1627 | # Check if we have lex/yacc available |
1628 | yacc="no" | |
e7b2c7a3 | 1629 | yacc_is_bison="no" |
b470a02c SC |
1630 | lex="no" |
1631 | arith="no" | |
de26b824 | 1632 | if test "$disable_lex" = "no" || test -z "$disable_lex" ; then |
cf6dd80e | 1633 | if test "$targetos" != "SunOS" ; then |
e7b2c7a3 | 1634 | LEX=$(which lex 2> /dev/null) |
b470a02c SC |
1635 | if test -x "$LEX" ; then |
1636 | lex="yes" | |
1637 | fi | |
7e0049e9 | 1638 | YACC=$(which bison 2> /dev/null) |
b470a02c SC |
1639 | if test -x "$YACC" ; then |
1640 | yacc="yes" | |
7e0049e9 | 1641 | yacc_is_bison="yes" |
e7b2c7a3 | 1642 | else |
7e0049e9 | 1643 | YACC=$(which yacc 2> /dev/null) |
e7b2c7a3 JA |
1644 | if test -x "$YACC" ; then |
1645 | yacc="yes" | |
e7b2c7a3 | 1646 | fi |
b470a02c SC |
1647 | fi |
1648 | if test "$yacc" = "yes" && test "$lex" = "yes" ; then | |
1649 | arith="yes" | |
1650 | fi | |
1651 | ||
1652 | if test "$arith" = "yes" ; then | |
1653 | cat > $TMPC << EOF | |
1654 | extern int yywrap(void); | |
1655 | ||
1656 | int main(int argc, char **argv) | |
1657 | { | |
1658 | yywrap(); | |
1659 | return 0; | |
1660 | } | |
1661 | EOF | |
719cda03 JA |
1662 | if compile_prog "" "-ll" "lex"; then |
1663 | LIBS="-ll $LIBS" | |
b470a02c SC |
1664 | else |
1665 | arith="no" | |
1666 | fi | |
1667 | fi | |
cf6dd80e | 1668 | fi |
a655bbc4 | 1669 | fi |
b470a02c | 1670 | |
63bda378 JA |
1671 | # Check if lex fails using -o |
1672 | if test "$arith" = "yes" ; then | |
daf705b5 JA |
1673 | if test "$force_no_lex_o" = "yes" ; then |
1674 | lex_use_o="no" | |
1675 | else | |
63bda378 JA |
1676 | $LEX -o lex.yy.c exp/expression-parser.l 2> /dev/null |
1677 | if test "$?" = "0" ; then | |
1678 | lex_use_o="yes" | |
1679 | else | |
1680 | lex_use_o="no" | |
1681 | fi | |
1682 | fi | |
daf705b5 | 1683 | fi |
63bda378 | 1684 | |
b470a02c SC |
1685 | echo "lex/yacc for arithmetic $arith" |
1686 | ||
aae599ba JA |
1687 | ########################################## |
1688 | # Check whether we have setmntent/getmntent | |
1689 | getmntent="no" | |
1690 | cat > $TMPC << EOF | |
1691 | #include <stdio.h> | |
1692 | #include <mntent.h> | |
1693 | int main(int argc, char **argv) | |
1694 | { | |
1695 | FILE *mtab = setmntent(NULL, "r"); | |
1696 | struct mntent *mnt = getmntent(mtab); | |
1581b82a | 1697 | endmntent(mtab); |
aae599ba JA |
1698 | return 0; |
1699 | } | |
1700 | EOF | |
1701 | if compile_prog "" "" "getmntent"; then | |
1702 | getmntent="yes" | |
1703 | fi | |
1704 | echo "getmntent $getmntent" | |
1705 | ||
e7e136da TK |
1706 | ########################################## |
1707 | # Check whether we have getmntinfo | |
b765bec0 TK |
1708 | # These are originally added for BSDs, but may also work |
1709 | # on other operating systems with getmntinfo(3). | |
1710 | ||
1711 | # getmntinfo(3) for FreeBSD/DragonFlyBSD/OpenBSD. | |
1712 | # Note that NetBSD needs -Werror to catch warning as error. | |
e7e136da TK |
1713 | getmntinfo="no" |
1714 | cat > $TMPC << EOF | |
1715 | #include <stdio.h> | |
1716 | #include <sys/param.h> | |
1717 | #include <sys/mount.h> | |
1718 | int main(int argc, char **argv) | |
1719 | { | |
9ada751d | 1720 | struct statfs *st; |
e7e136da TK |
1721 | return getmntinfo(&st, MNT_NOWAIT); |
1722 | } | |
1723 | EOF | |
b765bec0 | 1724 | if compile_prog "-Werror" "" "getmntinfo"; then |
e7e136da TK |
1725 | getmntinfo="yes" |
1726 | fi | |
1727 | echo "getmntinfo $getmntinfo" | |
1728 | ||
b765bec0 TK |
1729 | # getmntinfo(3) for NetBSD. |
1730 | getmntinfo_statvfs="no" | |
1731 | cat > $TMPC << EOF | |
1732 | #include <stdio.h> | |
1733 | #include <sys/statvfs.h> | |
1734 | int main(int argc, char **argv) | |
1735 | { | |
1736 | struct statvfs *st; | |
1737 | return getmntinfo(&st, MNT_NOWAIT); | |
1738 | } | |
1739 | EOF | |
1740 | # Skip the test if the one with statfs arg is detected. | |
1741 | if test "$getmntinfo" != "yes" && compile_prog "-Werror" "" "getmntinfo_statvfs"; then | |
1742 | getmntinfo_statvfs="yes" | |
1743 | echo "getmntinfo_statvfs $getmntinfo_statvfs" | |
1744 | fi | |
1745 | ||
5018f79f AH |
1746 | ########################################## |
1747 | # Check whether we have _Static_assert | |
1748 | static_assert="no" | |
1749 | cat > $TMPC << EOF | |
1750 | #include <assert.h> | |
94815a5c JA |
1751 | #include <stdlib.h> |
1752 | #undef offsetof | |
1753 | #ifdef __compiler_offsetof | |
1754 | #define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER) | |
1755 | #else | |
1756 | #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) | |
1757 | #endif | |
1758 | ||
1759 | #define container_of(ptr, type, member) ({ \ | |
1760 | const typeof( ((type *)0)->member ) *__mptr = (ptr); \ | |
1761 | (type *)( (char *)__mptr - offsetof(type,member) );}) | |
1762 | ||
1763 | struct foo { | |
1764 | int a, b; | |
1765 | }; | |
1766 | ||
5018f79f AH |
1767 | int main(int argc, char **argv) |
1768 | { | |
94815a5c | 1769 | _Static_assert(offsetof(struct foo, a) == 0 , "Check"); |
5018f79f AH |
1770 | return 0 ; |
1771 | } | |
1772 | EOF | |
1773 | if compile_prog "" "" "static_assert"; then | |
1774 | static_assert="yes" | |
1775 | fi | |
1776 | echo "Static Assert $static_assert" | |
e39c0676 JA |
1777 | |
1778 | ########################################## | |
1779 | # Check whether we have bool / stdbool.h | |
1780 | have_bool="no" | |
1781 | cat > $TMPC << EOF | |
1782 | #include <stdbool.h> | |
1783 | int main(int argc, char **argv) | |
1784 | { | |
1785 | bool var = true; | |
1786 | return var != false; | |
1787 | } | |
1788 | EOF | |
1789 | if compile_prog "" "" "bool"; then | |
1790 | have_bool="yes" | |
1791 | fi | |
1792 | echo "bool $have_bool" | |
1793 | ||
214e2d56 | 1794 | ########################################## |
1795 | # check march=armv8-a+crc+crypto | |
1796 | march_armv8_a_crc_crypto="no" | |
1797 | if test "$cpu" = "arm64" ; then | |
1798 | cat > $TMPC <<EOF | |
1799 | int main(void) | |
1800 | { | |
1801 | return 0; | |
1802 | } | |
1803 | EOF | |
1804 | if compile_prog "-march=armv8-a+crc+crypto" "" ""; then | |
1805 | march_armv8_a_crc_crypto="yes" | |
1806 | CFLAGS="$CFLAGS -march=armv8-a+crc+crypto -DARCH_HAVE_CRC_CRYPTO" | |
1807 | fi | |
1808 | fi | |
1809 | echo "march_armv8_a_crc_crypto $march_armv8_a_crc_crypto" | |
1810 | ||
1811 | ||
67bf9823 JA |
1812 | ############################################################################# |
1813 | ||
67bf9823 | 1814 | if test "$wordsize" = "64" ; then |
4feafb1e | 1815 | output_sym "CONFIG_64BIT" |
67bf9823 | 1816 | elif test "$wordsize" = "32" ; then |
4feafb1e | 1817 | output_sym "CONFIG_32BIT" |
67bf9823 | 1818 | else |
d7145a78 | 1819 | fatal "Unknown wordsize!" |
67bf9823 | 1820 | fi |
0dcebdf4 | 1821 | if test "$bigendian" = "yes" ; then |
4feafb1e | 1822 | output_sym "CONFIG_BIG_ENDIAN" |
0dcebdf4 | 1823 | else |
4feafb1e | 1824 | output_sym "CONFIG_LITTLE_ENDIAN" |
0dcebdf4 | 1825 | fi |
3989b143 JA |
1826 | if test "$zlib" = "yes" ; then |
1827 | output_sym "CONFIG_ZLIB" | |
1828 | fi | |
67bf9823 | 1829 | if test "$libaio" = "yes" ; then |
4feafb1e | 1830 | output_sym "CONFIG_LIBAIO" |
67bf9823 JA |
1831 | fi |
1832 | if test "$posix_aio" = "yes" ; then | |
4feafb1e | 1833 | output_sym "CONFIG_POSIXAIO" |
67bf9823 JA |
1834 | fi |
1835 | if test "$posix_aio_fsync" = "yes" ; then | |
4feafb1e | 1836 | output_sym "CONFIG_POSIXAIO_FSYNC" |
67bf9823 JA |
1837 | fi |
1838 | if test "$linux_fallocate" = "yes" ; then | |
4feafb1e | 1839 | output_sym "CONFIG_LINUX_FALLOCATE" |
67bf9823 JA |
1840 | fi |
1841 | if test "$posix_fallocate" = "yes" ; then | |
4feafb1e | 1842 | output_sym "CONFIG_POSIX_FALLOCATE" |
67bf9823 JA |
1843 | fi |
1844 | if test "$fdatasync" = "yes" ; then | |
4feafb1e | 1845 | output_sym "CONFIG_FDATASYNC" |
67bf9823 JA |
1846 | fi |
1847 | if test "$sync_file_range" = "yes" ; then | |
4feafb1e | 1848 | output_sym "CONFIG_SYNC_FILE_RANGE" |
67bf9823 JA |
1849 | fi |
1850 | if test "$sfaa" = "yes" ; then | |
4feafb1e | 1851 | output_sym "CONFIG_SFAA" |
67bf9823 | 1852 | fi |
954cd73a | 1853 | if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then |
4feafb1e | 1854 | output_sym "CONFIG_RDMA" |
67bf9823 JA |
1855 | fi |
1856 | if test "$clock_gettime" = "yes" ; then | |
4feafb1e | 1857 | output_sym "CONFIG_CLOCK_GETTIME" |
67bf9823 JA |
1858 | fi |
1859 | if test "$clock_monotonic" = "yes" ; then | |
4feafb1e | 1860 | output_sym "CONFIG_CLOCK_MONOTONIC" |
67bf9823 | 1861 | fi |
c544f604 SN |
1862 | if test "$clock_monotonic_raw" = "yes" ; then |
1863 | output_sym "CONFIG_CLOCK_MONOTONIC_RAW" | |
1864 | fi | |
67bf9823 | 1865 | if test "$clock_monotonic_precise" = "yes" ; then |
4feafb1e | 1866 | output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE" |
67bf9823 | 1867 | fi |
25f8227d JA |
1868 | if test "$clockid_t" = "yes"; then |
1869 | output_sym "CONFIG_CLOCKID_T" | |
1870 | fi | |
67bf9823 | 1871 | if test "$gettimeofday" = "yes" ; then |
4feafb1e | 1872 | output_sym "CONFIG_GETTIMEOFDAY" |
67bf9823 JA |
1873 | fi |
1874 | if test "$posix_fadvise" = "yes" ; then | |
4feafb1e | 1875 | output_sym "CONFIG_POSIX_FADVISE" |
67bf9823 JA |
1876 | fi |
1877 | if test "$linux_3arg_affinity" = "yes" ; then | |
4feafb1e | 1878 | output_sym "CONFIG_3ARG_AFFINITY" |
67bf9823 | 1879 | elif test "$linux_2arg_affinity" = "yes" ; then |
4feafb1e | 1880 | output_sym "CONFIG_2ARG_AFFINITY" |
67bf9823 JA |
1881 | fi |
1882 | if test "$strsep" = "yes" ; then | |
4feafb1e | 1883 | output_sym "CONFIG_STRSEP" |
67bf9823 | 1884 | fi |
9ad8da82 JA |
1885 | if test "$strcasestr" = "yes" ; then |
1886 | output_sym "CONFIG_STRCASESTR" | |
1887 | fi | |
5ad7be56 KD |
1888 | if test "$strlcat" = "yes" ; then |
1889 | output_sym "CONFIG_STRLCAT" | |
1890 | fi | |
67bf9823 | 1891 | if test "$getopt_long_only" = "yes" ; then |
4feafb1e | 1892 | output_sym "CONFIG_GETOPT_LONG_ONLY" |
67bf9823 JA |
1893 | fi |
1894 | if test "$inet_aton" = "yes" ; then | |
4feafb1e | 1895 | output_sym "CONFIG_INET_ATON" |
67bf9823 JA |
1896 | fi |
1897 | if test "$socklen_t" = "yes" ; then | |
4feafb1e | 1898 | output_sym "CONFIG_SOCKLEN_T" |
67bf9823 JA |
1899 | fi |
1900 | if test "$ext4_me" = "yes" ; then | |
4feafb1e | 1901 | output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT" |
67bf9823 JA |
1902 | fi |
1903 | if test "$linux_splice" = "yes" ; then | |
4feafb1e | 1904 | output_sym "CONFIG_LINUX_SPLICE" |
67bf9823 JA |
1905 | fi |
1906 | if test "$guasi" = "yes" ; then | |
4feafb1e | 1907 | output_sym "CONFIG_GUASI" |
67bf9823 JA |
1908 | fi |
1909 | if test "$fusion_aw" = "yes" ; then | |
4feafb1e | 1910 | output_sym "CONFIG_FUSION_AW" |
67bf9823 | 1911 | fi |
50206d9b | 1912 | if test "$libnuma_v2" = "yes" ; then |
4feafb1e | 1913 | output_sym "CONFIG_LIBNUMA" |
67bf9823 JA |
1914 | fi |
1915 | if test "$solaris_aio" = "yes" ; then | |
4feafb1e | 1916 | output_sym "CONFIG_SOLARISAIO" |
67bf9823 JA |
1917 | fi |
1918 | if test "$tls_thread" = "yes" ; then | |
4feafb1e | 1919 | output_sym "CONFIG_TLS_THREAD" |
67bf9823 | 1920 | fi |
44404c5a | 1921 | if test "$rusage_thread" = "yes" ; then |
4feafb1e | 1922 | output_sym "CONFIG_RUSAGE_THREAD" |
67bf9823 | 1923 | fi |
91f94d5b JA |
1924 | if test "$gfio" = "yes" ; then |
1925 | echo "CONFIG_GFIO=y" >> $config_host_mak | |
1926 | fi | |
c8931876 JA |
1927 | if test "$esx" = "yes" ; then |
1928 | output_sym "CONFIG_ESX" | |
1929 | output_sym "CONFIG_NO_SHM" | |
1930 | fi | |
7e09a9f1 JA |
1931 | if test "$sched_idle" = "yes" ; then |
1932 | output_sym "CONFIG_SCHED_IDLE" | |
1933 | fi | |
1eafa37a JA |
1934 | if test "$tcp_nodelay" = "yes" ; then |
1935 | output_sym "CONFIG_TCP_NODELAY" | |
1936 | fi | |
1008602c JA |
1937 | if test "$window_size" = "yes" ; then |
1938 | output_sym "CONFIG_NET_WINDOWSIZE" | |
1939 | fi | |
e5f34d95 JA |
1940 | if test "$mss" = "yes" ; then |
1941 | output_sym "CONFIG_NET_MSS" | |
1942 | fi | |
38b9354a JA |
1943 | if test "$rlimit_memlock" = "yes" ; then |
1944 | output_sym "CONFIG_RLIMIT_MEMLOCK" | |
1945 | fi | |
07fc0acd JA |
1946 | if test "$pwritev" = "yes" ; then |
1947 | output_sym "CONFIG_PWRITEV" | |
1948 | fi | |
2cafffbe JA |
1949 | if test "$pwritev2" = "yes" ; then |
1950 | output_sym "CONFIG_PWRITEV2" | |
1951 | fi | |
ecad55e9 JA |
1952 | if test "$ipv6" = "yes" ; then |
1953 | output_sym "CONFIG_IPV6" | |
1954 | fi | |
fc5c0345 DG |
1955 | if test "$rbd" = "yes" ; then |
1956 | output_sym "CONFIG_RBD" | |
1957 | fi | |
53b6c979 PL |
1958 | if test "$rbd_poll" = "yes" ; then |
1959 | output_sym "CONFIG_RBD_POLL" | |
1960 | fi | |
903b2812 JA |
1961 | if test "$rbd_inval" = "yes" ; then |
1962 | output_sym "CONFIG_RBD_INVAL" | |
1963 | fi | |
a4c4c346 | 1964 | if test "$rbd_blkin" = "yes" ; then |
1965 | output_sym "CONFIG_RBD_BLKIN" | |
1966 | fi | |
2e802282 JA |
1967 | if test "$setvbuf" = "yes" ; then |
1968 | output_sym "CONFIG_SETVBUF" | |
1969 | fi | |
81795ce3 CE |
1970 | if test "$s390_z196_facilities" = "yes" ; then |
1971 | output_sym "CONFIG_S390_Z196_FACILITIES" | |
1972 | CFLAGS="$CFLAGS -march=z9-109" | |
1973 | fi | |
6e7d7dfb | 1974 | if test "$gfapi" = "yes" ; then |
1975 | output_sym "CONFIG_GFAPI" | |
1976 | fi | |
6fa14b99 | 1977 | if test "$gf_fadvise" = "yes" ; then |
1978 | output_sym "CONFIG_GF_FADVISE" | |
1979 | fi | |
6876c98c JA |
1980 | if test "$gf_trim" = "yes" ; then |
1981 | output_sym "CONFIG_GF_TRIM" | |
1982 | fi | |
1b10477b MM |
1983 | if test "$libhdfs" = "yes" ; then |
1984 | output_sym "CONFIG_LIBHDFS" | |
247e5436 | 1985 | echo "FIO_HDFS_CPU=$FIO_HDFS_CPU" >> $config_host_mak |
1527dc50 FB |
1986 | echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak |
1987 | echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak | |
1988 | echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak | |
1989 | fi | |
b8116a87 DE |
1990 | if test "$mtd" = "yes" ; then |
1991 | output_sym "CONFIG_MTD" | |
1992 | fi | |
43f3cec2 BB |
1993 | if test "$pmemblk" = "yes" ; then |
1994 | output_sym "CONFIG_PMEMBLK" | |
1995 | fi | |
cbb15e42 DJ |
1996 | if test "$devdax" = "yes" ; then |
1997 | output_sym "CONFIG_LINUX_DEVDAX" | |
1998 | fi | |
b470a02c SC |
1999 | if test "$arith" = "yes" ; then |
2000 | output_sym "CONFIG_ARITHMETIC" | |
e7b2c7a3 JA |
2001 | if test "$yacc_is_bison" = "yes" ; then |
2002 | echo "YACC=$YACC -y" >> $config_host_mak | |
2003 | else | |
2004 | echo "YACC=$YACC" >> $config_host_mak | |
2005 | fi | |
63bda378 JA |
2006 | if test "$lex_use_o" = "yes" ; then |
2007 | echo "CONFIG_LEX_USE_O=y" >> $config_host_mak | |
2008 | fi | |
b470a02c | 2009 | fi |
aae599ba JA |
2010 | if test "$getmntent" = "yes" ; then |
2011 | output_sym "CONFIG_GETMNTENT" | |
2012 | fi | |
e7e136da TK |
2013 | if test "$getmntinfo" = "yes" ; then |
2014 | output_sym "CONFIG_GETMNTINFO" | |
2015 | fi | |
b765bec0 TK |
2016 | if test "$getmntinfo_statvfs" = "yes" ; then |
2017 | output_sym "CONFIG_GETMNTINFO_STATVFS" | |
2018 | fi | |
5018f79f AH |
2019 | if test "$static_assert" = "yes" ; then |
2020 | output_sym "CONFIG_STATIC_ASSERT" | |
2021 | fi | |
e39c0676 JA |
2022 | if test "$have_bool" = "yes" ; then |
2023 | output_sym "CONFIG_HAVE_BOOL" | |
2024 | fi | |
67bf9823 | 2025 | |
605cf82e JA |
2026 | if test "$zlib" = "no" ; then |
2027 | echo "Consider installing zlib-dev (zlib-devel), some fio features depend on it." | |
2028 | fi | |
2029 | ||
67bf9823 | 2030 | echo "LIBS+=$LIBS" >> $config_host_mak |
86719845 | 2031 | echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak |
91f94d5b | 2032 | echo "CFLAGS+=$CFLAGS" >> $config_host_mak |
d2aeedb9 | 2033 | echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak |
67bf9823 | 2034 | echo "CC=$cc" >> $config_host_mak |
af4862b3 | 2035 | echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak |
020d54bd | 2036 | echo "INSTALL_PREFIX=$prefix" >> $config_host_mak |
c61a3a44 | 2037 | |
59d8f412 | 2038 | if [ `dirname $0` != "." -a ! -e Makefile ]; then |
c61a3a44 JF |
2039 | cat > Makefile <<EOF |
2040 | SRCDIR:=`dirname $0` | |
2041 | include \$(SRCDIR)/Makefile | |
2042 | EOF | |
2043 | fi |