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