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 |
4c0b3d98 | 47 | CFLAGS="-D_GNU_SOURCE -include config-host.h $CFLAGS" |
b6a1e63a | 48 | CONFIGURE_CFLAGS="-Werror-implicit-function-declaration" |
af4862b3 | 49 | BUILD_CFLAGS="" |
67bf9823 JA |
50 | |
51 | # Print a helpful header at the top of config.log | |
52 | echo "# FIO configure log $(date)" >> config.log | |
53 | printf "# Configured with:" >> config.log | |
54 | printf " '%s'" "$0" "$@" >> config.log | |
55 | echo >> config.log | |
56 | echo "#" >> config.log | |
57 | ||
7560fe7c JA |
58 | # Print configure header at the top of $config_host_h |
59 | echo "/*" > $config_host_h | |
60 | echo " * Automatically generated by configure - do not modify" >> $config_host_h | |
61 | printf " * Configured with:" >> $config_host_h | |
62 | printf " * '%s'" "$0" "$@" >> $config_host_h | |
63 | echo "" >> $config_host_h | |
64 | echo " */" >> $config_host_h | |
65 | ||
67bf9823 JA |
66 | do_cc() { |
67 | # Run the compiler, capturing its output to the log. | |
68 | echo $cc "$@" >> config.log | |
69 | $cc "$@" >> config.log 2>&1 || return $? | |
70 | # Test passed. If this is an --enable-werror build, rerun | |
71 | # the test with -Werror and bail out if it fails. This | |
72 | # makes warning-generating-errors in configure test code | |
73 | # obvious to developers. | |
74 | if test "$werror" != "yes"; then | |
75 | return 0 | |
76 | fi | |
77 | # Don't bother rerunning the compile if we were already using -Werror | |
78 | case "$*" in | |
79 | *-Werror*) | |
80 | return 0 | |
81 | ;; | |
82 | esac | |
83 | echo $cc -Werror "$@" >> config.log | |
84 | $cc -Werror "$@" >> config.log 2>&1 && return $? | |
85 | echo "ERROR: configure test passed without -Werror but failed with -Werror." | |
86 | echo "This is probably a bug in the configure script. The failing command" | |
87 | echo "will be at the bottom of config.log." | |
d7145a78 | 88 | fatal "You can run configure with --disable-werror to bypass this check." |
67bf9823 JA |
89 | } |
90 | ||
91 | compile_object() { | |
b6a1e63a | 92 | do_cc $CFLAGS $CONFIGURE_CFLAGS -c -o $TMPO $TMPC |
67bf9823 JA |
93 | } |
94 | ||
95 | compile_prog() { | |
96 | local_cflags="$1" | |
adaa46d8 | 97 | local_ldflags="$2 $LIBS" |
67bf9823 | 98 | echo "Compiling test case $3" >> config.log |
b6a1e63a | 99 | do_cc $CFLAGS $CONFIGURE_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags |
67bf9823 JA |
100 | } |
101 | ||
102 | feature_not_found() { | |
103 | feature=$1 | |
c55d728b | 104 | packages=$2 |
67bf9823 JA |
105 | |
106 | echo "ERROR" | |
107 | echo "ERROR: User requested feature $feature" | |
c55d728b JA |
108 | if test ! -z "$packages" ; then |
109 | echo "ERROR: That feature needs $packages installed" | |
110 | fi | |
67bf9823 | 111 | echo "ERROR: configure was not able to find it" |
d7145a78 | 112 | fatal "ERROR" |
67bf9823 JA |
113 | } |
114 | ||
115 | has() { | |
116 | type "$1" >/dev/null 2>&1 | |
117 | } | |
118 | ||
7ff204c8 | 119 | num() { |
d1468702 | 120 | echo "$1" | grep -E -q "^[0-9]+$" |
7ff204c8 SM |
121 | } |
122 | ||
67bf9823 JA |
123 | check_define() { |
124 | cat > $TMPC <<EOF | |
125 | #if !defined($1) | |
126 | #error $1 not defined | |
127 | #endif | |
128 | int main(void) | |
129 | { | |
130 | return 0; | |
131 | } | |
132 | EOF | |
133 | compile_object | |
134 | } | |
135 | ||
21540653 MB |
136 | check_val() { |
137 | cat > $TMPC <<EOF | |
138 | #if $1 == $2 | |
139 | int main(void) | |
140 | { | |
141 | return 0; | |
142 | } | |
143 | #else | |
144 | #error $1 is not equal $2 | |
145 | #endif | |
146 | EOF | |
147 | compile_object | |
148 | } | |
149 | ||
4feafb1e JA |
150 | output_sym() { |
151 | echo "$1=y" >> $config_host_mak | |
152 | echo "#define $1" >> $config_host_h | |
153 | } | |
154 | ||
162f8c2a | 155 | check_min_lib_version() { |
3e48f7c9 | 156 | _feature=$3 |
162f8c2a | 157 | |
1ee0469f | 158 | if pkg-config --atleast-version="$2" "$1" > /dev/null 2>&1; then |
162f8c2a DF |
159 | return 0 |
160 | fi | |
3e48f7c9 | 161 | : "${_feature:=${1}}" |
1ee0469f | 162 | if pkg-config --version > /dev/null 2>&1; then |
cffe80a4 | 163 | if test "$(eval echo \"\$$_feature\")" = "yes" ; then |
3e48f7c9 | 164 | feature_not_found "$_feature" "$1 >= $2" |
162f8c2a DF |
165 | fi |
166 | else | |
3e48f7c9 | 167 | print_config "$1" "missing pkg-config, can't check $_feature version" |
162f8c2a DF |
168 | fi |
169 | return 1 | |
170 | } | |
171 | ||
67bf9823 JA |
172 | targetos="" |
173 | cpu="" | |
174 | ||
91f94d5b | 175 | # default options |
47f44635 JA |
176 | show_help="no" |
177 | exit_val=0 | |
ebec2094 | 178 | gfio_check="no" |
1b10477b | 179 | libhdfs="no" |
cbb15e42 | 180 | devdax="no" |
ae0db592 | 181 | pmem="no" |
d490af7f | 182 | cuda="no" |
10756b2c | 183 | libcufile="no" |
de26b824 | 184 | disable_lex="" |
3ee2a3c1 | 185 | disable_pmem="no" |
a817dc3b | 186 | disable_native="no" |
9f75af77 | 187 | march_set="no" |
247ef2aa | 188 | libiscsi="no" |
d643a1e2 | 189 | libnbd="no" |
98ab1262 | 190 | libnfs="" |
6aaebfbe | 191 | xnvme="" |
a4614bff | 192 | isal="" |
a601337a | 193 | libblkio="" |
38551c04 | 194 | libzbc="" |
c363fdd7 | 195 | dfs="" |
7ff204c8 | 196 | seed_buckets="" |
5a8a6a03 | 197 | dynamic_engines="no" |
020d54bd | 198 | prefix=/usr/local |
91f94d5b | 199 | |
cb1125b0 JA |
200 | # parse options |
201 | for opt do | |
202 | optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` | |
203 | case "$opt" in | |
020d54bd JA |
204 | --prefix=*) prefix="$optarg" |
205 | ;; | |
8b156d8e JA |
206 | --cpu=*) cpu="$optarg" |
207 | ;; | |
c8931876 JA |
208 | # esx is cross compiled and cannot be detect through simple uname calls |
209 | --esx) | |
210 | esx="yes" | |
211 | ;; | |
cb1125b0 JA |
212 | --cc=*) CC="$optarg" |
213 | ;; | |
208e4c8b JA |
214 | --extra-cflags=*) CFLAGS="$CFLAGS $optarg" |
215 | ;; | |
b7c12794 | 216 | --build-32bit-win) build_32bit_win="yes" |
7409711b | 217 | ;; |
a6ab5391 SW |
218 | --target-win-ver=*) target_win_ver="$optarg" |
219 | ;; | |
76bc30ca SW |
220 | --enable-pdb) pdb="yes" |
221 | ;; | |
d2aeedb9 JA |
222 | --build-static) build_static="yes" |
223 | ;; | |
bad7e42c | 224 | --enable-gfio) gfio_check="yes" |
899fab33 | 225 | ;; |
44462517 CF |
226 | --disable-numa) disable_numa="yes" |
227 | ;; | |
f678f8d2 MF |
228 | --disable-rdma) disable_rdma="yes" |
229 | ;; | |
d5f9b0ea IF |
230 | --disable-rados) disable_rados="yes" |
231 | ;; | |
ce18290e TM |
232 | --disable-rbd) disable_rbd="yes" |
233 | ;; | |
c2f6a13d LMB |
234 | --disable-http) disable_http="yes" |
235 | ;; | |
ce18290e TM |
236 | --disable-gfapi) disable_gfapi="yes" |
237 | ;; | |
1b10477b MM |
238 | --enable-libhdfs) libhdfs="yes" |
239 | ;; | |
a655bbc4 JA |
240 | --disable-lex) disable_lex="yes" |
241 | ;; | |
de26b824 JA |
242 | --enable-lex) disable_lex="no" |
243 | ;; | |
61054f0d JA |
244 | --disable-shm) no_shm="yes" |
245 | ;; | |
246 | --disable-optimizations) disable_opt="yes" | |
ba40757e | 247 | ;; |
3ee2a3c1 DJ |
248 | --disable-pmem) disable_pmem="yes" |
249 | ;; | |
d490af7f | 250 | --enable-cuda) cuda="yes" |
03553853 | 251 | ;; |
10756b2c BS |
252 | --enable-libcufile) libcufile="yes" |
253 | ;; | |
a817dc3b JA |
254 | --disable-native) disable_native="yes" |
255 | ;; | |
a40e7a59 GB |
256 | --with-ime=*) ime_path="$optarg" |
257 | ;; | |
247ef2aa KZ |
258 | --enable-libiscsi) libiscsi="yes" |
259 | ;; | |
d643a1e2 RJ |
260 | --enable-libnbd) libnbd="yes" |
261 | ;; | |
38551c04 DF |
262 | --disable-libzbc) libzbc="no" |
263 | ;; | |
6aaebfbe | 264 | --disable-xnvme) xnvme="no" |
a3ff873e | 265 | ;; |
a4614bff AK |
266 | --disable-isal) isal="no" |
267 | ;; | |
a601337a AF |
268 | --disable-libblkio) libblkio="no" |
269 | ;; | |
01fe773d JD |
270 | --disable-tcmalloc) disable_tcmalloc="yes" |
271 | ;; | |
98ab1262 VF |
272 | --disable-libnfs) libnfs="no" |
273 | ;; | |
1eb5ca76 | 274 | --enable-libnfs) libnfs="yes" |
9326926b | 275 | ;; |
5a8a6a03 YK |
276 | --dynamic-libengines) dynamic_engines="yes" |
277 | ;; | |
c363fdd7 JL |
278 | --disable-dfs) dfs="no" |
279 | ;; | |
39c83923 DP |
280 | --enable-asan) asan="yes" |
281 | ;; | |
7ff204c8 SM |
282 | --seed-buckets=*) seed_buckets="$optarg" |
283 | ;; | |
699bc19b VF |
284 | --disable-tls) tls_check="no" |
285 | ;; | |
827da4f5 | 286 | --help) |
47f44635 | 287 | show_help="yes" |
827da4f5 | 288 | ;; |
cb1125b0 JA |
289 | *) |
290 | echo "Bad option $opt" | |
47f44635 JA |
291 | show_help="yes" |
292 | exit_val=1 | |
cb1125b0 JA |
293 | esac |
294 | done | |
295 | ||
47f44635 | 296 | if test "$show_help" = "yes" ; then |
05cef7a0 TK |
297 | echo "--prefix= Use this directory as installation prefix" |
298 | echo "--cpu= Specify target CPU if auto-detect fails" | |
299 | echo "--cc= Specify compiler to use" | |
300 | echo "--extra-cflags= Specify extra CFLAGS to pass to compiler" | |
301 | echo "--build-32bit-win Enable 32-bit build on Windows" | |
26dcc084 | 302 | echo "--target-win-ver= Minimum version of Windows to target (only accepts 7)" |
76bc30ca | 303 | echo "--enable-pdb Enable Windows PDB symbols generation (needs clang/lld)" |
05cef7a0 TK |
304 | echo "--build-static Build a static fio" |
305 | echo "--esx Configure build options for esx" | |
306 | echo "--enable-gfio Enable building of gtk gfio" | |
307 | echo "--disable-numa Disable libnuma even if found" | |
03553853 | 308 | echo "--disable-rdma Disable RDMA support even if found" |
e75a6fac JH |
309 | echo "--disable-rados Disable Rados support even if found" |
310 | echo "--disable-rbd Disable Rados Block Device even if found" | |
311 | echo "--disable-http Disable HTTP support even if found" | |
05cef7a0 TK |
312 | echo "--disable-gfapi Disable gfapi" |
313 | echo "--enable-libhdfs Enable hdfs support" | |
9326926b | 314 | echo "--enable-libnfs Enable nfs support" |
98ab1262 | 315 | echo "--disable-libnfs Disable nfs support" |
05cef7a0 TK |
316 | echo "--disable-lex Disable use of lex/yacc for math" |
317 | echo "--disable-pmem Disable pmem based engines even if found" | |
318 | echo "--enable-lex Enable use of lex/yacc for math" | |
319 | echo "--disable-shm Disable SHM support" | |
61054f0d | 320 | echo "--disable-optimizations Don't enable compiler optimizations" |
03553853 | 321 | echo "--enable-cuda Enable GPUDirect RDMA support" |
10756b2c | 322 | echo "--enable-libcufile Enable GPUDirect Storage cuFile support" |
a817dc3b | 323 | echo "--disable-native Don't build for native host" |
a40e7a59 | 324 | echo "--with-ime= Install path for DDN's Infinite Memory Engine" |
247ef2aa | 325 | echo "--enable-libiscsi Enable iscsi support" |
d643a1e2 | 326 | echo "--enable-libnbd Enable libnbd (NBD engine) support" |
6aaebfbe | 327 | echo "--disable-xnvme Disable xnvme support even if found" |
a4614bff | 328 | echo "--disable-isal Disable isal support even if found" |
a601337a | 329 | echo "--disable-libblkio Disable libblkio support even if found" |
38551c04 | 330 | echo "--disable-libzbc Disable libzbc even if found" |
66634ad8 DP |
331 | echo "--disable-tcmalloc Disable tcmalloc support" |
332 | echo "--dynamic-libengines Lib-based ioengines as dynamic libraries" | |
333 | echo "--disable-dfs Disable DAOS File System support even if found" | |
39c83923 | 334 | echo "--enable-asan Enable address sanitizer" |
7ff204c8 | 335 | echo "--seed-buckets= Number of seed buckets for the refill-buffer" |
699bc19b | 336 | echo "--disable-tls Disable __thread local storage" |
b7a99316 | 337 | exit $exit_val |
47f44635 JA |
338 | fi |
339 | ||
47986339 | 340 | cross_prefix=${cross_prefix-${CROSS_COMPILE}} |
85ccc10a | 341 | # Preferred compiler (can be overridden later after we know the platform): |
b73af738 SW |
342 | # ${CC} (if set) |
343 | # ${cross_prefix}gcc (if cross-prefix specified) | |
344 | # gcc if available | |
345 | # clang if available | |
346 | if test -z "${CC}${cross_prefix}"; then | |
347 | if has gcc; then | |
348 | cc=gcc | |
349 | elif has clang; then | |
350 | cc=clang | |
351 | fi | |
352 | else | |
353 | cc="${CC-${cross_prefix}gcc}" | |
354 | fi | |
47986339 | 355 | |
6d0e9f83 AC |
356 | if check_define __ANDROID__ ; then |
357 | targetos="Android" | |
358 | elif check_define __linux__ ; then | |
67bf9823 | 359 | targetos="Linux" |
67bf9823 JA |
360 | elif check_define __OpenBSD__ ; then |
361 | targetos='OpenBSD' | |
89556808 BVA |
362 | elif check_define __NetBSD__ ; then |
363 | targetos='NetBSD' | |
67bf9823 JA |
364 | elif check_define __sun__ ; then |
365 | targetos='SunOS' | |
7cb024f8 | 366 | CFLAGS="$CFLAGS -D_REENTRANT" |
b24f59ab SH |
367 | elif check_define _WIN32 ; then |
368 | targetos='CYGWIN' | |
946733c6 H |
369 | elif check_define __QNX__ ; then |
370 | targetos='QNX' | |
67bf9823 JA |
371 | else |
372 | targetos=`uname -s` | |
373 | fi | |
374 | ||
53cd4eee AC |
375 | echo "# Automatically generated by configure - do not modify" > $config_host_mak |
376 | printf "# Configured with:" >> $config_host_mak | |
377 | printf " '%s'" "$0" "$@" >> $config_host_mak | |
378 | echo >> $config_host_mak | |
379 | echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak | |
380 | ||
61054f0d JA |
381 | if test "$no_shm" = "yes" ; then |
382 | output_sym "CONFIG_NO_SHM" | |
383 | fi | |
384 | ||
385 | if test "$disable_opt" = "yes" ; then | |
386 | output_sym "CONFIG_FIO_NO_OPT" | |
387 | fi | |
388 | ||
67bf9823 JA |
389 | # Some host OSes need non-standard checks for which CPU to use. |
390 | # Note that these checks are broken for cross-compilation: if you're | |
391 | # cross-compiling to one of these OSes then you'll need to specify | |
392 | # the correct CPU with the --cpu option. | |
393 | case $targetos in | |
26532556 | 394 | AIX|OpenBSD|NetBSD) |
de26b824 | 395 | # Unless explicitly enabled, turn off lex. |
baa78fdc | 396 | # OpenBSD will hit syntax error when enabled. |
de26b824 JA |
397 | if test -z "$disable_lex" ; then |
398 | disable_lex="yes" | |
daf705b5 JA |
399 | else |
400 | force_no_lex_o="yes" | |
de26b824 JA |
401 | fi |
402 | ;; | |
f22dd97a RC |
403 | FreeBSD) |
404 | CFLAGS="$CFLAGS -I/usr/local/include" | |
405 | LDFLAGS="$LDFLAGS -L/usr/local/lib" | |
406 | ;; | |
67bf9823 JA |
407 | Darwin) |
408 | # on Leopard most of the system is 32-bit, so we have to ask the kernel if | |
409 | # we can run 64-bit userspace code. | |
410 | # If the user didn't specify a CPU explicitly and the kernel says this is | |
411 | # 64 bit hw, then assume x86_64. Otherwise fall through to the usual | |
412 | # detection code. | |
413 | if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then | |
414 | cpu="x86_64" | |
415 | fi | |
b6a1e63a | 416 | # Avoid configure feature detection of features provided by weak symbols |
ccf2d89d SW |
417 | cat > $TMPC <<EOF |
418 | int main(void) | |
419 | { | |
420 | return 0; | |
421 | } | |
422 | EOF | |
b6a1e63a SW |
423 | if compile_prog "" "-Werror=partial-availability" "error on weak symbols"; then |
424 | CONFIGURE_CFLAGS="$CONFIGURE_CFLAGS -Werror=partial-availability" | |
ccf2d89d | 425 | fi |
67bf9823 JA |
426 | ;; |
427 | SunOS) | |
428 | # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo | |
429 | if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then | |
430 | cpu="x86_64" | |
431 | fi | |
adaa46d8 | 432 | LIBS="-lnsl -lsocket" |
cfd94f79 JA |
433 | ;; |
434 | CYGWIN*) | |
ca205a75 TK |
435 | # We still force some options, so keep this message here. |
436 | echo "Forcing some known good options on Windows" | |
b73af738 | 437 | if test -z "${CC}${cross_prefix}"; then |
7409711b | 438 | if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then |
b73af738 | 439 | cc="i686-w64-mingw32-gcc" |
7409711b | 440 | else |
b73af738 | 441 | cc="x86_64-w64-mingw32-gcc" |
7409711b | 442 | fi |
4578d01f | 443 | fi |
a6ab5391 SW |
444 | |
445 | target_win_ver=$(echo "$target_win_ver" | tr '[:lower:]' '[:upper:]') | |
446 | if test -z "$target_win_ver"; then | |
447 | # Default Windows API target | |
448 | target_win_ver="7" | |
449 | fi | |
26dcc084 | 450 | if test "$target_win_ver" = "7"; then |
a6ab5391 SW |
451 | output_sym "CONFIG_WINDOWS_7" |
452 | CFLAGS="$CFLAGS -D_WIN32_WINNT=0x0601" | |
7409711b | 453 | else |
a6ab5391 | 454 | fatal "Unknown target Windows version" |
7409711b | 455 | fi |
a6ab5391 | 456 | |
ca205a75 TK |
457 | # We need this to be output_sym'd here because this is Windows specific. |
458 | # The regular configure path never sets this config. | |
4feafb1e | 459 | output_sym "CONFIG_WINDOWSAIO" |
ca205a75 TK |
460 | # We now take the regular configuration path without having exit 0 here. |
461 | # Flags below are still necessary mostly for MinGW. | |
12ed4fc8 | 462 | build_static="yes" |
ca205a75 TK |
463 | rusage_thread="yes" |
464 | fdatasync="yes" | |
465 | clock_gettime="yes" # clock_monotonic probe has dependency on this | |
466 | clock_monotonic="yes" | |
ca205a75 | 467 | sched_idle="yes" |
ea8c20c3 | 468 | pthread_condattr_setclock="no" |
deb859d6 | 469 | pthread_affinity="no" |
6d0e9f83 | 470 | ;; |
946733c6 H |
471 | QNX) |
472 | LIBS="-lsocket" | |
473 | ;; | |
67bf9823 JA |
474 | esac |
475 | ||
b73af738 SW |
476 | # Now we know the target platform we can have another guess at the preferred |
477 | # compiler when it wasn't explictly set | |
478 | if test -z "${CC}${cross_prefix}"; then | |
479 | if test "$targetos" = "FreeBSD" || test "$targetos" = "Darwin"; then | |
480 | if has clang; then | |
481 | cc=clang | |
482 | fi | |
483 | fi | |
484 | fi | |
485 | if test -z "$cc"; then | |
486 | echo "configure: failed to find compiler" | |
487 | exit 1 | |
488 | fi | |
489 | ||
67bf9823 JA |
490 | if test ! -z "$cpu" ; then |
491 | # command line argument | |
492 | : | |
493 | elif check_define __i386__ ; then | |
494 | cpu="i386" | |
495 | elif check_define __x86_64__ ; then | |
496 | cpu="x86_64" | |
497 | elif check_define __sparc__ ; then | |
498 | if check_define __arch64__ ; then | |
499 | cpu="sparc64" | |
500 | else | |
501 | cpu="sparc" | |
502 | fi | |
503 | elif check_define _ARCH_PPC ; then | |
504 | if check_define _ARCH_PPC64 ; then | |
505 | cpu="ppc64" | |
506 | else | |
507 | cpu="ppc" | |
508 | fi | |
509 | elif check_define __mips__ ; then | |
510 | cpu="mips" | |
511 | elif check_define __ia64__ ; then | |
512 | cpu="ia64" | |
513 | elif check_define __s390__ ; then | |
514 | if check_define __s390x__ ; then | |
515 | cpu="s390x" | |
516 | else | |
517 | cpu="s390" | |
518 | fi | |
519 | elif check_define __arm__ ; then | |
520 | cpu="arm" | |
214e2d56 | 521 | elif check_define __aarch64__ ; then |
522 | cpu="aarch64" | |
67bf9823 JA |
523 | elif check_define __hppa__ ; then |
524 | cpu="hppa" | |
9496e398 JH |
525 | elif check_define __loongarch64 ; then |
526 | cpu="loongarch64" | |
21540653 MB |
527 | elif check_define __riscv ; then |
528 | if check_val __riscv_xlen 32 ; then | |
529 | cpu="riscv32" | |
530 | elif check_val __riscv_xlen 64 ; then | |
531 | cpu="riscv64" | |
532 | elif check_val __riscv_xlen 128 ; then | |
533 | cpu="riscv128" | |
534 | fi | |
67bf9823 JA |
535 | else |
536 | cpu=`uname -m` | |
537 | fi | |
538 | ||
539 | # Normalise host CPU name and set ARCH. | |
540 | case "$cpu" in | |
21540653 | 541 | ia64|ppc|ppc64|s390|s390x|sparc64|loongarch64|riscv64) |
67bf9823 JA |
542 | cpu="$cpu" |
543 | ;; | |
544 | i386|i486|i586|i686|i86pc|BePC) | |
95ef38ab | 545 | cpu="x86" |
67bf9823 JA |
546 | ;; |
547 | x86_64|amd64) | |
548 | cpu="x86_64" | |
549 | ;; | |
550 | armv*b|armv*l|arm) | |
551 | cpu="arm" | |
552 | ;; | |
214e2d56 | 553 | aarch64) |
554 | cpu="arm64" | |
555 | ;; | |
67bf9823 JA |
556 | hppa|parisc|parisc64) |
557 | cpu="hppa" | |
558 | ;; | |
559 | mips*) | |
560 | cpu="mips" | |
561 | ;; | |
562 | sparc|sun4[cdmuv]) | |
563 | cpu="sparc" | |
564 | ;; | |
565 | *) | |
8b156d8e | 566 | echo "Unknown CPU" |
67bf9823 JA |
567 | ;; |
568 | esac | |
569 | ||
1a17cfdb AC |
570 | ########################################## |
571 | # check cross compile | |
572 | ||
ca205a75 TK |
573 | if test "$cross_compile" != "yes" ; then |
574 | cross_compile="no" | |
575 | fi | |
1a17cfdb AC |
576 | cat > $TMPC <<EOF |
577 | int main(void) | |
578 | { | |
579 | return 0; | |
580 | } | |
581 | EOF | |
582 | if compile_prog "" "" "cross"; then | |
583 | $TMPE 2>/dev/null || cross_compile="yes" | |
584 | else | |
585 | fatal "compile test failed" | |
586 | fi | |
587 | ||
0dcebdf4 JA |
588 | ########################################## |
589 | # check endianness | |
ca205a75 TK |
590 | if test "$bigendian" != "yes" ; then |
591 | bigendian="no" | |
592 | fi | |
1a17cfdb AC |
593 | if test "$cross_compile" = "no" ; then |
594 | cat > $TMPC <<EOF | |
0dcebdf4 JA |
595 | #include <inttypes.h> |
596 | int main(void) | |
597 | { | |
598 | volatile uint32_t i=0x01234567; | |
599 | return (*((uint8_t*)(&i))) == 0x67; | |
600 | } | |
601 | EOF | |
1a17cfdb AC |
602 | if compile_prog "" "" "endian"; then |
603 | $TMPE && bigendian="yes" | |
604 | fi | |
605 | else | |
606 | # If we're cross compiling, try our best to work it out and rely on the | |
607 | # run-time check to fail if we get it wrong. | |
608 | cat > $TMPC <<EOF | |
609 | #include <endian.h> | |
610 | int main(void) | |
611 | { | |
612 | #if __BYTE_ORDER != __BIG_ENDIAN | |
613 | # error "Unknown endianness" | |
614 | #endif | |
615 | } | |
616 | EOF | |
617 | compile_prog "" "" "endian" && bigendian="yes" | |
618 | check_define "__ARMEB__" && bigendian="yes" | |
619 | check_define "__MIPSEB__" && bigendian="yes" | |
0dcebdf4 JA |
620 | fi |
621 | ||
622 | ||
484b0b65 TK |
623 | print_config "Operating system" "$targetos" |
624 | print_config "CPU" "$cpu" | |
625 | print_config "Big endian" "$bigendian" | |
a6ab5391 SW |
626 | if test ! -z "$target_win_ver"; then |
627 | print_config "Target Windows version" "$target_win_ver" | |
628 | fi | |
484b0b65 TK |
629 | print_config "Compiler" "$cc" |
630 | print_config "Cross compile" "$cross_compile" | |
67bf9823 JA |
631 | echo |
632 | ||
d2aeedb9 JA |
633 | ########################################## |
634 | # See if we need to build a static build | |
635 | if test "$build_static" = "yes" ; then | |
636 | CFLAGS="$CFLAGS -ffunction-sections -fdata-sections" | |
637 | LDFLAGS="$LDFLAGS -static -Wl,--gc-sections" | |
638 | else | |
639 | build_static="no" | |
640 | fi | |
484b0b65 | 641 | print_config "Static build" "$build_static" |
d2aeedb9 | 642 | |
bb012314 SW |
643 | ########################################## |
644 | # check for C11 atomics support | |
645 | cat > $TMPC <<EOF | |
646 | #include <stdatomic.h> | |
647 | int main(void) | |
648 | { | |
649 | _Atomic unsigned v; | |
650 | atomic_load(&v); | |
651 | return 0; | |
652 | } | |
653 | EOF | |
654 | if ! compile_prog "" "" "C11 atomics"; then | |
655 | echo | |
656 | echo "Your compiler doesn't support C11 atomics. gcc 4.9/clang 3.6 are the" | |
657 | echo "minimum versions with it - perhaps your compiler is too old?" | |
658 | fatal "C11 atomics support not found" | |
659 | fi | |
660 | ||
661 | ||
67bf9823 JA |
662 | ########################################## |
663 | # check for wordsize | |
664 | wordsize="0" | |
665 | cat > $TMPC <<EOF | |
142429e5 AC |
666 | #include <limits.h> |
667 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) | |
67bf9823 JA |
668 | int main(void) |
669 | { | |
142429e5 | 670 | BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE); |
67bf9823 JA |
671 | return 0; |
672 | } | |
673 | EOF | |
142429e5 AC |
674 | if compile_prog "-DWORDSIZE=32" "" "wordsize"; then |
675 | wordsize="32" | |
676 | elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then | |
677 | wordsize="64" | |
678 | else | |
679 | fatal "Unknown wordsize" | |
67bf9823 | 680 | fi |
484b0b65 | 681 | print_config "Wordsize" "$wordsize" |
67bf9823 | 682 | |
a9bca4aa JA |
683 | ########################################## |
684 | # zlib probe | |
ca205a75 TK |
685 | if test "$zlib" != "yes" ; then |
686 | zlib="no" | |
687 | fi | |
a9bca4aa | 688 | cat > $TMPC <<EOF |
804a1e05 | 689 | #include <zlib.h> |
a9bca4aa JA |
690 | int main(void) |
691 | { | |
692 | z_stream stream; | |
693 | if (inflateInit(&stream) != Z_OK) | |
694 | return 1; | |
695 | return 0; | |
696 | } | |
697 | EOF | |
698 | if compile_prog "" "-lz" "zlib" ; then | |
699 | zlib=yes | |
700 | LIBS="-lz $LIBS" | |
a9bca4aa | 701 | fi |
484b0b65 | 702 | print_config "zlib" "$zlib" |
a9bca4aa | 703 | |
a04e0665 JA |
704 | ########################################## |
705 | # fcntl(F_FULLFSYNC) support | |
706 | if test "$fcntl_sync" != "yes" ; then | |
707 | fcntl_sync="no" | |
708 | fi | |
709 | cat > $TMPC << EOF | |
710 | #include <unistd.h> | |
711 | #include <fcntl.h> | |
712 | ||
713 | int main(int argc, char **argv) | |
714 | { | |
c99c81ad | 715 | return fcntl(0, F_FULLFSYNC); |
a04e0665 JA |
716 | } |
717 | EOF | |
c99c81ad | 718 | if compile_prog "" "" "fcntl(F_FULLFSYNC)" ; then |
a04e0665 JA |
719 | fcntl_sync="yes" |
720 | fi | |
c99c81ad | 721 | print_config "fcntl(F_FULLFSYNC)" "$fcntl_sync" |
a04e0665 | 722 | |
67bf9823 JA |
723 | ########################################## |
724 | # linux-aio probe | |
ca205a75 TK |
725 | if test "$libaio" != "yes" ; then |
726 | libaio="no" | |
727 | fi | |
7c77ebef | 728 | if test "$esx" != "yes" ; then |
729 | cat > $TMPC <<EOF | |
67bf9823 JA |
730 | #include <libaio.h> |
731 | #include <stddef.h> | |
732 | int main(void) | |
733 | { | |
734 | io_setup(0, NULL); | |
735 | return 0; | |
736 | } | |
737 | EOF | |
d4946e79 | 738 | if compile_prog "" "-laio" "libaio" ; then |
7c77ebef | 739 | libaio=yes |
7c77ebef | 740 | else |
741 | if test "$libaio" = "yes" ; then | |
742 | feature_not_found "linux AIO" "libaio-dev or libaio-devel" | |
743 | fi | |
744 | libaio=no | |
67bf9823 | 745 | fi |
7d42e66e KK |
746 | |
747 | cat > $TMPC <<EOF | |
748 | #include <libaio.h> | |
749 | #include <stddef.h> | |
750 | int main(void) | |
751 | { | |
752 | io_prep_preadv2(NULL, 0, NULL, 0, 0, 0); | |
753 | io_prep_pwritev2(NULL, 0, NULL, 0, 0, 0); | |
754 | return 0; | |
755 | } | |
756 | EOF | |
757 | if compile_prog "" "" "libaio rw flags" ; then | |
758 | libaio_rw_flags=yes | |
759 | else | |
760 | libaio_rw_flags=no | |
761 | fi | |
67bf9823 | 762 | fi |
484b0b65 | 763 | print_config "Linux AIO support" "$libaio" |
7d42e66e | 764 | print_config "Linux AIO support rw flags" "$libaio_rw_flags" |
67bf9823 JA |
765 | |
766 | ########################################## | |
767 | # posix aio probe | |
ca205a75 TK |
768 | if test "$posix_aio" != "yes" ; then |
769 | posix_aio="no" | |
770 | fi | |
771 | if test "$posix_aio_lrt" != "yes" ; then | |
772 | posix_aio_lrt="no" | |
773 | fi | |
67bf9823 JA |
774 | cat > $TMPC <<EOF |
775 | #include <aio.h> | |
776 | int main(void) | |
777 | { | |
778 | struct aiocb cb; | |
779 | aio_read(&cb); | |
780 | return 0; | |
781 | } | |
782 | EOF | |
783 | if compile_prog "" "" "posixaio" ; then | |
784 | posix_aio="yes" | |
09c81e13 | 785 | elif compile_prog "" "-lrt" "posixaio -lrt"; then |
67bf9823 JA |
786 | posix_aio="yes" |
787 | posix_aio_lrt="yes" | |
788 | LIBS="-lrt $LIBS" | |
789 | fi | |
484b0b65 TK |
790 | print_config "POSIX AIO support" "$posix_aio" |
791 | print_config "POSIX AIO support needs -lrt" "$posix_aio_lrt" | |
67bf9823 JA |
792 | |
793 | ########################################## | |
794 | # posix aio fsync probe | |
ca205a75 TK |
795 | if test "$posix_aio_fsync" != "yes" ; then |
796 | posix_aio_fsync="no" | |
797 | fi | |
67bf9823 JA |
798 | if test "$posix_aio" = "yes" ; then |
799 | cat > $TMPC <<EOF | |
800 | #include <fcntl.h> | |
801 | #include <aio.h> | |
802 | int main(void) | |
803 | { | |
804 | struct aiocb cb; | |
805 | return aio_fsync(O_SYNC, &cb); | |
806 | return 0; | |
807 | } | |
808 | EOF | |
809 | if compile_prog "" "$LIBS" "posix_aio_fsync" ; then | |
810 | posix_aio_fsync=yes | |
811 | fi | |
812 | fi | |
484b0b65 | 813 | print_config "POSIX AIO fsync" "$posix_aio_fsync" |
67bf9823 | 814 | |
06eac6b2 SW |
815 | ########################################## |
816 | # POSIX pshared attribute probe | |
d418fa90 TK |
817 | if test "$posix_pshared" != "yes" ; then |
818 | posix_pshared="no" | |
819 | fi | |
06eac6b2 SW |
820 | cat > $TMPC <<EOF |
821 | #include <unistd.h> | |
822 | int main(void) | |
823 | { | |
824 | #if defined(_POSIX_THREAD_PROCESS_SHARED) && ((_POSIX_THREAD_PROCESS_SHARED + 0) > 0) | |
825 | # if defined(__CYGWIN__) | |
826 | # error "_POSIX_THREAD_PROCESS_SHARED is buggy on Cygwin" | |
827 | # elif defined(__APPLE__) | |
828 | # include <AvailabilityMacros.h> | |
829 | # include <TargetConditionals.h> | |
830 | # if TARGET_OS_MAC && MAC_OS_X_VERSION_MIN_REQUIRED < 1070 | |
831 | # error "_POSIX_THREAD_PROCESS_SHARED is buggy/unsupported prior to OSX 10.7" | |
832 | # endif | |
833 | # endif | |
834 | #else | |
835 | # error "_POSIX_THREAD_PROCESS_SHARED is unsupported" | |
836 | #endif | |
837 | return 0; | |
838 | } | |
839 | EOF | |
840 | if compile_prog "" "$LIBS" "posix_pshared" ; then | |
841 | posix_pshared=yes | |
842 | fi | |
484b0b65 | 843 | print_config "POSIX pshared support" "$posix_pshared" |
06eac6b2 | 844 | |
78b66d32 BVA |
845 | ########################################## |
846 | # POSIX pthread_condattr_setclock() probe | |
ea8c20c3 JL |
847 | if test "$pthread_condattr_setclock" != "no" ; then |
848 | cat > $TMPC <<EOF | |
78b66d32 BVA |
849 | #include <pthread.h> |
850 | int main(void) | |
851 | { | |
852 | pthread_condattr_t condattr; | |
853 | pthread_condattr_setclock(&condattr, CLOCK_MONOTONIC); | |
854 | return 0; | |
855 | } | |
856 | EOF | |
ea8c20c3 JL |
857 | if compile_prog "" "$LIBS" "pthread_condattr_setclock" ; then |
858 | pthread_condattr_setclock=yes | |
859 | elif compile_prog "" "$LIBS -lpthread" "pthread_condattr_setclock" ; then | |
860 | pthread_condattr_setclock=yes | |
861 | LIBS="$LIBS -lpthread" | |
862 | fi | |
78b66d32 | 863 | fi |
a9bf436e | 864 | print_config "pthread_condattr_setclock()" "$pthread_condattr_setclock" |
78b66d32 | 865 | |
c31092b8 BVA |
866 | ########################################## |
867 | # pthread_sigmask() probe | |
868 | if test "$pthread_sigmask" != "yes" ; then | |
869 | pthread_sigmask="no" | |
870 | fi | |
871 | cat > $TMPC <<EOF | |
872 | #include <stddef.h> /* NULL */ | |
873 | #include <signal.h> /* pthread_sigmask() */ | |
874 | int main(void) | |
875 | { | |
1fa44a7e SL |
876 | sigset_t sigmask; |
877 | return pthread_sigmask(0, NULL, &sigmask); | |
c31092b8 BVA |
878 | } |
879 | EOF | |
880 | if compile_prog "" "$LIBS" "pthread_sigmask" ; then | |
881 | pthread_sigmask=yes | |
882 | elif compile_prog "" "$LIBS -lpthread" "pthread_sigmask" ; then | |
883 | pthread_sigmask=yes | |
884 | LIBS="$LIBS -lpthread" | |
885 | fi | |
886 | print_config "pthread_sigmask()" "$pthread_sigmask" | |
887 | ||
deb859d6 JA |
888 | ########################################## |
889 | # pthread_getaffinity_np() probe | |
890 | if test "$pthread_getaffinity" != "yes" ; then | |
891 | pthread_getaffinity="no" | |
892 | fi | |
893 | cat > $TMPC <<EOF | |
894 | #include <stddef.h> /* NULL */ | |
895 | #include <signal.h> /* pthread_sigmask() */ | |
896 | #include <pthread.h> | |
897 | int main(void) | |
898 | { | |
899 | cpu_set_t set; | |
900 | return pthread_getaffinity_np(pthread_self(), sizeof(set), &set); | |
901 | } | |
902 | EOF | |
903 | if compile_prog "" "$LIBS" "pthread_getaffinity" ; then | |
904 | pthread_getaffinity="yes" | |
905 | elif compile_prog "" "$LIBS -lpthread" "pthread_getaffinity" ; then | |
906 | pthread_getaffinity="yes" | |
907 | LIBS="$LIBS -lpthread" | |
908 | fi | |
909 | print_config "pthread_getaffinity_np()" "$pthread_getaffinity" | |
910 | ||
67bf9823 JA |
911 | ########################################## |
912 | # solaris aio probe | |
ca205a75 TK |
913 | if test "$solaris_aio" != "yes" ; then |
914 | solaris_aio="no" | |
915 | fi | |
67bf9823 JA |
916 | cat > $TMPC <<EOF |
917 | #include <sys/types.h> | |
918 | #include <sys/asynch.h> | |
919 | #include <unistd.h> | |
920 | int main(void) | |
921 | { | |
922 | aio_result_t res; | |
923 | return aioread(0, NULL, 0, 0, SEEK_SET, &res); | |
924 | return 0; | |
925 | } | |
926 | EOF | |
927 | if compile_prog "" "-laio" "solarisaio" ; then | |
928 | solaris_aio=yes | |
929 | LIBS="-laio $LIBS" | |
930 | fi | |
484b0b65 | 931 | print_config "Solaris AIO support" "$solaris_aio" |
67bf9823 JA |
932 | |
933 | ########################################## | |
f5cd2907 | 934 | # __sync_fetch_and_add test |
ca205a75 TK |
935 | if test "$sfaa" != "yes" ; then |
936 | sfaa="no" | |
937 | fi | |
67bf9823 | 938 | cat > $TMPC << EOF |
958886d8 JA |
939 | #include <inttypes.h> |
940 | static int sfaa(uint64_t *ptr) | |
67bf9823 | 941 | { |
9c639a76 | 942 | return __sync_fetch_and_add(ptr, 0); |
67bf9823 JA |
943 | } |
944 | ||
945 | int main(int argc, char **argv) | |
946 | { | |
958886d8 | 947 | uint64_t val = 42; |
67bf9823 JA |
948 | sfaa(&val); |
949 | return val; | |
950 | } | |
951 | EOF | |
952 | if compile_prog "" "" "__sync_fetch_and_add()" ; then | |
953 | sfaa="yes" | |
954 | fi | |
484b0b65 | 955 | print_config "__sync_fetch_and_add" "$sfaa" |
67bf9823 | 956 | |
a250edd0 JA |
957 | ########################################## |
958 | # __sync_synchronize() test | |
959 | if test "$sync_sync" != "yes" ; then | |
960 | sync_sync="no" | |
961 | fi | |
962 | cat > $TMPC << EOF | |
963 | #include <inttypes.h> | |
964 | ||
965 | int main(int argc, char **argv) | |
966 | { | |
967 | __sync_synchronize(); | |
968 | return 0; | |
969 | } | |
970 | EOF | |
971 | if compile_prog "" "" "__sync_synchronize()" ; then | |
972 | sync_sync="yes" | |
973 | fi | |
974 | print_config "__sync_synchronize" "$sync_sync" | |
975 | ||
976 | ########################################## | |
977 | # __sync_val_compare_and_swap() test | |
978 | if test "$cmp_swap" != "yes" ; then | |
979 | cmp_swap="no" | |
980 | fi | |
981 | cat > $TMPC << EOF | |
982 | #include <inttypes.h> | |
983 | ||
984 | int main(int argc, char **argv) | |
985 | { | |
986 | int x = 0; | |
987 | return __sync_val_compare_and_swap(&x, 1, 2); | |
988 | } | |
989 | EOF | |
990 | if compile_prog "" "" "__sync_val_compare_and_swap()" ; then | |
991 | cmp_swap="yes" | |
992 | fi | |
993 | print_config "__sync_val_compare_and_swap" "$cmp_swap" | |
994 | ||
67bf9823 JA |
995 | ########################################## |
996 | # libverbs probe | |
ca205a75 TK |
997 | if test "$libverbs" != "yes" ; then |
998 | libverbs="no" | |
999 | fi | |
67bf9823 | 1000 | cat > $TMPC << EOF |
eb3bfdd8 | 1001 | #include <infiniband/verbs.h> |
67bf9823 JA |
1002 | int main(int argc, char **argv) |
1003 | { | |
1004 | struct ibv_pd *pd = ibv_alloc_pd(NULL); | |
40dae137 | 1005 | return pd != NULL; |
67bf9823 JA |
1006 | } |
1007 | EOF | |
f678f8d2 | 1008 | if test "$disable_rdma" != "yes" && compile_prog "" "-libverbs" "libverbs" ; then |
67bf9823 | 1009 | libverbs="yes" |
67bf9823 | 1010 | fi |
484b0b65 | 1011 | print_config "libverbs" "$libverbs" |
67bf9823 JA |
1012 | |
1013 | ########################################## | |
1014 | # rdmacm probe | |
ca205a75 TK |
1015 | if test "$rdmacm" != "yes" ; then |
1016 | rdmacm="no" | |
1017 | fi | |
67bf9823 JA |
1018 | cat > $TMPC << EOF |
1019 | #include <stdio.h> | |
1020 | #include <rdma/rdma_cma.h> | |
1021 | int main(int argc, char **argv) | |
1022 | { | |
1023 | rdma_destroy_qp(NULL); | |
1024 | return 0; | |
1025 | } | |
1026 | EOF | |
f678f8d2 | 1027 | if test "$disable_rdma" != "yes" && compile_prog "" "-lrdmacm" "rdma"; then |
67bf9823 | 1028 | rdmacm="yes" |
67bf9823 | 1029 | fi |
484b0b65 | 1030 | print_config "rdmacm" "$rdmacm" |
67bf9823 | 1031 | |
44e8e956 BVA |
1032 | ########################################## |
1033 | # asprintf() and vasprintf() probes | |
1034 | if test "$have_asprintf" != "yes" ; then | |
1035 | have_asprintf="no" | |
1036 | fi | |
1037 | cat > $TMPC << EOF | |
1038 | #include <stdio.h> | |
1039 | ||
1040 | int main(int argc, char **argv) | |
1041 | { | |
0a702282 SW |
1042 | char *buf; |
1043 | return asprintf(&buf, "%s", "str") == 0; | |
44e8e956 BVA |
1044 | } |
1045 | EOF | |
1046 | if compile_prog "" "" "have_asprintf"; then | |
1047 | have_asprintf="yes" | |
1048 | fi | |
1049 | print_config "asprintf()" "$have_asprintf" | |
1050 | ||
1051 | if test "$have_vasprintf" != "yes" ; then | |
1052 | have_vasprintf="no" | |
1053 | fi | |
1054 | cat > $TMPC << EOF | |
1055 | #include <stdio.h> | |
946733c6 | 1056 | #include <stdarg.h> |
44e8e956 BVA |
1057 | |
1058 | int main(int argc, char **argv) | |
1059 | { | |
849ac4b2 | 1060 | va_list ap; |
0a702282 SW |
1061 | char *buf; |
1062 | return vasprintf(&buf, "%s", ap) == 0; | |
44e8e956 BVA |
1063 | } |
1064 | EOF | |
1065 | if compile_prog "" "" "have_vasprintf"; then | |
1066 | have_vasprintf="yes" | |
1067 | fi | |
1068 | print_config "vasprintf()" "$have_vasprintf" | |
1069 | ||
67bf9823 JA |
1070 | ########################################## |
1071 | # Linux fallocate probe | |
ca205a75 TK |
1072 | if test "$linux_fallocate" != "yes" ; then |
1073 | linux_fallocate="no" | |
1074 | fi | |
67bf9823 JA |
1075 | cat > $TMPC << EOF |
1076 | #include <stdio.h> | |
aa6738a5 | 1077 | #include <fcntl.h> |
67bf9823 JA |
1078 | #include <linux/falloc.h> |
1079 | int main(int argc, char **argv) | |
1080 | { | |
1081 | int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024); | |
1082 | return r; | |
1083 | } | |
1084 | EOF | |
1085 | if compile_prog "" "" "linux_fallocate"; then | |
1086 | linux_fallocate="yes" | |
1087 | fi | |
484b0b65 | 1088 | print_config "Linux fallocate" "$linux_fallocate" |
67bf9823 JA |
1089 | |
1090 | ########################################## | |
1091 | # POSIX fadvise probe | |
ca205a75 TK |
1092 | if test "$posix_fadvise" != "yes" ; then |
1093 | posix_fadvise="no" | |
1094 | fi | |
67bf9823 JA |
1095 | cat > $TMPC << EOF |
1096 | #include <stdio.h> | |
1097 | #include <fcntl.h> | |
1098 | int main(int argc, char **argv) | |
1099 | { | |
1100 | int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL); | |
1101 | return r; | |
1102 | } | |
1103 | EOF | |
1104 | if compile_prog "" "" "posix_fadvise"; then | |
1105 | posix_fadvise="yes" | |
1106 | fi | |
484b0b65 | 1107 | print_config "POSIX fadvise" "$posix_fadvise" |
67bf9823 JA |
1108 | |
1109 | ########################################## | |
1110 | # POSIX fallocate probe | |
ca205a75 TK |
1111 | if test "$posix_fallocate" != "yes" ; then |
1112 | posix_fallocate="no" | |
1113 | fi | |
67bf9823 JA |
1114 | cat > $TMPC << EOF |
1115 | #include <stdio.h> | |
1116 | #include <fcntl.h> | |
1117 | int main(int argc, char **argv) | |
1118 | { | |
1119 | int r = posix_fallocate(0, 0, 1024); | |
1120 | return r; | |
1121 | } | |
1122 | EOF | |
1123 | if compile_prog "" "" "posix_fallocate"; then | |
1124 | posix_fallocate="yes" | |
1125 | fi | |
484b0b65 | 1126 | print_config "POSIX fallocate" "$posix_fallocate" |
67bf9823 JA |
1127 | |
1128 | ########################################## | |
1129 | # sched_set/getaffinity 2 or 3 argument test | |
ca205a75 TK |
1130 | if test "$linux_2arg_affinity" != "yes" ; then |
1131 | linux_2arg_affinity="no" | |
1132 | fi | |
1133 | if test "$linux_3arg_affinity" != "yes" ; then | |
1134 | linux_3arg_affinity="no" | |
1135 | fi | |
67bf9823 | 1136 | cat > $TMPC << EOF |
67bf9823 JA |
1137 | #include <sched.h> |
1138 | int main(int argc, char **argv) | |
1139 | { | |
e9aab3c9 BVA |
1140 | cpu_set_t mask = { }; |
1141 | ||
67bf9823 JA |
1142 | return sched_setaffinity(0, sizeof(mask), &mask); |
1143 | } | |
1144 | EOF | |
1145 | if compile_prog "" "" "sched_setaffinity(,,)"; then | |
1146 | linux_3arg_affinity="yes" | |
1147 | else | |
1148 | cat > $TMPC << EOF | |
67bf9823 JA |
1149 | #include <sched.h> |
1150 | int main(int argc, char **argv) | |
1151 | { | |
e9aab3c9 BVA |
1152 | cpu_set_t mask = { }; |
1153 | ||
67bf9823 JA |
1154 | return sched_setaffinity(0, &mask); |
1155 | } | |
1156 | EOF | |
1157 | if compile_prog "" "" "sched_setaffinity(,)"; then | |
1158 | linux_2arg_affinity="yes" | |
1159 | fi | |
1160 | fi | |
484b0b65 TK |
1161 | print_config "sched_setaffinity(3 arg)" "$linux_3arg_affinity" |
1162 | print_config "sched_setaffinity(2 arg)" "$linux_2arg_affinity" | |
67bf9823 JA |
1163 | |
1164 | ########################################## | |
1165 | # clock_gettime probe | |
ca205a75 TK |
1166 | if test "$clock_gettime" != "yes" ; then |
1167 | clock_gettime="no" | |
1168 | fi | |
67bf9823 JA |
1169 | cat > $TMPC << EOF |
1170 | #include <stdio.h> | |
1171 | #include <time.h> | |
1172 | int main(int argc, char **argv) | |
1173 | { | |
73816e1a BVA |
1174 | struct timespec ts; |
1175 | ||
1176 | return clock_gettime(0, &ts); | |
67bf9823 JA |
1177 | } |
1178 | EOF | |
1179 | if compile_prog "" "" "clock_gettime"; then | |
1180 | clock_gettime="yes" | |
1181 | elif compile_prog "" "-lrt" "clock_gettime"; then | |
1182 | clock_gettime="yes" | |
1183 | LIBS="-lrt $LIBS" | |
1184 | fi | |
484b0b65 | 1185 | print_config "clock_gettime" "$clock_gettime" |
67bf9823 JA |
1186 | |
1187 | ########################################## | |
1188 | # CLOCK_MONOTONIC probe | |
ca205a75 TK |
1189 | if test "$clock_monotonic" != "yes" ; then |
1190 | clock_monotonic="no" | |
1191 | fi | |
67bf9823 JA |
1192 | if test "$clock_gettime" = "yes" ; then |
1193 | cat > $TMPC << EOF | |
1194 | #include <stdio.h> | |
1195 | #include <time.h> | |
1196 | int main(int argc, char **argv) | |
1197 | { | |
73816e1a BVA |
1198 | struct timespec ts; |
1199 | ||
1200 | return clock_gettime(CLOCK_MONOTONIC, &ts); | |
67bf9823 JA |
1201 | } |
1202 | EOF | |
1203 | if compile_prog "" "$LIBS" "clock monotonic"; then | |
1204 | clock_monotonic="yes" | |
1205 | fi | |
1206 | fi | |
484b0b65 | 1207 | print_config "CLOCK_MONOTONIC" "$clock_monotonic" |
67bf9823 | 1208 | |
25f8227d JA |
1209 | ########################################## |
1210 | # clockid_t probe | |
ca205a75 TK |
1211 | if test "$clockid_t" != "yes" ; then |
1212 | clockid_t="no" | |
1213 | fi | |
25f8227d | 1214 | cat > $TMPC << EOF |
25f8227d | 1215 | #include <time.h> |
209c37b4 | 1216 | #include <string.h> |
25f8227d JA |
1217 | int main(int argc, char **argv) |
1218 | { | |
ccf2d89d | 1219 | volatile clockid_t cid; |
7fcad9e1 | 1220 | memset((void*)&cid, 0, sizeof(cid)); |
ccf2d89d | 1221 | return 0; |
25f8227d JA |
1222 | } |
1223 | EOF | |
1224 | if compile_prog "" "$LIBS" "clockid_t"; then | |
1225 | clockid_t="yes" | |
1226 | fi | |
484b0b65 | 1227 | print_config "clockid_t" "$clockid_t" |
25f8227d | 1228 | |
67bf9823 JA |
1229 | ########################################## |
1230 | # gettimeofday() probe | |
ca205a75 TK |
1231 | if test "$gettimeofday" != "yes" ; then |
1232 | gettimeofday="no" | |
1233 | fi | |
67bf9823 JA |
1234 | cat > $TMPC << EOF |
1235 | #include <sys/time.h> | |
1236 | #include <stdio.h> | |
1237 | int main(int argc, char **argv) | |
1238 | { | |
1239 | struct timeval tv; | |
1240 | return gettimeofday(&tv, NULL); | |
1241 | } | |
1242 | EOF | |
1243 | if compile_prog "" "" "gettimeofday"; then | |
1244 | gettimeofday="yes" | |
1245 | fi | |
484b0b65 | 1246 | print_config "gettimeofday" "$gettimeofday" |
67bf9823 JA |
1247 | |
1248 | ########################################## | |
1249 | # fdatasync() probe | |
ca205a75 TK |
1250 | if test "$fdatasync" != "yes" ; then |
1251 | fdatasync="no" | |
1252 | fi | |
67bf9823 JA |
1253 | cat > $TMPC << EOF |
1254 | #include <stdio.h> | |
1255 | #include <unistd.h> | |
1256 | int main(int argc, char **argv) | |
1257 | { | |
1258 | return fdatasync(0); | |
1259 | } | |
1260 | EOF | |
1261 | if compile_prog "" "" "fdatasync"; then | |
1262 | fdatasync="yes" | |
1263 | fi | |
484b0b65 | 1264 | print_config "fdatasync" "$fdatasync" |
67bf9823 | 1265 | |
52a552e2 BVA |
1266 | ########################################## |
1267 | # pipe() probe | |
1268 | if test "$pipe" != "yes" ; then | |
1269 | pipe="no" | |
1270 | fi | |
1271 | cat > $TMPC << EOF | |
1272 | #include <unistd.h> | |
1273 | int main(int argc, char **argv) | |
1274 | { | |
1275 | int fd[2]; | |
1276 | return pipe(fd); | |
1277 | } | |
1278 | EOF | |
1279 | if compile_prog "" "" "pipe"; then | |
1280 | pipe="yes" | |
1281 | fi | |
1282 | print_config "pipe()" "$pipe" | |
1283 | ||
1284 | ########################################## | |
1285 | # pipe2() probe | |
1286 | if test "$pipe2" != "yes" ; then | |
1287 | pipe2="no" | |
1288 | fi | |
1289 | cat > $TMPC << EOF | |
1290 | #include <unistd.h> | |
1291 | int main(int argc, char **argv) | |
1292 | { | |
1293 | int fd[2]; | |
1294 | return pipe2(fd, 0); | |
1295 | } | |
1296 | EOF | |
1297 | if compile_prog "" "" "pipe2"; then | |
1298 | pipe2="yes" | |
1299 | fi | |
1300 | print_config "pipe2()" "$pipe2" | |
1301 | ||
15eca9aa BVA |
1302 | ########################################## |
1303 | # pread() probe | |
1304 | if test "$pread" != "yes" ; then | |
1305 | pread="no" | |
1306 | fi | |
1307 | cat > $TMPC << EOF | |
1308 | #include <unistd.h> | |
1309 | int main(int argc, char **argv) | |
1310 | { | |
1311 | return pread(0, NULL, 0, 0); | |
1312 | } | |
1313 | EOF | |
1314 | if compile_prog "" "" "pread"; then | |
1315 | pread="yes" | |
1316 | fi | |
1317 | print_config "pread()" "$pread" | |
1318 | ||
67bf9823 JA |
1319 | ########################################## |
1320 | # sync_file_range() probe | |
ca205a75 TK |
1321 | if test "$sync_file_range" != "yes" ; then |
1322 | sync_file_range="no" | |
1323 | fi | |
67bf9823 JA |
1324 | cat > $TMPC << EOF |
1325 | #include <stdio.h> | |
1326 | #include <unistd.h> | |
67bf9823 JA |
1327 | #include <fcntl.h> |
1328 | #include <linux/fs.h> | |
1329 | int main(int argc, char **argv) | |
1330 | { | |
1331 | unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE | | |
1332 | SYNC_FILE_RANGE_WAIT_AFTER; | |
1333 | return sync_file_range(0, 0, 0, flags); | |
1334 | } | |
1335 | EOF | |
1336 | if compile_prog "" "" "sync_file_range"; then | |
1337 | sync_file_range="yes" | |
1338 | fi | |
484b0b65 | 1339 | print_config "sync_file_range" "$sync_file_range" |
67bf9823 | 1340 | |
d9705059 BVA |
1341 | ########################################## |
1342 | # ASharedMemory_create() probe | |
1343 | if test "$ASharedMemory_create" != "yes" ; then | |
1344 | ASharedMemory_create="no" | |
1345 | fi | |
1346 | cat > $TMPC << EOF | |
1347 | #include <android/sharedmem.h> | |
1348 | int main(int argc, char **argv) | |
1349 | { | |
1350 | return ASharedMemory_create("", 0); | |
1351 | } | |
1352 | EOF | |
1353 | if compile_prog "" "" "ASharedMemory_create"; then | |
1354 | ASharedMemory_create="yes" | |
1355 | fi | |
1356 | print_config "ASharedMemory_create" "$ASharedMemory_create" | |
1357 | ||
67bf9823 JA |
1358 | ########################################## |
1359 | # ext4 move extent probe | |
ca205a75 TK |
1360 | if test "$ext4_me" != "yes" ; then |
1361 | ext4_me="no" | |
1362 | fi | |
67bf9823 JA |
1363 | cat > $TMPC << EOF |
1364 | #include <fcntl.h> | |
1365 | #include <sys/ioctl.h> | |
1366 | int main(int argc, char **argv) | |
1367 | { | |
1368 | struct move_extent me; | |
1369 | return ioctl(0, EXT4_IOC_MOVE_EXT, &me); | |
1370 | } | |
1371 | EOF | |
c7165b8d JA |
1372 | if compile_prog "" "" "ext4 move extent" ; then |
1373 | ext4_me="yes" | |
1374 | elif test $targetos = "Linux" ; then | |
1375 | # On Linux, just default to it on and let it error at runtime if we really | |
1376 | # don't have it. None of my updated systems have it defined, but it does | |
1377 | # work. Takes a while to bubble back. | |
67bf9823 JA |
1378 | ext4_me="yes" |
1379 | fi | |
484b0b65 | 1380 | print_config "EXT4 move extent" "$ext4_me" |
67bf9823 JA |
1381 | |
1382 | ########################################## | |
1383 | # splice probe | |
ca205a75 TK |
1384 | if test "$linux_splice" != "yes" ; then |
1385 | linux_splice="no" | |
1386 | fi | |
67bf9823 | 1387 | cat > $TMPC << EOF |
67bf9823 JA |
1388 | #include <stdio.h> |
1389 | #include <fcntl.h> | |
1390 | int main(int argc, char **argv) | |
1391 | { | |
1392 | return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK); | |
1393 | } | |
1394 | EOF | |
1395 | if compile_prog "" "" "linux splice"; then | |
1396 | linux_splice="yes" | |
1397 | fi | |
484b0b65 | 1398 | print_config "Linux splice(2)" "$linux_splice" |
67bf9823 | 1399 | |
67bf9823 JA |
1400 | ########################################## |
1401 | # libnuma probe | |
ca205a75 TK |
1402 | if test "$libnuma" != "yes" ; then |
1403 | libnuma="no" | |
1404 | fi | |
67bf9823 JA |
1405 | cat > $TMPC << EOF |
1406 | #include <numa.h> | |
1407 | int main(int argc, char **argv) | |
1408 | { | |
1409 | return numa_available(); | |
1410 | } | |
1411 | EOF | |
44462517 | 1412 | if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then |
67bf9823 JA |
1413 | libnuma="yes" |
1414 | LIBS="-lnuma $LIBS" | |
1415 | fi | |
484b0b65 | 1416 | print_config "libnuma" "$libnuma" |
67bf9823 | 1417 | |
50206d9b | 1418 | ########################################## |
ca205a75 | 1419 | # libnuma 2.x version API, initialize with "no" only if $libnuma is set to "yes" |
50206d9b JA |
1420 | if test "$libnuma" = "yes" ; then |
1421 | libnuma_v2="no" | |
1422 | cat > $TMPC << EOF | |
1423 | #include <numa.h> | |
1424 | int main(int argc, char **argv) | |
1425 | { | |
1426 | struct bitmask *mask = numa_parse_nodestring(NULL); | |
61bde962 | 1427 | return mask->size == 0; |
50206d9b JA |
1428 | } |
1429 | EOF | |
1430 | if compile_prog "" "" "libnuma api"; then | |
1431 | libnuma_v2="yes" | |
1432 | fi | |
484b0b65 | 1433 | print_config "libnuma v2" "$libnuma_v2" |
50206d9b JA |
1434 | fi |
1435 | ||
67bf9823 JA |
1436 | ########################################## |
1437 | # strsep() probe | |
ca205a75 TK |
1438 | if test "$strsep" != "yes" ; then |
1439 | strsep="no" | |
1440 | fi | |
67bf9823 JA |
1441 | cat > $TMPC << EOF |
1442 | #include <string.h> | |
1443 | int main(int argc, char **argv) | |
1444 | { | |
ae156be6 JA |
1445 | static char *string = "This is a string"; |
1446 | strsep(&string, "needle"); | |
67bf9823 JA |
1447 | return 0; |
1448 | } | |
1449 | EOF | |
1450 | if compile_prog "" "" "strsep"; then | |
1451 | strsep="yes" | |
1452 | fi | |
484b0b65 | 1453 | print_config "strsep" "$strsep" |
67bf9823 | 1454 | |
9ad8da82 JA |
1455 | ########################################## |
1456 | # strcasestr() probe | |
ca205a75 TK |
1457 | if test "$strcasestr" != "yes" ; then |
1458 | strcasestr="no" | |
1459 | fi | |
9ad8da82 JA |
1460 | cat > $TMPC << EOF |
1461 | #include <string.h> | |
1462 | int main(int argc, char **argv) | |
1463 | { | |
aa6738a5 | 1464 | return strcasestr(argv[0], argv[1]) != NULL; |
9ad8da82 JA |
1465 | } |
1466 | EOF | |
1467 | if compile_prog "" "" "strcasestr"; then | |
1468 | strcasestr="yes" | |
1469 | fi | |
484b0b65 | 1470 | print_config "strcasestr" "$strcasestr" |
9ad8da82 | 1471 | |
5ad7be56 KD |
1472 | ########################################## |
1473 | # strlcat() probe | |
ca205a75 TK |
1474 | if test "$strlcat" != "yes" ; then |
1475 | strlcat="no" | |
1476 | fi | |
5ad7be56 KD |
1477 | cat > $TMPC << EOF |
1478 | #include <string.h> | |
1479 | int main(int argc, char **argv) | |
1480 | { | |
1481 | static char dst[64]; | |
1482 | static char *string = "This is a string"; | |
1483 | memset(dst, 0, sizeof(dst)); | |
1484 | strlcat(dst, string, sizeof(dst)); | |
1485 | return 0; | |
1486 | } | |
1487 | EOF | |
1488 | if compile_prog "" "" "strlcat"; then | |
1489 | strlcat="yes" | |
1490 | fi | |
484b0b65 | 1491 | print_config "strlcat" "$strlcat" |
5ad7be56 | 1492 | |
67bf9823 JA |
1493 | ########################################## |
1494 | # getopt_long_only() probe | |
ca205a75 TK |
1495 | if test "$getopt_long_only" != "yes" ; then |
1496 | getopt_long_only="no" | |
1497 | fi | |
67bf9823 JA |
1498 | cat > $TMPC << EOF |
1499 | #include <unistd.h> | |
1500 | #include <stdio.h> | |
aa6738a5 | 1501 | #include <getopt.h> |
67bf9823 JA |
1502 | int main(int argc, char **argv) |
1503 | { | |
d24ff97d | 1504 | int c = getopt_long_only(argc, argv, "", NULL, NULL); |
67bf9823 JA |
1505 | return c; |
1506 | } | |
1507 | EOF | |
1508 | if compile_prog "" "" "getopt_long_only"; then | |
1509 | getopt_long_only="yes" | |
1510 | fi | |
484b0b65 | 1511 | print_config "getopt_long_only()" "$getopt_long_only" |
67bf9823 JA |
1512 | |
1513 | ########################################## | |
1514 | # inet_aton() probe | |
ca205a75 TK |
1515 | if test "$inet_aton" != "yes" ; then |
1516 | inet_aton="no" | |
1517 | fi | |
67bf9823 | 1518 | cat > $TMPC << EOF |
a932a2cf BVA |
1519 | #ifdef _WIN32 |
1520 | #include <winsock2.h> | |
1521 | #else | |
67bf9823 JA |
1522 | #include <sys/socket.h> |
1523 | #include <arpa/inet.h> | |
a932a2cf | 1524 | #endif |
67bf9823 JA |
1525 | #include <stdio.h> |
1526 | int main(int argc, char **argv) | |
1527 | { | |
1528 | struct in_addr in; | |
1529 | return inet_aton(NULL, &in); | |
1530 | } | |
1531 | EOF | |
1532 | if compile_prog "" "" "inet_aton"; then | |
1533 | inet_aton="yes" | |
1534 | fi | |
484b0b65 | 1535 | print_config "inet_aton" "$inet_aton" |
67bf9823 JA |
1536 | |
1537 | ########################################## | |
1538 | # socklen_t probe | |
ca205a75 TK |
1539 | if test "$socklen_t" != "yes" ; then |
1540 | socklen_t="no" | |
1541 | fi | |
67bf9823 | 1542 | cat > $TMPC << EOF |
a932a2cf BVA |
1543 | #ifdef _WIN32 |
1544 | #include <winsock2.h> | |
1545 | #include <ws2tcpip.h> | |
1546 | #else | |
f6482613 | 1547 | #include <sys/socket.h> |
a932a2cf | 1548 | #endif |
67bf9823 JA |
1549 | int main(int argc, char **argv) |
1550 | { | |
1551 | socklen_t len = 0; | |
1552 | return len; | |
1553 | } | |
1554 | EOF | |
1555 | if compile_prog "" "" "socklen_t"; then | |
1556 | socklen_t="yes" | |
1557 | fi | |
484b0b65 | 1558 | print_config "socklen_t" "$socklen_t" |
67bf9823 JA |
1559 | |
1560 | ########################################## | |
1561 | # Whether or not __thread is supported for TLS | |
ca205a75 TK |
1562 | if test "$tls_thread" != "yes" ; then |
1563 | tls_thread="no" | |
1564 | fi | |
699bc19b VF |
1565 | if test "$tls_check" != "no"; then |
1566 | cat > $TMPC << EOF | |
67bf9823 | 1567 | #include <stdio.h> |
aa6738a5 | 1568 | static __thread int ret; |
67bf9823 JA |
1569 | int main(int argc, char **argv) |
1570 | { | |
1571 | return ret; | |
1572 | } | |
1573 | EOF | |
1574 | if compile_prog "" "" "__thread"; then | |
1575 | tls_thread="yes" | |
1576 | fi | |
699bc19b | 1577 | fi |
484b0b65 | 1578 | print_config "__thread" "$tls_thread" |
67bf9823 | 1579 | |
91f94d5b | 1580 | ########################################## |
2639f056 | 1581 | # Check if we have required gtk/glib support for gfio |
ca205a75 TK |
1582 | if test "$gfio" != "yes" ; then |
1583 | gfio="no" | |
1584 | fi | |
ebec2094 | 1585 | if test "$gfio_check" = "yes" ; then |
91f94d5b JA |
1586 | cat > $TMPC << EOF |
1587 | #include <glib.h> | |
1588 | #include <cairo.h> | |
1589 | #include <gtk/gtk.h> | |
1590 | int main(void) | |
1591 | { | |
1592 | gdk_threads_enter(); | |
91f94d5b | 1593 | gdk_threads_leave(); |
b7a99316 | 1594 | |
ef2b61aa | 1595 | return GTK_CHECK_VERSION(2, 18, 0) ? 0 : 1; /* 0 on success */ |
91f94d5b JA |
1596 | } |
1597 | EOF | |
1ee0469f | 1598 | GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0) |
86719845 JA |
1599 | ORG_LDFLAGS=$LDFLAGS |
1600 | LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g) | |
91f94d5b JA |
1601 | if test "$?" != "0" ; then |
1602 | echo "configure: gtk and gthread not found" | |
1603 | exit 1 | |
1604 | fi | |
1ee0469f | 1605 | GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0) |
91f94d5b JA |
1606 | if test "$?" != "0" ; then |
1607 | echo "configure: gtk and gthread not found" | |
1608 | exit 1 | |
1609 | fi | |
162f8c2a DF |
1610 | gfio="yes" |
1611 | if check_min_lib_version gtk+-2.0 2.18.0 "gfio"; then | |
31ce8438 | 1612 | if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then |
86719845 | 1613 | GFIO_LIBS="$LIBS $GTK_LIBS" |
b7a99316 JA |
1614 | CFLAGS="$CFLAGS $GTK_CFLAGS" |
1615 | else | |
31ce8438 | 1616 | echo "Please install gtk and gdk libraries" |
b7a99316 JA |
1617 | gfio="no" |
1618 | fi | |
162f8c2a DF |
1619 | else |
1620 | gfio="no" | |
91f94d5b | 1621 | fi |
86719845 | 1622 | LDFLAGS=$ORG_LDFLAGS |
91f94d5b JA |
1623 | fi |
1624 | ||
ebec2094 | 1625 | if test "$gfio_check" = "yes" ; then |
484b0b65 | 1626 | print_config "gtk 2.18 or higher" "$gfio" |
ebec2094 | 1627 | fi |
91f94d5b | 1628 | |
bda92394 | 1629 | ########################################## |
44404c5a | 1630 | # Check whether we have getrusage(RUSAGE_THREAD) |
ca205a75 TK |
1631 | if test "$rusage_thread" != "yes" ; then |
1632 | rusage_thread="no" | |
1633 | fi | |
44404c5a JA |
1634 | cat > $TMPC << EOF |
1635 | #include <sys/time.h> | |
1636 | #include <sys/resource.h> | |
1637 | int main(int argc, char **argv) | |
1638 | { | |
1639 | struct rusage ru; | |
1640 | getrusage(RUSAGE_THREAD, &ru); | |
1641 | return 0; | |
1642 | } | |
1643 | EOF | |
1644 | if compile_prog "" "" "RUSAGE_THREAD"; then | |
1645 | rusage_thread="yes" | |
1646 | fi | |
484b0b65 | 1647 | print_config "RUSAGE_THREAD" "$rusage_thread" |
44404c5a | 1648 | |
7e09a9f1 JA |
1649 | ########################################## |
1650 | # Check whether we have SCHED_IDLE | |
ca205a75 TK |
1651 | if test "$sched_idle" != "yes" ; then |
1652 | sched_idle="no" | |
1653 | fi | |
7e09a9f1 JA |
1654 | cat > $TMPC << EOF |
1655 | #include <sched.h> | |
1656 | int main(int argc, char **argv) | |
1657 | { | |
e9aab3c9 BVA |
1658 | struct sched_param p = { }; |
1659 | ||
7e09a9f1 JA |
1660 | return sched_setscheduler(0, SCHED_IDLE, &p); |
1661 | } | |
1662 | EOF | |
1663 | if compile_prog "" "" "SCHED_IDLE"; then | |
1664 | sched_idle="yes" | |
1665 | fi | |
484b0b65 | 1666 | print_config "SCHED_IDLE" "$sched_idle" |
7e09a9f1 | 1667 | |
1eafa37a JA |
1668 | ########################################## |
1669 | # Check whether we have TCP_NODELAY | |
ca205a75 TK |
1670 | if test "$tcp_nodelay" != "yes" ; then |
1671 | tcp_nodelay="no" | |
1672 | fi | |
1eafa37a | 1673 | cat > $TMPC << EOF |
a932a2cf BVA |
1674 | #ifdef _WIN32 |
1675 | #include <winsock2.h> | |
1676 | #else | |
1eafa37a JA |
1677 | #include <stdio.h> |
1678 | #include <sys/types.h> | |
1679 | #include <sys/socket.h> | |
1680 | #include <netinet/tcp.h> | |
a932a2cf | 1681 | #endif |
1eafa37a JA |
1682 | int main(int argc, char **argv) |
1683 | { | |
1684 | return getsockopt(0, 0, TCP_NODELAY, NULL, NULL); | |
1685 | } | |
1686 | EOF | |
1687 | if compile_prog "" "" "TCP_NODELAY"; then | |
1688 | tcp_nodelay="yes" | |
a932a2cf BVA |
1689 | elif compile_prog "" "-lws2_32" "TCP_NODELAY"; then |
1690 | tcp_nodelay="yes" | |
1691 | LIBS="$LIBS -lws2_32" | |
1eafa37a | 1692 | fi |
484b0b65 | 1693 | print_config "TCP_NODELAY" "$tcp_nodelay" |
1eafa37a | 1694 | |
80cc242a MP |
1695 | ########################################## |
1696 | # Check whether we have vsock | |
1697 | if test "$vsock" != "yes" ; then | |
1698 | vsock="no" | |
1699 | fi | |
1700 | cat > $TMPC << EOF | |
1701 | #include <sys/types.h> | |
1702 | #include <sys/socket.h> | |
1703 | #include <linux/vm_sockets.h> | |
1704 | int main(int argc, char **argv) | |
1705 | { | |
1706 | return socket(AF_VSOCK, SOCK_STREAM, 0); | |
1707 | } | |
1708 | EOF | |
1709 | if compile_prog "" "" "vsock"; then | |
1710 | vsock="yes" | |
1711 | fi | |
1712 | print_config "vsock" "$vsock" | |
1713 | ||
1008602c JA |
1714 | ########################################## |
1715 | # Check whether we have SO_SNDBUF | |
ca205a75 TK |
1716 | if test "$window_size" != "yes" ; then |
1717 | window_size="no" | |
1718 | fi | |
1008602c | 1719 | cat > $TMPC << EOF |
a932a2cf BVA |
1720 | #ifdef _WIN32 |
1721 | #include <winsock2.h> | |
1722 | #else | |
1008602c JA |
1723 | #include <stdio.h> |
1724 | #include <sys/types.h> | |
1725 | #include <sys/socket.h> | |
1726 | #include <netinet/tcp.h> | |
a932a2cf | 1727 | #endif |
1008602c JA |
1728 | int main(int argc, char **argv) |
1729 | { | |
1730 | setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0); | |
1731 | setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0); | |
1732 | } | |
1733 | EOF | |
1734 | if compile_prog "" "" "SO_SNDBUF"; then | |
1735 | window_size="yes" | |
a932a2cf BVA |
1736 | elif compile_prog "" "-lws2_32" "SO_SNDBUF"; then |
1737 | window_size="yes" | |
1738 | LIBS="$LIBS -lws2_32" | |
1008602c | 1739 | fi |
484b0b65 | 1740 | print_config "Net engine window_size" "$window_size" |
1008602c | 1741 | |
e5f34d95 JA |
1742 | ########################################## |
1743 | # Check whether we have TCP_MAXSEG | |
ca205a75 TK |
1744 | if test "$mss" != "yes" ; then |
1745 | mss="no" | |
1746 | fi | |
e5f34d95 | 1747 | cat > $TMPC << EOF |
a932a2cf BVA |
1748 | #ifdef _WIN32 |
1749 | #include <winsock2.h> | |
1750 | #else | |
e5f34d95 JA |
1751 | #include <stdio.h> |
1752 | #include <sys/types.h> | |
1753 | #include <sys/socket.h> | |
1754 | #include <netinet/tcp.h> | |
1755 | #include <arpa/inet.h> | |
1756 | #include <netinet/in.h> | |
a932a2cf | 1757 | #endif |
e5f34d95 JA |
1758 | int main(int argc, char **argv) |
1759 | { | |
1760 | return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0); | |
1761 | } | |
1762 | EOF | |
1763 | if compile_prog "" "" "TCP_MAXSEG"; then | |
1764 | mss="yes" | |
a932a2cf BVA |
1765 | elif compile_prog "" "-lws2_32" "TCP_MAXSEG"; then |
1766 | mss="yes" | |
1767 | LIBS="$LIBS -lws2_32" | |
e5f34d95 | 1768 | fi |
484b0b65 | 1769 | print_config "TCP_MAXSEG" "$mss" |
e5f34d95 | 1770 | |
38b9354a JA |
1771 | ########################################## |
1772 | # Check whether we have RLIMIT_MEMLOCK | |
ca205a75 TK |
1773 | if test "$rlimit_memlock" != "yes" ; then |
1774 | rlimit_memlock="no" | |
1775 | fi | |
38b9354a JA |
1776 | cat > $TMPC << EOF |
1777 | #include <sys/time.h> | |
1778 | #include <sys/resource.h> | |
1779 | int main(int argc, char **argv) | |
1780 | { | |
1781 | struct rlimit rl; | |
1782 | return getrlimit(RLIMIT_MEMLOCK, &rl); | |
1783 | } | |
1784 | EOF | |
1785 | if compile_prog "" "" "RLIMIT_MEMLOCK"; then | |
1786 | rlimit_memlock="yes" | |
1787 | fi | |
484b0b65 | 1788 | print_config "RLIMIT_MEMLOCK" "$rlimit_memlock" |
38b9354a | 1789 | |
07fc0acd JA |
1790 | ########################################## |
1791 | # Check whether we have pwritev/preadv | |
ca205a75 TK |
1792 | if test "$pwritev" != "yes" ; then |
1793 | pwritev="no" | |
1794 | fi | |
07fc0acd JA |
1795 | cat > $TMPC << EOF |
1796 | #include <stdio.h> | |
1797 | #include <sys/uio.h> | |
1798 | int main(int argc, char **argv) | |
1799 | { | |
e9aab3c9 BVA |
1800 | struct iovec iov[1] = { }; |
1801 | ||
1802 | return pwritev(0, iov, 1, 0) + preadv(0, iov, 1, 0); | |
07fc0acd JA |
1803 | } |
1804 | EOF | |
1805 | if compile_prog "" "" "pwritev"; then | |
1806 | pwritev="yes" | |
1807 | fi | |
484b0b65 | 1808 | print_config "pwritev/preadv" "$pwritev" |
07fc0acd | 1809 | |
2cafffbe JA |
1810 | ########################################## |
1811 | # Check whether we have pwritev2/preadv2 | |
ca205a75 TK |
1812 | if test "$pwritev2" != "yes" ; then |
1813 | pwritev2="no" | |
1814 | fi | |
2cafffbe JA |
1815 | cat > $TMPC << EOF |
1816 | #include <stdio.h> | |
1817 | #include <sys/uio.h> | |
1818 | int main(int argc, char **argv) | |
1819 | { | |
e9aab3c9 BVA |
1820 | struct iovec iov[1] = { }; |
1821 | ||
1822 | return pwritev2(0, iov, 1, 0, 0) + preadv2(0, iov, 1, 0, 0); | |
2cafffbe JA |
1823 | } |
1824 | EOF | |
1825 | if compile_prog "" "" "pwritev2"; then | |
1826 | pwritev2="yes" | |
1827 | fi | |
484b0b65 | 1828 | print_config "pwritev2/preadv2" "$pwritev2" |
2cafffbe | 1829 | |
ecad55e9 JA |
1830 | ########################################## |
1831 | # Check whether we have the required functions for ipv6 | |
ca205a75 TK |
1832 | if test "$ipv6" != "yes" ; then |
1833 | ipv6="no" | |
1834 | fi | |
ecad55e9 | 1835 | cat > $TMPC << EOF |
a932a2cf BVA |
1836 | #ifdef _WIN32 |
1837 | #include <winsock2.h> | |
1838 | #include <ws2tcpip.h> | |
1839 | #else | |
ecad55e9 JA |
1840 | #include <sys/types.h> |
1841 | #include <sys/socket.h> | |
d219028d | 1842 | #include <netinet/in.h> |
ecad55e9 | 1843 | #include <netdb.h> |
a932a2cf | 1844 | #endif |
ecad55e9 JA |
1845 | #include <stdio.h> |
1846 | int main(int argc, char **argv) | |
1847 | { | |
e9aab3c9 BVA |
1848 | struct addrinfo hints = { }; |
1849 | struct in6_addr addr = in6addr_any; | |
ecad55e9 JA |
1850 | int ret; |
1851 | ||
1852 | ret = getaddrinfo(NULL, NULL, &hints, NULL); | |
1853 | freeaddrinfo(NULL); | |
e9aab3c9 BVA |
1854 | printf("%s %d\n", gai_strerror(ret), addr.s6_addr[0]); |
1855 | ||
ecad55e9 JA |
1856 | return 0; |
1857 | } | |
1858 | EOF | |
1859 | if compile_prog "" "" "ipv6"; then | |
1860 | ipv6="yes" | |
1861 | fi | |
484b0b65 | 1862 | print_config "IPv6 helpers" "$ipv6" |
07fc0acd | 1863 | |
c2f6a13d LMB |
1864 | ########################################## |
1865 | # check for http | |
1866 | if test "$http" != "yes" ; then | |
1867 | http="no" | |
1868 | fi | |
9ee669fa DD |
1869 | # check for openssl >= 1.1.0, which uses an opaque HMAC_CTX pointer |
1870 | cat > $TMPC << EOF | |
1871 | #include <curl/curl.h> | |
1872 | #include <openssl/hmac.h> | |
1873 | ||
1874 | int main(int argc, char **argv) | |
1875 | { | |
1876 | CURL *curl; | |
1877 | HMAC_CTX *ctx; | |
1878 | ||
1879 | curl = curl_easy_init(); | |
1880 | curl_easy_cleanup(curl); | |
1881 | ||
1882 | ctx = HMAC_CTX_new(); | |
1883 | HMAC_CTX_reset(ctx); | |
1884 | HMAC_CTX_free(ctx); | |
1885 | return 0; | |
1886 | } | |
1887 | EOF | |
1888 | # openssl < 1.1.0 uses the HMAC_CTX type directly | |
1889 | cat > $TMPC2 << EOF | |
1890 | #include <curl/curl.h> | |
1891 | #include <openssl/hmac.h> | |
1892 | ||
1893 | int main(int argc, char **argv) | |
1894 | { | |
1895 | CURL *curl; | |
1896 | HMAC_CTX ctx; | |
1897 | ||
1898 | curl = curl_easy_init(); | |
1899 | curl_easy_cleanup(curl); | |
1900 | ||
1901 | HMAC_CTX_init(&ctx); | |
1902 | HMAC_CTX_cleanup(&ctx); | |
1903 | return 0; | |
1904 | } | |
1905 | EOF | |
1906 | if test "$disable_http" != "yes"; then | |
1907 | HTTP_LIBS="-lcurl -lssl -lcrypto" | |
1908 | if compile_prog "" "$HTTP_LIBS" "curl-new-ssl"; then | |
b61a5f46 | 1909 | output_sym "CONFIG_HAVE_OPAQUE_HMAC_CTX" |
9ee669fa | 1910 | http="yes" |
9ee669fa DD |
1911 | elif mv $TMPC2 $TMPC && compile_prog "" "$HTTP_LIBS" "curl-old-ssl"; then |
1912 | http="yes" | |
0290c589 | 1913 | fi |
c2f6a13d LMB |
1914 | fi |
1915 | print_config "http engine" "$http" | |
1916 | ||
d5f9b0ea IF |
1917 | ########################################## |
1918 | # check for rados | |
1919 | if test "$rados" != "yes" ; then | |
1920 | rados="no" | |
1921 | fi | |
1922 | cat > $TMPC << EOF | |
1923 | #include <rados/librados.h> | |
1924 | ||
1925 | int main(int argc, char **argv) | |
1926 | { | |
1927 | rados_t cluster; | |
1928 | rados_ioctx_t io_ctx; | |
1929 | const char cluster_name[] = "ceph"; | |
1930 | const char user_name[] = "client.admin"; | |
1931 | const char pool[] = "rados"; | |
1932 | ||
1933 | /* The rados_create2 signature required was only introduced in ceph 0.65 */ | |
1934 | rados_create2(&cluster, cluster_name, user_name, 0); | |
1935 | rados_ioctx_create(cluster, pool, &io_ctx); | |
1936 | ||
1937 | return 0; | |
1938 | } | |
1939 | EOF | |
1940 | if test "$disable_rados" != "yes" && compile_prog "" "-lrados" "rados"; then | |
d5f9b0ea IF |
1941 | rados="yes" |
1942 | fi | |
1943 | print_config "Rados engine" "$rados" | |
1944 | ||
fc5c0345 DG |
1945 | ########################################## |
1946 | # check for rbd | |
ca205a75 TK |
1947 | if test "$rbd" != "yes" ; then |
1948 | rbd="no" | |
1949 | fi | |
fc5c0345 DG |
1950 | cat > $TMPC << EOF |
1951 | #include <rbd/librbd.h> | |
1952 | ||
1953 | int main(int argc, char **argv) | |
1954 | { | |
fc5c0345 DG |
1955 | rados_t cluster; |
1956 | rados_ioctx_t io_ctx; | |
fb9bc6e3 SW |
1957 | const char cluster_name[] = "ceph"; |
1958 | const char user_name[] = "client.admin"; | |
fc5c0345 | 1959 | const char pool[] = "rbd"; |
fc5c0345 | 1960 | int major, minor, extra; |
fc5c0345 | 1961 | |
fb9bc6e3 SW |
1962 | rbd_version(&major, &minor, &extra); |
1963 | /* The rados_create2 signature required was only introduced in ceph 0.65 */ | |
1964 | rados_create2(&cluster, cluster_name, user_name, 0); | |
fc5c0345 | 1965 | rados_ioctx_create(cluster, pool, &io_ctx); |
fb9bc6e3 | 1966 | |
fc5c0345 DG |
1967 | return 0; |
1968 | } | |
1969 | EOF | |
ce18290e | 1970 | if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then |
fc5c0345 DG |
1971 | rbd="yes" |
1972 | fi | |
484b0b65 | 1973 | print_config "Rados Block Device engine" "$rbd" |
fc5c0345 | 1974 | |
53b6c979 PL |
1975 | ########################################## |
1976 | # check for rbd_poll | |
ca205a75 TK |
1977 | if test "$rbd_poll" != "yes" ; then |
1978 | rbd_poll="no" | |
1979 | fi | |
53b6c979 PL |
1980 | if test "$rbd" = "yes"; then |
1981 | cat > $TMPC << EOF | |
1982 | #include <rbd/librbd.h> | |
1983 | #include <sys/eventfd.h> | |
1984 | ||
1985 | int main(int argc, char **argv) | |
1986 | { | |
1987 | rbd_image_t image; | |
1988 | rbd_completion_t comp; | |
1989 | ||
1990 | int fd = eventfd(0, EFD_NONBLOCK); | |
1991 | rbd_set_image_notification(image, fd, EVENT_TYPE_EVENTFD); | |
1992 | rbd_poll_io_events(image, comp, 1); | |
1993 | ||
1994 | return 0; | |
1995 | } | |
1996 | EOF | |
1997 | if compile_prog "" "-lrbd -lrados" "rbd"; then | |
1998 | rbd_poll="yes" | |
1999 | fi | |
484b0b65 | 2000 | print_config "rbd_poll" "$rbd_poll" |
53b6c979 PL |
2001 | fi |
2002 | ||
903b2812 | 2003 | ########################################## |
6266dd72 | 2004 | # check for rbd_invalidate_cache() |
ca205a75 TK |
2005 | if test "$rbd_inval" != "yes" ; then |
2006 | rbd_inval="no" | |
2007 | fi | |
903b2812 JA |
2008 | if test "$rbd" = "yes"; then |
2009 | cat > $TMPC << EOF | |
2010 | #include <rbd/librbd.h> | |
2011 | ||
2012 | int main(int argc, char **argv) | |
2013 | { | |
2014 | rbd_image_t image; | |
2015 | ||
2016 | return rbd_invalidate_cache(image); | |
2017 | } | |
2018 | EOF | |
2019 | if compile_prog "" "-lrbd -lrados" "rbd"; then | |
2020 | rbd_inval="yes" | |
2021 | fi | |
484b0b65 | 2022 | print_config "rbd_invalidate_cache" "$rbd_inval" |
903b2812 JA |
2023 | fi |
2024 | ||
2e802282 JA |
2025 | ########################################## |
2026 | # Check whether we have setvbuf | |
ca205a75 TK |
2027 | if test "$setvbuf" != "yes" ; then |
2028 | setvbuf="no" | |
2029 | fi | |
2e802282 JA |
2030 | cat > $TMPC << EOF |
2031 | #include <stdio.h> | |
2032 | int main(int argc, char **argv) | |
2033 | { | |
2034 | FILE *f = NULL; | |
2035 | char buf[80]; | |
2036 | setvbuf(f, buf, _IOFBF, sizeof(buf)); | |
2037 | return 0; | |
2038 | } | |
2039 | EOF | |
2040 | if compile_prog "" "" "setvbuf"; then | |
2041 | setvbuf="yes" | |
2042 | fi | |
484b0b65 | 2043 | print_config "setvbuf" "$setvbuf" |
fc5c0345 | 2044 | |
bda92394 | 2045 | ########################################## |
6e7d7dfb | 2046 | # check for gfapi |
ca205a75 TK |
2047 | if test "$gfapi" != "yes" ; then |
2048 | gfapi="no" | |
2049 | fi | |
6e7d7dfb | 2050 | cat > $TMPC << EOF |
2051 | #include <glusterfs/api/glfs.h> | |
2052 | ||
2053 | int main(int argc, char **argv) | |
2054 | { | |
6e7d7dfb | 2055 | glfs_t *g = glfs_new("foo"); |
2056 | ||
2057 | return 0; | |
2058 | } | |
2059 | EOF | |
ce18290e | 2060 | if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then |
6e7d7dfb | 2061 | gfapi="yes" |
2062 | fi | |
484b0b65 | 2063 | print_config "Gluster API engine" "$gfapi" |
6e7d7dfb | 2064 | |
6fa14b99 | 2065 | ########################################## |
ca205a75 | 2066 | # check for gfapi fadvise support, initialize with "no" only if $gfapi is set to "yes" |
6876c98c | 2067 | if test "$gfapi" = "yes" ; then |
6fa14b99 | 2068 | gf_fadvise="no" |
2069 | cat > $TMPC << EOF | |
2070 | #include <glusterfs/api/glfs.h> | |
2071 | ||
2072 | int main(int argc, char **argv) | |
2073 | { | |
2074 | struct glfs_fd *fd; | |
2075 | int ret = glfs_fadvise(fd, 0, 0, 1); | |
2076 | ||
2077 | return 0; | |
2078 | } | |
2079 | EOF | |
6fa14b99 | 2080 | if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then |
2081 | gf_fadvise="yes" | |
2082 | fi | |
484b0b65 | 2083 | print_config "Gluster API use fadvise" "$gf_fadvise" |
6876c98c JA |
2084 | fi |
2085 | ||
ce4d13ca JA |
2086 | ########################################## |
2087 | # check for newer gfapi | |
2088 | if test "$gfapi" = "yes" ; then | |
2089 | gf_new="no" | |
2090 | cat > $TMPC << EOF | |
2091 | #include <glusterfs/api/glfs.h> | |
2092 | ||
2093 | int main(int argc, char **argv) | |
2094 | { | |
2095 | return glfs_fsync(NULL, NULL, NULL) && glfs_ftruncate(NULL, 0, NULL, NULL); | |
2096 | } | |
2097 | EOF | |
2098 | if compile_prog "" "-lgfapi -lglusterfs" "gf new api"; then | |
2099 | gf_new="yes" | |
2100 | fi | |
2101 | print_config "Gluster new API" "$gf_new" | |
2102 | fi | |
2103 | ||
6876c98c JA |
2104 | ########################################## |
2105 | # check for gfapi trim support | |
ca205a75 TK |
2106 | if test "$gf_trim" != "yes" ; then |
2107 | gf_trim="no" | |
2108 | fi | |
6876c98c JA |
2109 | if test "$gfapi" = "yes" ; then |
2110 | cat > $TMPC << EOF | |
2111 | #include <glusterfs/api/glfs.h> | |
2112 | ||
2113 | int main(int argc, char **argv) | |
2114 | { | |
2115 | return glfs_discard_async(NULL, 0, 0); | |
2116 | } | |
2117 | EOF | |
2118 | if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then | |
2119 | gf_trim="yes" | |
2120 | fi | |
484b0b65 | 2121 | print_config "Gluster API trim support" "$gf_trim" |
6876c98c | 2122 | fi |
fc5c0345 | 2123 | |
81795ce3 CE |
2124 | ########################################## |
2125 | # Check if we support stckf on s390 | |
ca205a75 TK |
2126 | if test "$s390_z196_facilities" != "yes" ; then |
2127 | s390_z196_facilities="no" | |
2128 | fi | |
81795ce3 CE |
2129 | cat > $TMPC << EOF |
2130 | #define STFLE_BITS_Z196 45 /* various z196 facilities ... */ | |
2131 | int main(int argc, char **argv) | |
2132 | { | |
2133 | /* We want just 1 double word to be returned. */ | |
2134 | register unsigned long reg0 asm("0") = 0; | |
2135 | unsigned long stfle_bits; | |
2136 | asm volatile(".machine push" "\n\t" | |
2137 | ".machine \"z9-109\"" "\n\t" | |
2138 | "stfle %0" "\n\t" | |
2139 | ".machine pop" "\n" | |
2140 | : "=QS" (stfle_bits), "+d" (reg0) | |
2141 | : : "cc"); | |
2142 | ||
2143 | if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0) | |
2144 | return 0; | |
2145 | else | |
2146 | return -1; | |
2147 | } | |
2148 | EOF | |
2149 | if compile_prog "" "" "s390_z196_facilities"; then | |
2150 | $TMPE | |
6a2c9363 | 2151 | if [ $? -eq 0 ]; then |
81795ce3 CE |
2152 | s390_z196_facilities="yes" |
2153 | fi | |
2154 | fi | |
484b0b65 | 2155 | print_config "s390_z196_facilities" "$s390_z196_facilities" |
1b10477b MM |
2156 | |
2157 | ########################################## | |
2158 | # Check if we have required environment variables configured for libhdfs | |
2159 | if test "$libhdfs" = "yes" ; then | |
2160 | hdfs_conf_error=0 | |
2161 | if test "$JAVA_HOME" = "" ; then | |
2162 | echo "configure: JAVA_HOME should be defined to jdk/jvm path" | |
2163 | hdfs_conf_error=1 | |
2164 | fi | |
2165 | if test "$FIO_LIBHDFS_INCLUDE" = "" ; then | |
9ed87094 | 2166 | echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs include path" |
1b10477b MM |
2167 | hdfs_conf_error=1 |
2168 | fi | |
2169 | if test "$FIO_LIBHDFS_LIB" = "" ; then | |
2170 | echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path" | |
2171 | hdfs_conf_error=1 | |
2172 | fi | |
2173 | if test "$hdfs_conf_error" = "1" ; then | |
d490af7f | 2174 | feature_not_found "libhdfs" "" |
1b10477b | 2175 | fi |
247e5436 JA |
2176 | FIO_HDFS_CPU=$cpu |
2177 | if test "$FIO_HDFS_CPU" = "x86_64" ; then | |
2178 | FIO_HDFS_CPU="amd64" | |
2179 | fi | |
1b10477b | 2180 | fi |
484b0b65 | 2181 | print_config "HDFS engine" "$libhdfs" |
1b10477b | 2182 | |
b8116a87 DE |
2183 | ########################################## |
2184 | # Check whether we have MTD | |
ca205a75 TK |
2185 | if test "$mtd" != "yes" ; then |
2186 | mtd="no" | |
2187 | fi | |
b8116a87 | 2188 | cat > $TMPC << EOF |
0e1c454a | 2189 | #include <string.h> |
b8116a87 DE |
2190 | #include <mtd/mtd-user.h> |
2191 | #include <sys/ioctl.h> | |
2192 | int main(int argc, char **argv) | |
2193 | { | |
0e1c454a | 2194 | struct mtd_write_req ops; |
b8116a87 | 2195 | struct mtd_info_user info; |
0e1c454a | 2196 | memset(&ops, 0, sizeof(ops)); |
400cd0ff | 2197 | info.type = MTD_MLCNANDFLASH; |
b8116a87 DE |
2198 | return ioctl(0, MEMGETINFO, &info); |
2199 | } | |
2200 | EOF | |
2201 | if compile_prog "" "" "mtd"; then | |
2202 | mtd="yes" | |
2203 | fi | |
484b0b65 | 2204 | print_config "MTD" "$mtd" |
b8116a87 | 2205 | |
3ee2a3c1 DJ |
2206 | ########################################## |
2207 | # Check whether we have libpmem | |
ca205a75 TK |
2208 | if test "$libpmem" != "yes" ; then |
2209 | libpmem="no" | |
2210 | fi | |
3ee2a3c1 DJ |
2211 | cat > $TMPC << EOF |
2212 | #include <libpmem.h> | |
67719e13 | 2213 | #include <stdlib.h> |
3ee2a3c1 DJ |
2214 | int main(int argc, char **argv) |
2215 | { | |
e9aab3c9 | 2216 | return pmem_is_pmem(NULL, 0); |
3ee2a3c1 DJ |
2217 | } |
2218 | EOF | |
2219 | if compile_prog "" "-lpmem" "libpmem"; then | |
2220 | libpmem="yes" | |
2221 | fi | |
484b0b65 | 2222 | print_config "libpmem" "$libpmem" |
3ee2a3c1 | 2223 | |
67719e13 ÅS |
2224 | ########################################## |
2225 | # Check whether libpmem's version >= 1.5 | |
2226 | if test "$libpmem1_5" != "yes" ; then | |
2227 | libpmem1_5="no" | |
2228 | fi | |
2229 | if test "$libpmem" = "yes"; then | |
2230 | cat > $TMPC << EOF | |
2231 | #include <libpmem.h> | |
2232 | #include <stdlib.h> | |
2233 | int main(int argc, char **argv) | |
2234 | { | |
e9aab3c9 | 2235 | pmem_memcpy(NULL, NULL, 0, 0); |
67719e13 ÅS |
2236 | return 0; |
2237 | } | |
2238 | EOF | |
2239 | if compile_prog "" "-lpmem" "libpmem1_5"; then | |
2240 | libpmem1_5="yes" | |
2241 | fi | |
2242 | fi | |
2243 | print_config "libpmem1_5" "$libpmem1_5" | |
2244 | ||
8fabefc1 KS |
2245 | ########################################## |
2246 | # Check whether we have libpmem2 | |
2247 | if test "$libpmem2" != "yes" ; then | |
2248 | libpmem2="no" | |
2249 | fi | |
2250 | cat > $TMPC << EOF | |
2251 | #include <libpmem2.h> | |
2252 | int main(int argc, char **argv) | |
2253 | { | |
2254 | struct pmem2_config *cfg; | |
2255 | pmem2_config_new(&cfg); | |
2256 | pmem2_config_delete(&cfg); | |
2257 | return 0; | |
2258 | } | |
2259 | EOF | |
2260 | if compile_prog "" "-lpmem2" "libpmem2"; then | |
2261 | libpmem2="yes" | |
2262 | fi | |
2263 | print_config "libpmem2" "$libpmem2" | |
2264 | ||
7a3a166c VF |
2265 | # Choose libpmem-based ioengines |
2266 | if test "$libpmem" = "yes" && test "$disable_pmem" = "no"; then | |
2267 | devdax="yes" | |
2268 | if test "$libpmem1_5" = "yes"; then | |
2269 | pmem="yes" | |
2270 | fi | |
2271 | fi | |
2272 | ||
cbb15e42 DJ |
2273 | ########################################## |
2274 | # Report whether dev-dax engine is enabled | |
363a5f65 | 2275 | print_config "PMDK dev-dax engine" "$devdax" |
cbb15e42 | 2276 | |
ae0db592 TI |
2277 | ########################################## |
2278 | # Report whether libpmem engine is enabled | |
363a5f65 | 2279 | print_config "PMDK libpmem engine" "$pmem" |
ae0db592 | 2280 | |
a40e7a59 GB |
2281 | ########################################## |
2282 | # Check whether we support DDN's IME | |
2283 | if test "$libime" != "yes" ; then | |
2284 | libime="no" | |
2285 | fi | |
2286 | cat > $TMPC << EOF | |
2287 | #include <ime_native.h> | |
2288 | int main(int argc, char **argv) | |
2289 | { | |
2290 | int rc; | |
2291 | ime_native_init(); | |
2292 | rc = ime_native_finalize(); | |
2293 | return 0; | |
2294 | } | |
2295 | EOF | |
2296 | if compile_prog "-I${ime_path}/include" "-L${ime_path}/lib -lim_client" "libime"; then | |
2297 | libime="yes" | |
2298 | CFLAGS="-I${ime_path}/include $CFLAGS" | |
2299 | LDFLAGS="-Wl,-rpath ${ime_path}/lib -L${ime_path}/lib $LDFLAGS" | |
2300 | LIBS="-lim_client $LIBS" | |
2301 | fi | |
2302 | print_config "DDN's Infinite Memory Engine" "$libime" | |
2303 | ||
247ef2aa | 2304 | ########################################## |
d490af7f SW |
2305 | # Check if we have libiscsi |
2306 | if test "$libiscsi" != "no" ; then | |
162f8c2a | 2307 | if check_min_lib_version libiscsi 1.9.0; then |
247ef2aa KZ |
2308 | libiscsi="yes" |
2309 | libiscsi_cflags=$(pkg-config --cflags libiscsi) | |
2310 | libiscsi_libs=$(pkg-config --libs libiscsi) | |
2311 | else | |
247ef2aa KZ |
2312 | libiscsi="no" |
2313 | fi | |
2314 | fi | |
2315 | print_config "iscsi engine" "$libiscsi" | |
2316 | ||
d643a1e2 | 2317 | ########################################## |
d490af7f SW |
2318 | # Check if we have libnbd (for NBD support) |
2319 | if test "$libnbd" != "no" ; then | |
162f8c2a | 2320 | if check_min_lib_version libnbd 0.9.8; then |
d643a1e2 RJ |
2321 | libnbd="yes" |
2322 | libnbd_cflags=$(pkg-config --cflags libnbd) | |
2323 | libnbd_libs=$(pkg-config --libs libnbd) | |
2324 | else | |
d643a1e2 RJ |
2325 | libnbd="no" |
2326 | fi | |
2327 | fi | |
2328 | print_config "NBD engine" "$libnbd" | |
2329 | ||
c363fdd7 JL |
2330 | ########################################## |
2331 | # check for dfs (DAOS File System) | |
2332 | if test "$dfs" != "no" ; then | |
2333 | cat > $TMPC << EOF | |
2334 | #include <fcntl.h> | |
2335 | #include <daos.h> | |
2336 | #include <daos_fs.h> | |
2337 | ||
2338 | int main(int argc, char **argv) | |
2339 | { | |
2340 | daos_handle_t poh; | |
2341 | daos_handle_t coh; | |
2342 | dfs_t *dfs; | |
2343 | ||
2344 | (void) dfs_mount(poh, coh, O_RDWR, &dfs); | |
2345 | ||
2346 | return 0; | |
2347 | } | |
2348 | EOF | |
2349 | if compile_prog "" "-luuid -ldfs -ldaos" "dfs"; then | |
2350 | dfs="yes" | |
2351 | else | |
2352 | dfs="no" | |
2353 | fi | |
2354 | fi | |
2355 | print_config "DAOS File System (dfs) Engine" "$dfs" | |
2356 | ||
165b8a70 TG |
2357 | ########################################## |
2358 | # Check if we have libnfs (for userspace nfs support). | |
98ab1262 | 2359 | if test "$libnfs" != "no" ; then |
be5670c8 | 2360 | if $(pkg-config libnfs > /dev/null 2>&1); then |
9326926b TG |
2361 | libnfs="yes" |
2362 | libnfs_cflags=$(pkg-config --cflags libnfs) | |
98ab1262 | 2363 | libnfs_libs=$(pkg-config --libs libnfs) |
9326926b TG |
2364 | else |
2365 | if test "$libnfs" = "yes" ; then | |
98ab1262 | 2366 | feature_not_found "libnfs" "libnfs" |
9326926b | 2367 | fi |
1eb5ca76 | 2368 | libnfs="no" |
9326926b TG |
2369 | fi |
2370 | fi | |
165b8a70 | 2371 | print_config "NFS engine" "$libnfs" |
c363fdd7 | 2372 | |
bda92394 | 2373 | ########################################## |
b470a02c SC |
2374 | # Check if we have lex/yacc available |
2375 | yacc="no" | |
e7b2c7a3 | 2376 | yacc_is_bison="no" |
b470a02c SC |
2377 | lex="no" |
2378 | arith="no" | |
de26b824 | 2379 | if test "$disable_lex" = "no" || test -z "$disable_lex" ; then |
cf6dd80e | 2380 | if test "$targetos" != "SunOS" ; then |
63c25ff8 | 2381 | if has lex; then |
b470a02c SC |
2382 | lex="yes" |
2383 | fi | |
63c25ff8 | 2384 | if has bison; then |
b470a02c | 2385 | yacc="yes" |
7e0049e9 | 2386 | yacc_is_bison="yes" |
63c25ff8 SW |
2387 | elif has yacc; then |
2388 | yacc="yes" | |
b470a02c SC |
2389 | fi |
2390 | if test "$yacc" = "yes" && test "$lex" = "yes" ; then | |
2391 | arith="yes" | |
2392 | fi | |
2393 | ||
2394 | if test "$arith" = "yes" ; then | |
2395 | cat > $TMPC << EOF | |
2396 | extern int yywrap(void); | |
2397 | ||
2398 | int main(int argc, char **argv) | |
2399 | { | |
2400 | yywrap(); | |
2401 | return 0; | |
2402 | } | |
2403 | EOF | |
63c25ff8 SW |
2404 | if compile_prog "" "-lfl" "flex"; then |
2405 | LIBS="-lfl $LIBS" | |
2406 | elif compile_prog "" "-ll" "lex"; then | |
719cda03 | 2407 | LIBS="-ll $LIBS" |
b470a02c SC |
2408 | else |
2409 | arith="no" | |
2410 | fi | |
2411 | fi | |
cf6dd80e | 2412 | fi |
a655bbc4 | 2413 | fi |
b470a02c | 2414 | |
63bda378 JA |
2415 | # Check if lex fails using -o |
2416 | if test "$arith" = "yes" ; then | |
daf705b5 JA |
2417 | if test "$force_no_lex_o" = "yes" ; then |
2418 | lex_use_o="no" | |
2419 | else | |
63c25ff8 | 2420 | if lex -o lex.yy.c exp/expression-parser.l 2> /dev/null; then |
63bda378 JA |
2421 | lex_use_o="yes" |
2422 | else | |
2423 | lex_use_o="no" | |
2424 | fi | |
2425 | fi | |
daf705b5 | 2426 | fi |
63bda378 | 2427 | |
484b0b65 | 2428 | print_config "lex/yacc for arithmetic" "$arith" |
b470a02c | 2429 | |
aae599ba JA |
2430 | ########################################## |
2431 | # Check whether we have setmntent/getmntent | |
ca205a75 TK |
2432 | if test "$getmntent" != "yes" ; then |
2433 | getmntent="no" | |
2434 | fi | |
aae599ba JA |
2435 | cat > $TMPC << EOF |
2436 | #include <stdio.h> | |
2437 | #include <mntent.h> | |
2438 | int main(int argc, char **argv) | |
2439 | { | |
2440 | FILE *mtab = setmntent(NULL, "r"); | |
2441 | struct mntent *mnt = getmntent(mtab); | |
1581b82a | 2442 | endmntent(mtab); |
e9aab3c9 | 2443 | return mnt != NULL; |
aae599ba JA |
2444 | } |
2445 | EOF | |
2446 | if compile_prog "" "" "getmntent"; then | |
2447 | getmntent="yes" | |
2448 | fi | |
484b0b65 | 2449 | print_config "getmntent" "$getmntent" |
aae599ba | 2450 | |
e7e136da TK |
2451 | ########################################## |
2452 | # Check whether we have getmntinfo | |
b765bec0 TK |
2453 | # These are originally added for BSDs, but may also work |
2454 | # on other operating systems with getmntinfo(3). | |
2455 | ||
2456 | # getmntinfo(3) for FreeBSD/DragonFlyBSD/OpenBSD. | |
2457 | # Note that NetBSD needs -Werror to catch warning as error. | |
ca205a75 TK |
2458 | if test "$getmntinfo" != "yes" ; then |
2459 | getmntinfo="no" | |
2460 | fi | |
e7e136da TK |
2461 | cat > $TMPC << EOF |
2462 | #include <stdio.h> | |
2463 | #include <sys/param.h> | |
2464 | #include <sys/mount.h> | |
2465 | int main(int argc, char **argv) | |
2466 | { | |
9ada751d | 2467 | struct statfs *st; |
e7e136da TK |
2468 | return getmntinfo(&st, MNT_NOWAIT); |
2469 | } | |
2470 | EOF | |
b765bec0 | 2471 | if compile_prog "-Werror" "" "getmntinfo"; then |
e7e136da TK |
2472 | getmntinfo="yes" |
2473 | fi | |
484b0b65 | 2474 | print_config "getmntinfo" "$getmntinfo" |
e7e136da | 2475 | |
b765bec0 | 2476 | # getmntinfo(3) for NetBSD. |
ca205a75 TK |
2477 | if test "$getmntinfo_statvfs" != "yes" ; then |
2478 | getmntinfo_statvfs="no" | |
2479 | fi | |
b765bec0 TK |
2480 | cat > $TMPC << EOF |
2481 | #include <stdio.h> | |
2482 | #include <sys/statvfs.h> | |
2483 | int main(int argc, char **argv) | |
2484 | { | |
2485 | struct statvfs *st; | |
2486 | return getmntinfo(&st, MNT_NOWAIT); | |
2487 | } | |
2488 | EOF | |
2489 | # Skip the test if the one with statfs arg is detected. | |
2490 | if test "$getmntinfo" != "yes" && compile_prog "-Werror" "" "getmntinfo_statvfs"; then | |
2491 | getmntinfo_statvfs="yes" | |
484b0b65 | 2492 | print_config "getmntinfo_statvfs" "$getmntinfo_statvfs" |
b765bec0 TK |
2493 | fi |
2494 | ||
5018f79f AH |
2495 | ########################################## |
2496 | # Check whether we have _Static_assert | |
ca205a75 TK |
2497 | if test "$static_assert" != "yes" ; then |
2498 | static_assert="no" | |
2499 | fi | |
5018f79f AH |
2500 | cat > $TMPC << EOF |
2501 | #include <assert.h> | |
94815a5c | 2502 | #include <stdlib.h> |
51b4c81e | 2503 | #include <stddef.h> |
94815a5c JA |
2504 | |
2505 | struct foo { | |
2506 | int a, b; | |
2507 | }; | |
2508 | ||
5018f79f AH |
2509 | int main(int argc, char **argv) |
2510 | { | |
94815a5c | 2511 | _Static_assert(offsetof(struct foo, a) == 0 , "Check"); |
5018f79f AH |
2512 | return 0 ; |
2513 | } | |
2514 | EOF | |
2515 | if compile_prog "" "" "static_assert"; then | |
2516 | static_assert="yes" | |
2517 | fi | |
484b0b65 | 2518 | print_config "Static Assert" "$static_assert" |
e39c0676 JA |
2519 | |
2520 | ########################################## | |
2521 | # Check whether we have bool / stdbool.h | |
ca205a75 TK |
2522 | if test "$have_bool" != "yes" ; then |
2523 | have_bool="no" | |
2524 | fi | |
e39c0676 JA |
2525 | cat > $TMPC << EOF |
2526 | #include <stdbool.h> | |
2527 | int main(int argc, char **argv) | |
2528 | { | |
2529 | bool var = true; | |
2530 | return var != false; | |
2531 | } | |
2532 | EOF | |
2533 | if compile_prog "" "" "bool"; then | |
2534 | have_bool="yes" | |
2535 | fi | |
484b0b65 | 2536 | print_config "bool" "$have_bool" |
e39c0676 | 2537 | |
b29c71c4 JA |
2538 | ########################################## |
2539 | # Check whether we have strndup() | |
107ad008 | 2540 | strndup="no" |
b29c71c4 JA |
2541 | cat > $TMPC << EOF |
2542 | #include <string.h> | |
2543 | #include <stdlib.h> | |
2544 | int main(int argc, char **argv) | |
2545 | { | |
2546 | char *res = strndup("test string", 8); | |
2547 | ||
2548 | free(res); | |
2549 | return 0; | |
2550 | } | |
2551 | EOF | |
2552 | if compile_prog "" "" "strndup"; then | |
2553 | strndup="yes" | |
2554 | fi | |
2555 | print_config "strndup" "$strndup" | |
2556 | ||
214e2d56 | 2557 | ########################################## |
0ffccc21 BVA |
2558 | # <valgrind/drd.h> probe |
2559 | # Note: presence of <valgrind/drd.h> implies that <valgrind/valgrind.h> is | |
2560 | # also available but not the other way around. | |
2561 | if test "$valgrind_dev" != "yes" ; then | |
2562 | valgrind_dev="no" | |
2563 | fi | |
2564 | cat > $TMPC << EOF | |
2565 | #include <valgrind/drd.h> | |
2566 | int main(int argc, char **argv) | |
2567 | { | |
2568 | return 0; | |
2569 | } | |
2570 | EOF | |
2571 | if compile_prog "" "" "valgrind_dev"; then | |
2572 | valgrind_dev="yes" | |
2573 | fi | |
2574 | print_config "Valgrind headers" "$valgrind_dev" | |
2575 | ||
13a9a800 | 2576 | if test "$targetos" = "Linux" || test "$targetos" = "Android"; then |
a76e1995 BVA |
2577 | ########################################## |
2578 | # <linux/blkzoned.h> probe | |
2579 | if test "$linux_blkzoned" != "yes" ; then | |
2580 | linux_blkzoned="no" | |
2581 | fi | |
2582 | cat > $TMPC << EOF | |
2583 | #include <linux/blkzoned.h> | |
2584 | int main(int argc, char **argv) | |
2585 | { | |
2586 | return 0; | |
2587 | } | |
2588 | EOF | |
2589 | if compile_prog "" "" "linux_blkzoned"; then | |
2590 | linux_blkzoned="yes" | |
2591 | fi | |
2592 | print_config "Zoned block device support" "$linux_blkzoned" | |
2593 | ||
236d23a8 SK |
2594 | ########################################## |
2595 | # Check BLK_ZONE_REP_CAPACITY | |
2596 | cat > $TMPC << EOF | |
2597 | #include <linux/blkzoned.h> | |
2598 | int main(void) | |
2599 | { | |
2600 | return BLK_ZONE_REP_CAPACITY; | |
2601 | } | |
2602 | EOF | |
2603 | if compile_prog "" "" "blkzoned report capacity"; then | |
2604 | output_sym "CONFIG_HAVE_REP_CAPACITY" | |
2605 | rep_capacity="yes" | |
2606 | else | |
2607 | rep_capacity="no" | |
2608 | fi | |
2609 | print_config "Zoned block device capacity" "$rep_capacity" | |
2610 | fi | |
2611 | ||
56a19325 DF |
2612 | ########################################## |
2613 | # libzbc probe | |
56a19325 DF |
2614 | cat > $TMPC << EOF |
2615 | #include <libzbc/zbc.h> | |
2616 | int main(int argc, char **argv) | |
2617 | { | |
2618 | struct zbc_device *dev = NULL; | |
2619 | ||
2620 | return zbc_open("foo=bar", O_RDONLY, &dev); | |
2621 | } | |
2622 | EOF | |
38551c04 | 2623 | if test "$libzbc" != "no" ; then |
67ff4de3 BVA |
2624 | if [ -e /usr/include/libzbc/libzbc ]; then |
2625 | # SUSE Linux. | |
2626 | CFLAGS="$CFLAGS -I/usr/include/libzbc" | |
2627 | fi | |
38551c04 | 2628 | if compile_prog "" "-lzbc" "libzbc"; then |
162f8c2a DF |
2629 | libzbc="yes" |
2630 | if ! check_min_lib_version libzbc 5; then | |
38551c04 DF |
2631 | libzbc="no" |
2632 | fi | |
56a19325 | 2633 | else |
38551c04 | 2634 | if test "$libzbc" = "yes" ; then |
56a19325 | 2635 | feature_not_found "libzbc" "libzbc or libzbc/zbc.h" |
38551c04 DF |
2636 | fi |
2637 | libzbc="no" | |
56a19325 | 2638 | fi |
56a19325 DF |
2639 | fi |
2640 | print_config "libzbc engine" "$libzbc" | |
2641 | ||
9eefdcc1 | 2642 | if test "$targetos" = "Linux" || test "$targetos" = "Android"; then |
76a490bb AK |
2643 | ########################################## |
2644 | # Check NVME_URING_CMD support | |
2645 | cat > $TMPC << EOF | |
2646 | #include <linux/nvme_ioctl.h> | |
2647 | int main(void) | |
2648 | { | |
76a490bb AK |
2649 | return sizeof(struct nvme_uring_cmd); |
2650 | } | |
2651 | EOF | |
2652 | if compile_prog "" "" "nvme uring cmd"; then | |
2653 | output_sym "CONFIG_NVME_URING_CMD" | |
2654 | nvme_uring_cmd="yes" | |
2655 | else | |
2656 | nvme_uring_cmd="no" | |
2657 | fi | |
2658 | print_config "NVMe uring command support" "$nvme_uring_cmd" | |
2659 | fi | |
2660 | ||
a3ff873e AK |
2661 | ########################################## |
2662 | # Check if we have xnvme | |
6aaebfbe | 2663 | if test "$xnvme" != "no" ; then |
be5514e3 | 2664 | if check_min_lib_version xnvme 0.7.4; then |
a3ff873e AK |
2665 | xnvme="yes" |
2666 | xnvme_cflags=$(pkg-config --cflags xnvme) | |
2667 | xnvme_libs=$(pkg-config --libs xnvme) | |
2668 | else | |
2669 | xnvme="no" | |
2670 | fi | |
2671 | fi | |
2672 | print_config "xnvme engine" "$xnvme" | |
2673 | ||
a4614bff AK |
2674 | if test "$targetos" = "Linux" ; then |
2675 | ########################################## | |
2676 | # Check ISA-L support | |
2677 | cat > $TMPC << EOF | |
2678 | #include <isa-l/crc.h> | |
2679 | #include <stddef.h> | |
2680 | int main(void) | |
2681 | { | |
2682 | return crc16_t10dif(0, NULL, 4096); | |
2683 | } | |
2684 | EOF | |
2685 | if test "$isal" != "no" ; then | |
2686 | if compile_prog "" "-lisal" "ISAL"; then | |
2687 | isal="yes" | |
2688 | LIBS="-lisal $LIBS" | |
2689 | else | |
2690 | isal="no" | |
2691 | fi | |
2692 | fi | |
2693 | print_config "isal" "$isal" | |
2694 | fi | |
2695 | ||
a601337a AF |
2696 | ########################################## |
2697 | # Check if we have libblkio | |
2698 | if test "$libblkio" != "no" ; then | |
2699 | if check_min_lib_version blkio 1.0.0; then | |
2700 | libblkio="yes" | |
2701 | libblkio_cflags=$(pkg-config --cflags blkio) | |
2702 | libblkio_libs=$(pkg-config --libs blkio) | |
2703 | else | |
2704 | if test "$libblkio" = "yes" ; then | |
2705 | feature_not_found "libblkio" "libblkio-dev or libblkio-devel" | |
2706 | fi | |
2707 | libblkio="no" | |
2708 | fi | |
2709 | fi | |
2710 | print_config "libblkio engine" "$libblkio" | |
2711 | ||
a76e1995 | 2712 | ########################################## |
214e2d56 | 2713 | # check march=armv8-a+crc+crypto |
1e8ec88f | 2714 | march_armv8_a_crc_crypto="no" |
214e2d56 | 2715 | if test "$cpu" = "arm64" ; then |
2716 | cat > $TMPC <<EOF | |
1e8ec88f | 2717 | #if __linux__ |
9b153dc2 TT |
2718 | #include <arm_acle.h> |
2719 | #include <arm_neon.h> | |
58828d07 | 2720 | #include <sys/auxv.h> |
1e8ec88f | 2721 | #endif |
9b153dc2 | 2722 | |
214e2d56 | 2723 | int main(void) |
2724 | { | |
58828d07 SW |
2725 | /* Can we also do a runtime probe? */ |
2726 | #if __linux__ | |
2727 | return getauxval(AT_HWCAP); | |
1e8ec88f JA |
2728 | #elif defined(__APPLE__) |
2729 | return 0; | |
58828d07 SW |
2730 | #else |
2731 | # error "Don't know how to do runtime probe for ARM CRC32c" | |
2732 | #endif | |
214e2d56 | 2733 | } |
2734 | EOF | |
58828d07 | 2735 | if compile_prog "-march=armv8-a+crc+crypto" "" "ARM CRC32c"; then |
214e2d56 | 2736 | march_armv8_a_crc_crypto="yes" |
58828d07 | 2737 | CFLAGS="$CFLAGS -march=armv8-a+crc+crypto" |
9f75af77 | 2738 | march_set="yes" |
214e2d56 | 2739 | fi |
2740 | fi | |
484b0b65 | 2741 | print_config "march_armv8_a_crc_crypto" "$march_armv8_a_crc_crypto" |
214e2d56 | 2742 | |
03553853 YR |
2743 | ########################################## |
2744 | # cuda probe | |
d490af7f | 2745 | if test "$cuda" != "no" ; then |
03553853 YR |
2746 | cat > $TMPC << EOF |
2747 | #include <cuda.h> | |
2748 | int main(int argc, char **argv) | |
2749 | { | |
2750 | return cuInit(0); | |
2751 | } | |
2752 | EOF | |
d490af7f SW |
2753 | if compile_prog "" "-lcuda" "cuda"; then |
2754 | cuda="yes" | |
2755 | LIBS="-lcuda $LIBS" | |
2756 | else | |
2757 | if test "$cuda" = "yes" ; then | |
2758 | feature_not_found "cuda" "" | |
2759 | fi | |
2760 | cuda="no" | |
2761 | fi | |
03553853 | 2762 | fi |
484b0b65 | 2763 | print_config "cuda" "$cuda" |
214e2d56 | 2764 | |
10756b2c BS |
2765 | ########################################## |
2766 | # libcufile probe | |
2767 | if test "$libcufile" != "no" ; then | |
2768 | cat > $TMPC << EOF | |
2769 | #include <cufile.h> | |
2770 | ||
2771 | int main(int argc, char* argv[]) { | |
2772 | cuFileDriverOpen(); | |
2773 | return 0; | |
2774 | } | |
2775 | EOF | |
57a5412f | 2776 | if compile_prog "" "-lcuda -lcudart -lcufile -ldl" "libcufile"; then |
10756b2c | 2777 | libcufile="yes" |
57a5412f | 2778 | LIBS="-lcuda -lcudart -lcufile -ldl $LIBS" |
10756b2c BS |
2779 | else |
2780 | if test "$libcufile" = "yes" ; then | |
2781 | feature_not_found "libcufile" "" | |
2782 | fi | |
2783 | libcufile="no" | |
2784 | fi | |
2785 | fi | |
2786 | print_config "libcufile" "$libcufile" | |
2787 | ||
a817dc3b JA |
2788 | ########################################## |
2789 | # check for cc -march=native | |
2790 | build_native="no" | |
2791 | cat > $TMPC << EOF | |
2792 | int main(int argc, char **argv) | |
2793 | { | |
2794 | return 0; | |
2795 | } | |
2796 | EOF | |
c922e0b0 SW |
2797 | if test "$disable_native" = "no" && test "$disable_opt" != "yes" && \ |
2798 | compile_prog "-march=native" "" "march=native"; then | |
a817dc3b JA |
2799 | build_native="yes" |
2800 | fi | |
2801 | print_config "Build march=native" "$build_native" | |
2802 | ||
b8b0e1ee TK |
2803 | ########################################## |
2804 | # check for -lcunit | |
2805 | if test "$cunit" != "yes" ; then | |
2806 | cunit="no" | |
2807 | fi | |
2808 | cat > $TMPC << EOF | |
2809 | #include <CUnit/CUnit.h> | |
2810 | #include <CUnit/Basic.h> | |
2811 | int main(void) | |
2812 | { | |
2813 | if (CU_initialize_registry() != CUE_SUCCESS) | |
2814 | return CU_get_error(); | |
2815 | CU_basic_set_mode(CU_BRM_VERBOSE); | |
2816 | CU_basic_run_tests(); | |
2817 | CU_cleanup_registry(); | |
2818 | return CU_get_error(); | |
2819 | } | |
2820 | EOF | |
2821 | if compile_prog "" "-lcunit" "CUnit"; then | |
2822 | cunit="yes" | |
2823 | fi | |
2824 | print_config "CUnit" "$cunit" | |
2825 | ||
57fa61f0 JA |
2826 | ########################################## |
2827 | # check for __kernel_rwf_t | |
2828 | __kernel_rwf_t="no" | |
2829 | cat > $TMPC << EOF | |
2830 | #include <linux/fs.h> | |
2831 | int main(int argc, char **argv) | |
2832 | { | |
2833 | __kernel_rwf_t x; | |
2834 | x = 0; | |
2835 | return x; | |
2836 | } | |
2837 | EOF | |
2838 | if compile_prog "" "" "__kernel_rwf_t"; then | |
2839 | __kernel_rwf_t="yes" | |
2840 | fi | |
2841 | print_config "__kernel_rwf_t" "$__kernel_rwf_t" | |
2842 | ||
71144e67 | 2843 | ########################################## |
5ad91012 | 2844 | # check if gcc has -Wimplicit-fallthrough=2 |
71144e67 JA |
2845 | fallthrough="no" |
2846 | cat > $TMPC << EOF | |
2847 | int main(int argc, char **argv) | |
2848 | { | |
2849 | return 0; | |
2850 | } | |
2851 | EOF | |
5ad91012 | 2852 | if compile_prog "-Wimplicit-fallthrough=2" "" "-Wimplicit-fallthrough=2"; then |
71144e67 JA |
2853 | fallthrough="yes" |
2854 | fi | |
5ad91012 | 2855 | print_config "-Wimplicit-fallthrough=2" "$fallthrough" |
71144e67 | 2856 | |
5ca54c1b JA |
2857 | ########################################## |
2858 | # check if the compiler has -Wno-stringop-concatenation | |
2859 | no_stringop="no" | |
2860 | cat > $TMPC << EOF | |
2861 | #include <stdio.h> | |
2862 | ||
2863 | int main(int argc, char **argv) | |
2864 | { | |
2865 | return printf("%s\n", argv[0]); | |
2866 | } | |
2867 | EOF | |
2868 | if compile_prog "-Wno-stringop-truncation -Werror" "" "no_stringop"; then | |
2869 | no_stringop="yes" | |
2870 | fi | |
2871 | print_config "-Wno-stringop-truncation" "$no_stringop" | |
2872 | ||
ff547caa KB |
2873 | ########################################## |
2874 | # check for MADV_HUGEPAGE support | |
2875 | if test "$thp" != "yes" ; then | |
2876 | thp="no" | |
2877 | fi | |
2878 | if test "$esx" != "yes" ; then | |
2879 | cat > $TMPC <<EOF | |
2880 | #include <sys/mman.h> | |
2881 | int main(void) | |
2882 | { | |
2883 | return madvise(0, 0x1000, MADV_HUGEPAGE); | |
2884 | } | |
2885 | EOF | |
2886 | if compile_prog "" "" "thp" ; then | |
2887 | thp=yes | |
2888 | else | |
2889 | if test "$thp" = "yes" ; then | |
2890 | feature_not_found "Transparent Huge Page" "" | |
2891 | fi | |
2892 | thp=no | |
2893 | fi | |
2894 | fi | |
2895 | print_config "MADV_HUGEPAGE" "$thp" | |
2896 | ||
de5ed0e4 JA |
2897 | ########################################## |
2898 | # check for gettid() | |
2899 | gettid="no" | |
2900 | cat > $TMPC << EOF | |
2901 | #include <unistd.h> | |
2902 | int main(int argc, char **argv) | |
2903 | { | |
2904 | return gettid(); | |
2905 | } | |
2906 | EOF | |
2907 | if compile_prog "" "" "gettid"; then | |
2908 | gettid="yes" | |
2909 | fi | |
2910 | print_config "gettid" "$gettid" | |
2911 | ||
95f31f7d TK |
2912 | ########################################## |
2913 | # check for statx(2) support by libc | |
2914 | statx="no" | |
2915 | cat > $TMPC << EOF | |
2916 | #include <unistd.h> | |
2917 | #include <sys/stat.h> | |
2918 | ||
2919 | int main(int argc, char **argv) | |
2920 | { | |
2921 | struct statx st; | |
2922 | return statx(-1, *argv, 0, 0, &st); | |
2923 | } | |
2924 | EOF | |
2925 | if compile_prog "" "" "statx"; then | |
2926 | statx="yes" | |
2927 | fi | |
2928 | print_config "statx(2)/libc" "$statx" | |
2929 | ||
2930 | ########################################## | |
2931 | # check for statx(2) support by kernel | |
2932 | statx_syscall="no" | |
2933 | cat > $TMPC << EOF | |
2934 | #include <unistd.h> | |
2935 | #include <linux/stat.h> | |
2936 | #include <sys/stat.h> | |
2937 | #include <sys/syscall.h> | |
2938 | ||
2939 | static int _statx(int dfd, const char *pathname, int flags, unsigned int mask, | |
2940 | struct statx *buffer) | |
2941 | { | |
2942 | return syscall(__NR_statx, dfd, pathname, flags, mask, buffer); | |
2943 | } | |
2944 | ||
2945 | int main(int argc, char **argv) | |
2946 | { | |
2947 | struct statx st; | |
2948 | return _statx(-1, *argv, 0, 0, &st); | |
2949 | } | |
2950 | EOF | |
2951 | if compile_prog "" "" "statx_syscall"; then | |
2952 | statx_syscall="yes" | |
2953 | fi | |
2954 | print_config "statx(2)/syscall" "$statx_syscall" | |
2955 | ||
76bc30ca SW |
2956 | ########################################## |
2957 | # check for Windows PDB generation support | |
2958 | if test "pdb" != "no" ; then | |
2959 | cat > $TMPC <<EOF | |
2960 | int main(void) | |
2961 | { | |
2962 | return 0; | |
2963 | } | |
2964 | EOF | |
2965 | if compile_prog "-g -gcodeview" "-fuse-ld=lld -Wl,-pdb,$TMPO" "pdb"; then | |
2966 | pdb=yes | |
2967 | else | |
2968 | if test "$pdb" = "yes"; then | |
2969 | feature_not_found "PDB" "clang and lld" | |
2970 | fi | |
2971 | pdb=no | |
2972 | fi | |
2973 | else | |
2974 | pdb=no | |
2975 | fi | |
2976 | print_config "Windows PDB generation" "$pdb" | |
696378af BVA |
2977 | |
2978 | ########################################## | |
2979 | # check for timerfd support | |
2980 | timerfd_create="no" | |
ffaaf8ab | 2981 | if test "$esx" != "yes" ; then |
696378af BVA |
2982 | cat > $TMPC << EOF |
2983 | #include <sys/time.h> | |
2984 | #include <sys/timerfd.h> | |
2985 | ||
2986 | int main(int argc, char **argv) | |
2987 | { | |
2988 | return timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK); | |
2989 | } | |
2990 | EOF | |
ffaaf8ab BRH |
2991 | if compile_prog "" "" "timerfd_create"; then |
2992 | timerfd_create="yes" | |
2993 | fi | |
696378af BVA |
2994 | fi |
2995 | print_config "timerfd_create" "$timerfd_create" | |
2996 | ||
67bf9823 JA |
2997 | ############################################################################# |
2998 | ||
67bf9823 | 2999 | if test "$wordsize" = "64" ; then |
4feafb1e | 3000 | output_sym "CONFIG_64BIT" |
67bf9823 | 3001 | elif test "$wordsize" = "32" ; then |
4feafb1e | 3002 | output_sym "CONFIG_32BIT" |
67bf9823 | 3003 | else |
d7145a78 | 3004 | fatal "Unknown wordsize!" |
67bf9823 | 3005 | fi |
0dcebdf4 | 3006 | if test "$bigendian" = "yes" ; then |
4feafb1e | 3007 | output_sym "CONFIG_BIG_ENDIAN" |
0dcebdf4 | 3008 | else |
4feafb1e | 3009 | output_sym "CONFIG_LITTLE_ENDIAN" |
0dcebdf4 | 3010 | fi |
3989b143 JA |
3011 | if test "$zlib" = "yes" ; then |
3012 | output_sym "CONFIG_ZLIB" | |
3013 | fi | |
67bf9823 | 3014 | if test "$libaio" = "yes" ; then |
4feafb1e | 3015 | output_sym "CONFIG_LIBAIO" |
7d42e66e KK |
3016 | if test "$libaio_rw_flags" = "yes" ; then |
3017 | output_sym "CONFIG_LIBAIO_RW_FLAGS" | |
3018 | fi | |
67bf9823 JA |
3019 | fi |
3020 | if test "$posix_aio" = "yes" ; then | |
4feafb1e | 3021 | output_sym "CONFIG_POSIXAIO" |
67bf9823 JA |
3022 | fi |
3023 | if test "$posix_aio_fsync" = "yes" ; then | |
4feafb1e | 3024 | output_sym "CONFIG_POSIXAIO_FSYNC" |
67bf9823 | 3025 | fi |
06eac6b2 SW |
3026 | if test "$posix_pshared" = "yes" ; then |
3027 | output_sym "CONFIG_PSHARED" | |
3028 | fi | |
78b66d32 BVA |
3029 | if test "$pthread_condattr_setclock" = "yes" ; then |
3030 | output_sym "CONFIG_PTHREAD_CONDATTR_SETCLOCK" | |
3031 | fi | |
c31092b8 BVA |
3032 | if test "$pthread_sigmask" = "yes" ; then |
3033 | output_sym "CONFIG_PTHREAD_SIGMASK" | |
3034 | fi | |
deb859d6 JA |
3035 | if test "$pthread_getaffinity" = "yes" ; then |
3036 | output_sym "CONFIG_PTHREAD_GETAFFINITY" | |
3037 | fi | |
44e8e956 | 3038 | if test "$have_asprintf" = "yes" ; then |
cb3b6806 | 3039 | output_sym "CONFIG_HAVE_ASPRINTF" |
44e8e956 BVA |
3040 | fi |
3041 | if test "$have_vasprintf" = "yes" ; then | |
cb3b6806 | 3042 | output_sym "CONFIG_HAVE_VASPRINTF" |
44e8e956 | 3043 | fi |
67bf9823 | 3044 | if test "$linux_fallocate" = "yes" ; then |
4feafb1e | 3045 | output_sym "CONFIG_LINUX_FALLOCATE" |
67bf9823 JA |
3046 | fi |
3047 | if test "$posix_fallocate" = "yes" ; then | |
4feafb1e | 3048 | output_sym "CONFIG_POSIX_FALLOCATE" |
67bf9823 JA |
3049 | fi |
3050 | if test "$fdatasync" = "yes" ; then | |
4feafb1e | 3051 | output_sym "CONFIG_FDATASYNC" |
67bf9823 | 3052 | fi |
52a552e2 BVA |
3053 | if test "$pipe" = "yes" ; then |
3054 | output_sym "CONFIG_PIPE" | |
3055 | fi | |
3056 | if test "$pipe2" = "yes" ; then | |
3057 | output_sym "CONFIG_PIPE2" | |
3058 | fi | |
15eca9aa BVA |
3059 | if test "$pread" = "yes" ; then |
3060 | output_sym "CONFIG_PREAD" | |
3061 | fi | |
67bf9823 | 3062 | if test "$sync_file_range" = "yes" ; then |
4feafb1e | 3063 | output_sym "CONFIG_SYNC_FILE_RANGE" |
67bf9823 | 3064 | fi |
d9705059 BVA |
3065 | if test "$ASharedMemory_create" = "yes" ; then |
3066 | output_sym "CONFIG_ASHAREDMEMORY_CREATE" | |
3067 | fi | |
67bf9823 | 3068 | if test "$sfaa" = "yes" ; then |
4feafb1e | 3069 | output_sym "CONFIG_SFAA" |
67bf9823 | 3070 | fi |
a250edd0 JA |
3071 | if test "$sync_sync" = "yes" ; then |
3072 | output_sym "CONFIG_SYNC_SYNC" | |
3073 | fi | |
3074 | if test "$cmp_swap" = "yes" ; then | |
3075 | output_sym "CONFIG_CMP_SWAP" | |
3076 | fi | |
954cd73a | 3077 | if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then |
4feafb1e | 3078 | output_sym "CONFIG_RDMA" |
67bf9823 JA |
3079 | fi |
3080 | if test "$clock_gettime" = "yes" ; then | |
4feafb1e | 3081 | output_sym "CONFIG_CLOCK_GETTIME" |
67bf9823 JA |
3082 | fi |
3083 | if test "$clock_monotonic" = "yes" ; then | |
4feafb1e | 3084 | output_sym "CONFIG_CLOCK_MONOTONIC" |
67bf9823 | 3085 | fi |
25f8227d JA |
3086 | if test "$clockid_t" = "yes"; then |
3087 | output_sym "CONFIG_CLOCKID_T" | |
3088 | fi | |
67bf9823 | 3089 | if test "$gettimeofday" = "yes" ; then |
4feafb1e | 3090 | output_sym "CONFIG_GETTIMEOFDAY" |
67bf9823 JA |
3091 | fi |
3092 | if test "$posix_fadvise" = "yes" ; then | |
4feafb1e | 3093 | output_sym "CONFIG_POSIX_FADVISE" |
67bf9823 JA |
3094 | fi |
3095 | if test "$linux_3arg_affinity" = "yes" ; then | |
4feafb1e | 3096 | output_sym "CONFIG_3ARG_AFFINITY" |
67bf9823 | 3097 | elif test "$linux_2arg_affinity" = "yes" ; then |
4feafb1e | 3098 | output_sym "CONFIG_2ARG_AFFINITY" |
67bf9823 JA |
3099 | fi |
3100 | if test "$strsep" = "yes" ; then | |
4feafb1e | 3101 | output_sym "CONFIG_STRSEP" |
67bf9823 | 3102 | fi |
9ad8da82 JA |
3103 | if test "$strcasestr" = "yes" ; then |
3104 | output_sym "CONFIG_STRCASESTR" | |
3105 | fi | |
5ad7be56 KD |
3106 | if test "$strlcat" = "yes" ; then |
3107 | output_sym "CONFIG_STRLCAT" | |
3108 | fi | |
67bf9823 | 3109 | if test "$getopt_long_only" = "yes" ; then |
4feafb1e | 3110 | output_sym "CONFIG_GETOPT_LONG_ONLY" |
67bf9823 JA |
3111 | fi |
3112 | if test "$inet_aton" = "yes" ; then | |
4feafb1e | 3113 | output_sym "CONFIG_INET_ATON" |
67bf9823 JA |
3114 | fi |
3115 | if test "$socklen_t" = "yes" ; then | |
4feafb1e | 3116 | output_sym "CONFIG_SOCKLEN_T" |
67bf9823 JA |
3117 | fi |
3118 | if test "$ext4_me" = "yes" ; then | |
4feafb1e | 3119 | output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT" |
67bf9823 JA |
3120 | fi |
3121 | if test "$linux_splice" = "yes" ; then | |
4feafb1e | 3122 | output_sym "CONFIG_LINUX_SPLICE" |
67bf9823 | 3123 | fi |
50206d9b | 3124 | if test "$libnuma_v2" = "yes" ; then |
4feafb1e | 3125 | output_sym "CONFIG_LIBNUMA" |
67bf9823 JA |
3126 | fi |
3127 | if test "$solaris_aio" = "yes" ; then | |
4feafb1e | 3128 | output_sym "CONFIG_SOLARISAIO" |
67bf9823 JA |
3129 | fi |
3130 | if test "$tls_thread" = "yes" ; then | |
4feafb1e | 3131 | output_sym "CONFIG_TLS_THREAD" |
67bf9823 | 3132 | fi |
44404c5a | 3133 | if test "$rusage_thread" = "yes" ; then |
4feafb1e | 3134 | output_sym "CONFIG_RUSAGE_THREAD" |
67bf9823 | 3135 | fi |
91f94d5b | 3136 | if test "$gfio" = "yes" ; then |
bad7e42c | 3137 | output_sym "CONFIG_GFIO" |
91f94d5b | 3138 | fi |
c8931876 JA |
3139 | if test "$esx" = "yes" ; then |
3140 | output_sym "CONFIG_ESX" | |
3141 | output_sym "CONFIG_NO_SHM" | |
3142 | fi | |
7e09a9f1 JA |
3143 | if test "$sched_idle" = "yes" ; then |
3144 | output_sym "CONFIG_SCHED_IDLE" | |
3145 | fi | |
1eafa37a JA |
3146 | if test "$tcp_nodelay" = "yes" ; then |
3147 | output_sym "CONFIG_TCP_NODELAY" | |
3148 | fi | |
1008602c JA |
3149 | if test "$window_size" = "yes" ; then |
3150 | output_sym "CONFIG_NET_WINDOWSIZE" | |
3151 | fi | |
e5f34d95 JA |
3152 | if test "$mss" = "yes" ; then |
3153 | output_sym "CONFIG_NET_MSS" | |
3154 | fi | |
38b9354a JA |
3155 | if test "$rlimit_memlock" = "yes" ; then |
3156 | output_sym "CONFIG_RLIMIT_MEMLOCK" | |
3157 | fi | |
07fc0acd JA |
3158 | if test "$pwritev" = "yes" ; then |
3159 | output_sym "CONFIG_PWRITEV" | |
3160 | fi | |
2cafffbe JA |
3161 | if test "$pwritev2" = "yes" ; then |
3162 | output_sym "CONFIG_PWRITEV2" | |
3163 | fi | |
ecad55e9 JA |
3164 | if test "$ipv6" = "yes" ; then |
3165 | output_sym "CONFIG_IPV6" | |
3166 | fi | |
80cc242a MP |
3167 | if test "$vsock" = "yes"; then |
3168 | output_sym "CONFIG_VSOCK" | |
3169 | fi | |
c2f6a13d LMB |
3170 | if test "$http" = "yes" ; then |
3171 | output_sym "CONFIG_HTTP" | |
3172 | fi | |
d5f9b0ea IF |
3173 | if test "$rados" = "yes" ; then |
3174 | output_sym "CONFIG_RADOS" | |
3175 | fi | |
fc5c0345 DG |
3176 | if test "$rbd" = "yes" ; then |
3177 | output_sym "CONFIG_RBD" | |
3178 | fi | |
53b6c979 PL |
3179 | if test "$rbd_poll" = "yes" ; then |
3180 | output_sym "CONFIG_RBD_POLL" | |
3181 | fi | |
903b2812 JA |
3182 | if test "$rbd_inval" = "yes" ; then |
3183 | output_sym "CONFIG_RBD_INVAL" | |
3184 | fi | |
2e802282 JA |
3185 | if test "$setvbuf" = "yes" ; then |
3186 | output_sym "CONFIG_SETVBUF" | |
3187 | fi | |
81795ce3 CE |
3188 | if test "$s390_z196_facilities" = "yes" ; then |
3189 | output_sym "CONFIG_S390_Z196_FACILITIES" | |
3190 | CFLAGS="$CFLAGS -march=z9-109" | |
9f75af77 | 3191 | march_set="yes" |
81795ce3 | 3192 | fi |
6e7d7dfb | 3193 | if test "$gfapi" = "yes" ; then |
3194 | output_sym "CONFIG_GFAPI" | |
3195 | fi | |
6fa14b99 | 3196 | if test "$gf_fadvise" = "yes" ; then |
3197 | output_sym "CONFIG_GF_FADVISE" | |
3198 | fi | |
6876c98c JA |
3199 | if test "$gf_trim" = "yes" ; then |
3200 | output_sym "CONFIG_GF_TRIM" | |
3201 | fi | |
ce4d13ca JA |
3202 | if test "$gf_new" = "yes" ; then |
3203 | output_sym "CONFIG_GF_NEW_API" | |
3204 | fi | |
1b10477b MM |
3205 | if test "$libhdfs" = "yes" ; then |
3206 | output_sym "CONFIG_LIBHDFS" | |
247e5436 | 3207 | echo "FIO_HDFS_CPU=$FIO_HDFS_CPU" >> $config_host_mak |
1527dc50 FB |
3208 | echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak |
3209 | echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak | |
3210 | echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak | |
247ef2aa | 3211 | fi |
b8116a87 DE |
3212 | if test "$mtd" = "yes" ; then |
3213 | output_sym "CONFIG_MTD" | |
3214 | fi | |
cbb15e42 DJ |
3215 | if test "$devdax" = "yes" ; then |
3216 | output_sym "CONFIG_LINUX_DEVDAX" | |
3217 | fi | |
ae0db592 TI |
3218 | if test "$pmem" = "yes" ; then |
3219 | output_sym "CONFIG_LIBPMEM" | |
3220 | fi | |
8fabefc1 KS |
3221 | if test "$libpmem2" = "yes" ; then |
3222 | output_sym "CONFIG_LIBPMEM2_INSTALLED" | |
3223 | fi | |
a40e7a59 GB |
3224 | if test "$libime" = "yes" ; then |
3225 | output_sym "CONFIG_IME" | |
3226 | fi | |
b470a02c SC |
3227 | if test "$arith" = "yes" ; then |
3228 | output_sym "CONFIG_ARITHMETIC" | |
e7b2c7a3 | 3229 | if test "$yacc_is_bison" = "yes" ; then |
63c25ff8 | 3230 | echo "YACC=bison -y" >> $config_host_mak |
e7b2c7a3 | 3231 | else |
63c25ff8 | 3232 | echo "YACC=yacc" >> $config_host_mak |
e7b2c7a3 | 3233 | fi |
63bda378 JA |
3234 | if test "$lex_use_o" = "yes" ; then |
3235 | echo "CONFIG_LEX_USE_O=y" >> $config_host_mak | |
3236 | fi | |
b470a02c | 3237 | fi |
aae599ba JA |
3238 | if test "$getmntent" = "yes" ; then |
3239 | output_sym "CONFIG_GETMNTENT" | |
3240 | fi | |
e7e136da TK |
3241 | if test "$getmntinfo" = "yes" ; then |
3242 | output_sym "CONFIG_GETMNTINFO" | |
3243 | fi | |
b765bec0 TK |
3244 | if test "$getmntinfo_statvfs" = "yes" ; then |
3245 | output_sym "CONFIG_GETMNTINFO_STATVFS" | |
3246 | fi | |
5018f79f AH |
3247 | if test "$static_assert" = "yes" ; then |
3248 | output_sym "CONFIG_STATIC_ASSERT" | |
3249 | fi | |
e39c0676 JA |
3250 | if test "$have_bool" = "yes" ; then |
3251 | output_sym "CONFIG_HAVE_BOOL" | |
3252 | fi | |
b29c71c4 JA |
3253 | if test "$strndup" = "yes" ; then |
3254 | output_sym "CONFIG_HAVE_STRNDUP" | |
3255 | fi | |
484817a9 JA |
3256 | if test "$disable_opt" = "yes" ; then |
3257 | output_sym "CONFIG_DISABLE_OPTIMIZATIONS" | |
3258 | fi | |
0ffccc21 BVA |
3259 | if test "$valgrind_dev" = "yes"; then |
3260 | output_sym "CONFIG_VALGRIND_DEV" | |
3261 | fi | |
a76e1995 | 3262 | if test "$linux_blkzoned" = "yes" ; then |
b7694961 | 3263 | output_sym "CONFIG_HAS_BLKZONED" |
a76e1995 | 3264 | fi |
56a19325 DF |
3265 | if test "$libzbc" = "yes" ; then |
3266 | output_sym "CONFIG_LIBZBC" | |
3267 | fi | |
605cf82e | 3268 | if test "$zlib" = "no" ; then |
95f791d3 | 3269 | echo "Consider installing zlib1g-dev (zlib-devel) as some fio features depend on it." |
8f909424 JA |
3270 | if test "$build_static" = "yes"; then |
3271 | echo "Note that some distros have separate packages for static libraries." | |
3272 | fi | |
605cf82e | 3273 | fi |
58828d07 SW |
3274 | if test "$march_armv8_a_crc_crypto" = "yes" ; then |
3275 | output_sym "ARCH_HAVE_CRC_CRYPTO" | |
3276 | fi | |
03553853 YR |
3277 | if test "$cuda" = "yes" ; then |
3278 | output_sym "CONFIG_CUDA" | |
3279 | fi | |
10756b2c BS |
3280 | if test "$libcufile" = "yes" ; then |
3281 | output_sym "CONFIG_LIBCUFILE" | |
3282 | fi | |
c363fdd7 JL |
3283 | if test "$dfs" = "yes" ; then |
3284 | output_sym "CONFIG_DFS" | |
3285 | fi | |
9f75af77 | 3286 | if test "$march_set" = "no" && test "$build_native" = "yes" ; then |
a817dc3b JA |
3287 | output_sym "CONFIG_BUILD_NATIVE" |
3288 | fi | |
b8b0e1ee TK |
3289 | if test "$cunit" = "yes" ; then |
3290 | output_sym "CONFIG_HAVE_CUNIT" | |
3291 | fi | |
57fa61f0 JA |
3292 | if test "$__kernel_rwf_t" = "yes"; then |
3293 | output_sym "CONFIG_HAVE_KERNEL_RWF_T" | |
3294 | fi | |
de5ed0e4 JA |
3295 | if test "$gettid" = "yes"; then |
3296 | output_sym "CONFIG_HAVE_GETTID" | |
3297 | fi | |
95f31f7d TK |
3298 | if test "$statx" = "yes"; then |
3299 | output_sym "CONFIG_HAVE_STATX" | |
3300 | fi | |
3301 | if test "$statx_syscall" = "yes"; then | |
3302 | output_sym "CONFIG_HAVE_STATX_SYSCALL" | |
3303 | fi | |
696378af BVA |
3304 | if test "$timerfd_create" = "yes"; then |
3305 | output_sym "CONFIG_HAVE_TIMERFD_CREATE" | |
3306 | fi | |
71144e67 JA |
3307 | if test "$fallthrough" = "yes"; then |
3308 | CFLAGS="$CFLAGS -Wimplicit-fallthrough" | |
3309 | fi | |
5ca54c1b JA |
3310 | if test "$no_stringop" = "yes"; then |
3311 | output_sym "CONFIG_HAVE_NO_STRINGOP" | |
3312 | fi | |
ff547caa KB |
3313 | if test "$thp" = "yes" ; then |
3314 | output_sym "CONFIG_HAVE_THP" | |
3315 | fi | |
247ef2aa KZ |
3316 | if test "$libiscsi" = "yes" ; then |
3317 | output_sym "CONFIG_LIBISCSI" | |
3318 | echo "CONFIG_LIBISCSI=m" >> $config_host_mak | |
3319 | echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak | |
3320 | echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak | |
3321 | fi | |
d643a1e2 RJ |
3322 | if test "$libnbd" = "yes" ; then |
3323 | output_sym "CONFIG_LIBNBD" | |
3324 | echo "CONFIG_LIBNBD=m" >> $config_host_mak | |
3325 | echo "LIBNBD_CFLAGS=$libnbd_cflags" >> $config_host_mak | |
3326 | echo "LIBNBD_LIBS=$libnbd_libs" >> $config_host_mak | |
3327 | fi | |
9326926b TG |
3328 | if test "$libnfs" = "yes" ; then |
3329 | output_sym "CONFIG_LIBNFS" | |
9326926b TG |
3330 | echo "LIBNFS_CFLAGS=$libnfs_cflags" >> $config_host_mak |
3331 | echo "LIBNFS_LIBS=$libnfs_libs" >> $config_host_mak | |
3332 | fi | |
a3ff873e AK |
3333 | if test "$xnvme" = "yes" ; then |
3334 | output_sym "CONFIG_LIBXNVME" | |
3335 | echo "LIBXNVME_CFLAGS=$xnvme_cflags" >> $config_host_mak | |
3336 | echo "LIBXNVME_LIBS=$xnvme_libs" >> $config_host_mak | |
3337 | fi | |
a4614bff AK |
3338 | if test "$isal" = "yes" ; then |
3339 | output_sym "CONFIG_LIBISAL" | |
3340 | fi | |
a601337a AF |
3341 | if test "$libblkio" = "yes" ; then |
3342 | output_sym "CONFIG_LIBBLKIO" | |
3343 | echo "LIBBLKIO_CFLAGS=$libblkio_cflags" >> $config_host_mak | |
3344 | echo "LIBBLKIO_LIBS=$libblkio_libs" >> $config_host_mak | |
3345 | fi | |
5a8a6a03 | 3346 | if test "$dynamic_engines" = "yes" ; then |
a504a390 | 3347 | output_sym "CONFIG_DYNAMIC_ENGINES" |
5a8a6a03 | 3348 | fi |
76bc30ca SW |
3349 | if test "$pdb" = yes; then |
3350 | output_sym "CONFIG_PDB" | |
3351 | fi | |
a04e0665 JA |
3352 | if test "$fcntl_sync" = "yes" ; then |
3353 | output_sym "CONFIG_FCNTL_SYNC" | |
3354 | fi | |
39c83923 DP |
3355 | if test "$asan" = "yes"; then |
3356 | CFLAGS="$CFLAGS -fsanitize=address" | |
3357 | LDFLAGS="$LDFLAGS -fsanitize=address" | |
3358 | fi | |
5a8a6a03 | 3359 | print_config "Lib-based ioengines dynamic" "$dynamic_engines" |
01fe773d JD |
3360 | cat > $TMPC << EOF |
3361 | int main(int argc, char **argv) | |
3362 | { | |
3363 | return 0; | |
3364 | } | |
3365 | EOF | |
ab6e4714 SW |
3366 | if test "$disable_tcmalloc" != "yes"; then |
3367 | if compile_prog "" "-ltcmalloc" "tcmalloc"; then | |
3368 | tcmalloc="yes" | |
3369 | LIBS="-ltcmalloc $LIBS" | |
3370 | elif compile_prog "" "-l:libtcmalloc_minimal.so.4" "tcmalloc_minimal4"; then | |
3371 | tcmalloc="yes" | |
3372 | LIBS="-l:libtcmalloc_minimal.so.4 $LIBS" | |
3373 | else | |
3374 | tcmalloc="no" | |
3375 | fi | |
01fe773d JD |
3376 | fi |
3377 | print_config "TCMalloc support" "$tcmalloc" | |
7ff204c8 SM |
3378 | if ! num "$seed_buckets"; then |
3379 | seed_buckets=4 | |
3380 | elif test "$seed_buckets" -lt 2; then | |
3381 | seed_buckets=2 | |
3382 | elif test "$seed_buckets" -gt 16; then | |
3383 | seed_buckets=16 | |
3384 | fi | |
3385 | echo "#define CONFIG_SEED_BUCKETS $seed_buckets" >> $config_host_h | |
3386 | print_config "seed_buckets" "$seed_buckets" | |
605cf82e | 3387 | |
67bf9823 | 3388 | echo "LIBS+=$LIBS" >> $config_host_mak |
86719845 | 3389 | echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak |
91f94d5b | 3390 | echo "CFLAGS+=$CFLAGS" >> $config_host_mak |
d2aeedb9 | 3391 | echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak |
67bf9823 | 3392 | echo "CC=$cc" >> $config_host_mak |
af4862b3 | 3393 | echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak |
020d54bd | 3394 | echo "INSTALL_PREFIX=$prefix" >> $config_host_mak |
c61a3a44 | 3395 | |
59d8f412 | 3396 | if [ `dirname $0` != "." -a ! -e Makefile ]; then |
c61a3a44 JF |
3397 | cat > Makefile <<EOF |
3398 | SRCDIR:=`dirname $0` | |
3399 | include \$(SRCDIR)/Makefile | |
3400 | EOF | |
3401 | fi |