| 1 | #!/bin/sh |
| 2 | # |
| 3 | # Fio configure script. Heavily influenced by the manual qemu configure |
| 4 | # script. Sad this 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 | TMPO="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.o" |
| 18 | TMPE="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.exe" |
| 19 | |
| 20 | # NB: do not call "exit" in the trap handler; this is buggy with some shells; |
| 21 | # see <1285349658-3122-1-git-send-email-loic.minier@linaro.org> |
| 22 | trap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM |
| 23 | |
| 24 | rm -rf config.log |
| 25 | |
| 26 | config_host_mak="config-host.mak" |
| 27 | config_host_ld="config-host.ld" |
| 28 | |
| 29 | # Print a helpful header at the top of config.log |
| 30 | echo "# FIO configure log $(date)" >> config.log |
| 31 | printf "# Configured with:" >> config.log |
| 32 | printf " '%s'" "$0" "$@" >> config.log |
| 33 | echo >> config.log |
| 34 | echo "#" >> config.log |
| 35 | |
| 36 | do_cc() { |
| 37 | # Run the compiler, capturing its output to the log. |
| 38 | echo $cc "$@" >> config.log |
| 39 | $cc "$@" >> config.log 2>&1 || return $? |
| 40 | # Test passed. If this is an --enable-werror build, rerun |
| 41 | # the test with -Werror and bail out if it fails. This |
| 42 | # makes warning-generating-errors in configure test code |
| 43 | # obvious to developers. |
| 44 | if test "$werror" != "yes"; then |
| 45 | return 0 |
| 46 | fi |
| 47 | # Don't bother rerunning the compile if we were already using -Werror |
| 48 | case "$*" in |
| 49 | *-Werror*) |
| 50 | return 0 |
| 51 | ;; |
| 52 | esac |
| 53 | echo $cc -Werror "$@" >> config.log |
| 54 | $cc -Werror "$@" >> config.log 2>&1 && return $? |
| 55 | echo "ERROR: configure test passed without -Werror but failed with -Werror." |
| 56 | echo "This is probably a bug in the configure script. The failing command" |
| 57 | echo "will be at the bottom of config.log." |
| 58 | echo "You can run configure with --disable-werror to bypass this check." |
| 59 | exit 1 |
| 60 | } |
| 61 | |
| 62 | compile_object() { |
| 63 | do_cc $CFLAGS -c -o $TMPO $TMPC |
| 64 | } |
| 65 | |
| 66 | compile_prog() { |
| 67 | local_cflags="$1" |
| 68 | local_ldflags="$2" |
| 69 | echo "Compiling test case $3" >> config.log |
| 70 | do_cc $CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags |
| 71 | } |
| 72 | |
| 73 | feature_not_found() { |
| 74 | feature=$1 |
| 75 | |
| 76 | echo "ERROR" |
| 77 | echo "ERROR: User requested feature $feature" |
| 78 | echo "ERROR: configure was not able to find it" |
| 79 | echo "ERROR" |
| 80 | exit 1; |
| 81 | } |
| 82 | |
| 83 | has() { |
| 84 | type "$1" >/dev/null 2>&1 |
| 85 | } |
| 86 | |
| 87 | check_define() { |
| 88 | cat > $TMPC <<EOF |
| 89 | #if !defined($1) |
| 90 | #error $1 not defined |
| 91 | #endif |
| 92 | int main(void) |
| 93 | { |
| 94 | return 0; |
| 95 | } |
| 96 | EOF |
| 97 | compile_object |
| 98 | } |
| 99 | |
| 100 | targetos="" |
| 101 | cpu="" |
| 102 | |
| 103 | cc="${CC-${cross_prefix}gcc}" |
| 104 | |
| 105 | # parse options |
| 106 | for opt do |
| 107 | optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` |
| 108 | case "$opt" in |
| 109 | --cc=*) CC="$optarg" |
| 110 | ;; |
| 111 | *) |
| 112 | echo "Bad option $opt" |
| 113 | exit 1 |
| 114 | esac |
| 115 | done |
| 116 | |
| 117 | if check_define __linux__ ; then |
| 118 | targetos="Linux" |
| 119 | elif check_define _WIN32 ; then |
| 120 | echo "Forcing known good options on Windows" |
| 121 | echo "CONFIG_64BIT_LLP64=y" >> $config_host_mak |
| 122 | echo "CONFIG_CLOCK_GETTIME=y" >> $config_host_mak |
| 123 | echo "CONFIG_CLOCK_MONOTONIC=y" >> $config_host_mak |
| 124 | echo "CONFIG_GETTIMEOFDAY=y" >> $config_host_mak |
| 125 | echo "CONFIG_FADVISE=y" >> $config_host_mak |
| 126 | echo "CONFIG_STRSEP=y" >> $config_host_mak |
| 127 | echo "CONFIG_SOCKLEN_T=y" >> $config_host_mak |
| 128 | echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak |
| 129 | echo "CONFIG_FADVISE=y" >> $config_host_mak |
| 130 | echo "CONFIG_SFAA=y" >> $config_host_mak |
| 131 | exit 0 |
| 132 | elif check_define __OpenBSD__ ; then |
| 133 | targetos='OpenBSD' |
| 134 | elif check_define __sun__ ; then |
| 135 | targetos='SunOS' |
| 136 | else |
| 137 | targetos=`uname -s` |
| 138 | fi |
| 139 | |
| 140 | # Some host OSes need non-standard checks for which CPU to use. |
| 141 | # Note that these checks are broken for cross-compilation: if you're |
| 142 | # cross-compiling to one of these OSes then you'll need to specify |
| 143 | # the correct CPU with the --cpu option. |
| 144 | case $targetos in |
| 145 | Darwin) |
| 146 | # on Leopard most of the system is 32-bit, so we have to ask the kernel if |
| 147 | # we can run 64-bit userspace code. |
| 148 | # If the user didn't specify a CPU explicitly and the kernel says this is |
| 149 | # 64 bit hw, then assume x86_64. Otherwise fall through to the usual |
| 150 | # detection code. |
| 151 | if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then |
| 152 | cpu="x86_64" |
| 153 | fi |
| 154 | ;; |
| 155 | SunOS) |
| 156 | # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo |
| 157 | if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then |
| 158 | cpu="x86_64" |
| 159 | fi |
| 160 | esac |
| 161 | |
| 162 | if test ! -z "$cpu" ; then |
| 163 | # command line argument |
| 164 | : |
| 165 | elif check_define __i386__ ; then |
| 166 | cpu="i386" |
| 167 | elif check_define __x86_64__ ; then |
| 168 | cpu="x86_64" |
| 169 | elif check_define __sparc__ ; then |
| 170 | if check_define __arch64__ ; then |
| 171 | cpu="sparc64" |
| 172 | else |
| 173 | cpu="sparc" |
| 174 | fi |
| 175 | elif check_define _ARCH_PPC ; then |
| 176 | if check_define _ARCH_PPC64 ; then |
| 177 | cpu="ppc64" |
| 178 | else |
| 179 | cpu="ppc" |
| 180 | fi |
| 181 | elif check_define __mips__ ; then |
| 182 | cpu="mips" |
| 183 | elif check_define __ia64__ ; then |
| 184 | cpu="ia64" |
| 185 | elif check_define __s390__ ; then |
| 186 | if check_define __s390x__ ; then |
| 187 | cpu="s390x" |
| 188 | else |
| 189 | cpu="s390" |
| 190 | fi |
| 191 | elif check_define __arm__ ; then |
| 192 | cpu="arm" |
| 193 | elif check_define __hppa__ ; then |
| 194 | cpu="hppa" |
| 195 | else |
| 196 | cpu=`uname -m` |
| 197 | fi |
| 198 | |
| 199 | # Normalise host CPU name and set ARCH. |
| 200 | case "$cpu" in |
| 201 | ia64|ppc|ppc64|s390|s390x|sparc64) |
| 202 | cpu="$cpu" |
| 203 | ;; |
| 204 | i386|i486|i586|i686|i86pc|BePC) |
| 205 | cpu="i386" |
| 206 | ;; |
| 207 | x86_64|amd64) |
| 208 | cpu="x86_64" |
| 209 | ;; |
| 210 | armv*b|armv*l|arm) |
| 211 | cpu="arm" |
| 212 | ;; |
| 213 | hppa|parisc|parisc64) |
| 214 | cpu="hppa" |
| 215 | ;; |
| 216 | mips*) |
| 217 | cpu="mips" |
| 218 | ;; |
| 219 | sparc|sun4[cdmuv]) |
| 220 | cpu="sparc" |
| 221 | ;; |
| 222 | *) |
| 223 | echo "Unknown CPU" |
| 224 | exit 1; |
| 225 | ;; |
| 226 | esac |
| 227 | |
| 228 | if test -z $CC; then |
| 229 | if test "$targetos" = "FreeBSD"; then |
| 230 | if has clang; then |
| 231 | CC=clang |
| 232 | else |
| 233 | CC=gcc |
| 234 | fi |
| 235 | fi |
| 236 | fi |
| 237 | |
| 238 | cc="${CC-${cross_prefix}gcc}" |
| 239 | |
| 240 | echo "Operating system $targetos" |
| 241 | echo "CPU $cpu" |
| 242 | echo "Compiler $cc" |
| 243 | echo |
| 244 | |
| 245 | ########################################## |
| 246 | # check for wordsize |
| 247 | wordsize="0" |
| 248 | cat > $TMPC <<EOF |
| 249 | #include <stdio.h> |
| 250 | int main(void) |
| 251 | { |
| 252 | unsigned int wsize = sizeof(long) * 8; |
| 253 | printf("%d\n", wsize); |
| 254 | return 0; |
| 255 | } |
| 256 | EOF |
| 257 | if compile_prog "" "" "wordsize"; then |
| 258 | wordsize=$($TMPE) |
| 259 | fi |
| 260 | echo "Wordsize $wordsize" |
| 261 | |
| 262 | ########################################## |
| 263 | # linux-aio probe |
| 264 | libaio="no" |
| 265 | cat > $TMPC <<EOF |
| 266 | #include <libaio.h> |
| 267 | #include <stddef.h> |
| 268 | int main(void) |
| 269 | { |
| 270 | io_setup(0, NULL); |
| 271 | return 0; |
| 272 | } |
| 273 | EOF |
| 274 | if compile_prog "" "-laio" "libaio" ; then |
| 275 | libaio=yes |
| 276 | LIBS="-laio $LIBS" |
| 277 | else |
| 278 | if test "$libaio" = "yes" ; then |
| 279 | feature_not_found "linux AIO" |
| 280 | fi |
| 281 | libaio=no |
| 282 | fi |
| 283 | echo "Linux AIO support $libaio" |
| 284 | |
| 285 | ########################################## |
| 286 | # posix aio probe |
| 287 | posix_aio="no" |
| 288 | posix_aio_lrt="no" |
| 289 | cat > $TMPC <<EOF |
| 290 | #include <aio.h> |
| 291 | int main(void) |
| 292 | { |
| 293 | struct aiocb cb; |
| 294 | aio_read(&cb); |
| 295 | return 0; |
| 296 | } |
| 297 | EOF |
| 298 | if compile_prog "" "" "posixaio" ; then |
| 299 | posix_aio="yes" |
| 300 | elif compile_prog "" "-lrt" "posixaio"; then |
| 301 | posix_aio="yes" |
| 302 | posix_aio_lrt="yes" |
| 303 | LIBS="-lrt $LIBS" |
| 304 | fi |
| 305 | echo "POSIX AIO support $posix_aio" |
| 306 | echo "POSIX AIO support needs -lrt $posix_aio_lrt" |
| 307 | |
| 308 | ########################################## |
| 309 | # posix aio fsync probe |
| 310 | posix_aio_fsync="no" |
| 311 | if test "$posix_aio" = "yes" ; then |
| 312 | cat > $TMPC <<EOF |
| 313 | #include <fcntl.h> |
| 314 | #include <aio.h> |
| 315 | int main(void) |
| 316 | { |
| 317 | struct aiocb cb; |
| 318 | return aio_fsync(O_SYNC, &cb); |
| 319 | return 0; |
| 320 | } |
| 321 | EOF |
| 322 | if compile_prog "" "$LIBS" "posix_aio_fsync" ; then |
| 323 | posix_aio_fsync=yes |
| 324 | fi |
| 325 | fi |
| 326 | echo "POSIX AIO fsync $posix_aio_fsync" |
| 327 | |
| 328 | ########################################## |
| 329 | # solaris aio probe |
| 330 | solaris_aio="no" |
| 331 | cat > $TMPC <<EOF |
| 332 | #include <sys/types.h> |
| 333 | #include <sys/asynch.h> |
| 334 | #include <unistd.h> |
| 335 | int main(void) |
| 336 | { |
| 337 | aio_result_t res; |
| 338 | return aioread(0, NULL, 0, 0, SEEK_SET, &res); |
| 339 | return 0; |
| 340 | } |
| 341 | EOF |
| 342 | if compile_prog "" "-laio" "solarisaio" ; then |
| 343 | solaris_aio=yes |
| 344 | LIBS="-laio $LIBS" |
| 345 | fi |
| 346 | echo "Solaris AIO support $solaris_aio" |
| 347 | |
| 348 | ########################################## |
| 349 | # __sync_fetch_and_and test |
| 350 | sfaa="no" |
| 351 | cat > $TMPC << EOF |
| 352 | static int sfaa(int *ptr) |
| 353 | { |
| 354 | return __sync_fetch_and_and(ptr, 0); |
| 355 | } |
| 356 | |
| 357 | int main(int argc, char **argv) |
| 358 | { |
| 359 | int val = 42; |
| 360 | sfaa(&val); |
| 361 | return val; |
| 362 | } |
| 363 | EOF |
| 364 | if compile_prog "" "" "__sync_fetch_and_add()" ; then |
| 365 | sfaa="yes" |
| 366 | fi |
| 367 | echo "__sync_fetch_and add $sfaa" |
| 368 | |
| 369 | ########################################## |
| 370 | # libverbs probe |
| 371 | libverbs="no" |
| 372 | cat > $TMPC << EOF |
| 373 | #include <stdio.h> |
| 374 | #include <infiniband/arch.h> |
| 375 | int main(int argc, char **argv) |
| 376 | { |
| 377 | struct ibv_pd *pd = ibv_alloc_pd(NULL); |
| 378 | return 0; |
| 379 | } |
| 380 | EOF |
| 381 | if compile_prog "" "-libverbs" "libverbs" ; then |
| 382 | libverbs="yes" |
| 383 | LIBS="-libverbs $LIBS" |
| 384 | fi |
| 385 | echo "libverbs $libverbs" |
| 386 | |
| 387 | ########################################## |
| 388 | # rdmacm probe |
| 389 | rdmacm="no" |
| 390 | cat > $TMPC << EOF |
| 391 | #include <stdio.h> |
| 392 | #include <rdma/rdma_cma.h> |
| 393 | int main(int argc, char **argv) |
| 394 | { |
| 395 | rdma_destroy_qp(NULL); |
| 396 | return 0; |
| 397 | } |
| 398 | EOF |
| 399 | if compile_prog "" "-lrdmacm" "rdma"; then |
| 400 | rdmacm="yes" |
| 401 | LIBS="-lrdmacm $LIBS" |
| 402 | fi |
| 403 | echo "rdmacm $rdmacm" |
| 404 | |
| 405 | ########################################## |
| 406 | # Linux fallocate probe |
| 407 | linux_fallocate="no" |
| 408 | cat > $TMPC << EOF |
| 409 | #include <stdio.h> |
| 410 | #include <linux/falloc.h> |
| 411 | int main(int argc, char **argv) |
| 412 | { |
| 413 | int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024); |
| 414 | return r; |
| 415 | } |
| 416 | EOF |
| 417 | if compile_prog "" "" "linux_fallocate"; then |
| 418 | linux_fallocate="yes" |
| 419 | fi |
| 420 | echo "Linux fallocate $linux_fallocate" |
| 421 | |
| 422 | ########################################## |
| 423 | # POSIX fadvise probe |
| 424 | posix_fadvise="no" |
| 425 | cat > $TMPC << EOF |
| 426 | #include <stdio.h> |
| 427 | #include <fcntl.h> |
| 428 | int main(int argc, char **argv) |
| 429 | { |
| 430 | int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL); |
| 431 | return r; |
| 432 | } |
| 433 | EOF |
| 434 | if compile_prog "" "" "posix_fadvise"; then |
| 435 | posix_fadvise="yes" |
| 436 | fi |
| 437 | echo "POSIX fadvise $posix_fadvise" |
| 438 | |
| 439 | ########################################## |
| 440 | # POSIX fallocate probe |
| 441 | posix_fallocate="no" |
| 442 | cat > $TMPC << EOF |
| 443 | #include <stdio.h> |
| 444 | #include <fcntl.h> |
| 445 | int main(int argc, char **argv) |
| 446 | { |
| 447 | int r = posix_fallocate(0, 0, 1024); |
| 448 | return r; |
| 449 | } |
| 450 | EOF |
| 451 | if compile_prog "" "" "posix_fallocate"; then |
| 452 | posix_fallocate="yes" |
| 453 | fi |
| 454 | echo "POSIX fallocate $posix_fallocate" |
| 455 | |
| 456 | ########################################## |
| 457 | # sched_set/getaffinity 2 or 3 argument test |
| 458 | linux_2arg_affinity="no" |
| 459 | linux_3arg_affinity="no" |
| 460 | cat > $TMPC << EOF |
| 461 | #define _GNU_SOURCE |
| 462 | #include <sched.h> |
| 463 | int main(int argc, char **argv) |
| 464 | { |
| 465 | cpu_set_t mask; |
| 466 | return sched_setaffinity(0, sizeof(mask), &mask); |
| 467 | } |
| 468 | EOF |
| 469 | if compile_prog "" "" "sched_setaffinity(,,)"; then |
| 470 | linux_3arg_affinity="yes" |
| 471 | else |
| 472 | cat > $TMPC << EOF |
| 473 | #define _GNU_SOURCE |
| 474 | #include <sched.h> |
| 475 | int main(int argc, char **argv) |
| 476 | { |
| 477 | cpu_set_t mask; |
| 478 | return sched_setaffinity(0, &mask); |
| 479 | } |
| 480 | EOF |
| 481 | if compile_prog "" "" "sched_setaffinity(,)"; then |
| 482 | linux_2arg_affinity="yes" |
| 483 | fi |
| 484 | fi |
| 485 | echo "sched_setaffinity(3 arg) $linux_3arg_affinity" |
| 486 | echo "sched_setaffinity(2 arg) $linux_2arg_affinity" |
| 487 | |
| 488 | ########################################## |
| 489 | # clock_gettime probe |
| 490 | clock_gettime="no" |
| 491 | cat > $TMPC << EOF |
| 492 | #include <stdio.h> |
| 493 | #include <time.h> |
| 494 | int main(int argc, char **argv) |
| 495 | { |
| 496 | return clock_gettime(0, NULL); |
| 497 | } |
| 498 | EOF |
| 499 | if compile_prog "" "" "clock_gettime"; then |
| 500 | clock_gettime="yes" |
| 501 | elif compile_prog "" "-lrt" "clock_gettime"; then |
| 502 | clock_gettime="yes" |
| 503 | LIBS="-lrt $LIBS" |
| 504 | fi |
| 505 | echo "clock_gettime $clock_gettime" |
| 506 | |
| 507 | ########################################## |
| 508 | # CLOCK_MONOTONIC probe |
| 509 | clock_monotonic="no" |
| 510 | if test "$clock_gettime" = "yes" ; then |
| 511 | cat > $TMPC << EOF |
| 512 | #include <stdio.h> |
| 513 | #include <time.h> |
| 514 | int main(int argc, char **argv) |
| 515 | { |
| 516 | return clock_gettime(CLOCK_MONOTONIC, NULL); |
| 517 | } |
| 518 | EOF |
| 519 | if compile_prog "" "$LIBS" "clock monotonic"; then |
| 520 | clock_monotonic="yes" |
| 521 | fi |
| 522 | fi |
| 523 | echo "CLOCK_MONOTONIC $clock_monotonic" |
| 524 | |
| 525 | ########################################## |
| 526 | # CLOCK_MONOTONIC_PRECISE probe |
| 527 | clock_monotonic_precise="no" |
| 528 | if test "$clock_gettime" = "yes" ; then |
| 529 | cat > $TMPC << EOF |
| 530 | #include <stdio.h> |
| 531 | #include <time.h> |
| 532 | int main(int argc, char **argv) |
| 533 | { |
| 534 | return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL); |
| 535 | } |
| 536 | EOF |
| 537 | if compile_prog "" "$LIBS" "clock monotonic precise"; then |
| 538 | clock_monotonic_precise="yes" |
| 539 | fi |
| 540 | fi |
| 541 | echo "CLOCK_MONOTONIC_PRECISE $clock_monotonic_precise" |
| 542 | |
| 543 | ########################################## |
| 544 | # gettimeofday() probe |
| 545 | gettimeofday="no" |
| 546 | cat > $TMPC << EOF |
| 547 | #include <sys/time.h> |
| 548 | #include <stdio.h> |
| 549 | int main(int argc, char **argv) |
| 550 | { |
| 551 | struct timeval tv; |
| 552 | return gettimeofday(&tv, NULL); |
| 553 | } |
| 554 | EOF |
| 555 | if compile_prog "" "" "gettimeofday"; then |
| 556 | gettimeofday="yes" |
| 557 | fi |
| 558 | echo "gettimeofday $gettimeofday" |
| 559 | |
| 560 | ########################################## |
| 561 | # fdatasync() probe |
| 562 | fdatasync="no" |
| 563 | cat > $TMPC << EOF |
| 564 | #include <stdio.h> |
| 565 | #include <unistd.h> |
| 566 | int main(int argc, char **argv) |
| 567 | { |
| 568 | return fdatasync(0); |
| 569 | } |
| 570 | EOF |
| 571 | if compile_prog "" "" "fdatasync"; then |
| 572 | fdatasync="yes" |
| 573 | fi |
| 574 | echo "fdatasync $fdatasync" |
| 575 | |
| 576 | ########################################## |
| 577 | # sync_file_range() probe |
| 578 | sync_file_range="no" |
| 579 | cat > $TMPC << EOF |
| 580 | #include <stdio.h> |
| 581 | #include <unistd.h> |
| 582 | #define _GNU_SOURCE |
| 583 | #include <fcntl.h> |
| 584 | #include <linux/fs.h> |
| 585 | int main(int argc, char **argv) |
| 586 | { |
| 587 | unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE | |
| 588 | SYNC_FILE_RANGE_WAIT_AFTER; |
| 589 | return sync_file_range(0, 0, 0, flags); |
| 590 | } |
| 591 | EOF |
| 592 | if compile_prog "" "" "sync_file_range"; then |
| 593 | sync_file_range="yes" |
| 594 | fi |
| 595 | echo "sync_file_range $sync_file_range" |
| 596 | |
| 597 | ########################################## |
| 598 | # ext4 move extent probe |
| 599 | ext4_me="no" |
| 600 | cat > $TMPC << EOF |
| 601 | #include <fcntl.h> |
| 602 | #include <sys/ioctl.h> |
| 603 | int main(int argc, char **argv) |
| 604 | { |
| 605 | struct move_extent me; |
| 606 | return ioctl(0, EXT4_IOC_MOVE_EXT, &me); |
| 607 | } |
| 608 | EOF |
| 609 | if compile_prog "" "" "ext4 move extent" ; then |
| 610 | ext4_me="yes" |
| 611 | elif test $targetos = "Linux" ; then |
| 612 | # On Linux, just default to it on and let it error at runtime if we really |
| 613 | # don't have it. None of my updated systems have it defined, but it does |
| 614 | # work. Takes a while to bubble back. |
| 615 | ext4_me="yes" |
| 616 | fi |
| 617 | echo "EXT4 move extent $ext4_me" |
| 618 | |
| 619 | ########################################## |
| 620 | # splice probe |
| 621 | linux_splice="no" |
| 622 | cat > $TMPC << EOF |
| 623 | #define _GNU_SOURCE |
| 624 | #include <stdio.h> |
| 625 | #include <fcntl.h> |
| 626 | int main(int argc, char **argv) |
| 627 | { |
| 628 | return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK); |
| 629 | } |
| 630 | EOF |
| 631 | if compile_prog "" "" "linux splice"; then |
| 632 | linux_splice="yes" |
| 633 | fi |
| 634 | echo "Linux splice(2) $linux_splice" |
| 635 | |
| 636 | ########################################## |
| 637 | # GUASI probe |
| 638 | guasi="no" |
| 639 | cat > $TMPC << EOF |
| 640 | #include <guasi.h> |
| 641 | #include <guasi_syscalls.h> |
| 642 | int main(int argc, char **argv) |
| 643 | { |
| 644 | guasi_t ctx = guasi_create(0, 0, 0); |
| 645 | return 0; |
| 646 | } |
| 647 | EOF |
| 648 | if compile_prog "" "" "guasi"; then |
| 649 | guasi="yes" |
| 650 | fi |
| 651 | echo "GUASI $guasi" |
| 652 | |
| 653 | ########################################## |
| 654 | # fusion-aw probe |
| 655 | fusion_aw="no" |
| 656 | cat > $TMPC << EOF |
| 657 | #include <nvm/vectored_write.h> |
| 658 | int main(int argc, char **argv) |
| 659 | { |
| 660 | struct vsl_iovec iov; |
| 661 | return vsl_vectored_write(0, &iov, 0, O_ATOMIC); |
| 662 | } |
| 663 | EOF |
| 664 | if compile_prog "" "-L/usr/lib/fio -lnvm-primitives" "fusion-aw"; then |
| 665 | LIBS="-L/usr/lib/fio -lnvm-primitives $LIBS" |
| 666 | fusion_aw="yes" |
| 667 | fi |
| 668 | echo "Fusion-io atomic engine $fusion_aw" |
| 669 | |
| 670 | ########################################## |
| 671 | # libnuma probe |
| 672 | libnuma="no" |
| 673 | cat > $TMPC << EOF |
| 674 | #include <numa.h> |
| 675 | int main(int argc, char **argv) |
| 676 | { |
| 677 | return numa_available(); |
| 678 | } |
| 679 | EOF |
| 680 | if compile_prog "" "-lnuma" "libnuma"; then |
| 681 | libnuma="yes" |
| 682 | LIBS="-lnuma $LIBS" |
| 683 | fi |
| 684 | echo "libnuma $libnuma" |
| 685 | |
| 686 | ########################################## |
| 687 | # strsep() probe |
| 688 | strsep="no" |
| 689 | cat > $TMPC << EOF |
| 690 | #include <string.h> |
| 691 | int main(int argc, char **argv) |
| 692 | { |
| 693 | strsep(NULL, NULL); |
| 694 | return 0; |
| 695 | } |
| 696 | EOF |
| 697 | if compile_prog "" "" "strsep"; then |
| 698 | strsep="yes" |
| 699 | fi |
| 700 | echo "strsep $strsep" |
| 701 | |
| 702 | ########################################## |
| 703 | # getopt_long_only() probe |
| 704 | getopt_long_only="no" |
| 705 | cat > $TMPC << EOF |
| 706 | #include <unistd.h> |
| 707 | #include <stdio.h> |
| 708 | int main(int argc, char **argv) |
| 709 | { |
| 710 | int c = getopt_long_only(argc, argv, NULL, NULL, NULL); |
| 711 | return c; |
| 712 | } |
| 713 | EOF |
| 714 | if compile_prog "" "" "getopt_long_only"; then |
| 715 | getopt_long_only="yes" |
| 716 | fi |
| 717 | echo "getopt_long_only() $getopt_long_only" |
| 718 | |
| 719 | ########################################## |
| 720 | # inet_aton() probe |
| 721 | inet_aton="no" |
| 722 | cat > $TMPC << EOF |
| 723 | #include <sys/socket.h> |
| 724 | #include <arpa/inet.h> |
| 725 | #include <stdio.h> |
| 726 | int main(int argc, char **argv) |
| 727 | { |
| 728 | struct in_addr in; |
| 729 | return inet_aton(NULL, &in); |
| 730 | } |
| 731 | EOF |
| 732 | if compile_prog "" "" "inet_aton"; then |
| 733 | inet_aton="yes" |
| 734 | fi |
| 735 | echo "inet_aton $inet_aton" |
| 736 | |
| 737 | ########################################## |
| 738 | # socklen_t probe |
| 739 | socklen_t="no" |
| 740 | cat > $TMPC << EOF |
| 741 | #include <string.h> |
| 742 | #include <netinet/in.h> |
| 743 | int main(int argc, char **argv) |
| 744 | { |
| 745 | socklen_t len = 0; |
| 746 | return len; |
| 747 | } |
| 748 | EOF |
| 749 | if compile_prog "" "" "socklen_t"; then |
| 750 | socklen_t="yes" |
| 751 | fi |
| 752 | echo "socklen_t $socklen_t" |
| 753 | |
| 754 | ########################################## |
| 755 | # Whether or not __thread is supported for TLS |
| 756 | tls_thread="no" |
| 757 | cat > $TMPC << EOF |
| 758 | #include <stdio.h> |
| 759 | static int __thread ret; |
| 760 | int main(int argc, char **argv) |
| 761 | { |
| 762 | return ret; |
| 763 | } |
| 764 | EOF |
| 765 | if compile_prog "" "" "__thread"; then |
| 766 | tls_thread="yes" |
| 767 | fi |
| 768 | echo "__thread $tls_thread" |
| 769 | |
| 770 | ############################################################################# |
| 771 | |
| 772 | echo "# Automatically generated by configure - do not modify" > $config_host_mak |
| 773 | printf "# Configured with:" >> $config_host_mak |
| 774 | printf " '%s'" "$0" "$@" >> $config_host_mak |
| 775 | echo >> $config_host_mak |
| 776 | |
| 777 | if test "$wordsize" = "64" ; then |
| 778 | echo "CONFIG_64BIT=y" >> $config_host_mak |
| 779 | elif test "$wordsize" = "32" ; then |
| 780 | echo "CONFIG_32BIT=y" >> $config_host_mak |
| 781 | else |
| 782 | echo "Unknown wordsize!" |
| 783 | exit 1 |
| 784 | fi |
| 785 | if test "$libaio" = "yes" ; then |
| 786 | echo "CONFIG_LIBAIO=y" >> $config_host_mak |
| 787 | fi |
| 788 | if test "$posix_aio" = "yes" ; then |
| 789 | echo "CONFIG_POSIXAIO=y" >> $config_host_mak |
| 790 | fi |
| 791 | if test "$posix_aio_fsync" = "yes" ; then |
| 792 | echo "CONFIG_POSIXAIO_FSYNC=y" >> $config_host_mak |
| 793 | fi |
| 794 | if test "$linux_fallocate" = "yes" ; then |
| 795 | echo "CONFIG_LINUX_FALLOCATE=y" >> $config_host_mak |
| 796 | fi |
| 797 | if test "$posix_fallocate" = "yes" ; then |
| 798 | echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak |
| 799 | fi |
| 800 | if test "$fdatasync" = "yes" ; then |
| 801 | echo "CONFIG_FDATASYNC=y" >> $config_host_mak |
| 802 | fi |
| 803 | if test "$sync_file_range" = "yes" ; then |
| 804 | echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak |
| 805 | fi |
| 806 | if test "$sfaa" = "yes" ; then |
| 807 | echo "CONFIG_SFAA=y" >> $config_host_mak |
| 808 | fi |
| 809 | if test "$libverbs" = "yes" -o "rdmacm" = "yes" ; then |
| 810 | echo "CONFIG_RDMA=y" >> $config_host_mak |
| 811 | fi |
| 812 | if test "$clock_gettime" = "yes" ; then |
| 813 | echo "CONFIG_CLOCK_GETTIME=y" >> $config_host_mak |
| 814 | fi |
| 815 | if test "$clock_monotonic" = "yes" ; then |
| 816 | echo "CONFIG_CLOCK_MONOTONIC=y" >> $config_host_mak |
| 817 | fi |
| 818 | if test "$clock_monotonic_precise" = "yes" ; then |
| 819 | echo "CONFIG_CLOCK_MONOTONIC_PRECISE=y" >> $config_host_mak |
| 820 | fi |
| 821 | if test "$gettimeofday" = "yes" ; then |
| 822 | echo "CONFIG_GETTIMEOFDAY=y" >> $config_host_mak |
| 823 | fi |
| 824 | if test "$posix_fadvise" = "yes" ; then |
| 825 | echo "CONFIG_POSIX_FADVISE=y" >> $config_host_mak |
| 826 | fi |
| 827 | if test "$linux_3arg_affinity" = "yes" ; then |
| 828 | echo "CONFIG_3ARG_AFFINITY=y" >> $config_host_mak |
| 829 | elif test "$linux_2arg_affinity" = "yes" ; then |
| 830 | echo "CONFIG_2ARG_AFFINITY=y" >> $config_host_mak |
| 831 | fi |
| 832 | if test "$strsep" = "yes" ; then |
| 833 | echo "CONFIG_STRSEP=y" >> $config_host_mak |
| 834 | fi |
| 835 | if test "$getopt_long_only" = "yes" ; then |
| 836 | echo "CONFIG_GETOPT_LONG_ONLY=y" >> $config_host_mak |
| 837 | fi |
| 838 | if test "$inet_aton" = "yes" ; then |
| 839 | echo "CONFIG_INET_ATON=y" >> $config_host_mak |
| 840 | fi |
| 841 | if test "$socklen_t" = "yes" ; then |
| 842 | echo "CONFIG_SOCKLEN_T=y" >> $config_host_mak |
| 843 | fi |
| 844 | if test "$ext4_me" = "yes" ; then |
| 845 | echo "CONFIG_LINUX_EXT4_MOVE_EXTENT=y" >> $config_host_mak |
| 846 | fi |
| 847 | if test "$linux_splice" = "yes" ; then |
| 848 | echo "CONFIG_LINUX_SPLICE=y" >> $config_host_mak |
| 849 | fi |
| 850 | if test "$guasi" = "yes" ; then |
| 851 | echo "CONFIG_GUASI=y" >> $config_host_mak |
| 852 | fi |
| 853 | if test "$fusion_aw" = "yes" ; then |
| 854 | echo "CONFIG_FUSION_AW=y" >> $config_host_mak |
| 855 | fi |
| 856 | if test "$libnuma" = "yes" ; then |
| 857 | echo "CONFIG_LIBNUMA=y" >> $config_host_mak |
| 858 | fi |
| 859 | if test "$solaris_aio" = "yes" ; then |
| 860 | echo "CONFIG_SOLARISAIO=y" >> $config_host_mak |
| 861 | fi |
| 862 | if test "$tls_thread" = "yes" ; then |
| 863 | echo "CONFIG_TLS_THREAD=y" >> $config_host_mak |
| 864 | fi |
| 865 | |
| 866 | echo "LIBS+=$LIBS" >> $config_host_mak |
| 867 | echo "CC=$cc" >> $config_host_mak |