Commit | Line | Data |
---|---|---|
67bf9823 JA |
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 | |
c7165b8d JA |
588 | if compile_prog "" "" "ext4 move extent" ; then |
589 | ext4_me="yes" | |
590 | elif test $targetos = "Linux" ; then | |
591 | # On Linux, just default to it on and let it error at runtime if we really | |
592 | # don't have it. None of my updated systems have it defined, but it does | |
593 | # work. Takes a while to bubble back. | |
67bf9823 JA |
594 | ext4_me="yes" |
595 | fi | |
596 | echo "EXT4 move extent $ext4_me" | |
597 | ||
598 | ########################################## | |
599 | # splice probe | |
600 | linux_splice="no" | |
601 | cat > $TMPC << EOF | |
602 | #define _GNU_SOURCE | |
603 | #include <stdio.h> | |
604 | #include <fcntl.h> | |
605 | int main(int argc, char **argv) | |
606 | { | |
607 | return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK); | |
608 | } | |
609 | EOF | |
610 | if compile_prog "" "" "linux splice"; then | |
611 | linux_splice="yes" | |
612 | fi | |
613 | echo "Linux splice(2) $linux_splice" | |
614 | ||
615 | ########################################## | |
616 | # GUASI probe | |
617 | guasi="no" | |
618 | cat > $TMPC << EOF | |
619 | #include <guasi.h> | |
620 | #include <guasi_syscalls.h> | |
621 | int main(int argc, char **argv) | |
622 | { | |
623 | guasi_t ctx = guasi_create(0, 0, 0); | |
624 | return 0; | |
625 | } | |
626 | EOF | |
627 | if compile_prog "" "" "guasi"; then | |
628 | guasi="yes" | |
629 | fi | |
630 | echo "GUASI $guasi" | |
631 | ||
632 | ########################################## | |
633 | # fusion-aw probe | |
634 | fusion_aw="no" | |
635 | cat > $TMPC << EOF | |
636 | #include <vsl_dp_experimental/vectored_write.h> | |
637 | int main(int argc, char **argv) | |
638 | { | |
639 | struct vsl_iovec iov; | |
640 | return vsl_vectored_write(0, &iov, 0, O_ATOMIC); | |
641 | } | |
642 | EOF | |
643 | if compile_prog "" "" "fusion-aw"; then | |
644 | fusion_aw="yes" | |
645 | fi | |
646 | echo "Fusion-io atomic engine $fusion_aw" | |
647 | ||
648 | ########################################## | |
649 | # libnuma probe | |
650 | libnuma="no" | |
651 | cat > $TMPC << EOF | |
652 | #include <numa.h> | |
653 | int main(int argc, char **argv) | |
654 | { | |
655 | return numa_available(); | |
656 | } | |
657 | EOF | |
658 | if compile_prog "" "-lnuma" "libnuma"; then | |
659 | libnuma="yes" | |
660 | LIBS="-lnuma $LIBS" | |
661 | fi | |
662 | echo "libnuma $libnuma" | |
663 | ||
664 | ########################################## | |
665 | # strsep() probe | |
666 | strsep="no" | |
667 | cat > $TMPC << EOF | |
668 | #include <string.h> | |
669 | int main(int argc, char **argv) | |
670 | { | |
671 | strsep(NULL, NULL); | |
672 | return 0; | |
673 | } | |
674 | EOF | |
675 | if compile_prog "" "" "strsep"; then | |
676 | strsep="yes" | |
677 | fi | |
678 | echo "strsep $strsep" | |
679 | ||
680 | ########################################## | |
681 | # getopt_long_only() probe | |
682 | getopt_long_only="no" | |
683 | cat > $TMPC << EOF | |
684 | #include <unistd.h> | |
685 | #include <stdio.h> | |
686 | int main(int argc, char **argv) | |
687 | { | |
688 | int c = getopt_long_only(argc, argv, NULL, NULL, NULL); | |
689 | return c; | |
690 | } | |
691 | EOF | |
692 | if compile_prog "" "" "getopt_long_only"; then | |
693 | getopt_long_only="yes" | |
694 | fi | |
695 | echo "getopt_long_only() $getopt_long_only" | |
696 | ||
697 | ########################################## | |
698 | # inet_aton() probe | |
699 | inet_aton="no" | |
700 | cat > $TMPC << EOF | |
701 | #include <sys/socket.h> | |
702 | #include <arpa/inet.h> | |
703 | #include <stdio.h> | |
704 | int main(int argc, char **argv) | |
705 | { | |
706 | struct in_addr in; | |
707 | return inet_aton(NULL, &in); | |
708 | } | |
709 | EOF | |
710 | if compile_prog "" "" "inet_aton"; then | |
711 | inet_aton="yes" | |
712 | fi | |
713 | echo "inet_aton $inet_aton" | |
714 | ||
715 | ########################################## | |
716 | # socklen_t probe | |
717 | socklen_t="no" | |
718 | cat > $TMPC << EOF | |
719 | #include <string.h> | |
720 | #include <netinet/in.h> | |
721 | int main(int argc, char **argv) | |
722 | { | |
723 | socklen_t len = 0; | |
724 | return len; | |
725 | } | |
726 | EOF | |
727 | if compile_prog "" "" "socklen_t"; then | |
728 | socklen_t="yes" | |
729 | fi | |
730 | echo "socklen_t $socklen_t" | |
731 | ||
732 | ########################################## | |
733 | # Whether or not __thread is supported for TLS | |
734 | tls_thread="no" | |
735 | cat > $TMPC << EOF | |
736 | #include <stdio.h> | |
737 | static int __thread ret; | |
738 | int main(int argc, char **argv) | |
739 | { | |
740 | return ret; | |
741 | } | |
742 | EOF | |
743 | if compile_prog "" "" "__thread"; then | |
744 | tls_thread="yes" | |
745 | fi | |
746 | echo "__thread $tls_thread" | |
747 | ||
748 | ############################################################################# | |
749 | ||
750 | echo "# Automatically generated by configure - do not modify" > $config_host_mak | |
751 | printf "# Configured with:" >> $config_host_mak | |
752 | printf " '%s'" "$0" "$@" >> $config_host_mak | |
753 | echo >> $config_host_mak | |
754 | ||
755 | if test "$wordsize" = "64" ; then | |
756 | echo "CONFIG_64BIT=y" >> $config_host_mak | |
757 | elif test "$wordsize" = "32" ; then | |
758 | echo "CONFIG_32BIT=y" >> $config_host_mak | |
759 | else | |
760 | echo "Unknown wordsize!" | |
761 | exit 1 | |
762 | fi | |
763 | if test "$libaio" = "yes" ; then | |
764 | echo "CONFIG_LIBAIO=y" >> $config_host_mak | |
765 | fi | |
766 | if test "$posix_aio" = "yes" ; then | |
767 | echo "CONFIG_POSIXAIO=y" >> $config_host_mak | |
768 | fi | |
769 | if test "$posix_aio_fsync" = "yes" ; then | |
770 | echo "CONFIG_POSIXAIO_FSYNC=y" >> $config_host_mak | |
771 | fi | |
772 | if test "$linux_fallocate" = "yes" ; then | |
773 | echo "CONFIG_LINUX_FALLOCATE=y" >> $config_host_mak | |
774 | fi | |
775 | if test "$posix_fallocate" = "yes" ; then | |
776 | echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak | |
777 | fi | |
778 | if test "$fdatasync" = "yes" ; then | |
779 | echo "CONFIG_FDATASYNC=y" >> $config_host_mak | |
780 | fi | |
781 | if test "$sync_file_range" = "yes" ; then | |
782 | echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak | |
783 | fi | |
784 | if test "$sfaa" = "yes" ; then | |
785 | echo "CONFIG_SFAA=y" >> $config_host_mak | |
786 | fi | |
787 | if test "$libverbs" = "yes" -o "rdmacm" = "yes" ; then | |
788 | echo "CONFIG_RDMA=y" >> $config_host_mak | |
789 | fi | |
790 | if test "$clock_gettime" = "yes" ; then | |
791 | echo "CONFIG_CLOCK_GETTIME=y" >> $config_host_mak | |
792 | fi | |
793 | if test "$clock_monotonic" = "yes" ; then | |
794 | echo "CONFIG_CLOCK_MONOTONIC=y" >> $config_host_mak | |
795 | fi | |
796 | if test "$clock_monotonic_precise" = "yes" ; then | |
797 | echo "CONFIG_CLOCK_MONOTONIC_PRECISE=y" >> $config_host_mak | |
798 | fi | |
799 | if test "$gettimeofday" = "yes" ; then | |
800 | echo "CONFIG_GETTIMEOFDAY=y" >> $config_host_mak | |
801 | fi | |
802 | if test "$posix_fadvise" = "yes" ; then | |
803 | echo "CONFIG_POSIX_FADVISE=y" >> $config_host_mak | |
804 | fi | |
805 | if test "$linux_3arg_affinity" = "yes" ; then | |
806 | echo "CONFIG_3ARG_AFFINITY=y" >> $config_host_mak | |
807 | elif test "$linux_2arg_affinity" = "yes" ; then | |
808 | echo "CONFIG_2ARG_AFFINITY=y" >> $config_host_mak | |
809 | fi | |
810 | if test "$strsep" = "yes" ; then | |
811 | echo "CONFIG_STRSEP=y" >> $config_host_mak | |
812 | fi | |
813 | if test "$getopt_long_only" = "yes" ; then | |
814 | echo "CONFIG_GETOPT_LONG_ONLY=y" >> $config_host_mak | |
815 | fi | |
816 | if test "$inet_aton" = "yes" ; then | |
817 | echo "CONFIG_INET_ATON=y" >> $config_host_mak | |
818 | fi | |
819 | if test "$socklen_t" = "yes" ; then | |
820 | echo "CONFIG_SOCKLEN_T=y" >> $config_host_mak | |
821 | fi | |
822 | if test "$ext4_me" = "yes" ; then | |
823 | echo "CONFIG_LINUX_EXT4_MOVE_EXTENT=y" >> $config_host_mak | |
824 | fi | |
825 | if test "$linux_splice" = "yes" ; then | |
826 | echo "CONFIG_LINUX_SPLICE=y" >> $config_host_mak | |
827 | fi | |
828 | if test "$guasi" = "yes" ; then | |
829 | echo "CONFIG_GUASI=y" >> $config_host_mak | |
830 | fi | |
831 | if test "$fusion_aw" = "yes" ; then | |
832 | echo "CONFIG_FUSION_AW=y" >> $config_host_mak | |
833 | fi | |
834 | if test "$libnuma" = "yes" ; then | |
835 | echo "CONFIG_LIBNUMA=y" >> $config_host_mak | |
836 | fi | |
837 | if test "$solaris_aio" = "yes" ; then | |
838 | echo "CONFIG_SOLARISAIO=y" >> $config_host_mak | |
839 | fi | |
840 | if test "$tls_thread" = "yes" ; then | |
841 | echo "CONFIG_TLS_THREAD=y" >> $config_host_mak | |
842 | fi | |
843 | ||
844 | echo "LIBS+=$LIBS" >> $config_host_mak | |
845 | echo "CC=$cc" >> $config_host_mak |