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