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