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