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