Commit | Line | Data |
---|---|---|
67bf9823 JA |
1 | #!/bin/sh |
2 | # | |
3 | # Fio configure script. Heavily influenced by the manual qemu configure | |
c922e0b0 | 4 | # script. Sad this is easier than autoconf and enemies. |
67bf9823 JA |
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" | |
9ee669fa | 17 | TMPC2="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}-2.c" |
67bf9823 JA |
18 | TMPO="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.o" |
19 | TMPE="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.exe" | |
20 | ||
21 | # NB: do not call "exit" in the trap handler; this is buggy with some shells; | |
22 | # see <1285349658-3122-1-git-send-email-loic.minier@linaro.org> | |
9ee669fa | 23 | trap "rm -f $TMPC $TMPC2 $TMPO $TMPE" EXIT INT QUIT TERM |
67bf9823 JA |
24 | |
25 | rm -rf config.log | |
26 | ||
27 | config_host_mak="config-host.mak" | |
4feafb1e JA |
28 | config_host_h="config-host.h" |
29 | ||
30 | rm -rf $config_host_mak | |
31 | rm -rf $config_host_h | |
67bf9823 | 32 | |
d7145a78 JA |
33 | fatal() { |
34 | echo $@ | |
35 | echo "Configure failed, check config.log and/or the above output" | |
36 | rm -rf $config_host_mak | |
37 | rm -rf $config_host_h | |
38 | exit 1 | |
39 | } | |
40 | ||
484b0b65 TK |
41 | # Print result for each configuration test |
42 | print_config() { | |
43 | printf "%-30s%s\n" "$1" "$2" | |
44 | } | |
45 | ||
44404c5a | 46 | # Default CFLAGS |
af4862b3 JA |
47 | CFLAGS="-D_GNU_SOURCE -include config-host.h" |
48 | BUILD_CFLAGS="" | |
67bf9823 JA |
49 | |
50 | # Print a helpful header at the top of config.log | |
51 | echo "# FIO configure log $(date)" >> config.log | |
52 | printf "# Configured with:" >> config.log | |
53 | printf " '%s'" "$0" "$@" >> config.log | |
54 | echo >> config.log | |
55 | echo "#" >> config.log | |
56 | ||
7560fe7c JA |
57 | # Print configure header at the top of $config_host_h |
58 | echo "/*" > $config_host_h | |
59 | echo " * Automatically generated by configure - do not modify" >> $config_host_h | |
60 | printf " * Configured with:" >> $config_host_h | |
61 | printf " * '%s'" "$0" "$@" >> $config_host_h | |
62 | echo "" >> $config_host_h | |
63 | echo " */" >> $config_host_h | |
64 | ||
67bf9823 JA |
65 | do_cc() { |
66 | # Run the compiler, capturing its output to the log. | |
67 | echo $cc "$@" >> config.log | |
68 | $cc "$@" >> config.log 2>&1 || return $? | |
69 | # Test passed. If this is an --enable-werror build, rerun | |
70 | # the test with -Werror and bail out if it fails. This | |
71 | # makes warning-generating-errors in configure test code | |
72 | # obvious to developers. | |
73 | if test "$werror" != "yes"; then | |
74 | return 0 | |
75 | fi | |
76 | # Don't bother rerunning the compile if we were already using -Werror | |
77 | case "$*" in | |
78 | *-Werror*) | |
79 | return 0 | |
80 | ;; | |
81 | esac | |
82 | echo $cc -Werror "$@" >> config.log | |
83 | $cc -Werror "$@" >> config.log 2>&1 && return $? | |
84 | echo "ERROR: configure test passed without -Werror but failed with -Werror." | |
85 | echo "This is probably a bug in the configure script. The failing command" | |
86 | echo "will be at the bottom of config.log." | |
d7145a78 | 87 | fatal "You can run configure with --disable-werror to bypass this check." |
67bf9823 JA |
88 | } |
89 | ||
90 | compile_object() { | |
91 | do_cc $CFLAGS -c -o $TMPO $TMPC | |
92 | } | |
93 | ||
94 | compile_prog() { | |
95 | local_cflags="$1" | |
adaa46d8 | 96 | local_ldflags="$2 $LIBS" |
67bf9823 JA |
97 | echo "Compiling test case $3" >> config.log |
98 | do_cc $CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags | |
99 | } | |
100 | ||
101 | feature_not_found() { | |
102 | feature=$1 | |
c55d728b | 103 | packages=$2 |
67bf9823 JA |
104 | |
105 | echo "ERROR" | |
106 | echo "ERROR: User requested feature $feature" | |
c55d728b JA |
107 | if test ! -z "$packages" ; then |
108 | echo "ERROR: That feature needs $packages installed" | |
109 | fi | |
67bf9823 | 110 | echo "ERROR: configure was not able to find it" |
d7145a78 | 111 | fatal "ERROR" |
67bf9823 JA |
112 | } |
113 | ||
114 | has() { | |
115 | type "$1" >/dev/null 2>&1 | |
116 | } | |
117 | ||
118 | check_define() { | |
119 | cat > $TMPC <<EOF | |
120 | #if !defined($1) | |
121 | #error $1 not defined | |
122 | #endif | |
123 | int main(void) | |
124 | { | |
125 | return 0; | |
126 | } | |
127 | EOF | |
128 | compile_object | |
129 | } | |
130 | ||
4feafb1e JA |
131 | output_sym() { |
132 | echo "$1=y" >> $config_host_mak | |
133 | echo "#define $1" >> $config_host_h | |
134 | } | |
135 | ||
67bf9823 JA |
136 | targetos="" |
137 | cpu="" | |
138 | ||
91f94d5b | 139 | # default options |
47f44635 JA |
140 | show_help="no" |
141 | exit_val=0 | |
ebec2094 | 142 | gfio_check="no" |
1b10477b | 143 | libhdfs="no" |
43f3cec2 | 144 | pmemblk="no" |
cbb15e42 | 145 | devdax="no" |
ae0db592 | 146 | pmem="no" |
de26b824 | 147 | disable_lex="" |
3ee2a3c1 | 148 | disable_pmem="no" |
a817dc3b | 149 | disable_native="no" |
9f75af77 | 150 | march_set="no" |
020d54bd | 151 | prefix=/usr/local |
91f94d5b | 152 | |
cb1125b0 JA |
153 | # parse options |
154 | for opt do | |
155 | optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` | |
156 | case "$opt" in | |
020d54bd JA |
157 | --prefix=*) prefix="$optarg" |
158 | ;; | |
8b156d8e JA |
159 | --cpu=*) cpu="$optarg" |
160 | ;; | |
c8931876 JA |
161 | # esx is cross compiled and cannot be detect through simple uname calls |
162 | --esx) | |
163 | esx="yes" | |
164 | ;; | |
cb1125b0 JA |
165 | --cc=*) CC="$optarg" |
166 | ;; | |
208e4c8b JA |
167 | --extra-cflags=*) CFLAGS="$CFLAGS $optarg" |
168 | ;; | |
b7c12794 | 169 | --build-32bit-win) build_32bit_win="yes" |
7409711b | 170 | ;; |
a6ab5391 SW |
171 | --target-win-ver=*) target_win_ver="$optarg" |
172 | ;; | |
d2aeedb9 JA |
173 | --build-static) build_static="yes" |
174 | ;; | |
bad7e42c | 175 | --enable-gfio) gfio_check="yes" |
899fab33 | 176 | ;; |
44462517 CF |
177 | --disable-numa) disable_numa="yes" |
178 | ;; | |
f678f8d2 MF |
179 | --disable-rdma) disable_rdma="yes" |
180 | ;; | |
d5f9b0ea IF |
181 | --disable-rados) disable_rados="yes" |
182 | ;; | |
ce18290e TM |
183 | --disable-rbd) disable_rbd="yes" |
184 | ;; | |
c2f6a13d LMB |
185 | --disable-http) disable_http="yes" |
186 | ;; | |
ce18290e TM |
187 | --disable-gfapi) disable_gfapi="yes" |
188 | ;; | |
1b10477b MM |
189 | --enable-libhdfs) libhdfs="yes" |
190 | ;; | |
a655bbc4 JA |
191 | --disable-lex) disable_lex="yes" |
192 | ;; | |
de26b824 JA |
193 | --enable-lex) disable_lex="no" |
194 | ;; | |
61054f0d JA |
195 | --disable-shm) no_shm="yes" |
196 | ;; | |
197 | --disable-optimizations) disable_opt="yes" | |
ba40757e | 198 | ;; |
3ee2a3c1 DJ |
199 | --disable-pmem) disable_pmem="yes" |
200 | ;; | |
03553853 YR |
201 | --enable-cuda) enable_cuda="yes" |
202 | ;; | |
a817dc3b JA |
203 | --disable-native) disable_native="yes" |
204 | ;; | |
a40e7a59 GB |
205 | --with-ime=*) ime_path="$optarg" |
206 | ;; | |
827da4f5 | 207 | --help) |
47f44635 | 208 | show_help="yes" |
827da4f5 | 209 | ;; |
cb1125b0 JA |
210 | *) |
211 | echo "Bad option $opt" | |
47f44635 JA |
212 | show_help="yes" |
213 | exit_val=1 | |
cb1125b0 JA |
214 | esac |
215 | done | |
216 | ||
47f44635 | 217 | if test "$show_help" = "yes" ; then |
05cef7a0 TK |
218 | echo "--prefix= Use this directory as installation prefix" |
219 | echo "--cpu= Specify target CPU if auto-detect fails" | |
220 | echo "--cc= Specify compiler to use" | |
221 | echo "--extra-cflags= Specify extra CFLAGS to pass to compiler" | |
222 | echo "--build-32bit-win Enable 32-bit build on Windows" | |
a6ab5391 | 223 | echo "--target-win-ver= Minimum version of Windows to target (XP or 7)" |
05cef7a0 TK |
224 | echo "--build-static Build a static fio" |
225 | echo "--esx Configure build options for esx" | |
226 | echo "--enable-gfio Enable building of gtk gfio" | |
227 | echo "--disable-numa Disable libnuma even if found" | |
03553853 | 228 | echo "--disable-rdma Disable RDMA support even if found" |
05cef7a0 TK |
229 | echo "--disable-gfapi Disable gfapi" |
230 | echo "--enable-libhdfs Enable hdfs support" | |
231 | echo "--disable-lex Disable use of lex/yacc for math" | |
232 | echo "--disable-pmem Disable pmem based engines even if found" | |
233 | echo "--enable-lex Enable use of lex/yacc for math" | |
234 | echo "--disable-shm Disable SHM support" | |
61054f0d | 235 | echo "--disable-optimizations Don't enable compiler optimizations" |
03553853 | 236 | echo "--enable-cuda Enable GPUDirect RDMA support" |
a817dc3b | 237 | echo "--disable-native Don't build for native host" |
a40e7a59 | 238 | echo "--with-ime= Install path for DDN's Infinite Memory Engine" |
b7a99316 | 239 | exit $exit_val |
47f44635 JA |
240 | fi |
241 | ||
47986339 | 242 | cross_prefix=${cross_prefix-${CROSS_COMPILE}} |
b73af738 SW |
243 | # Preferred compiler (can be overriden later after we know the platform): |
244 | # ${CC} (if set) | |
245 | # ${cross_prefix}gcc (if cross-prefix specified) | |
246 | # gcc if available | |
247 | # clang if available | |
248 | if test -z "${CC}${cross_prefix}"; then | |
249 | if has gcc; then | |
250 | cc=gcc | |
251 | elif has clang; then | |
252 | cc=clang | |
253 | fi | |
254 | else | |
255 | cc="${CC-${cross_prefix}gcc}" | |
256 | fi | |
47986339 | 257 | |
6d0e9f83 AC |
258 | if check_define __ANDROID__ ; then |
259 | targetos="Android" | |
260 | elif check_define __linux__ ; then | |
67bf9823 | 261 | targetos="Linux" |
67bf9823 JA |
262 | elif check_define __OpenBSD__ ; then |
263 | targetos='OpenBSD' | |
89556808 BVA |
264 | elif check_define __NetBSD__ ; then |
265 | targetos='NetBSD' | |
67bf9823 JA |
266 | elif check_define __sun__ ; then |
267 | targetos='SunOS' | |
7cb024f8 | 268 | CFLAGS="$CFLAGS -D_REENTRANT" |
b24f59ab SH |
269 | elif check_define _WIN32 ; then |
270 | targetos='CYGWIN' | |
67bf9823 JA |
271 | else |
272 | targetos=`uname -s` | |
273 | fi | |
274 | ||
53cd4eee AC |
275 | echo "# Automatically generated by configure - do not modify" > $config_host_mak |
276 | printf "# Configured with:" >> $config_host_mak | |
277 | printf " '%s'" "$0" "$@" >> $config_host_mak | |
278 | echo >> $config_host_mak | |
279 | echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak | |
280 | ||
61054f0d JA |
281 | if test "$no_shm" = "yes" ; then |
282 | output_sym "CONFIG_NO_SHM" | |
283 | fi | |
284 | ||
285 | if test "$disable_opt" = "yes" ; then | |
286 | output_sym "CONFIG_FIO_NO_OPT" | |
287 | fi | |
288 | ||
67bf9823 JA |
289 | # Some host OSes need non-standard checks for which CPU to use. |
290 | # Note that these checks are broken for cross-compilation: if you're | |
291 | # cross-compiling to one of these OSes then you'll need to specify | |
292 | # the correct CPU with the --cpu option. | |
293 | case $targetos in | |
26532556 | 294 | AIX|OpenBSD|NetBSD) |
de26b824 | 295 | # Unless explicitly enabled, turn off lex. |
baa78fdc | 296 | # OpenBSD will hit syntax error when enabled. |
de26b824 JA |
297 | if test -z "$disable_lex" ; then |
298 | disable_lex="yes" | |
daf705b5 JA |
299 | else |
300 | force_no_lex_o="yes" | |
de26b824 JA |
301 | fi |
302 | ;; | |
67bf9823 JA |
303 | Darwin) |
304 | # on Leopard most of the system is 32-bit, so we have to ask the kernel if | |
305 | # we can run 64-bit userspace code. | |
306 | # If the user didn't specify a CPU explicitly and the kernel says this is | |
307 | # 64 bit hw, then assume x86_64. Otherwise fall through to the usual | |
308 | # detection code. | |
309 | if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then | |
310 | cpu="x86_64" | |
311 | fi | |
ccf2d89d SW |
312 | # Error at compile time linking of weak/partial symbols if possible... |
313 | cat > $TMPC <<EOF | |
314 | int main(void) | |
315 | { | |
316 | return 0; | |
317 | } | |
318 | EOF | |
319 | if compile_prog "" "-Wl,-no_weak_imports" "disable weak symbols"; then | |
320 | echo "Disabling weak symbols" | |
321 | LDFLAGS="$LDFLAGS -Wl,-no_weak_imports" | |
322 | fi | |
67bf9823 JA |
323 | ;; |
324 | SunOS) | |
325 | # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo | |
326 | if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then | |
327 | cpu="x86_64" | |
328 | fi | |
adaa46d8 | 329 | LIBS="-lnsl -lsocket" |
cfd94f79 JA |
330 | ;; |
331 | CYGWIN*) | |
ca205a75 TK |
332 | # We still force some options, so keep this message here. |
333 | echo "Forcing some known good options on Windows" | |
b73af738 | 334 | if test -z "${CC}${cross_prefix}"; then |
7409711b | 335 | if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then |
b73af738 | 336 | cc="i686-w64-mingw32-gcc" |
7409711b | 337 | else |
b73af738 | 338 | cc="x86_64-w64-mingw32-gcc" |
7409711b | 339 | fi |
4578d01f | 340 | fi |
a6ab5391 SW |
341 | |
342 | target_win_ver=$(echo "$target_win_ver" | tr '[:lower:]' '[:upper:]') | |
343 | if test -z "$target_win_ver"; then | |
344 | # Default Windows API target | |
345 | target_win_ver="7" | |
346 | fi | |
347 | if test "$target_win_ver" = "XP"; then | |
348 | output_sym "CONFIG_WINDOWS_XP" | |
349 | elif test "$target_win_ver" = "7"; then | |
350 | output_sym "CONFIG_WINDOWS_7" | |
351 | CFLAGS="$CFLAGS -D_WIN32_WINNT=0x0601" | |
7409711b | 352 | else |
a6ab5391 | 353 | fatal "Unknown target Windows version" |
7409711b | 354 | fi |
a6ab5391 | 355 | |
ca205a75 TK |
356 | # We need this to be output_sym'd here because this is Windows specific. |
357 | # The regular configure path never sets this config. | |
4feafb1e | 358 | output_sym "CONFIG_WINDOWSAIO" |
ca205a75 TK |
359 | # We now take the regular configuration path without having exit 0 here. |
360 | # Flags below are still necessary mostly for MinGW. | |
361 | socklen_t="yes" | |
ca205a75 TK |
362 | rusage_thread="yes" |
363 | fdatasync="yes" | |
364 | clock_gettime="yes" # clock_monotonic probe has dependency on this | |
365 | clock_monotonic="yes" | |
366 | gettimeofday="yes" | |
367 | sched_idle="yes" | |
368 | tcp_nodelay="yes" | |
ca205a75 | 369 | ipv6="yes" |
6d0e9f83 | 370 | ;; |
67bf9823 JA |
371 | esac |
372 | ||
b73af738 SW |
373 | # Now we know the target platform we can have another guess at the preferred |
374 | # compiler when it wasn't explictly set | |
375 | if test -z "${CC}${cross_prefix}"; then | |
376 | if test "$targetos" = "FreeBSD" || test "$targetos" = "Darwin"; then | |
377 | if has clang; then | |
378 | cc=clang | |
379 | fi | |
380 | fi | |
381 | fi | |
382 | if test -z "$cc"; then | |
383 | echo "configure: failed to find compiler" | |
384 | exit 1 | |
385 | fi | |
386 | ||
67bf9823 JA |
387 | if test ! -z "$cpu" ; then |
388 | # command line argument | |
389 | : | |
390 | elif check_define __i386__ ; then | |
391 | cpu="i386" | |
392 | elif check_define __x86_64__ ; then | |
393 | cpu="x86_64" | |
394 | elif check_define __sparc__ ; then | |
395 | if check_define __arch64__ ; then | |
396 | cpu="sparc64" | |
397 | else | |
398 | cpu="sparc" | |
399 | fi | |
400 | elif check_define _ARCH_PPC ; then | |
401 | if check_define _ARCH_PPC64 ; then | |
402 | cpu="ppc64" | |
403 | else | |
404 | cpu="ppc" | |
405 | fi | |
406 | elif check_define __mips__ ; then | |
407 | cpu="mips" | |
408 | elif check_define __ia64__ ; then | |
409 | cpu="ia64" | |
410 | elif check_define __s390__ ; then | |
411 | if check_define __s390x__ ; then | |
412 | cpu="s390x" | |
413 | else | |
414 | cpu="s390" | |
415 | fi | |
416 | elif check_define __arm__ ; then | |
417 | cpu="arm" | |
214e2d56 | 418 | elif check_define __aarch64__ ; then |
419 | cpu="aarch64" | |
67bf9823 JA |
420 | elif check_define __hppa__ ; then |
421 | cpu="hppa" | |
422 | else | |
423 | cpu=`uname -m` | |
424 | fi | |
425 | ||
426 | # Normalise host CPU name and set ARCH. | |
427 | case "$cpu" in | |
428 | ia64|ppc|ppc64|s390|s390x|sparc64) | |
429 | cpu="$cpu" | |
430 | ;; | |
431 | i386|i486|i586|i686|i86pc|BePC) | |
95ef38ab | 432 | cpu="x86" |
67bf9823 JA |
433 | ;; |
434 | x86_64|amd64) | |
435 | cpu="x86_64" | |
436 | ;; | |
437 | armv*b|armv*l|arm) | |
438 | cpu="arm" | |
439 | ;; | |
214e2d56 | 440 | aarch64) |
441 | cpu="arm64" | |
442 | ;; | |
67bf9823 JA |
443 | hppa|parisc|parisc64) |
444 | cpu="hppa" | |
445 | ;; | |
446 | mips*) | |
447 | cpu="mips" | |
448 | ;; | |
449 | sparc|sun4[cdmuv]) | |
450 | cpu="sparc" | |
451 | ;; | |
452 | *) | |
8b156d8e | 453 | echo "Unknown CPU" |
67bf9823 JA |
454 | ;; |
455 | esac | |
456 | ||
1a17cfdb AC |
457 | ########################################## |
458 | # check cross compile | |
459 | ||
ca205a75 TK |
460 | if test "$cross_compile" != "yes" ; then |
461 | cross_compile="no" | |
462 | fi | |
1a17cfdb AC |
463 | cat > $TMPC <<EOF |
464 | int main(void) | |
465 | { | |
466 | return 0; | |
467 | } | |
468 | EOF | |
469 | if compile_prog "" "" "cross"; then | |
470 | $TMPE 2>/dev/null || cross_compile="yes" | |
471 | else | |
472 | fatal "compile test failed" | |
473 | fi | |
474 | ||
0dcebdf4 JA |
475 | ########################################## |
476 | # check endianness | |
ca205a75 TK |
477 | if test "$bigendian" != "yes" ; then |
478 | bigendian="no" | |
479 | fi | |
1a17cfdb AC |
480 | if test "$cross_compile" = "no" ; then |
481 | cat > $TMPC <<EOF | |
0dcebdf4 JA |
482 | #include <inttypes.h> |
483 | int main(void) | |
484 | { | |
485 | volatile uint32_t i=0x01234567; | |
486 | return (*((uint8_t*)(&i))) == 0x67; | |
487 | } | |
488 | EOF | |
1a17cfdb AC |
489 | if compile_prog "" "" "endian"; then |
490 | $TMPE && bigendian="yes" | |
491 | fi | |
492 | else | |
493 | # If we're cross compiling, try our best to work it out and rely on the | |
494 | # run-time check to fail if we get it wrong. | |
495 | cat > $TMPC <<EOF | |
496 | #include <endian.h> | |
497 | int main(void) | |
498 | { | |
499 | #if __BYTE_ORDER != __BIG_ENDIAN | |
500 | # error "Unknown endianness" | |
501 | #endif | |
502 | } | |
503 | EOF | |
504 | compile_prog "" "" "endian" && bigendian="yes" | |
505 | check_define "__ARMEB__" && bigendian="yes" | |
506 | check_define "__MIPSEB__" && bigendian="yes" | |
0dcebdf4 JA |
507 | fi |
508 | ||
509 | ||
484b0b65 TK |
510 | print_config "Operating system" "$targetos" |
511 | print_config "CPU" "$cpu" | |
512 | print_config "Big endian" "$bigendian" | |
a6ab5391 SW |
513 | if test ! -z "$target_win_ver"; then |
514 | print_config "Target Windows version" "$target_win_ver" | |
515 | fi | |
484b0b65 TK |
516 | print_config "Compiler" "$cc" |
517 | print_config "Cross compile" "$cross_compile" | |
67bf9823 JA |
518 | echo |
519 | ||
d2aeedb9 JA |
520 | ########################################## |
521 | # See if we need to build a static build | |
522 | if test "$build_static" = "yes" ; then | |
523 | CFLAGS="$CFLAGS -ffunction-sections -fdata-sections" | |
524 | LDFLAGS="$LDFLAGS -static -Wl,--gc-sections" | |
525 | else | |
526 | build_static="no" | |
527 | fi | |
484b0b65 | 528 | print_config "Static build" "$build_static" |
d2aeedb9 | 529 | |
67bf9823 JA |
530 | ########################################## |
531 | # check for wordsize | |
532 | wordsize="0" | |
533 | cat > $TMPC <<EOF | |
142429e5 AC |
534 | #include <limits.h> |
535 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) | |
67bf9823 JA |
536 | int main(void) |
537 | { | |
142429e5 | 538 | BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE); |
67bf9823 JA |
539 | return 0; |
540 | } | |
541 | EOF | |
142429e5 AC |
542 | if compile_prog "-DWORDSIZE=32" "" "wordsize"; then |
543 | wordsize="32" | |
544 | elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then | |
545 | wordsize="64" | |
546 | else | |
547 | fatal "Unknown wordsize" | |
67bf9823 | 548 | fi |
484b0b65 | 549 | print_config "Wordsize" "$wordsize" |
67bf9823 | 550 | |
a9bca4aa JA |
551 | ########################################## |
552 | # zlib probe | |
ca205a75 TK |
553 | if test "$zlib" != "yes" ; then |
554 | zlib="no" | |
555 | fi | |
a9bca4aa | 556 | cat > $TMPC <<EOF |
804a1e05 | 557 | #include <zlib.h> |
a9bca4aa JA |
558 | int main(void) |
559 | { | |
560 | z_stream stream; | |
561 | if (inflateInit(&stream) != Z_OK) | |
562 | return 1; | |
563 | return 0; | |
564 | } | |
565 | EOF | |
566 | if compile_prog "" "-lz" "zlib" ; then | |
567 | zlib=yes | |
568 | LIBS="-lz $LIBS" | |
a9bca4aa | 569 | fi |
484b0b65 | 570 | print_config "zlib" "$zlib" |
a9bca4aa | 571 | |
67bf9823 JA |
572 | ########################################## |
573 | # linux-aio probe | |
ca205a75 TK |
574 | if test "$libaio" != "yes" ; then |
575 | libaio="no" | |
576 | fi | |
7c77ebef | 577 | if test "$esx" != "yes" ; then |
578 | cat > $TMPC <<EOF | |
67bf9823 JA |
579 | #include <libaio.h> |
580 | #include <stddef.h> | |
581 | int main(void) | |
582 | { | |
583 | io_setup(0, NULL); | |
584 | return 0; | |
585 | } | |
586 | EOF | |
7c77ebef | 587 | if compile_prog "" "-laio" "libaio" ; then |
588 | libaio=yes | |
589 | LIBS="-laio $LIBS" | |
590 | else | |
591 | if test "$libaio" = "yes" ; then | |
592 | feature_not_found "linux AIO" "libaio-dev or libaio-devel" | |
593 | fi | |
594 | libaio=no | |
67bf9823 | 595 | fi |
67bf9823 | 596 | fi |
484b0b65 | 597 | print_config "Linux AIO support" "$libaio" |
67bf9823 JA |
598 | |
599 | ########################################## | |
600 | # posix aio probe | |
ca205a75 TK |
601 | if test "$posix_aio" != "yes" ; then |
602 | posix_aio="no" | |
603 | fi | |
604 | if test "$posix_aio_lrt" != "yes" ; then | |
605 | posix_aio_lrt="no" | |
606 | fi | |
67bf9823 JA |
607 | cat > $TMPC <<EOF |
608 | #include <aio.h> | |
609 | int main(void) | |
610 | { | |
611 | struct aiocb cb; | |
612 | aio_read(&cb); | |
613 | return 0; | |
614 | } | |
615 | EOF | |
616 | if compile_prog "" "" "posixaio" ; then | |
617 | posix_aio="yes" | |
09c81e13 | 618 | elif compile_prog "" "-lrt" "posixaio -lrt"; then |
67bf9823 JA |
619 | posix_aio="yes" |
620 | posix_aio_lrt="yes" | |
621 | LIBS="-lrt $LIBS" | |
622 | fi | |
484b0b65 TK |
623 | print_config "POSIX AIO support" "$posix_aio" |
624 | print_config "POSIX AIO support needs -lrt" "$posix_aio_lrt" | |
67bf9823 JA |
625 | |
626 | ########################################## | |
627 | # posix aio fsync probe | |
ca205a75 TK |
628 | if test "$posix_aio_fsync" != "yes" ; then |
629 | posix_aio_fsync="no" | |
630 | fi | |
67bf9823 JA |
631 | if test "$posix_aio" = "yes" ; then |
632 | cat > $TMPC <<EOF | |
633 | #include <fcntl.h> | |
634 | #include <aio.h> | |
635 | int main(void) | |
636 | { | |
637 | struct aiocb cb; | |
638 | return aio_fsync(O_SYNC, &cb); | |
639 | return 0; | |
640 | } | |
641 | EOF | |
642 | if compile_prog "" "$LIBS" "posix_aio_fsync" ; then | |
643 | posix_aio_fsync=yes | |
644 | fi | |
645 | fi | |
484b0b65 | 646 | print_config "POSIX AIO fsync" "$posix_aio_fsync" |
67bf9823 | 647 | |
06eac6b2 SW |
648 | ########################################## |
649 | # POSIX pshared attribute probe | |
d418fa90 TK |
650 | if test "$posix_pshared" != "yes" ; then |
651 | posix_pshared="no" | |
652 | fi | |
06eac6b2 SW |
653 | cat > $TMPC <<EOF |
654 | #include <unistd.h> | |
655 | int main(void) | |
656 | { | |
657 | #if defined(_POSIX_THREAD_PROCESS_SHARED) && ((_POSIX_THREAD_PROCESS_SHARED + 0) > 0) | |
658 | # if defined(__CYGWIN__) | |
659 | # error "_POSIX_THREAD_PROCESS_SHARED is buggy on Cygwin" | |
660 | # elif defined(__APPLE__) | |
661 | # include <AvailabilityMacros.h> | |
662 | # include <TargetConditionals.h> | |
663 | # if TARGET_OS_MAC && MAC_OS_X_VERSION_MIN_REQUIRED < 1070 | |
664 | # error "_POSIX_THREAD_PROCESS_SHARED is buggy/unsupported prior to OSX 10.7" | |
665 | # endif | |
666 | # endif | |
667 | #else | |
668 | # error "_POSIX_THREAD_PROCESS_SHARED is unsupported" | |
669 | #endif | |
670 | return 0; | |
671 | } | |
672 | EOF | |
673 | if compile_prog "" "$LIBS" "posix_pshared" ; then | |
674 | posix_pshared=yes | |
675 | fi | |
484b0b65 | 676 | print_config "POSIX pshared support" "$posix_pshared" |
06eac6b2 | 677 | |
67bf9823 JA |
678 | ########################################## |
679 | # solaris aio probe | |
ca205a75 TK |
680 | if test "$solaris_aio" != "yes" ; then |
681 | solaris_aio="no" | |
682 | fi | |
67bf9823 JA |
683 | cat > $TMPC <<EOF |
684 | #include <sys/types.h> | |
685 | #include <sys/asynch.h> | |
686 | #include <unistd.h> | |
687 | int main(void) | |
688 | { | |
689 | aio_result_t res; | |
690 | return aioread(0, NULL, 0, 0, SEEK_SET, &res); | |
691 | return 0; | |
692 | } | |
693 | EOF | |
694 | if compile_prog "" "-laio" "solarisaio" ; then | |
695 | solaris_aio=yes | |
696 | LIBS="-laio $LIBS" | |
697 | fi | |
484b0b65 | 698 | print_config "Solaris AIO support" "$solaris_aio" |
67bf9823 JA |
699 | |
700 | ########################################## | |
f5cd2907 | 701 | # __sync_fetch_and_add test |
ca205a75 TK |
702 | if test "$sfaa" != "yes" ; then |
703 | sfaa="no" | |
704 | fi | |
67bf9823 | 705 | cat > $TMPC << EOF |
958886d8 JA |
706 | #include <inttypes.h> |
707 | static int sfaa(uint64_t *ptr) | |
67bf9823 | 708 | { |
9c639a76 | 709 | return __sync_fetch_and_add(ptr, 0); |
67bf9823 JA |
710 | } |
711 | ||
712 | int main(int argc, char **argv) | |
713 | { | |
958886d8 | 714 | uint64_t val = 42; |
67bf9823 JA |
715 | sfaa(&val); |
716 | return val; | |
717 | } | |
718 | EOF | |
719 | if compile_prog "" "" "__sync_fetch_and_add()" ; then | |
720 | sfaa="yes" | |
721 | fi | |
484b0b65 | 722 | print_config "__sync_fetch_and_add" "$sfaa" |
67bf9823 | 723 | |
a250edd0 JA |
724 | ########################################## |
725 | # __sync_synchronize() test | |
726 | if test "$sync_sync" != "yes" ; then | |
727 | sync_sync="no" | |
728 | fi | |
729 | cat > $TMPC << EOF | |
730 | #include <inttypes.h> | |
731 | ||
732 | int main(int argc, char **argv) | |
733 | { | |
734 | __sync_synchronize(); | |
735 | return 0; | |
736 | } | |
737 | EOF | |
738 | if compile_prog "" "" "__sync_synchronize()" ; then | |
739 | sync_sync="yes" | |
740 | fi | |
741 | print_config "__sync_synchronize" "$sync_sync" | |
742 | ||
743 | ########################################## | |
744 | # __sync_val_compare_and_swap() test | |
745 | if test "$cmp_swap" != "yes" ; then | |
746 | cmp_swap="no" | |
747 | fi | |
748 | cat > $TMPC << EOF | |
749 | #include <inttypes.h> | |
750 | ||
751 | int main(int argc, char **argv) | |
752 | { | |
753 | int x = 0; | |
754 | return __sync_val_compare_and_swap(&x, 1, 2); | |
755 | } | |
756 | EOF | |
757 | if compile_prog "" "" "__sync_val_compare_and_swap()" ; then | |
758 | cmp_swap="yes" | |
759 | fi | |
760 | print_config "__sync_val_compare_and_swap" "$cmp_swap" | |
761 | ||
67bf9823 JA |
762 | ########################################## |
763 | # libverbs probe | |
ca205a75 TK |
764 | if test "$libverbs" != "yes" ; then |
765 | libverbs="no" | |
766 | fi | |
67bf9823 | 767 | cat > $TMPC << EOF |
eb3bfdd8 | 768 | #include <infiniband/verbs.h> |
67bf9823 JA |
769 | int main(int argc, char **argv) |
770 | { | |
771 | struct ibv_pd *pd = ibv_alloc_pd(NULL); | |
772 | return 0; | |
773 | } | |
774 | EOF | |
f678f8d2 | 775 | if test "$disable_rdma" != "yes" && compile_prog "" "-libverbs" "libverbs" ; then |
67bf9823 JA |
776 | libverbs="yes" |
777 | LIBS="-libverbs $LIBS" | |
778 | fi | |
484b0b65 | 779 | print_config "libverbs" "$libverbs" |
67bf9823 JA |
780 | |
781 | ########################################## | |
782 | # rdmacm probe | |
ca205a75 TK |
783 | if test "$rdmacm" != "yes" ; then |
784 | rdmacm="no" | |
785 | fi | |
67bf9823 JA |
786 | cat > $TMPC << EOF |
787 | #include <stdio.h> | |
788 | #include <rdma/rdma_cma.h> | |
789 | int main(int argc, char **argv) | |
790 | { | |
791 | rdma_destroy_qp(NULL); | |
792 | return 0; | |
793 | } | |
794 | EOF | |
f678f8d2 | 795 | if test "$disable_rdma" != "yes" && compile_prog "" "-lrdmacm" "rdma"; then |
67bf9823 JA |
796 | rdmacm="yes" |
797 | LIBS="-lrdmacm $LIBS" | |
798 | fi | |
484b0b65 | 799 | print_config "rdmacm" "$rdmacm" |
67bf9823 | 800 | |
44e8e956 BVA |
801 | ########################################## |
802 | # asprintf() and vasprintf() probes | |
803 | if test "$have_asprintf" != "yes" ; then | |
804 | have_asprintf="no" | |
805 | fi | |
806 | cat > $TMPC << EOF | |
807 | #include <stdio.h> | |
808 | ||
809 | int main(int argc, char **argv) | |
810 | { | |
811 | return asprintf(NULL, "%s", "str") == 0; | |
812 | } | |
813 | EOF | |
814 | if compile_prog "" "" "have_asprintf"; then | |
815 | have_asprintf="yes" | |
816 | fi | |
817 | print_config "asprintf()" "$have_asprintf" | |
818 | ||
819 | if test "$have_vasprintf" != "yes" ; then | |
820 | have_vasprintf="no" | |
821 | fi | |
822 | cat > $TMPC << EOF | |
823 | #include <stdio.h> | |
824 | ||
825 | int main(int argc, char **argv) | |
826 | { | |
827 | return vasprintf(NULL, "%s", NULL) == 0; | |
828 | } | |
829 | EOF | |
830 | if compile_prog "" "" "have_vasprintf"; then | |
831 | have_vasprintf="yes" | |
832 | fi | |
833 | print_config "vasprintf()" "$have_vasprintf" | |
834 | ||
67bf9823 JA |
835 | ########################################## |
836 | # Linux fallocate probe | |
ca205a75 TK |
837 | if test "$linux_fallocate" != "yes" ; then |
838 | linux_fallocate="no" | |
839 | fi | |
67bf9823 JA |
840 | cat > $TMPC << EOF |
841 | #include <stdio.h> | |
aa6738a5 | 842 | #include <fcntl.h> |
67bf9823 JA |
843 | #include <linux/falloc.h> |
844 | int main(int argc, char **argv) | |
845 | { | |
846 | int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024); | |
847 | return r; | |
848 | } | |
849 | EOF | |
850 | if compile_prog "" "" "linux_fallocate"; then | |
851 | linux_fallocate="yes" | |
852 | fi | |
484b0b65 | 853 | print_config "Linux fallocate" "$linux_fallocate" |
67bf9823 JA |
854 | |
855 | ########################################## | |
856 | # POSIX fadvise probe | |
ca205a75 TK |
857 | if test "$posix_fadvise" != "yes" ; then |
858 | posix_fadvise="no" | |
859 | fi | |
67bf9823 JA |
860 | cat > $TMPC << EOF |
861 | #include <stdio.h> | |
862 | #include <fcntl.h> | |
863 | int main(int argc, char **argv) | |
864 | { | |
865 | int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL); | |
866 | return r; | |
867 | } | |
868 | EOF | |
869 | if compile_prog "" "" "posix_fadvise"; then | |
870 | posix_fadvise="yes" | |
871 | fi | |
484b0b65 | 872 | print_config "POSIX fadvise" "$posix_fadvise" |
67bf9823 JA |
873 | |
874 | ########################################## | |
875 | # POSIX fallocate probe | |
ca205a75 TK |
876 | if test "$posix_fallocate" != "yes" ; then |
877 | posix_fallocate="no" | |
878 | fi | |
67bf9823 JA |
879 | cat > $TMPC << EOF |
880 | #include <stdio.h> | |
881 | #include <fcntl.h> | |
882 | int main(int argc, char **argv) | |
883 | { | |
884 | int r = posix_fallocate(0, 0, 1024); | |
885 | return r; | |
886 | } | |
887 | EOF | |
888 | if compile_prog "" "" "posix_fallocate"; then | |
889 | posix_fallocate="yes" | |
890 | fi | |
484b0b65 | 891 | print_config "POSIX fallocate" "$posix_fallocate" |
67bf9823 JA |
892 | |
893 | ########################################## | |
894 | # sched_set/getaffinity 2 or 3 argument test | |
ca205a75 TK |
895 | if test "$linux_2arg_affinity" != "yes" ; then |
896 | linux_2arg_affinity="no" | |
897 | fi | |
898 | if test "$linux_3arg_affinity" != "yes" ; then | |
899 | linux_3arg_affinity="no" | |
900 | fi | |
67bf9823 | 901 | cat > $TMPC << EOF |
67bf9823 JA |
902 | #include <sched.h> |
903 | int main(int argc, char **argv) | |
904 | { | |
905 | cpu_set_t mask; | |
906 | return sched_setaffinity(0, sizeof(mask), &mask); | |
907 | } | |
908 | EOF | |
909 | if compile_prog "" "" "sched_setaffinity(,,)"; then | |
910 | linux_3arg_affinity="yes" | |
911 | else | |
912 | cat > $TMPC << EOF | |
67bf9823 JA |
913 | #include <sched.h> |
914 | int main(int argc, char **argv) | |
915 | { | |
916 | cpu_set_t mask; | |
917 | return sched_setaffinity(0, &mask); | |
918 | } | |
919 | EOF | |
920 | if compile_prog "" "" "sched_setaffinity(,)"; then | |
921 | linux_2arg_affinity="yes" | |
922 | fi | |
923 | fi | |
484b0b65 TK |
924 | print_config "sched_setaffinity(3 arg)" "$linux_3arg_affinity" |
925 | print_config "sched_setaffinity(2 arg)" "$linux_2arg_affinity" | |
67bf9823 JA |
926 | |
927 | ########################################## | |
928 | # clock_gettime probe | |
ca205a75 TK |
929 | if test "$clock_gettime" != "yes" ; then |
930 | clock_gettime="no" | |
931 | fi | |
67bf9823 JA |
932 | cat > $TMPC << EOF |
933 | #include <stdio.h> | |
934 | #include <time.h> | |
935 | int main(int argc, char **argv) | |
936 | { | |
937 | return clock_gettime(0, NULL); | |
938 | } | |
939 | EOF | |
940 | if compile_prog "" "" "clock_gettime"; then | |
941 | clock_gettime="yes" | |
942 | elif compile_prog "" "-lrt" "clock_gettime"; then | |
943 | clock_gettime="yes" | |
944 | LIBS="-lrt $LIBS" | |
945 | fi | |
484b0b65 | 946 | print_config "clock_gettime" "$clock_gettime" |
67bf9823 JA |
947 | |
948 | ########################################## | |
949 | # CLOCK_MONOTONIC probe | |
ca205a75 TK |
950 | if test "$clock_monotonic" != "yes" ; then |
951 | clock_monotonic="no" | |
952 | fi | |
67bf9823 JA |
953 | if test "$clock_gettime" = "yes" ; then |
954 | cat > $TMPC << EOF | |
955 | #include <stdio.h> | |
956 | #include <time.h> | |
957 | int main(int argc, char **argv) | |
958 | { | |
959 | return clock_gettime(CLOCK_MONOTONIC, NULL); | |
960 | } | |
961 | EOF | |
962 | if compile_prog "" "$LIBS" "clock monotonic"; then | |
963 | clock_monotonic="yes" | |
964 | fi | |
965 | fi | |
484b0b65 | 966 | print_config "CLOCK_MONOTONIC" "$clock_monotonic" |
67bf9823 | 967 | |
c544f604 SN |
968 | ########################################## |
969 | # CLOCK_MONOTONIC_RAW probe | |
ca205a75 TK |
970 | if test "$clock_monotonic_raw" != "yes" ; then |
971 | clock_monotonic_raw="no" | |
972 | fi | |
c544f604 SN |
973 | if test "$clock_gettime" = "yes" ; then |
974 | cat > $TMPC << EOF | |
975 | #include <stdio.h> | |
976 | #include <time.h> | |
977 | int main(int argc, char **argv) | |
978 | { | |
979 | return clock_gettime(CLOCK_MONOTONIC_RAW, NULL); | |
980 | } | |
981 | EOF | |
982 | if compile_prog "" "$LIBS" "clock monotonic"; then | |
983 | clock_monotonic_raw="yes" | |
984 | fi | |
985 | fi | |
484b0b65 | 986 | print_config "CLOCK_MONOTONIC_RAW" "$clock_monotonic_raw" |
c544f604 | 987 | |
67bf9823 JA |
988 | ########################################## |
989 | # CLOCK_MONOTONIC_PRECISE probe | |
ca205a75 TK |
990 | if test "$clock_monotonic_precise" != "yes" ; then |
991 | clock_monotonic_precise="no" | |
992 | fi | |
67bf9823 JA |
993 | if test "$clock_gettime" = "yes" ; then |
994 | cat > $TMPC << EOF | |
995 | #include <stdio.h> | |
996 | #include <time.h> | |
997 | int main(int argc, char **argv) | |
998 | { | |
999 | return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL); | |
1000 | } | |
1001 | EOF | |
1002 | if compile_prog "" "$LIBS" "clock monotonic precise"; then | |
1003 | clock_monotonic_precise="yes" | |
1004 | fi | |
1005 | fi | |
484b0b65 | 1006 | print_config "CLOCK_MONOTONIC_PRECISE" "$clock_monotonic_precise" |
67bf9823 | 1007 | |
25f8227d JA |
1008 | ########################################## |
1009 | # clockid_t probe | |
ca205a75 TK |
1010 | if test "$clockid_t" != "yes" ; then |
1011 | clockid_t="no" | |
1012 | fi | |
25f8227d | 1013 | cat > $TMPC << EOF |
25f8227d | 1014 | #include <time.h> |
209c37b4 | 1015 | #include <string.h> |
25f8227d JA |
1016 | int main(int argc, char **argv) |
1017 | { | |
ccf2d89d | 1018 | volatile clockid_t cid; |
7fcad9e1 | 1019 | memset((void*)&cid, 0, sizeof(cid)); |
ccf2d89d | 1020 | return 0; |
25f8227d JA |
1021 | } |
1022 | EOF | |
1023 | if compile_prog "" "$LIBS" "clockid_t"; then | |
1024 | clockid_t="yes" | |
1025 | fi | |
484b0b65 | 1026 | print_config "clockid_t" "$clockid_t" |
25f8227d | 1027 | |
67bf9823 JA |
1028 | ########################################## |
1029 | # gettimeofday() probe | |
ca205a75 TK |
1030 | if test "$gettimeofday" != "yes" ; then |
1031 | gettimeofday="no" | |
1032 | fi | |
67bf9823 JA |
1033 | cat > $TMPC << EOF |
1034 | #include <sys/time.h> | |
1035 | #include <stdio.h> | |
1036 | int main(int argc, char **argv) | |
1037 | { | |
1038 | struct timeval tv; | |
1039 | return gettimeofday(&tv, NULL); | |
1040 | } | |
1041 | EOF | |
1042 | if compile_prog "" "" "gettimeofday"; then | |
1043 | gettimeofday="yes" | |
1044 | fi | |
484b0b65 | 1045 | print_config "gettimeofday" "$gettimeofday" |
67bf9823 JA |
1046 | |
1047 | ########################################## | |
1048 | # fdatasync() probe | |
ca205a75 TK |
1049 | if test "$fdatasync" != "yes" ; then |
1050 | fdatasync="no" | |
1051 | fi | |
67bf9823 JA |
1052 | cat > $TMPC << EOF |
1053 | #include <stdio.h> | |
1054 | #include <unistd.h> | |
1055 | int main(int argc, char **argv) | |
1056 | { | |
1057 | return fdatasync(0); | |
1058 | } | |
1059 | EOF | |
1060 | if compile_prog "" "" "fdatasync"; then | |
1061 | fdatasync="yes" | |
1062 | fi | |
484b0b65 | 1063 | print_config "fdatasync" "$fdatasync" |
67bf9823 JA |
1064 | |
1065 | ########################################## | |
1066 | # sync_file_range() probe | |
ca205a75 TK |
1067 | if test "$sync_file_range" != "yes" ; then |
1068 | sync_file_range="no" | |
1069 | fi | |
67bf9823 JA |
1070 | cat > $TMPC << EOF |
1071 | #include <stdio.h> | |
1072 | #include <unistd.h> | |
67bf9823 JA |
1073 | #include <fcntl.h> |
1074 | #include <linux/fs.h> | |
1075 | int main(int argc, char **argv) | |
1076 | { | |
1077 | unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE | | |
1078 | SYNC_FILE_RANGE_WAIT_AFTER; | |
1079 | return sync_file_range(0, 0, 0, flags); | |
1080 | } | |
1081 | EOF | |
1082 | if compile_prog "" "" "sync_file_range"; then | |
1083 | sync_file_range="yes" | |
1084 | fi | |
484b0b65 | 1085 | print_config "sync_file_range" "$sync_file_range" |
67bf9823 JA |
1086 | |
1087 | ########################################## | |
1088 | # ext4 move extent probe | |
ca205a75 TK |
1089 | if test "$ext4_me" != "yes" ; then |
1090 | ext4_me="no" | |
1091 | fi | |
67bf9823 JA |
1092 | cat > $TMPC << EOF |
1093 | #include <fcntl.h> | |
1094 | #include <sys/ioctl.h> | |
1095 | int main(int argc, char **argv) | |
1096 | { | |
1097 | struct move_extent me; | |
1098 | return ioctl(0, EXT4_IOC_MOVE_EXT, &me); | |
1099 | } | |
1100 | EOF | |
c7165b8d JA |
1101 | if compile_prog "" "" "ext4 move extent" ; then |
1102 | ext4_me="yes" | |
1103 | elif test $targetos = "Linux" ; then | |
1104 | # On Linux, just default to it on and let it error at runtime if we really | |
1105 | # don't have it. None of my updated systems have it defined, but it does | |
1106 | # work. Takes a while to bubble back. | |
67bf9823 JA |
1107 | ext4_me="yes" |
1108 | fi | |
484b0b65 | 1109 | print_config "EXT4 move extent" "$ext4_me" |
67bf9823 JA |
1110 | |
1111 | ########################################## | |
1112 | # splice probe | |
ca205a75 TK |
1113 | if test "$linux_splice" != "yes" ; then |
1114 | linux_splice="no" | |
1115 | fi | |
67bf9823 | 1116 | cat > $TMPC << EOF |
67bf9823 JA |
1117 | #include <stdio.h> |
1118 | #include <fcntl.h> | |
1119 | int main(int argc, char **argv) | |
1120 | { | |
1121 | return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK); | |
1122 | } | |
1123 | EOF | |
1124 | if compile_prog "" "" "linux splice"; then | |
1125 | linux_splice="yes" | |
1126 | fi | |
484b0b65 | 1127 | print_config "Linux splice(2)" "$linux_splice" |
67bf9823 JA |
1128 | |
1129 | ########################################## | |
1130 | # GUASI probe | |
ca205a75 TK |
1131 | if test "$guasi" != "yes" ; then |
1132 | guasi="no" | |
1133 | fi | |
67bf9823 JA |
1134 | cat > $TMPC << EOF |
1135 | #include <guasi.h> | |
1136 | #include <guasi_syscalls.h> | |
1137 | int main(int argc, char **argv) | |
1138 | { | |
1139 | guasi_t ctx = guasi_create(0, 0, 0); | |
1140 | return 0; | |
1141 | } | |
1142 | EOF | |
1143 | if compile_prog "" "" "guasi"; then | |
1144 | guasi="yes" | |
1145 | fi | |
484b0b65 | 1146 | print_config "GUASI" "$guasi" |
67bf9823 JA |
1147 | |
1148 | ########################################## | |
1149 | # fusion-aw probe | |
ca205a75 TK |
1150 | if test "$fusion_aw" != "yes" ; then |
1151 | fusion_aw="no" | |
1152 | fi | |
67bf9823 | 1153 | cat > $TMPC << EOF |
b2c77c25 | 1154 | #include <nvm/nvm_primitives.h> |
67bf9823 JA |
1155 | int main(int argc, char **argv) |
1156 | { | |
b2c77c25 SK |
1157 | nvm_version_t ver_info; |
1158 | nvm_handle_t handle; | |
1159 | ||
1160 | handle = nvm_get_handle(0, &ver_info); | |
1161 | return nvm_atomic_write(handle, 0, 0, 0); | |
67bf9823 JA |
1162 | } |
1163 | EOF | |
92aef550 ARJ |
1164 | if compile_prog "" "-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread" "fusion-aw"; then |
1165 | LIBS="-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread $LIBS" | |
67bf9823 JA |
1166 | fusion_aw="yes" |
1167 | fi | |
484b0b65 | 1168 | print_config "Fusion-io atomic engine" "$fusion_aw" |
67bf9823 JA |
1169 | |
1170 | ########################################## | |
1171 | # libnuma probe | |
ca205a75 TK |
1172 | if test "$libnuma" != "yes" ; then |
1173 | libnuma="no" | |
1174 | fi | |
67bf9823 JA |
1175 | cat > $TMPC << EOF |
1176 | #include <numa.h> | |
1177 | int main(int argc, char **argv) | |
1178 | { | |
1179 | return numa_available(); | |
1180 | } | |
1181 | EOF | |
44462517 | 1182 | if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then |
67bf9823 JA |
1183 | libnuma="yes" |
1184 | LIBS="-lnuma $LIBS" | |
1185 | fi | |
484b0b65 | 1186 | print_config "libnuma" "$libnuma" |
67bf9823 | 1187 | |
50206d9b | 1188 | ########################################## |
ca205a75 | 1189 | # libnuma 2.x version API, initialize with "no" only if $libnuma is set to "yes" |
50206d9b JA |
1190 | if test "$libnuma" = "yes" ; then |
1191 | libnuma_v2="no" | |
1192 | cat > $TMPC << EOF | |
1193 | #include <numa.h> | |
1194 | int main(int argc, char **argv) | |
1195 | { | |
1196 | struct bitmask *mask = numa_parse_nodestring(NULL); | |
61bde962 | 1197 | return mask->size == 0; |
50206d9b JA |
1198 | } |
1199 | EOF | |
1200 | if compile_prog "" "" "libnuma api"; then | |
1201 | libnuma_v2="yes" | |
1202 | fi | |
484b0b65 | 1203 | print_config "libnuma v2" "$libnuma_v2" |
50206d9b JA |
1204 | fi |
1205 | ||
67bf9823 JA |
1206 | ########################################## |
1207 | # strsep() probe | |
ca205a75 TK |
1208 | if test "$strsep" != "yes" ; then |
1209 | strsep="no" | |
1210 | fi | |
67bf9823 JA |
1211 | cat > $TMPC << EOF |
1212 | #include <string.h> | |
1213 | int main(int argc, char **argv) | |
1214 | { | |
ae156be6 JA |
1215 | static char *string = "This is a string"; |
1216 | strsep(&string, "needle"); | |
67bf9823 JA |
1217 | return 0; |
1218 | } | |
1219 | EOF | |
1220 | if compile_prog "" "" "strsep"; then | |
1221 | strsep="yes" | |
1222 | fi | |
484b0b65 | 1223 | print_config "strsep" "$strsep" |
67bf9823 | 1224 | |
9ad8da82 JA |
1225 | ########################################## |
1226 | # strcasestr() probe | |
ca205a75 TK |
1227 | if test "$strcasestr" != "yes" ; then |
1228 | strcasestr="no" | |
1229 | fi | |
9ad8da82 JA |
1230 | cat > $TMPC << EOF |
1231 | #include <string.h> | |
1232 | int main(int argc, char **argv) | |
1233 | { | |
aa6738a5 | 1234 | return strcasestr(argv[0], argv[1]) != NULL; |
9ad8da82 JA |
1235 | } |
1236 | EOF | |
1237 | if compile_prog "" "" "strcasestr"; then | |
1238 | strcasestr="yes" | |
1239 | fi | |
484b0b65 | 1240 | print_config "strcasestr" "$strcasestr" |
9ad8da82 | 1241 | |
5ad7be56 KD |
1242 | ########################################## |
1243 | # strlcat() probe | |
ca205a75 TK |
1244 | if test "$strlcat" != "yes" ; then |
1245 | strlcat="no" | |
1246 | fi | |
5ad7be56 KD |
1247 | cat > $TMPC << EOF |
1248 | #include <string.h> | |
1249 | int main(int argc, char **argv) | |
1250 | { | |
1251 | static char dst[64]; | |
1252 | static char *string = "This is a string"; | |
1253 | memset(dst, 0, sizeof(dst)); | |
1254 | strlcat(dst, string, sizeof(dst)); | |
1255 | return 0; | |
1256 | } | |
1257 | EOF | |
1258 | if compile_prog "" "" "strlcat"; then | |
1259 | strlcat="yes" | |
1260 | fi | |
484b0b65 | 1261 | print_config "strlcat" "$strlcat" |
5ad7be56 | 1262 | |
67bf9823 JA |
1263 | ########################################## |
1264 | # getopt_long_only() probe | |
ca205a75 TK |
1265 | if test "$getopt_long_only" != "yes" ; then |
1266 | getopt_long_only="no" | |
1267 | fi | |
67bf9823 JA |
1268 | cat > $TMPC << EOF |
1269 | #include <unistd.h> | |
1270 | #include <stdio.h> | |
aa6738a5 | 1271 | #include <getopt.h> |
67bf9823 JA |
1272 | int main(int argc, char **argv) |
1273 | { | |
1274 | int c = getopt_long_only(argc, argv, NULL, NULL, NULL); | |
1275 | return c; | |
1276 | } | |
1277 | EOF | |
1278 | if compile_prog "" "" "getopt_long_only"; then | |
1279 | getopt_long_only="yes" | |
1280 | fi | |
484b0b65 | 1281 | print_config "getopt_long_only()" "$getopt_long_only" |
67bf9823 JA |
1282 | |
1283 | ########################################## | |
1284 | # inet_aton() probe | |
ca205a75 TK |
1285 | if test "$inet_aton" != "yes" ; then |
1286 | inet_aton="no" | |
1287 | fi | |
67bf9823 JA |
1288 | cat > $TMPC << EOF |
1289 | #include <sys/socket.h> | |
1290 | #include <arpa/inet.h> | |
1291 | #include <stdio.h> | |
1292 | int main(int argc, char **argv) | |
1293 | { | |
1294 | struct in_addr in; | |
1295 | return inet_aton(NULL, &in); | |
1296 | } | |
1297 | EOF | |
1298 | if compile_prog "" "" "inet_aton"; then | |
1299 | inet_aton="yes" | |
1300 | fi | |
484b0b65 | 1301 | print_config "inet_aton" "$inet_aton" |
67bf9823 JA |
1302 | |
1303 | ########################################## | |
1304 | # socklen_t probe | |
ca205a75 TK |
1305 | if test "$socklen_t" != "yes" ; then |
1306 | socklen_t="no" | |
1307 | fi | |
67bf9823 | 1308 | cat > $TMPC << EOF |
f6482613 | 1309 | #include <sys/socket.h> |
67bf9823 JA |
1310 | int main(int argc, char **argv) |
1311 | { | |
1312 | socklen_t len = 0; | |
1313 | return len; | |
1314 | } | |
1315 | EOF | |
1316 | if compile_prog "" "" "socklen_t"; then | |
1317 | socklen_t="yes" | |
1318 | fi | |
484b0b65 | 1319 | print_config "socklen_t" "$socklen_t" |
67bf9823 JA |
1320 | |
1321 | ########################################## | |
1322 | # Whether or not __thread is supported for TLS | |
ca205a75 TK |
1323 | if test "$tls_thread" != "yes" ; then |
1324 | tls_thread="no" | |
1325 | fi | |
67bf9823 JA |
1326 | cat > $TMPC << EOF |
1327 | #include <stdio.h> | |
aa6738a5 | 1328 | static __thread int ret; |
67bf9823 JA |
1329 | int main(int argc, char **argv) |
1330 | { | |
1331 | return ret; | |
1332 | } | |
1333 | EOF | |
1334 | if compile_prog "" "" "__thread"; then | |
1335 | tls_thread="yes" | |
1336 | fi | |
484b0b65 | 1337 | print_config "__thread" "$tls_thread" |
67bf9823 | 1338 | |
91f94d5b | 1339 | ########################################## |
2639f056 | 1340 | # Check if we have required gtk/glib support for gfio |
ca205a75 TK |
1341 | if test "$gfio" != "yes" ; then |
1342 | gfio="no" | |
1343 | fi | |
ebec2094 | 1344 | if test "$gfio_check" = "yes" ; then |
91f94d5b JA |
1345 | cat > $TMPC << EOF |
1346 | #include <glib.h> | |
1347 | #include <cairo.h> | |
1348 | #include <gtk/gtk.h> | |
1349 | int main(void) | |
1350 | { | |
1351 | gdk_threads_enter(); | |
91f94d5b | 1352 | gdk_threads_leave(); |
b7a99316 | 1353 | |
ef2b61aa | 1354 | return GTK_CHECK_VERSION(2, 18, 0) ? 0 : 1; /* 0 on success */ |
91f94d5b JA |
1355 | } |
1356 | EOF | |
1357 | GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0) | |
86719845 JA |
1358 | ORG_LDFLAGS=$LDFLAGS |
1359 | LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g) | |
91f94d5b JA |
1360 | if test "$?" != "0" ; then |
1361 | echo "configure: gtk and gthread not found" | |
1362 | exit 1 | |
1363 | fi | |
1364 | GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0) | |
1365 | if test "$?" != "0" ; then | |
1366 | echo "configure: gtk and gthread not found" | |
1367 | exit 1 | |
1368 | fi | |
b7a99316 | 1369 | if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then |
ef2b61aa TK |
1370 | $TMPE |
1371 | if test "$?" = "0" ; then | |
b7a99316 | 1372 | gfio="yes" |
86719845 | 1373 | GFIO_LIBS="$LIBS $GTK_LIBS" |
b7a99316 JA |
1374 | CFLAGS="$CFLAGS $GTK_CFLAGS" |
1375 | else | |
1376 | echo "GTK found, but need version 2.18 or higher" | |
1377 | gfio="no" | |
1378 | fi | |
91f94d5b JA |
1379 | else |
1380 | echo "Please install gtk and gdk libraries" | |
1381 | gfio="no" | |
1382 | fi | |
86719845 | 1383 | LDFLAGS=$ORG_LDFLAGS |
91f94d5b JA |
1384 | fi |
1385 | ||
ebec2094 | 1386 | if test "$gfio_check" = "yes" ; then |
484b0b65 | 1387 | print_config "gtk 2.18 or higher" "$gfio" |
ebec2094 | 1388 | fi |
91f94d5b | 1389 | |
bda92394 | 1390 | ########################################## |
44404c5a | 1391 | # Check whether we have getrusage(RUSAGE_THREAD) |
ca205a75 TK |
1392 | if test "$rusage_thread" != "yes" ; then |
1393 | rusage_thread="no" | |
1394 | fi | |
44404c5a JA |
1395 | cat > $TMPC << EOF |
1396 | #include <sys/time.h> | |
1397 | #include <sys/resource.h> | |
1398 | int main(int argc, char **argv) | |
1399 | { | |
1400 | struct rusage ru; | |
1401 | getrusage(RUSAGE_THREAD, &ru); | |
1402 | return 0; | |
1403 | } | |
1404 | EOF | |
1405 | if compile_prog "" "" "RUSAGE_THREAD"; then | |
1406 | rusage_thread="yes" | |
1407 | fi | |
484b0b65 | 1408 | print_config "RUSAGE_THREAD" "$rusage_thread" |
44404c5a | 1409 | |
7e09a9f1 JA |
1410 | ########################################## |
1411 | # Check whether we have SCHED_IDLE | |
ca205a75 TK |
1412 | if test "$sched_idle" != "yes" ; then |
1413 | sched_idle="no" | |
1414 | fi | |
7e09a9f1 JA |
1415 | cat > $TMPC << EOF |
1416 | #include <sched.h> | |
1417 | int main(int argc, char **argv) | |
1418 | { | |
1419 | struct sched_param p; | |
1420 | return sched_setscheduler(0, SCHED_IDLE, &p); | |
1421 | } | |
1422 | EOF | |
1423 | if compile_prog "" "" "SCHED_IDLE"; then | |
1424 | sched_idle="yes" | |
1425 | fi | |
484b0b65 | 1426 | print_config "SCHED_IDLE" "$sched_idle" |
7e09a9f1 | 1427 | |
1eafa37a JA |
1428 | ########################################## |
1429 | # Check whether we have TCP_NODELAY | |
ca205a75 TK |
1430 | if test "$tcp_nodelay" != "yes" ; then |
1431 | tcp_nodelay="no" | |
1432 | fi | |
1eafa37a JA |
1433 | cat > $TMPC << EOF |
1434 | #include <stdio.h> | |
1435 | #include <sys/types.h> | |
1436 | #include <sys/socket.h> | |
1437 | #include <netinet/tcp.h> | |
1438 | int main(int argc, char **argv) | |
1439 | { | |
1440 | return getsockopt(0, 0, TCP_NODELAY, NULL, NULL); | |
1441 | } | |
1442 | EOF | |
1443 | if compile_prog "" "" "TCP_NODELAY"; then | |
1444 | tcp_nodelay="yes" | |
1445 | fi | |
484b0b65 | 1446 | print_config "TCP_NODELAY" "$tcp_nodelay" |
1eafa37a | 1447 | |
1008602c JA |
1448 | ########################################## |
1449 | # Check whether we have SO_SNDBUF | |
ca205a75 TK |
1450 | if test "$window_size" != "yes" ; then |
1451 | window_size="no" | |
1452 | fi | |
1008602c JA |
1453 | cat > $TMPC << EOF |
1454 | #include <stdio.h> | |
1455 | #include <sys/types.h> | |
1456 | #include <sys/socket.h> | |
1457 | #include <netinet/tcp.h> | |
1458 | int main(int argc, char **argv) | |
1459 | { | |
1460 | setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0); | |
1461 | setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0); | |
1462 | } | |
1463 | EOF | |
1464 | if compile_prog "" "" "SO_SNDBUF"; then | |
1465 | window_size="yes" | |
1466 | fi | |
484b0b65 | 1467 | print_config "Net engine window_size" "$window_size" |
1008602c | 1468 | |
e5f34d95 JA |
1469 | ########################################## |
1470 | # Check whether we have TCP_MAXSEG | |
ca205a75 TK |
1471 | if test "$mss" != "yes" ; then |
1472 | mss="no" | |
1473 | fi | |
e5f34d95 JA |
1474 | cat > $TMPC << EOF |
1475 | #include <stdio.h> | |
1476 | #include <sys/types.h> | |
1477 | #include <sys/socket.h> | |
1478 | #include <netinet/tcp.h> | |
1479 | #include <arpa/inet.h> | |
1480 | #include <netinet/in.h> | |
1481 | int main(int argc, char **argv) | |
1482 | { | |
1483 | return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0); | |
1484 | } | |
1485 | EOF | |
1486 | if compile_prog "" "" "TCP_MAXSEG"; then | |
1487 | mss="yes" | |
1488 | fi | |
484b0b65 | 1489 | print_config "TCP_MAXSEG" "$mss" |
e5f34d95 | 1490 | |
38b9354a JA |
1491 | ########################################## |
1492 | # Check whether we have RLIMIT_MEMLOCK | |
ca205a75 TK |
1493 | if test "$rlimit_memlock" != "yes" ; then |
1494 | rlimit_memlock="no" | |
1495 | fi | |
38b9354a JA |
1496 | cat > $TMPC << EOF |
1497 | #include <sys/time.h> | |
1498 | #include <sys/resource.h> | |
1499 | int main(int argc, char **argv) | |
1500 | { | |
1501 | struct rlimit rl; | |
1502 | return getrlimit(RLIMIT_MEMLOCK, &rl); | |
1503 | } | |
1504 | EOF | |
1505 | if compile_prog "" "" "RLIMIT_MEMLOCK"; then | |
1506 | rlimit_memlock="yes" | |
1507 | fi | |
484b0b65 | 1508 | print_config "RLIMIT_MEMLOCK" "$rlimit_memlock" |
38b9354a | 1509 | |
07fc0acd JA |
1510 | ########################################## |
1511 | # Check whether we have pwritev/preadv | |
ca205a75 TK |
1512 | if test "$pwritev" != "yes" ; then |
1513 | pwritev="no" | |
1514 | fi | |
07fc0acd JA |
1515 | cat > $TMPC << EOF |
1516 | #include <stdio.h> | |
1517 | #include <sys/uio.h> | |
1518 | int main(int argc, char **argv) | |
1519 | { | |
1520 | return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0); | |
1521 | } | |
1522 | EOF | |
1523 | if compile_prog "" "" "pwritev"; then | |
1524 | pwritev="yes" | |
1525 | fi | |
484b0b65 | 1526 | print_config "pwritev/preadv" "$pwritev" |
07fc0acd | 1527 | |
2cafffbe JA |
1528 | ########################################## |
1529 | # Check whether we have pwritev2/preadv2 | |
ca205a75 TK |
1530 | if test "$pwritev2" != "yes" ; then |
1531 | pwritev2="no" | |
1532 | fi | |
2cafffbe JA |
1533 | cat > $TMPC << EOF |
1534 | #include <stdio.h> | |
1535 | #include <sys/uio.h> | |
1536 | int main(int argc, char **argv) | |
1537 | { | |
1538 | return pwritev2(0, NULL, 1, 0, 0) + preadv2(0, NULL, 1, 0, 0); | |
1539 | } | |
1540 | EOF | |
1541 | if compile_prog "" "" "pwritev2"; then | |
1542 | pwritev2="yes" | |
1543 | fi | |
484b0b65 | 1544 | print_config "pwritev2/preadv2" "$pwritev2" |
2cafffbe | 1545 | |
ecad55e9 JA |
1546 | ########################################## |
1547 | # Check whether we have the required functions for ipv6 | |
ca205a75 TK |
1548 | if test "$ipv6" != "yes" ; then |
1549 | ipv6="no" | |
1550 | fi | |
ecad55e9 JA |
1551 | cat > $TMPC << EOF |
1552 | #include <sys/types.h> | |
1553 | #include <sys/socket.h> | |
d219028d | 1554 | #include <netinet/in.h> |
ecad55e9 JA |
1555 | #include <netdb.h> |
1556 | #include <stdio.h> | |
1557 | int main(int argc, char **argv) | |
1558 | { | |
1559 | struct addrinfo hints; | |
1560 | struct in6_addr addr; | |
1561 | int ret; | |
1562 | ||
1563 | ret = getaddrinfo(NULL, NULL, &hints, NULL); | |
1564 | freeaddrinfo(NULL); | |
1565 | printf("%s\n", gai_strerror(ret)); | |
1566 | addr = in6addr_any; | |
1567 | return 0; | |
1568 | } | |
1569 | EOF | |
1570 | if compile_prog "" "" "ipv6"; then | |
1571 | ipv6="yes" | |
1572 | fi | |
484b0b65 | 1573 | print_config "IPv6 helpers" "$ipv6" |
07fc0acd | 1574 | |
c2f6a13d LMB |
1575 | ########################################## |
1576 | # check for http | |
1577 | if test "$http" != "yes" ; then | |
1578 | http="no" | |
1579 | fi | |
9ee669fa DD |
1580 | # check for openssl >= 1.1.0, which uses an opaque HMAC_CTX pointer |
1581 | cat > $TMPC << EOF | |
1582 | #include <curl/curl.h> | |
1583 | #include <openssl/hmac.h> | |
1584 | ||
1585 | int main(int argc, char **argv) | |
1586 | { | |
1587 | CURL *curl; | |
1588 | HMAC_CTX *ctx; | |
1589 | ||
1590 | curl = curl_easy_init(); | |
1591 | curl_easy_cleanup(curl); | |
1592 | ||
1593 | ctx = HMAC_CTX_new(); | |
1594 | HMAC_CTX_reset(ctx); | |
1595 | HMAC_CTX_free(ctx); | |
1596 | return 0; | |
1597 | } | |
1598 | EOF | |
1599 | # openssl < 1.1.0 uses the HMAC_CTX type directly | |
1600 | cat > $TMPC2 << EOF | |
1601 | #include <curl/curl.h> | |
1602 | #include <openssl/hmac.h> | |
1603 | ||
1604 | int main(int argc, char **argv) | |
1605 | { | |
1606 | CURL *curl; | |
1607 | HMAC_CTX ctx; | |
1608 | ||
1609 | curl = curl_easy_init(); | |
1610 | curl_easy_cleanup(curl); | |
1611 | ||
1612 | HMAC_CTX_init(&ctx); | |
1613 | HMAC_CTX_cleanup(&ctx); | |
1614 | return 0; | |
1615 | } | |
1616 | EOF | |
1617 | if test "$disable_http" != "yes"; then | |
1618 | HTTP_LIBS="-lcurl -lssl -lcrypto" | |
1619 | if compile_prog "" "$HTTP_LIBS" "curl-new-ssl"; then | |
b61a5f46 | 1620 | output_sym "CONFIG_HAVE_OPAQUE_HMAC_CTX" |
9ee669fa DD |
1621 | http="yes" |
1622 | LIBS="$HTTP_LIBS $LIBS" | |
1623 | elif mv $TMPC2 $TMPC && compile_prog "" "$HTTP_LIBS" "curl-old-ssl"; then | |
1624 | http="yes" | |
1625 | LIBS="$HTTP_LIBS $LIBS" | |
0290c589 | 1626 | fi |
c2f6a13d LMB |
1627 | fi |
1628 | print_config "http engine" "$http" | |
1629 | ||
d5f9b0ea IF |
1630 | ########################################## |
1631 | # check for rados | |
1632 | if test "$rados" != "yes" ; then | |
1633 | rados="no" | |
1634 | fi | |
1635 | cat > $TMPC << EOF | |
1636 | #include <rados/librados.h> | |
1637 | ||
1638 | int main(int argc, char **argv) | |
1639 | { | |
1640 | rados_t cluster; | |
1641 | rados_ioctx_t io_ctx; | |
1642 | const char cluster_name[] = "ceph"; | |
1643 | const char user_name[] = "client.admin"; | |
1644 | const char pool[] = "rados"; | |
1645 | ||
1646 | /* The rados_create2 signature required was only introduced in ceph 0.65 */ | |
1647 | rados_create2(&cluster, cluster_name, user_name, 0); | |
1648 | rados_ioctx_create(cluster, pool, &io_ctx); | |
1649 | ||
1650 | return 0; | |
1651 | } | |
1652 | EOF | |
1653 | if test "$disable_rados" != "yes" && compile_prog "" "-lrados" "rados"; then | |
1654 | LIBS="-lrados $LIBS" | |
1655 | rados="yes" | |
1656 | fi | |
1657 | print_config "Rados engine" "$rados" | |
1658 | ||
fc5c0345 DG |
1659 | ########################################## |
1660 | # check for rbd | |
ca205a75 TK |
1661 | if test "$rbd" != "yes" ; then |
1662 | rbd="no" | |
1663 | fi | |
fc5c0345 DG |
1664 | cat > $TMPC << EOF |
1665 | #include <rbd/librbd.h> | |
1666 | ||
1667 | int main(int argc, char **argv) | |
1668 | { | |
fc5c0345 DG |
1669 | rados_t cluster; |
1670 | rados_ioctx_t io_ctx; | |
fb9bc6e3 SW |
1671 | const char cluster_name[] = "ceph"; |
1672 | const char user_name[] = "client.admin"; | |
fc5c0345 | 1673 | const char pool[] = "rbd"; |
fc5c0345 | 1674 | int major, minor, extra; |
fc5c0345 | 1675 | |
fb9bc6e3 SW |
1676 | rbd_version(&major, &minor, &extra); |
1677 | /* The rados_create2 signature required was only introduced in ceph 0.65 */ | |
1678 | rados_create2(&cluster, cluster_name, user_name, 0); | |
fc5c0345 | 1679 | rados_ioctx_create(cluster, pool, &io_ctx); |
fb9bc6e3 | 1680 | |
fc5c0345 DG |
1681 | return 0; |
1682 | } | |
1683 | EOF | |
ce18290e | 1684 | if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then |
fc5c0345 DG |
1685 | LIBS="-lrbd -lrados $LIBS" |
1686 | rbd="yes" | |
1687 | fi | |
484b0b65 | 1688 | print_config "Rados Block Device engine" "$rbd" |
fc5c0345 | 1689 | |
53b6c979 PL |
1690 | ########################################## |
1691 | # check for rbd_poll | |
ca205a75 TK |
1692 | if test "$rbd_poll" != "yes" ; then |
1693 | rbd_poll="no" | |
1694 | fi | |
53b6c979 PL |
1695 | if test "$rbd" = "yes"; then |
1696 | cat > $TMPC << EOF | |
1697 | #include <rbd/librbd.h> | |
1698 | #include <sys/eventfd.h> | |
1699 | ||
1700 | int main(int argc, char **argv) | |
1701 | { | |
1702 | rbd_image_t image; | |
1703 | rbd_completion_t comp; | |
1704 | ||
1705 | int fd = eventfd(0, EFD_NONBLOCK); | |
1706 | rbd_set_image_notification(image, fd, EVENT_TYPE_EVENTFD); | |
1707 | rbd_poll_io_events(image, comp, 1); | |
1708 | ||
1709 | return 0; | |
1710 | } | |
1711 | EOF | |
1712 | if compile_prog "" "-lrbd -lrados" "rbd"; then | |
1713 | rbd_poll="yes" | |
1714 | fi | |
484b0b65 | 1715 | print_config "rbd_poll" "$rbd_poll" |
53b6c979 PL |
1716 | fi |
1717 | ||
903b2812 | 1718 | ########################################## |
6266dd72 | 1719 | # check for rbd_invalidate_cache() |
ca205a75 TK |
1720 | if test "$rbd_inval" != "yes" ; then |
1721 | rbd_inval="no" | |
1722 | fi | |
903b2812 JA |
1723 | if test "$rbd" = "yes"; then |
1724 | cat > $TMPC << EOF | |
1725 | #include <rbd/librbd.h> | |
1726 | ||
1727 | int main(int argc, char **argv) | |
1728 | { | |
1729 | rbd_image_t image; | |
1730 | ||
1731 | return rbd_invalidate_cache(image); | |
1732 | } | |
1733 | EOF | |
1734 | if compile_prog "" "-lrbd -lrados" "rbd"; then | |
1735 | rbd_inval="yes" | |
1736 | fi | |
484b0b65 | 1737 | print_config "rbd_invalidate_cache" "$rbd_inval" |
903b2812 JA |
1738 | fi |
1739 | ||
2e802282 JA |
1740 | ########################################## |
1741 | # Check whether we have setvbuf | |
ca205a75 TK |
1742 | if test "$setvbuf" != "yes" ; then |
1743 | setvbuf="no" | |
1744 | fi | |
2e802282 JA |
1745 | cat > $TMPC << EOF |
1746 | #include <stdio.h> | |
1747 | int main(int argc, char **argv) | |
1748 | { | |
1749 | FILE *f = NULL; | |
1750 | char buf[80]; | |
1751 | setvbuf(f, buf, _IOFBF, sizeof(buf)); | |
1752 | return 0; | |
1753 | } | |
1754 | EOF | |
1755 | if compile_prog "" "" "setvbuf"; then | |
1756 | setvbuf="yes" | |
1757 | fi | |
484b0b65 | 1758 | print_config "setvbuf" "$setvbuf" |
fc5c0345 | 1759 | |
bda92394 | 1760 | ########################################## |
6e7d7dfb | 1761 | # check for gfapi |
ca205a75 TK |
1762 | if test "$gfapi" != "yes" ; then |
1763 | gfapi="no" | |
1764 | fi | |
6e7d7dfb | 1765 | cat > $TMPC << EOF |
1766 | #include <glusterfs/api/glfs.h> | |
1767 | ||
1768 | int main(int argc, char **argv) | |
1769 | { | |
6e7d7dfb | 1770 | glfs_t *g = glfs_new("foo"); |
1771 | ||
1772 | return 0; | |
1773 | } | |
1774 | EOF | |
ce18290e | 1775 | if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then |
6e7d7dfb | 1776 | LIBS="-lgfapi -lglusterfs $LIBS" |
1777 | gfapi="yes" | |
1778 | fi | |
484b0b65 | 1779 | print_config "Gluster API engine" "$gfapi" |
6e7d7dfb | 1780 | |
6fa14b99 | 1781 | ########################################## |
ca205a75 | 1782 | # check for gfapi fadvise support, initialize with "no" only if $gfapi is set to "yes" |
6876c98c | 1783 | if test "$gfapi" = "yes" ; then |
6fa14b99 | 1784 | gf_fadvise="no" |
1785 | cat > $TMPC << EOF | |
1786 | #include <glusterfs/api/glfs.h> | |
1787 | ||
1788 | int main(int argc, char **argv) | |
1789 | { | |
1790 | struct glfs_fd *fd; | |
1791 | int ret = glfs_fadvise(fd, 0, 0, 1); | |
1792 | ||
1793 | return 0; | |
1794 | } | |
1795 | EOF | |
6fa14b99 | 1796 | if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then |
1797 | gf_fadvise="yes" | |
1798 | fi | |
484b0b65 | 1799 | print_config "Gluster API use fadvise" "$gf_fadvise" |
6876c98c JA |
1800 | fi |
1801 | ||
1802 | ########################################## | |
1803 | # check for gfapi trim support | |
ca205a75 TK |
1804 | if test "$gf_trim" != "yes" ; then |
1805 | gf_trim="no" | |
1806 | fi | |
6876c98c JA |
1807 | if test "$gfapi" = "yes" ; then |
1808 | cat > $TMPC << EOF | |
1809 | #include <glusterfs/api/glfs.h> | |
1810 | ||
1811 | int main(int argc, char **argv) | |
1812 | { | |
1813 | return glfs_discard_async(NULL, 0, 0); | |
1814 | } | |
1815 | EOF | |
1816 | if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then | |
1817 | gf_trim="yes" | |
1818 | fi | |
484b0b65 | 1819 | print_config "Gluster API trim support" "$gf_trim" |
6876c98c | 1820 | fi |
fc5c0345 | 1821 | |
81795ce3 CE |
1822 | ########################################## |
1823 | # Check if we support stckf on s390 | |
ca205a75 TK |
1824 | if test "$s390_z196_facilities" != "yes" ; then |
1825 | s390_z196_facilities="no" | |
1826 | fi | |
81795ce3 CE |
1827 | cat > $TMPC << EOF |
1828 | #define STFLE_BITS_Z196 45 /* various z196 facilities ... */ | |
1829 | int main(int argc, char **argv) | |
1830 | { | |
1831 | /* We want just 1 double word to be returned. */ | |
1832 | register unsigned long reg0 asm("0") = 0; | |
1833 | unsigned long stfle_bits; | |
1834 | asm volatile(".machine push" "\n\t" | |
1835 | ".machine \"z9-109\"" "\n\t" | |
1836 | "stfle %0" "\n\t" | |
1837 | ".machine pop" "\n" | |
1838 | : "=QS" (stfle_bits), "+d" (reg0) | |
1839 | : : "cc"); | |
1840 | ||
1841 | if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0) | |
1842 | return 0; | |
1843 | else | |
1844 | return -1; | |
1845 | } | |
1846 | EOF | |
1847 | if compile_prog "" "" "s390_z196_facilities"; then | |
1848 | $TMPE | |
6a2c9363 | 1849 | if [ $? -eq 0 ]; then |
81795ce3 CE |
1850 | s390_z196_facilities="yes" |
1851 | fi | |
1852 | fi | |
484b0b65 | 1853 | print_config "s390_z196_facilities" "$s390_z196_facilities" |
1b10477b MM |
1854 | |
1855 | ########################################## | |
1856 | # Check if we have required environment variables configured for libhdfs | |
1857 | if test "$libhdfs" = "yes" ; then | |
1858 | hdfs_conf_error=0 | |
1859 | if test "$JAVA_HOME" = "" ; then | |
1860 | echo "configure: JAVA_HOME should be defined to jdk/jvm path" | |
1861 | hdfs_conf_error=1 | |
1862 | fi | |
1863 | if test "$FIO_LIBHDFS_INCLUDE" = "" ; then | |
1864 | echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path" | |
1865 | hdfs_conf_error=1 | |
1866 | fi | |
1867 | if test "$FIO_LIBHDFS_LIB" = "" ; then | |
1868 | echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path" | |
1869 | hdfs_conf_error=1 | |
1870 | fi | |
1871 | if test "$hdfs_conf_error" = "1" ; then | |
1872 | exit 1 | |
1873 | fi | |
247e5436 JA |
1874 | FIO_HDFS_CPU=$cpu |
1875 | if test "$FIO_HDFS_CPU" = "x86_64" ; then | |
1876 | FIO_HDFS_CPU="amd64" | |
1877 | fi | |
1b10477b | 1878 | fi |
484b0b65 | 1879 | print_config "HDFS engine" "$libhdfs" |
1b10477b | 1880 | |
b8116a87 DE |
1881 | ########################################## |
1882 | # Check whether we have MTD | |
ca205a75 TK |
1883 | if test "$mtd" != "yes" ; then |
1884 | mtd="no" | |
1885 | fi | |
b8116a87 | 1886 | cat > $TMPC << EOF |
0e1c454a | 1887 | #include <string.h> |
b8116a87 DE |
1888 | #include <mtd/mtd-user.h> |
1889 | #include <sys/ioctl.h> | |
1890 | int main(int argc, char **argv) | |
1891 | { | |
0e1c454a | 1892 | struct mtd_write_req ops; |
b8116a87 | 1893 | struct mtd_info_user info; |
0e1c454a | 1894 | memset(&ops, 0, sizeof(ops)); |
400cd0ff | 1895 | info.type = MTD_MLCNANDFLASH; |
b8116a87 DE |
1896 | return ioctl(0, MEMGETINFO, &info); |
1897 | } | |
1898 | EOF | |
1899 | if compile_prog "" "" "mtd"; then | |
1900 | mtd="yes" | |
1901 | fi | |
484b0b65 | 1902 | print_config "MTD" "$mtd" |
b8116a87 | 1903 | |
3ee2a3c1 DJ |
1904 | ########################################## |
1905 | # Check whether we have libpmem | |
ca205a75 TK |
1906 | if test "$libpmem" != "yes" ; then |
1907 | libpmem="no" | |
1908 | fi | |
3ee2a3c1 DJ |
1909 | cat > $TMPC << EOF |
1910 | #include <libpmem.h> | |
1911 | int main(int argc, char **argv) | |
1912 | { | |
1913 | int rc; | |
1914 | rc = pmem_is_pmem(0, 0); | |
1915 | return 0; | |
1916 | } | |
1917 | EOF | |
1918 | if compile_prog "" "-lpmem" "libpmem"; then | |
1919 | libpmem="yes" | |
cf8775b8 | 1920 | LIBS="-lpmem $LIBS" |
3ee2a3c1 | 1921 | fi |
484b0b65 | 1922 | print_config "libpmem" "$libpmem" |
3ee2a3c1 DJ |
1923 | |
1924 | ########################################## | |
1925 | # Check whether we have libpmemblk | |
cf8775b8 | 1926 | # libpmem is a prerequisite |
ca205a75 TK |
1927 | if test "$libpmemblk" != "yes" ; then |
1928 | libpmemblk="no" | |
1929 | fi | |
cf8775b8 RE |
1930 | if test "$libpmem" = "yes"; then |
1931 | cat > $TMPC << EOF | |
3ee2a3c1 DJ |
1932 | #include <libpmemblk.h> |
1933 | int main(int argc, char **argv) | |
1934 | { | |
cf8775b8 RE |
1935 | PMEMblkpool *pbp; |
1936 | pbp = pmemblk_open("", 0); | |
3ee2a3c1 DJ |
1937 | return 0; |
1938 | } | |
1939 | EOF | |
cf8775b8 RE |
1940 | if compile_prog "" "-lpmemblk" "libpmemblk"; then |
1941 | libpmemblk="yes" | |
1942 | LIBS="-lpmemblk $LIBS" | |
1943 | fi | |
3ee2a3c1 | 1944 | fi |
484b0b65 | 1945 | print_config "libpmemblk" "$libpmemblk" |
3ee2a3c1 | 1946 | |
cf8775b8 | 1947 | # Choose the ioengines |
3ee2a3c1 | 1948 | if test "$libpmem" = "yes" && test "$disable_pmem" = "no"; then |
ae0db592 | 1949 | pmem="yes" |
3ee2a3c1 DJ |
1950 | devdax="yes" |
1951 | if test "$libpmemblk" = "yes"; then | |
1952 | pmemblk="yes" | |
1953 | fi | |
1954 | fi | |
1955 | ||
43f3cec2 BB |
1956 | ########################################## |
1957 | # Report whether pmemblk engine is enabled | |
363a5f65 | 1958 | print_config "PMDK pmemblk engine" "$pmemblk" |
43f3cec2 | 1959 | |
cbb15e42 DJ |
1960 | ########################################## |
1961 | # Report whether dev-dax engine is enabled | |
363a5f65 | 1962 | print_config "PMDK dev-dax engine" "$devdax" |
cbb15e42 | 1963 | |
ae0db592 TI |
1964 | ########################################## |
1965 | # Report whether libpmem engine is enabled | |
363a5f65 | 1966 | print_config "PMDK libpmem engine" "$pmem" |
ae0db592 | 1967 | |
a40e7a59 GB |
1968 | ########################################## |
1969 | # Check whether we support DDN's IME | |
1970 | if test "$libime" != "yes" ; then | |
1971 | libime="no" | |
1972 | fi | |
1973 | cat > $TMPC << EOF | |
1974 | #include <ime_native.h> | |
1975 | int main(int argc, char **argv) | |
1976 | { | |
1977 | int rc; | |
1978 | ime_native_init(); | |
1979 | rc = ime_native_finalize(); | |
1980 | return 0; | |
1981 | } | |
1982 | EOF | |
1983 | if compile_prog "-I${ime_path}/include" "-L${ime_path}/lib -lim_client" "libime"; then | |
1984 | libime="yes" | |
1985 | CFLAGS="-I${ime_path}/include $CFLAGS" | |
1986 | LDFLAGS="-Wl,-rpath ${ime_path}/lib -L${ime_path}/lib $LDFLAGS" | |
1987 | LIBS="-lim_client $LIBS" | |
1988 | fi | |
1989 | print_config "DDN's Infinite Memory Engine" "$libime" | |
1990 | ||
bda92394 | 1991 | ########################################## |
b470a02c SC |
1992 | # Check if we have lex/yacc available |
1993 | yacc="no" | |
e7b2c7a3 | 1994 | yacc_is_bison="no" |
b470a02c SC |
1995 | lex="no" |
1996 | arith="no" | |
de26b824 | 1997 | if test "$disable_lex" = "no" || test -z "$disable_lex" ; then |
cf6dd80e | 1998 | if test "$targetos" != "SunOS" ; then |
e7b2c7a3 | 1999 | LEX=$(which lex 2> /dev/null) |
b470a02c SC |
2000 | if test -x "$LEX" ; then |
2001 | lex="yes" | |
2002 | fi | |
7e0049e9 | 2003 | YACC=$(which bison 2> /dev/null) |
b470a02c SC |
2004 | if test -x "$YACC" ; then |
2005 | yacc="yes" | |
7e0049e9 | 2006 | yacc_is_bison="yes" |
e7b2c7a3 | 2007 | else |
7e0049e9 | 2008 | YACC=$(which yacc 2> /dev/null) |
e7b2c7a3 JA |
2009 | if test -x "$YACC" ; then |
2010 | yacc="yes" | |
e7b2c7a3 | 2011 | fi |
b470a02c SC |
2012 | fi |
2013 | if test "$yacc" = "yes" && test "$lex" = "yes" ; then | |
2014 | arith="yes" | |
2015 | fi | |
2016 | ||
2017 | if test "$arith" = "yes" ; then | |
2018 | cat > $TMPC << EOF | |
2019 | extern int yywrap(void); | |
2020 | ||
2021 | int main(int argc, char **argv) | |
2022 | { | |
2023 | yywrap(); | |
2024 | return 0; | |
2025 | } | |
2026 | EOF | |
719cda03 JA |
2027 | if compile_prog "" "-ll" "lex"; then |
2028 | LIBS="-ll $LIBS" | |
b470a02c SC |
2029 | else |
2030 | arith="no" | |
2031 | fi | |
2032 | fi | |
cf6dd80e | 2033 | fi |
a655bbc4 | 2034 | fi |
b470a02c | 2035 | |
63bda378 JA |
2036 | # Check if lex fails using -o |
2037 | if test "$arith" = "yes" ; then | |
daf705b5 JA |
2038 | if test "$force_no_lex_o" = "yes" ; then |
2039 | lex_use_o="no" | |
2040 | else | |
63bda378 JA |
2041 | $LEX -o lex.yy.c exp/expression-parser.l 2> /dev/null |
2042 | if test "$?" = "0" ; then | |
2043 | lex_use_o="yes" | |
2044 | else | |
2045 | lex_use_o="no" | |
2046 | fi | |
2047 | fi | |
daf705b5 | 2048 | fi |
63bda378 | 2049 | |
484b0b65 | 2050 | print_config "lex/yacc for arithmetic" "$arith" |
b470a02c | 2051 | |
aae599ba JA |
2052 | ########################################## |
2053 | # Check whether we have setmntent/getmntent | |
ca205a75 TK |
2054 | if test "$getmntent" != "yes" ; then |
2055 | getmntent="no" | |
2056 | fi | |
aae599ba JA |
2057 | cat > $TMPC << EOF |
2058 | #include <stdio.h> | |
2059 | #include <mntent.h> | |
2060 | int main(int argc, char **argv) | |
2061 | { | |
2062 | FILE *mtab = setmntent(NULL, "r"); | |
2063 | struct mntent *mnt = getmntent(mtab); | |
1581b82a | 2064 | endmntent(mtab); |
aae599ba JA |
2065 | return 0; |
2066 | } | |
2067 | EOF | |
2068 | if compile_prog "" "" "getmntent"; then | |
2069 | getmntent="yes" | |
2070 | fi | |
484b0b65 | 2071 | print_config "getmntent" "$getmntent" |
aae599ba | 2072 | |
e7e136da TK |
2073 | ########################################## |
2074 | # Check whether we have getmntinfo | |
b765bec0 TK |
2075 | # These are originally added for BSDs, but may also work |
2076 | # on other operating systems with getmntinfo(3). | |
2077 | ||
2078 | # getmntinfo(3) for FreeBSD/DragonFlyBSD/OpenBSD. | |
2079 | # Note that NetBSD needs -Werror to catch warning as error. | |
ca205a75 TK |
2080 | if test "$getmntinfo" != "yes" ; then |
2081 | getmntinfo="no" | |
2082 | fi | |
e7e136da TK |
2083 | cat > $TMPC << EOF |
2084 | #include <stdio.h> | |
2085 | #include <sys/param.h> | |
2086 | #include <sys/mount.h> | |
2087 | int main(int argc, char **argv) | |
2088 | { | |
9ada751d | 2089 | struct statfs *st; |
e7e136da TK |
2090 | return getmntinfo(&st, MNT_NOWAIT); |
2091 | } | |
2092 | EOF | |
b765bec0 | 2093 | if compile_prog "-Werror" "" "getmntinfo"; then |
e7e136da TK |
2094 | getmntinfo="yes" |
2095 | fi | |
484b0b65 | 2096 | print_config "getmntinfo" "$getmntinfo" |
e7e136da | 2097 | |
b765bec0 | 2098 | # getmntinfo(3) for NetBSD. |
ca205a75 TK |
2099 | if test "$getmntinfo_statvfs" != "yes" ; then |
2100 | getmntinfo_statvfs="no" | |
2101 | fi | |
b765bec0 TK |
2102 | cat > $TMPC << EOF |
2103 | #include <stdio.h> | |
2104 | #include <sys/statvfs.h> | |
2105 | int main(int argc, char **argv) | |
2106 | { | |
2107 | struct statvfs *st; | |
2108 | return getmntinfo(&st, MNT_NOWAIT); | |
2109 | } | |
2110 | EOF | |
2111 | # Skip the test if the one with statfs arg is detected. | |
2112 | if test "$getmntinfo" != "yes" && compile_prog "-Werror" "" "getmntinfo_statvfs"; then | |
2113 | getmntinfo_statvfs="yes" | |
484b0b65 | 2114 | print_config "getmntinfo_statvfs" "$getmntinfo_statvfs" |
b765bec0 TK |
2115 | fi |
2116 | ||
5018f79f AH |
2117 | ########################################## |
2118 | # Check whether we have _Static_assert | |
ca205a75 TK |
2119 | if test "$static_assert" != "yes" ; then |
2120 | static_assert="no" | |
2121 | fi | |
5018f79f AH |
2122 | cat > $TMPC << EOF |
2123 | #include <assert.h> | |
94815a5c | 2124 | #include <stdlib.h> |
51b4c81e | 2125 | #include <stddef.h> |
94815a5c JA |
2126 | |
2127 | struct foo { | |
2128 | int a, b; | |
2129 | }; | |
2130 | ||
5018f79f AH |
2131 | int main(int argc, char **argv) |
2132 | { | |
94815a5c | 2133 | _Static_assert(offsetof(struct foo, a) == 0 , "Check"); |
5018f79f AH |
2134 | return 0 ; |
2135 | } | |
2136 | EOF | |
2137 | if compile_prog "" "" "static_assert"; then | |
2138 | static_assert="yes" | |
2139 | fi | |
484b0b65 | 2140 | print_config "Static Assert" "$static_assert" |
e39c0676 JA |
2141 | |
2142 | ########################################## | |
2143 | # Check whether we have bool / stdbool.h | |
ca205a75 TK |
2144 | if test "$have_bool" != "yes" ; then |
2145 | have_bool="no" | |
2146 | fi | |
e39c0676 JA |
2147 | cat > $TMPC << EOF |
2148 | #include <stdbool.h> | |
2149 | int main(int argc, char **argv) | |
2150 | { | |
2151 | bool var = true; | |
2152 | return var != false; | |
2153 | } | |
2154 | EOF | |
2155 | if compile_prog "" "" "bool"; then | |
2156 | have_bool="yes" | |
2157 | fi | |
484b0b65 | 2158 | print_config "bool" "$have_bool" |
e39c0676 | 2159 | |
b29c71c4 JA |
2160 | ########################################## |
2161 | # Check whether we have strndup() | |
107ad008 | 2162 | strndup="no" |
b29c71c4 JA |
2163 | cat > $TMPC << EOF |
2164 | #include <string.h> | |
2165 | #include <stdlib.h> | |
2166 | int main(int argc, char **argv) | |
2167 | { | |
2168 | char *res = strndup("test string", 8); | |
2169 | ||
2170 | free(res); | |
2171 | return 0; | |
2172 | } | |
2173 | EOF | |
2174 | if compile_prog "" "" "strndup"; then | |
2175 | strndup="yes" | |
2176 | fi | |
2177 | print_config "strndup" "$strndup" | |
2178 | ||
214e2d56 | 2179 | ########################################## |
0ffccc21 BVA |
2180 | # <valgrind/drd.h> probe |
2181 | # Note: presence of <valgrind/drd.h> implies that <valgrind/valgrind.h> is | |
2182 | # also available but not the other way around. | |
2183 | if test "$valgrind_dev" != "yes" ; then | |
2184 | valgrind_dev="no" | |
2185 | fi | |
2186 | cat > $TMPC << EOF | |
2187 | #include <valgrind/drd.h> | |
2188 | int main(int argc, char **argv) | |
2189 | { | |
2190 | return 0; | |
2191 | } | |
2192 | EOF | |
2193 | if compile_prog "" "" "valgrind_dev"; then | |
2194 | valgrind_dev="yes" | |
2195 | fi | |
2196 | print_config "Valgrind headers" "$valgrind_dev" | |
2197 | ||
214e2d56 | 2198 | # check march=armv8-a+crc+crypto |
ca205a75 TK |
2199 | if test "$march_armv8_a_crc_crypto" != "yes" ; then |
2200 | march_armv8_a_crc_crypto="no" | |
2201 | fi | |
214e2d56 | 2202 | if test "$cpu" = "arm64" ; then |
2203 | cat > $TMPC <<EOF | |
9b153dc2 TT |
2204 | #include <arm_acle.h> |
2205 | #include <arm_neon.h> | |
58828d07 | 2206 | #include <sys/auxv.h> |
9b153dc2 | 2207 | |
214e2d56 | 2208 | int main(void) |
2209 | { | |
58828d07 SW |
2210 | /* Can we also do a runtime probe? */ |
2211 | #if __linux__ | |
2212 | return getauxval(AT_HWCAP); | |
2213 | #else | |
2214 | # error "Don't know how to do runtime probe for ARM CRC32c" | |
2215 | #endif | |
214e2d56 | 2216 | } |
2217 | EOF | |
58828d07 | 2218 | if compile_prog "-march=armv8-a+crc+crypto" "" "ARM CRC32c"; then |
214e2d56 | 2219 | march_armv8_a_crc_crypto="yes" |
58828d07 | 2220 | CFLAGS="$CFLAGS -march=armv8-a+crc+crypto" |
9f75af77 | 2221 | march_set="yes" |
214e2d56 | 2222 | fi |
2223 | fi | |
484b0b65 | 2224 | print_config "march_armv8_a_crc_crypto" "$march_armv8_a_crc_crypto" |
214e2d56 | 2225 | |
03553853 YR |
2226 | ########################################## |
2227 | # cuda probe | |
d418fa90 TK |
2228 | if test "$cuda" != "yes" ; then |
2229 | cuda="no" | |
2230 | fi | |
03553853 YR |
2231 | cat > $TMPC << EOF |
2232 | #include <cuda.h> | |
2233 | int main(int argc, char **argv) | |
2234 | { | |
2235 | return cuInit(0); | |
2236 | } | |
2237 | EOF | |
4bd2c8b9 | 2238 | if test "$enable_cuda" = "yes" && compile_prog "" "-lcuda" "cuda"; then |
03553853 YR |
2239 | cuda="yes" |
2240 | LIBS="-lcuda $LIBS" | |
2241 | fi | |
484b0b65 | 2242 | print_config "cuda" "$cuda" |
214e2d56 | 2243 | |
4252396e JA |
2244 | ########################################## |
2245 | # mkdir() probe. mingw apparently has a one-argument mkdir :/ | |
2246 | mkdir_two="no" | |
2247 | cat > $TMPC << EOF | |
2248 | #include <sys/stat.h> | |
2249 | #include <sys/types.h> | |
2250 | int main(int argc, char **argv) | |
2251 | { | |
2252 | return mkdir("/tmp/bla", 0600); | |
2253 | } | |
2254 | EOF | |
2255 | if compile_prog "" "" "mkdir(a, b)"; then | |
2256 | mkdir_two="yes" | |
2257 | fi | |
2258 | print_config "mkdir(a, b)" "$mkdir_two" | |
2259 | ||
a817dc3b JA |
2260 | ########################################## |
2261 | # check for cc -march=native | |
2262 | build_native="no" | |
2263 | cat > $TMPC << EOF | |
2264 | int main(int argc, char **argv) | |
2265 | { | |
2266 | return 0; | |
2267 | } | |
2268 | EOF | |
c922e0b0 SW |
2269 | if test "$disable_native" = "no" && test "$disable_opt" != "yes" && \ |
2270 | compile_prog "-march=native" "" "march=native"; then | |
a817dc3b JA |
2271 | build_native="yes" |
2272 | fi | |
2273 | print_config "Build march=native" "$build_native" | |
2274 | ||
67bf9823 JA |
2275 | ############################################################################# |
2276 | ||
67bf9823 | 2277 | if test "$wordsize" = "64" ; then |
4feafb1e | 2278 | output_sym "CONFIG_64BIT" |
67bf9823 | 2279 | elif test "$wordsize" = "32" ; then |
4feafb1e | 2280 | output_sym "CONFIG_32BIT" |
67bf9823 | 2281 | else |
d7145a78 | 2282 | fatal "Unknown wordsize!" |
67bf9823 | 2283 | fi |
0dcebdf4 | 2284 | if test "$bigendian" = "yes" ; then |
4feafb1e | 2285 | output_sym "CONFIG_BIG_ENDIAN" |
0dcebdf4 | 2286 | else |
4feafb1e | 2287 | output_sym "CONFIG_LITTLE_ENDIAN" |
0dcebdf4 | 2288 | fi |
3989b143 JA |
2289 | if test "$zlib" = "yes" ; then |
2290 | output_sym "CONFIG_ZLIB" | |
2291 | fi | |
67bf9823 | 2292 | if test "$libaio" = "yes" ; then |
4feafb1e | 2293 | output_sym "CONFIG_LIBAIO" |
67bf9823 JA |
2294 | fi |
2295 | if test "$posix_aio" = "yes" ; then | |
4feafb1e | 2296 | output_sym "CONFIG_POSIXAIO" |
67bf9823 JA |
2297 | fi |
2298 | if test "$posix_aio_fsync" = "yes" ; then | |
4feafb1e | 2299 | output_sym "CONFIG_POSIXAIO_FSYNC" |
67bf9823 | 2300 | fi |
06eac6b2 SW |
2301 | if test "$posix_pshared" = "yes" ; then |
2302 | output_sym "CONFIG_PSHARED" | |
2303 | fi | |
44e8e956 | 2304 | if test "$have_asprintf" = "yes" ; then |
cb3b6806 | 2305 | output_sym "CONFIG_HAVE_ASPRINTF" |
44e8e956 BVA |
2306 | fi |
2307 | if test "$have_vasprintf" = "yes" ; then | |
cb3b6806 | 2308 | output_sym "CONFIG_HAVE_VASPRINTF" |
44e8e956 | 2309 | fi |
67bf9823 | 2310 | if test "$linux_fallocate" = "yes" ; then |
4feafb1e | 2311 | output_sym "CONFIG_LINUX_FALLOCATE" |
67bf9823 JA |
2312 | fi |
2313 | if test "$posix_fallocate" = "yes" ; then | |
4feafb1e | 2314 | output_sym "CONFIG_POSIX_FALLOCATE" |
67bf9823 JA |
2315 | fi |
2316 | if test "$fdatasync" = "yes" ; then | |
4feafb1e | 2317 | output_sym "CONFIG_FDATASYNC" |
67bf9823 JA |
2318 | fi |
2319 | if test "$sync_file_range" = "yes" ; then | |
4feafb1e | 2320 | output_sym "CONFIG_SYNC_FILE_RANGE" |
67bf9823 JA |
2321 | fi |
2322 | if test "$sfaa" = "yes" ; then | |
4feafb1e | 2323 | output_sym "CONFIG_SFAA" |
67bf9823 | 2324 | fi |
a250edd0 JA |
2325 | if test "$sync_sync" = "yes" ; then |
2326 | output_sym "CONFIG_SYNC_SYNC" | |
2327 | fi | |
2328 | if test "$cmp_swap" = "yes" ; then | |
2329 | output_sym "CONFIG_CMP_SWAP" | |
2330 | fi | |
954cd73a | 2331 | if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then |
4feafb1e | 2332 | output_sym "CONFIG_RDMA" |
67bf9823 JA |
2333 | fi |
2334 | if test "$clock_gettime" = "yes" ; then | |
4feafb1e | 2335 | output_sym "CONFIG_CLOCK_GETTIME" |
67bf9823 JA |
2336 | fi |
2337 | if test "$clock_monotonic" = "yes" ; then | |
4feafb1e | 2338 | output_sym "CONFIG_CLOCK_MONOTONIC" |
67bf9823 | 2339 | fi |
c544f604 SN |
2340 | if test "$clock_monotonic_raw" = "yes" ; then |
2341 | output_sym "CONFIG_CLOCK_MONOTONIC_RAW" | |
2342 | fi | |
67bf9823 | 2343 | if test "$clock_monotonic_precise" = "yes" ; then |
4feafb1e | 2344 | output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE" |
67bf9823 | 2345 | fi |
25f8227d JA |
2346 | if test "$clockid_t" = "yes"; then |
2347 | output_sym "CONFIG_CLOCKID_T" | |
2348 | fi | |
67bf9823 | 2349 | if test "$gettimeofday" = "yes" ; then |
4feafb1e | 2350 | output_sym "CONFIG_GETTIMEOFDAY" |
67bf9823 JA |
2351 | fi |
2352 | if test "$posix_fadvise" = "yes" ; then | |
4feafb1e | 2353 | output_sym "CONFIG_POSIX_FADVISE" |
67bf9823 JA |
2354 | fi |
2355 | if test "$linux_3arg_affinity" = "yes" ; then | |
4feafb1e | 2356 | output_sym "CONFIG_3ARG_AFFINITY" |
67bf9823 | 2357 | elif test "$linux_2arg_affinity" = "yes" ; then |
4feafb1e | 2358 | output_sym "CONFIG_2ARG_AFFINITY" |
67bf9823 JA |
2359 | fi |
2360 | if test "$strsep" = "yes" ; then | |
4feafb1e | 2361 | output_sym "CONFIG_STRSEP" |
67bf9823 | 2362 | fi |
9ad8da82 JA |
2363 | if test "$strcasestr" = "yes" ; then |
2364 | output_sym "CONFIG_STRCASESTR" | |
2365 | fi | |
5ad7be56 KD |
2366 | if test "$strlcat" = "yes" ; then |
2367 | output_sym "CONFIG_STRLCAT" | |
2368 | fi | |
67bf9823 | 2369 | if test "$getopt_long_only" = "yes" ; then |
4feafb1e | 2370 | output_sym "CONFIG_GETOPT_LONG_ONLY" |
67bf9823 JA |
2371 | fi |
2372 | if test "$inet_aton" = "yes" ; then | |
4feafb1e | 2373 | output_sym "CONFIG_INET_ATON" |
67bf9823 JA |
2374 | fi |
2375 | if test "$socklen_t" = "yes" ; then | |
4feafb1e | 2376 | output_sym "CONFIG_SOCKLEN_T" |
67bf9823 JA |
2377 | fi |
2378 | if test "$ext4_me" = "yes" ; then | |
4feafb1e | 2379 | output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT" |
67bf9823 JA |
2380 | fi |
2381 | if test "$linux_splice" = "yes" ; then | |
4feafb1e | 2382 | output_sym "CONFIG_LINUX_SPLICE" |
67bf9823 JA |
2383 | fi |
2384 | if test "$guasi" = "yes" ; then | |
4feafb1e | 2385 | output_sym "CONFIG_GUASI" |
67bf9823 JA |
2386 | fi |
2387 | if test "$fusion_aw" = "yes" ; then | |
4feafb1e | 2388 | output_sym "CONFIG_FUSION_AW" |
67bf9823 | 2389 | fi |
50206d9b | 2390 | if test "$libnuma_v2" = "yes" ; then |
4feafb1e | 2391 | output_sym "CONFIG_LIBNUMA" |
67bf9823 JA |
2392 | fi |
2393 | if test "$solaris_aio" = "yes" ; then | |
4feafb1e | 2394 | output_sym "CONFIG_SOLARISAIO" |
67bf9823 JA |
2395 | fi |
2396 | if test "$tls_thread" = "yes" ; then | |
4feafb1e | 2397 | output_sym "CONFIG_TLS_THREAD" |
67bf9823 | 2398 | fi |
44404c5a | 2399 | if test "$rusage_thread" = "yes" ; then |
4feafb1e | 2400 | output_sym "CONFIG_RUSAGE_THREAD" |
67bf9823 | 2401 | fi |
91f94d5b | 2402 | if test "$gfio" = "yes" ; then |
bad7e42c | 2403 | output_sym "CONFIG_GFIO" |
91f94d5b | 2404 | fi |
c8931876 JA |
2405 | if test "$esx" = "yes" ; then |
2406 | output_sym "CONFIG_ESX" | |
2407 | output_sym "CONFIG_NO_SHM" | |
2408 | fi | |
7e09a9f1 JA |
2409 | if test "$sched_idle" = "yes" ; then |
2410 | output_sym "CONFIG_SCHED_IDLE" | |
2411 | fi | |
1eafa37a JA |
2412 | if test "$tcp_nodelay" = "yes" ; then |
2413 | output_sym "CONFIG_TCP_NODELAY" | |
2414 | fi | |
1008602c JA |
2415 | if test "$window_size" = "yes" ; then |
2416 | output_sym "CONFIG_NET_WINDOWSIZE" | |
2417 | fi | |
e5f34d95 JA |
2418 | if test "$mss" = "yes" ; then |
2419 | output_sym "CONFIG_NET_MSS" | |
2420 | fi | |
38b9354a JA |
2421 | if test "$rlimit_memlock" = "yes" ; then |
2422 | output_sym "CONFIG_RLIMIT_MEMLOCK" | |
2423 | fi | |
07fc0acd JA |
2424 | if test "$pwritev" = "yes" ; then |
2425 | output_sym "CONFIG_PWRITEV" | |
2426 | fi | |
2cafffbe JA |
2427 | if test "$pwritev2" = "yes" ; then |
2428 | output_sym "CONFIG_PWRITEV2" | |
2429 | fi | |
ecad55e9 JA |
2430 | if test "$ipv6" = "yes" ; then |
2431 | output_sym "CONFIG_IPV6" | |
2432 | fi | |
c2f6a13d LMB |
2433 | if test "$http" = "yes" ; then |
2434 | output_sym "CONFIG_HTTP" | |
2435 | fi | |
d5f9b0ea IF |
2436 | if test "$rados" = "yes" ; then |
2437 | output_sym "CONFIG_RADOS" | |
2438 | fi | |
fc5c0345 DG |
2439 | if test "$rbd" = "yes" ; then |
2440 | output_sym "CONFIG_RBD" | |
2441 | fi | |
53b6c979 PL |
2442 | if test "$rbd_poll" = "yes" ; then |
2443 | output_sym "CONFIG_RBD_POLL" | |
2444 | fi | |
903b2812 JA |
2445 | if test "$rbd_inval" = "yes" ; then |
2446 | output_sym "CONFIG_RBD_INVAL" | |
2447 | fi | |
2e802282 JA |
2448 | if test "$setvbuf" = "yes" ; then |
2449 | output_sym "CONFIG_SETVBUF" | |
2450 | fi | |
81795ce3 CE |
2451 | if test "$s390_z196_facilities" = "yes" ; then |
2452 | output_sym "CONFIG_S390_Z196_FACILITIES" | |
2453 | CFLAGS="$CFLAGS -march=z9-109" | |
9f75af77 | 2454 | march_set="yes" |
81795ce3 | 2455 | fi |
6e7d7dfb | 2456 | if test "$gfapi" = "yes" ; then |
2457 | output_sym "CONFIG_GFAPI" | |
2458 | fi | |
6fa14b99 | 2459 | if test "$gf_fadvise" = "yes" ; then |
2460 | output_sym "CONFIG_GF_FADVISE" | |
2461 | fi | |
6876c98c JA |
2462 | if test "$gf_trim" = "yes" ; then |
2463 | output_sym "CONFIG_GF_TRIM" | |
2464 | fi | |
1b10477b MM |
2465 | if test "$libhdfs" = "yes" ; then |
2466 | output_sym "CONFIG_LIBHDFS" | |
247e5436 | 2467 | echo "FIO_HDFS_CPU=$FIO_HDFS_CPU" >> $config_host_mak |
1527dc50 FB |
2468 | echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak |
2469 | echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak | |
2470 | echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak | |
2471 | fi | |
b8116a87 DE |
2472 | if test "$mtd" = "yes" ; then |
2473 | output_sym "CONFIG_MTD" | |
2474 | fi | |
43f3cec2 BB |
2475 | if test "$pmemblk" = "yes" ; then |
2476 | output_sym "CONFIG_PMEMBLK" | |
2477 | fi | |
cbb15e42 DJ |
2478 | if test "$devdax" = "yes" ; then |
2479 | output_sym "CONFIG_LINUX_DEVDAX" | |
2480 | fi | |
ae0db592 TI |
2481 | if test "$pmem" = "yes" ; then |
2482 | output_sym "CONFIG_LIBPMEM" | |
2483 | fi | |
a40e7a59 GB |
2484 | if test "$libime" = "yes" ; then |
2485 | output_sym "CONFIG_IME" | |
2486 | fi | |
b470a02c SC |
2487 | if test "$arith" = "yes" ; then |
2488 | output_sym "CONFIG_ARITHMETIC" | |
e7b2c7a3 JA |
2489 | if test "$yacc_is_bison" = "yes" ; then |
2490 | echo "YACC=$YACC -y" >> $config_host_mak | |
2491 | else | |
2492 | echo "YACC=$YACC" >> $config_host_mak | |
2493 | fi | |
63bda378 JA |
2494 | if test "$lex_use_o" = "yes" ; then |
2495 | echo "CONFIG_LEX_USE_O=y" >> $config_host_mak | |
2496 | fi | |
b470a02c | 2497 | fi |
aae599ba JA |
2498 | if test "$getmntent" = "yes" ; then |
2499 | output_sym "CONFIG_GETMNTENT" | |
2500 | fi | |
e7e136da TK |
2501 | if test "$getmntinfo" = "yes" ; then |
2502 | output_sym "CONFIG_GETMNTINFO" | |
2503 | fi | |
b765bec0 TK |
2504 | if test "$getmntinfo_statvfs" = "yes" ; then |
2505 | output_sym "CONFIG_GETMNTINFO_STATVFS" | |
2506 | fi | |
5018f79f AH |
2507 | if test "$static_assert" = "yes" ; then |
2508 | output_sym "CONFIG_STATIC_ASSERT" | |
2509 | fi | |
e39c0676 JA |
2510 | if test "$have_bool" = "yes" ; then |
2511 | output_sym "CONFIG_HAVE_BOOL" | |
2512 | fi | |
b29c71c4 JA |
2513 | if test "$strndup" = "yes" ; then |
2514 | output_sym "CONFIG_HAVE_STRNDUP" | |
2515 | fi | |
484817a9 JA |
2516 | if test "$disable_opt" = "yes" ; then |
2517 | output_sym "CONFIG_DISABLE_OPTIMIZATIONS" | |
2518 | fi | |
0ffccc21 BVA |
2519 | if test "$valgrind_dev" = "yes"; then |
2520 | output_sym "CONFIG_VALGRIND_DEV" | |
2521 | fi | |
605cf82e | 2522 | if test "$zlib" = "no" ; then |
8f909424 JA |
2523 | echo "Consider installing zlib-dev (zlib-devel, some fio features depend on it." |
2524 | if test "$build_static" = "yes"; then | |
2525 | echo "Note that some distros have separate packages for static libraries." | |
2526 | fi | |
605cf82e | 2527 | fi |
58828d07 SW |
2528 | if test "$march_armv8_a_crc_crypto" = "yes" ; then |
2529 | output_sym "ARCH_HAVE_CRC_CRYPTO" | |
2530 | fi | |
03553853 YR |
2531 | if test "$cuda" = "yes" ; then |
2532 | output_sym "CONFIG_CUDA" | |
2533 | fi | |
4252396e JA |
2534 | if test "$mkdir_two" = "yes" ; then |
2535 | output_sym "CONFIG_HAVE_MKDIR_TWO" | |
2536 | fi | |
9f75af77 | 2537 | if test "$march_set" = "no" && test "$build_native" = "yes" ; then |
a817dc3b JA |
2538 | output_sym "CONFIG_BUILD_NATIVE" |
2539 | fi | |
605cf82e | 2540 | |
67bf9823 | 2541 | echo "LIBS+=$LIBS" >> $config_host_mak |
86719845 | 2542 | echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak |
91f94d5b | 2543 | echo "CFLAGS+=$CFLAGS" >> $config_host_mak |
d2aeedb9 | 2544 | echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak |
67bf9823 | 2545 | echo "CC=$cc" >> $config_host_mak |
af4862b3 | 2546 | echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak |
020d54bd | 2547 | echo "INSTALL_PREFIX=$prefix" >> $config_host_mak |
c61a3a44 | 2548 | |
59d8f412 | 2549 | if [ `dirname $0` != "." -a ! -e Makefile ]; then |
c61a3a44 JF |
2550 | cat > Makefile <<EOF |
2551 | SRCDIR:=`dirname $0` | |
2552 | include \$(SRCDIR)/Makefile | |
2553 | EOF | |
2554 | fi |