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