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 | ||
44404c5a JA |
29 | # Default CFLAGS |
30 | CFLAGS="-D_GNU_SOURCE" | |
31 | ||
67bf9823 JA |
32 | # Print a helpful header at the top of config.log |
33 | echo "# FIO configure log $(date)" >> config.log | |
34 | printf "# Configured with:" >> config.log | |
35 | printf " '%s'" "$0" "$@" >> config.log | |
36 | echo >> config.log | |
37 | echo "#" >> config.log | |
38 | ||
39 | do_cc() { | |
40 | # Run the compiler, capturing its output to the log. | |
41 | echo $cc "$@" >> config.log | |
42 | $cc "$@" >> config.log 2>&1 || return $? | |
43 | # Test passed. If this is an --enable-werror build, rerun | |
44 | # the test with -Werror and bail out if it fails. This | |
45 | # makes warning-generating-errors in configure test code | |
46 | # obvious to developers. | |
47 | if test "$werror" != "yes"; then | |
48 | return 0 | |
49 | fi | |
50 | # Don't bother rerunning the compile if we were already using -Werror | |
51 | case "$*" in | |
52 | *-Werror*) | |
53 | return 0 | |
54 | ;; | |
55 | esac | |
56 | echo $cc -Werror "$@" >> config.log | |
57 | $cc -Werror "$@" >> config.log 2>&1 && return $? | |
58 | echo "ERROR: configure test passed without -Werror but failed with -Werror." | |
59 | echo "This is probably a bug in the configure script. The failing command" | |
60 | echo "will be at the bottom of config.log." | |
61 | echo "You can run configure with --disable-werror to bypass this check." | |
62 | exit 1 | |
63 | } | |
64 | ||
65 | compile_object() { | |
66 | do_cc $CFLAGS -c -o $TMPO $TMPC | |
67 | } | |
68 | ||
69 | compile_prog() { | |
70 | local_cflags="$1" | |
71 | local_ldflags="$2" | |
72 | echo "Compiling test case $3" >> config.log | |
73 | do_cc $CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags | |
74 | } | |
75 | ||
76 | feature_not_found() { | |
77 | feature=$1 | |
78 | ||
79 | echo "ERROR" | |
80 | echo "ERROR: User requested feature $feature" | |
81 | echo "ERROR: configure was not able to find it" | |
82 | echo "ERROR" | |
83 | exit 1; | |
84 | } | |
85 | ||
86 | has() { | |
87 | type "$1" >/dev/null 2>&1 | |
88 | } | |
89 | ||
90 | check_define() { | |
91 | cat > $TMPC <<EOF | |
92 | #if !defined($1) | |
93 | #error $1 not defined | |
94 | #endif | |
95 | int main(void) | |
96 | { | |
97 | return 0; | |
98 | } | |
99 | EOF | |
100 | compile_object | |
101 | } | |
102 | ||
103 | targetos="" | |
104 | cpu="" | |
105 | ||
106 | cc="${CC-${cross_prefix}gcc}" | |
107 | ||
cb1125b0 JA |
108 | # parse options |
109 | for opt do | |
110 | optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` | |
111 | case "$opt" in | |
112 | --cc=*) CC="$optarg" | |
113 | ;; | |
114 | *) | |
115 | echo "Bad option $opt" | |
116 | exit 1 | |
117 | esac | |
118 | done | |
119 | ||
67bf9823 JA |
120 | if check_define __linux__ ; then |
121 | targetos="Linux" | |
67bf9823 JA |
122 | elif check_define __OpenBSD__ ; then |
123 | targetos='OpenBSD' | |
124 | elif check_define __sun__ ; then | |
125 | targetos='SunOS' | |
126 | else | |
127 | targetos=`uname -s` | |
128 | fi | |
129 | ||
130 | # Some host OSes need non-standard checks for which CPU to use. | |
131 | # Note that these checks are broken for cross-compilation: if you're | |
132 | # cross-compiling to one of these OSes then you'll need to specify | |
133 | # the correct CPU with the --cpu option. | |
134 | case $targetos in | |
135 | Darwin) | |
136 | # on Leopard most of the system is 32-bit, so we have to ask the kernel if | |
137 | # we can run 64-bit userspace code. | |
138 | # If the user didn't specify a CPU explicitly and the kernel says this is | |
139 | # 64 bit hw, then assume x86_64. Otherwise fall through to the usual | |
140 | # detection code. | |
141 | if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then | |
142 | cpu="x86_64" | |
143 | fi | |
144 | ;; | |
145 | SunOS) | |
146 | # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo | |
147 | if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then | |
148 | cpu="x86_64" | |
149 | fi | |
cfd94f79 JA |
150 | ;; |
151 | CYGWIN*) | |
152 | echo "Forcing known good options on Windows" | |
4578d01f JA |
153 | if test -z "$CC" ; then |
154 | CC="x86_64-w64-mingw32-gcc" | |
155 | fi | |
cfd94f79 JA |
156 | echo "CC=$CC" > $config_host_mak |
157 | echo "CONFIG_LITTLE_ENDIAN=y" >> $config_host_mak | |
158 | echo "CONFIG_64BIT_LLP64=y" >> $config_host_mak | |
159 | echo "CONFIG_CLOCK_GETTIME=y" >> $config_host_mak | |
160 | echo "CONFIG_CLOCK_MONOTONIC=y" >> $config_host_mak | |
161 | echo "CONFIG_GETTIMEOFDAY=y" >> $config_host_mak | |
162 | echo "CONFIG_FADVISE=y" >> $config_host_mak | |
cfd94f79 JA |
163 | echo "CONFIG_SOCKLEN_T=y" >> $config_host_mak |
164 | echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak | |
165 | echo "CONFIG_FADVISE=y" >> $config_host_mak | |
166 | echo "CONFIG_SFAA=y" >> $config_host_mak | |
a3430ee0 | 167 | echo "CONFIG_RUSAGE_THREAD=y" >> $config_host_mak |
4700b234 | 168 | echo "CONFIG_WINDOWSAIO=y" >> $config_host_mak |
cfd94f79 | 169 | exit 0 |
67bf9823 JA |
170 | esac |
171 | ||
172 | if test ! -z "$cpu" ; then | |
173 | # command line argument | |
174 | : | |
175 | elif check_define __i386__ ; then | |
176 | cpu="i386" | |
177 | elif check_define __x86_64__ ; then | |
178 | cpu="x86_64" | |
179 | elif check_define __sparc__ ; then | |
180 | if check_define __arch64__ ; then | |
181 | cpu="sparc64" | |
182 | else | |
183 | cpu="sparc" | |
184 | fi | |
185 | elif check_define _ARCH_PPC ; then | |
186 | if check_define _ARCH_PPC64 ; then | |
187 | cpu="ppc64" | |
188 | else | |
189 | cpu="ppc" | |
190 | fi | |
191 | elif check_define __mips__ ; then | |
192 | cpu="mips" | |
193 | elif check_define __ia64__ ; then | |
194 | cpu="ia64" | |
195 | elif check_define __s390__ ; then | |
196 | if check_define __s390x__ ; then | |
197 | cpu="s390x" | |
198 | else | |
199 | cpu="s390" | |
200 | fi | |
201 | elif check_define __arm__ ; then | |
202 | cpu="arm" | |
203 | elif check_define __hppa__ ; then | |
204 | cpu="hppa" | |
205 | else | |
206 | cpu=`uname -m` | |
207 | fi | |
208 | ||
209 | # Normalise host CPU name and set ARCH. | |
210 | case "$cpu" in | |
211 | ia64|ppc|ppc64|s390|s390x|sparc64) | |
212 | cpu="$cpu" | |
213 | ;; | |
214 | i386|i486|i586|i686|i86pc|BePC) | |
215 | cpu="i386" | |
216 | ;; | |
217 | x86_64|amd64) | |
218 | cpu="x86_64" | |
219 | ;; | |
220 | armv*b|armv*l|arm) | |
221 | cpu="arm" | |
222 | ;; | |
223 | hppa|parisc|parisc64) | |
224 | cpu="hppa" | |
225 | ;; | |
226 | mips*) | |
227 | cpu="mips" | |
228 | ;; | |
229 | sparc|sun4[cdmuv]) | |
230 | cpu="sparc" | |
231 | ;; | |
232 | *) | |
233 | echo "Unknown CPU" | |
234 | exit 1; | |
235 | ;; | |
236 | esac | |
237 | ||
238 | if test -z $CC; then | |
239 | if test "$targetos" = "FreeBSD"; then | |
240 | if has clang; then | |
241 | CC=clang | |
242 | else | |
243 | CC=gcc | |
244 | fi | |
67bf9823 JA |
245 | fi |
246 | fi | |
247 | ||
248 | cc="${CC-${cross_prefix}gcc}" | |
249 | ||
0dcebdf4 JA |
250 | ########################################## |
251 | # check endianness | |
252 | bigendian="no" | |
253 | cat > $TMPC <<EOF | |
254 | #include <inttypes.h> | |
255 | int main(void) | |
256 | { | |
257 | volatile uint32_t i=0x01234567; | |
258 | return (*((uint8_t*)(&i))) == 0x67; | |
259 | } | |
260 | EOF | |
261 | if compile_prog "" "" "endian"; then | |
262 | $TMPE && bigendian="yes" | |
263 | fi | |
264 | ||
265 | ||
67bf9823 JA |
266 | echo "Operating system $targetos" |
267 | echo "CPU $cpu" | |
0dcebdf4 | 268 | echo "Big endian $bigendian" |
67bf9823 JA |
269 | echo "Compiler $cc" |
270 | echo | |
271 | ||
272 | ########################################## | |
273 | # check for wordsize | |
274 | wordsize="0" | |
275 | cat > $TMPC <<EOF | |
276 | #include <stdio.h> | |
277 | int main(void) | |
278 | { | |
279 | unsigned int wsize = sizeof(long) * 8; | |
280 | printf("%d\n", wsize); | |
281 | return 0; | |
282 | } | |
283 | EOF | |
284 | if compile_prog "" "" "wordsize"; then | |
285 | wordsize=$($TMPE) | |
286 | fi | |
287 | echo "Wordsize $wordsize" | |
288 | ||
289 | ########################################## | |
290 | # linux-aio probe | |
291 | libaio="no" | |
292 | cat > $TMPC <<EOF | |
293 | #include <libaio.h> | |
294 | #include <stddef.h> | |
295 | int main(void) | |
296 | { | |
297 | io_setup(0, NULL); | |
298 | return 0; | |
299 | } | |
300 | EOF | |
301 | if compile_prog "" "-laio" "libaio" ; then | |
302 | libaio=yes | |
303 | LIBS="-laio $LIBS" | |
304 | else | |
305 | if test "$libaio" = "yes" ; then | |
306 | feature_not_found "linux AIO" | |
307 | fi | |
308 | libaio=no | |
309 | fi | |
310 | echo "Linux AIO support $libaio" | |
311 | ||
312 | ########################################## | |
313 | # posix aio probe | |
314 | posix_aio="no" | |
315 | posix_aio_lrt="no" | |
316 | cat > $TMPC <<EOF | |
317 | #include <aio.h> | |
318 | int main(void) | |
319 | { | |
320 | struct aiocb cb; | |
321 | aio_read(&cb); | |
322 | return 0; | |
323 | } | |
324 | EOF | |
325 | if compile_prog "" "" "posixaio" ; then | |
326 | posix_aio="yes" | |
327 | elif compile_prog "" "-lrt" "posixaio"; then | |
328 | posix_aio="yes" | |
329 | posix_aio_lrt="yes" | |
330 | LIBS="-lrt $LIBS" | |
331 | fi | |
332 | echo "POSIX AIO support $posix_aio" | |
333 | echo "POSIX AIO support needs -lrt $posix_aio_lrt" | |
334 | ||
335 | ########################################## | |
336 | # posix aio fsync probe | |
337 | posix_aio_fsync="no" | |
338 | if test "$posix_aio" = "yes" ; then | |
339 | cat > $TMPC <<EOF | |
340 | #include <fcntl.h> | |
341 | #include <aio.h> | |
342 | int main(void) | |
343 | { | |
344 | struct aiocb cb; | |
345 | return aio_fsync(O_SYNC, &cb); | |
346 | return 0; | |
347 | } | |
348 | EOF | |
349 | if compile_prog "" "$LIBS" "posix_aio_fsync" ; then | |
350 | posix_aio_fsync=yes | |
351 | fi | |
352 | fi | |
353 | echo "POSIX AIO fsync $posix_aio_fsync" | |
354 | ||
355 | ########################################## | |
356 | # solaris aio probe | |
357 | solaris_aio="no" | |
358 | cat > $TMPC <<EOF | |
359 | #include <sys/types.h> | |
360 | #include <sys/asynch.h> | |
361 | #include <unistd.h> | |
362 | int main(void) | |
363 | { | |
364 | aio_result_t res; | |
365 | return aioread(0, NULL, 0, 0, SEEK_SET, &res); | |
366 | return 0; | |
367 | } | |
368 | EOF | |
369 | if compile_prog "" "-laio" "solarisaio" ; then | |
370 | solaris_aio=yes | |
371 | LIBS="-laio $LIBS" | |
372 | fi | |
373 | echo "Solaris AIO support $solaris_aio" | |
374 | ||
375 | ########################################## | |
376 | # __sync_fetch_and_and test | |
377 | sfaa="no" | |
378 | cat > $TMPC << EOF | |
379 | static int sfaa(int *ptr) | |
380 | { | |
381 | return __sync_fetch_and_and(ptr, 0); | |
382 | } | |
383 | ||
384 | int main(int argc, char **argv) | |
385 | { | |
386 | int val = 42; | |
387 | sfaa(&val); | |
388 | return val; | |
389 | } | |
390 | EOF | |
391 | if compile_prog "" "" "__sync_fetch_and_add()" ; then | |
392 | sfaa="yes" | |
393 | fi | |
394 | echo "__sync_fetch_and add $sfaa" | |
395 | ||
396 | ########################################## | |
397 | # libverbs probe | |
398 | libverbs="no" | |
399 | cat > $TMPC << EOF | |
400 | #include <stdio.h> | |
401 | #include <infiniband/arch.h> | |
402 | int main(int argc, char **argv) | |
403 | { | |
404 | struct ibv_pd *pd = ibv_alloc_pd(NULL); | |
405 | return 0; | |
406 | } | |
407 | EOF | |
408 | if compile_prog "" "-libverbs" "libverbs" ; then | |
409 | libverbs="yes" | |
410 | LIBS="-libverbs $LIBS" | |
411 | fi | |
412 | echo "libverbs $libverbs" | |
413 | ||
414 | ########################################## | |
415 | # rdmacm probe | |
416 | rdmacm="no" | |
417 | cat > $TMPC << EOF | |
418 | #include <stdio.h> | |
419 | #include <rdma/rdma_cma.h> | |
420 | int main(int argc, char **argv) | |
421 | { | |
422 | rdma_destroy_qp(NULL); | |
423 | return 0; | |
424 | } | |
425 | EOF | |
426 | if compile_prog "" "-lrdmacm" "rdma"; then | |
427 | rdmacm="yes" | |
428 | LIBS="-lrdmacm $LIBS" | |
429 | fi | |
430 | echo "rdmacm $rdmacm" | |
431 | ||
432 | ########################################## | |
433 | # Linux fallocate probe | |
434 | linux_fallocate="no" | |
435 | cat > $TMPC << EOF | |
436 | #include <stdio.h> | |
437 | #include <linux/falloc.h> | |
438 | int main(int argc, char **argv) | |
439 | { | |
440 | int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024); | |
441 | return r; | |
442 | } | |
443 | EOF | |
444 | if compile_prog "" "" "linux_fallocate"; then | |
445 | linux_fallocate="yes" | |
446 | fi | |
447 | echo "Linux fallocate $linux_fallocate" | |
448 | ||
449 | ########################################## | |
450 | # POSIX fadvise probe | |
451 | posix_fadvise="no" | |
452 | cat > $TMPC << EOF | |
453 | #include <stdio.h> | |
454 | #include <fcntl.h> | |
455 | int main(int argc, char **argv) | |
456 | { | |
457 | int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL); | |
458 | return r; | |
459 | } | |
460 | EOF | |
461 | if compile_prog "" "" "posix_fadvise"; then | |
462 | posix_fadvise="yes" | |
463 | fi | |
464 | echo "POSIX fadvise $posix_fadvise" | |
465 | ||
466 | ########################################## | |
467 | # POSIX fallocate probe | |
468 | posix_fallocate="no" | |
469 | cat > $TMPC << EOF | |
470 | #include <stdio.h> | |
471 | #include <fcntl.h> | |
472 | int main(int argc, char **argv) | |
473 | { | |
474 | int r = posix_fallocate(0, 0, 1024); | |
475 | return r; | |
476 | } | |
477 | EOF | |
478 | if compile_prog "" "" "posix_fallocate"; then | |
479 | posix_fallocate="yes" | |
480 | fi | |
481 | echo "POSIX fallocate $posix_fallocate" | |
482 | ||
483 | ########################################## | |
484 | # sched_set/getaffinity 2 or 3 argument test | |
485 | linux_2arg_affinity="no" | |
486 | linux_3arg_affinity="no" | |
487 | cat > $TMPC << EOF | |
67bf9823 JA |
488 | #include <sched.h> |
489 | int main(int argc, char **argv) | |
490 | { | |
491 | cpu_set_t mask; | |
492 | return sched_setaffinity(0, sizeof(mask), &mask); | |
493 | } | |
494 | EOF | |
495 | if compile_prog "" "" "sched_setaffinity(,,)"; then | |
496 | linux_3arg_affinity="yes" | |
497 | else | |
498 | cat > $TMPC << EOF | |
67bf9823 JA |
499 | #include <sched.h> |
500 | int main(int argc, char **argv) | |
501 | { | |
502 | cpu_set_t mask; | |
503 | return sched_setaffinity(0, &mask); | |
504 | } | |
505 | EOF | |
506 | if compile_prog "" "" "sched_setaffinity(,)"; then | |
507 | linux_2arg_affinity="yes" | |
508 | fi | |
509 | fi | |
510 | echo "sched_setaffinity(3 arg) $linux_3arg_affinity" | |
511 | echo "sched_setaffinity(2 arg) $linux_2arg_affinity" | |
512 | ||
513 | ########################################## | |
514 | # clock_gettime probe | |
515 | clock_gettime="no" | |
516 | cat > $TMPC << EOF | |
517 | #include <stdio.h> | |
518 | #include <time.h> | |
519 | int main(int argc, char **argv) | |
520 | { | |
521 | return clock_gettime(0, NULL); | |
522 | } | |
523 | EOF | |
524 | if compile_prog "" "" "clock_gettime"; then | |
525 | clock_gettime="yes" | |
526 | elif compile_prog "" "-lrt" "clock_gettime"; then | |
527 | clock_gettime="yes" | |
528 | LIBS="-lrt $LIBS" | |
529 | fi | |
530 | echo "clock_gettime $clock_gettime" | |
531 | ||
532 | ########################################## | |
533 | # CLOCK_MONOTONIC probe | |
534 | clock_monotonic="no" | |
535 | if test "$clock_gettime" = "yes" ; then | |
536 | cat > $TMPC << EOF | |
537 | #include <stdio.h> | |
538 | #include <time.h> | |
539 | int main(int argc, char **argv) | |
540 | { | |
541 | return clock_gettime(CLOCK_MONOTONIC, NULL); | |
542 | } | |
543 | EOF | |
544 | if compile_prog "" "$LIBS" "clock monotonic"; then | |
545 | clock_monotonic="yes" | |
546 | fi | |
547 | fi | |
548 | echo "CLOCK_MONOTONIC $clock_monotonic" | |
549 | ||
550 | ########################################## | |
551 | # CLOCK_MONOTONIC_PRECISE probe | |
552 | clock_monotonic_precise="no" | |
553 | if test "$clock_gettime" = "yes" ; then | |
554 | cat > $TMPC << EOF | |
555 | #include <stdio.h> | |
556 | #include <time.h> | |
557 | int main(int argc, char **argv) | |
558 | { | |
559 | return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL); | |
560 | } | |
561 | EOF | |
562 | if compile_prog "" "$LIBS" "clock monotonic precise"; then | |
563 | clock_monotonic_precise="yes" | |
564 | fi | |
565 | fi | |
566 | echo "CLOCK_MONOTONIC_PRECISE $clock_monotonic_precise" | |
567 | ||
568 | ########################################## | |
569 | # gettimeofday() probe | |
570 | gettimeofday="no" | |
571 | cat > $TMPC << EOF | |
572 | #include <sys/time.h> | |
573 | #include <stdio.h> | |
574 | int main(int argc, char **argv) | |
575 | { | |
576 | struct timeval tv; | |
577 | return gettimeofday(&tv, NULL); | |
578 | } | |
579 | EOF | |
580 | if compile_prog "" "" "gettimeofday"; then | |
581 | gettimeofday="yes" | |
582 | fi | |
583 | echo "gettimeofday $gettimeofday" | |
584 | ||
585 | ########################################## | |
586 | # fdatasync() probe | |
587 | fdatasync="no" | |
588 | cat > $TMPC << EOF | |
589 | #include <stdio.h> | |
590 | #include <unistd.h> | |
591 | int main(int argc, char **argv) | |
592 | { | |
593 | return fdatasync(0); | |
594 | } | |
595 | EOF | |
596 | if compile_prog "" "" "fdatasync"; then | |
597 | fdatasync="yes" | |
598 | fi | |
599 | echo "fdatasync $fdatasync" | |
600 | ||
601 | ########################################## | |
602 | # sync_file_range() probe | |
603 | sync_file_range="no" | |
604 | cat > $TMPC << EOF | |
605 | #include <stdio.h> | |
606 | #include <unistd.h> | |
67bf9823 JA |
607 | #include <fcntl.h> |
608 | #include <linux/fs.h> | |
609 | int main(int argc, char **argv) | |
610 | { | |
611 | unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE | | |
612 | SYNC_FILE_RANGE_WAIT_AFTER; | |
613 | return sync_file_range(0, 0, 0, flags); | |
614 | } | |
615 | EOF | |
616 | if compile_prog "" "" "sync_file_range"; then | |
617 | sync_file_range="yes" | |
618 | fi | |
619 | echo "sync_file_range $sync_file_range" | |
620 | ||
621 | ########################################## | |
622 | # ext4 move extent probe | |
623 | ext4_me="no" | |
624 | cat > $TMPC << EOF | |
625 | #include <fcntl.h> | |
626 | #include <sys/ioctl.h> | |
627 | int main(int argc, char **argv) | |
628 | { | |
629 | struct move_extent me; | |
630 | return ioctl(0, EXT4_IOC_MOVE_EXT, &me); | |
631 | } | |
632 | EOF | |
c7165b8d JA |
633 | if compile_prog "" "" "ext4 move extent" ; then |
634 | ext4_me="yes" | |
635 | elif test $targetos = "Linux" ; then | |
636 | # On Linux, just default to it on and let it error at runtime if we really | |
637 | # don't have it. None of my updated systems have it defined, but it does | |
638 | # work. Takes a while to bubble back. | |
67bf9823 JA |
639 | ext4_me="yes" |
640 | fi | |
641 | echo "EXT4 move extent $ext4_me" | |
642 | ||
643 | ########################################## | |
644 | # splice probe | |
645 | linux_splice="no" | |
646 | cat > $TMPC << EOF | |
67bf9823 JA |
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 | ||
44404c5a JA |
793 | ########################################## |
794 | # Check whether we have getrusage(RUSAGE_THREAD) | |
795 | rusage_thread="no" | |
796 | cat > $TMPC << EOF | |
797 | #include <sys/time.h> | |
798 | #include <sys/resource.h> | |
799 | int main(int argc, char **argv) | |
800 | { | |
801 | struct rusage ru; | |
802 | getrusage(RUSAGE_THREAD, &ru); | |
803 | return 0; | |
804 | } | |
805 | EOF | |
806 | if compile_prog "" "" "RUSAGE_THREAD"; then | |
807 | rusage_thread="yes" | |
808 | fi | |
809 | echo "RUSAGE_THREAD $rusage_thread" | |
810 | ||
67bf9823 JA |
811 | ############################################################################# |
812 | ||
813 | echo "# Automatically generated by configure - do not modify" > $config_host_mak | |
814 | printf "# Configured with:" >> $config_host_mak | |
815 | printf " '%s'" "$0" "$@" >> $config_host_mak | |
816 | echo >> $config_host_mak | |
817 | ||
818 | if test "$wordsize" = "64" ; then | |
819 | echo "CONFIG_64BIT=y" >> $config_host_mak | |
820 | elif test "$wordsize" = "32" ; then | |
821 | echo "CONFIG_32BIT=y" >> $config_host_mak | |
822 | else | |
823 | echo "Unknown wordsize!" | |
824 | exit 1 | |
825 | fi | |
0dcebdf4 JA |
826 | if test "$bigendian" = "yes" ; then |
827 | echo "CONFIG_BIG_ENDIAN=y" >> $config_host_mak | |
828 | else | |
829 | echo "CONFIG_LITTLE_ENDIAN=y" >> $config_host_mak | |
830 | fi | |
67bf9823 JA |
831 | if test "$libaio" = "yes" ; then |
832 | echo "CONFIG_LIBAIO=y" >> $config_host_mak | |
833 | fi | |
834 | if test "$posix_aio" = "yes" ; then | |
835 | echo "CONFIG_POSIXAIO=y" >> $config_host_mak | |
836 | fi | |
837 | if test "$posix_aio_fsync" = "yes" ; then | |
838 | echo "CONFIG_POSIXAIO_FSYNC=y" >> $config_host_mak | |
839 | fi | |
840 | if test "$linux_fallocate" = "yes" ; then | |
841 | echo "CONFIG_LINUX_FALLOCATE=y" >> $config_host_mak | |
842 | fi | |
843 | if test "$posix_fallocate" = "yes" ; then | |
844 | echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak | |
845 | fi | |
846 | if test "$fdatasync" = "yes" ; then | |
847 | echo "CONFIG_FDATASYNC=y" >> $config_host_mak | |
848 | fi | |
849 | if test "$sync_file_range" = "yes" ; then | |
850 | echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak | |
851 | fi | |
852 | if test "$sfaa" = "yes" ; then | |
853 | echo "CONFIG_SFAA=y" >> $config_host_mak | |
854 | fi | |
855 | if test "$libverbs" = "yes" -o "rdmacm" = "yes" ; then | |
856 | echo "CONFIG_RDMA=y" >> $config_host_mak | |
857 | fi | |
858 | if test "$clock_gettime" = "yes" ; then | |
859 | echo "CONFIG_CLOCK_GETTIME=y" >> $config_host_mak | |
860 | fi | |
861 | if test "$clock_monotonic" = "yes" ; then | |
862 | echo "CONFIG_CLOCK_MONOTONIC=y" >> $config_host_mak | |
863 | fi | |
864 | if test "$clock_monotonic_precise" = "yes" ; then | |
865 | echo "CONFIG_CLOCK_MONOTONIC_PRECISE=y" >> $config_host_mak | |
866 | fi | |
867 | if test "$gettimeofday" = "yes" ; then | |
868 | echo "CONFIG_GETTIMEOFDAY=y" >> $config_host_mak | |
869 | fi | |
870 | if test "$posix_fadvise" = "yes" ; then | |
871 | echo "CONFIG_POSIX_FADVISE=y" >> $config_host_mak | |
872 | fi | |
873 | if test "$linux_3arg_affinity" = "yes" ; then | |
874 | echo "CONFIG_3ARG_AFFINITY=y" >> $config_host_mak | |
875 | elif test "$linux_2arg_affinity" = "yes" ; then | |
876 | echo "CONFIG_2ARG_AFFINITY=y" >> $config_host_mak | |
877 | fi | |
878 | if test "$strsep" = "yes" ; then | |
879 | echo "CONFIG_STRSEP=y" >> $config_host_mak | |
880 | fi | |
881 | if test "$getopt_long_only" = "yes" ; then | |
882 | echo "CONFIG_GETOPT_LONG_ONLY=y" >> $config_host_mak | |
883 | fi | |
884 | if test "$inet_aton" = "yes" ; then | |
885 | echo "CONFIG_INET_ATON=y" >> $config_host_mak | |
886 | fi | |
887 | if test "$socklen_t" = "yes" ; then | |
888 | echo "CONFIG_SOCKLEN_T=y" >> $config_host_mak | |
889 | fi | |
890 | if test "$ext4_me" = "yes" ; then | |
891 | echo "CONFIG_LINUX_EXT4_MOVE_EXTENT=y" >> $config_host_mak | |
892 | fi | |
893 | if test "$linux_splice" = "yes" ; then | |
894 | echo "CONFIG_LINUX_SPLICE=y" >> $config_host_mak | |
895 | fi | |
896 | if test "$guasi" = "yes" ; then | |
897 | echo "CONFIG_GUASI=y" >> $config_host_mak | |
898 | fi | |
899 | if test "$fusion_aw" = "yes" ; then | |
900 | echo "CONFIG_FUSION_AW=y" >> $config_host_mak | |
901 | fi | |
902 | if test "$libnuma" = "yes" ; then | |
903 | echo "CONFIG_LIBNUMA=y" >> $config_host_mak | |
904 | fi | |
905 | if test "$solaris_aio" = "yes" ; then | |
906 | echo "CONFIG_SOLARISAIO=y" >> $config_host_mak | |
907 | fi | |
908 | if test "$tls_thread" = "yes" ; then | |
909 | echo "CONFIG_TLS_THREAD=y" >> $config_host_mak | |
910 | fi | |
44404c5a JA |
911 | if test "$rusage_thread" = "yes" ; then |
912 | echo "CONFIG_RUSAGE_THREAD=y" >> $config_host_mak | |
913 | fi | |
67bf9823 JA |
914 | |
915 | echo "LIBS+=$LIBS" >> $config_host_mak | |
916 | echo "CC=$cc" >> $config_host_mak | |
44404c5a | 917 | echo "CFLAGS=$CFLAGS" >> $config_host_mak |