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