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