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