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