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 |
cfd94f79 | 168 | exit 0 |
67bf9823 JA |
169 | esac |
170 | ||
171 | if test ! -z "$cpu" ; then | |
172 | # command line argument | |
173 | : | |
174 | elif check_define __i386__ ; then | |
175 | cpu="i386" | |
176 | elif check_define __x86_64__ ; then | |
177 | cpu="x86_64" | |
178 | elif check_define __sparc__ ; then | |
179 | if check_define __arch64__ ; then | |
180 | cpu="sparc64" | |
181 | else | |
182 | cpu="sparc" | |
183 | fi | |
184 | elif check_define _ARCH_PPC ; then | |
185 | if check_define _ARCH_PPC64 ; then | |
186 | cpu="ppc64" | |
187 | else | |
188 | cpu="ppc" | |
189 | fi | |
190 | elif check_define __mips__ ; then | |
191 | cpu="mips" | |
192 | elif check_define __ia64__ ; then | |
193 | cpu="ia64" | |
194 | elif check_define __s390__ ; then | |
195 | if check_define __s390x__ ; then | |
196 | cpu="s390x" | |
197 | else | |
198 | cpu="s390" | |
199 | fi | |
200 | elif check_define __arm__ ; then | |
201 | cpu="arm" | |
202 | elif check_define __hppa__ ; then | |
203 | cpu="hppa" | |
204 | else | |
205 | cpu=`uname -m` | |
206 | fi | |
207 | ||
208 | # Normalise host CPU name and set ARCH. | |
209 | case "$cpu" in | |
210 | ia64|ppc|ppc64|s390|s390x|sparc64) | |
211 | cpu="$cpu" | |
212 | ;; | |
213 | i386|i486|i586|i686|i86pc|BePC) | |
214 | cpu="i386" | |
215 | ;; | |
216 | x86_64|amd64) | |
217 | cpu="x86_64" | |
218 | ;; | |
219 | armv*b|armv*l|arm) | |
220 | cpu="arm" | |
221 | ;; | |
222 | hppa|parisc|parisc64) | |
223 | cpu="hppa" | |
224 | ;; | |
225 | mips*) | |
226 | cpu="mips" | |
227 | ;; | |
228 | sparc|sun4[cdmuv]) | |
229 | cpu="sparc" | |
230 | ;; | |
231 | *) | |
232 | echo "Unknown CPU" | |
233 | exit 1; | |
234 | ;; | |
235 | esac | |
236 | ||
237 | if test -z $CC; then | |
238 | if test "$targetos" = "FreeBSD"; then | |
239 | if has clang; then | |
240 | CC=clang | |
241 | else | |
242 | CC=gcc | |
243 | fi | |
67bf9823 JA |
244 | fi |
245 | fi | |
246 | ||
247 | cc="${CC-${cross_prefix}gcc}" | |
248 | ||
0dcebdf4 JA |
249 | ########################################## |
250 | # check endianness | |
251 | bigendian="no" | |
252 | cat > $TMPC <<EOF | |
253 | #include <inttypes.h> | |
254 | int main(void) | |
255 | { | |
256 | volatile uint32_t i=0x01234567; | |
257 | return (*((uint8_t*)(&i))) == 0x67; | |
258 | } | |
259 | EOF | |
260 | if compile_prog "" "" "endian"; then | |
261 | $TMPE && bigendian="yes" | |
262 | fi | |
263 | ||
264 | ||
67bf9823 JA |
265 | echo "Operating system $targetos" |
266 | echo "CPU $cpu" | |
0dcebdf4 | 267 | echo "Big endian $bigendian" |
67bf9823 JA |
268 | echo "Compiler $cc" |
269 | echo | |
270 | ||
271 | ########################################## | |
272 | # check for wordsize | |
273 | wordsize="0" | |
274 | cat > $TMPC <<EOF | |
275 | #include <stdio.h> | |
276 | int main(void) | |
277 | { | |
278 | unsigned int wsize = sizeof(long) * 8; | |
279 | printf("%d\n", wsize); | |
280 | return 0; | |
281 | } | |
282 | EOF | |
283 | if compile_prog "" "" "wordsize"; then | |
284 | wordsize=$($TMPE) | |
285 | fi | |
286 | echo "Wordsize $wordsize" | |
287 | ||
288 | ########################################## | |
289 | # linux-aio probe | |
290 | libaio="no" | |
291 | cat > $TMPC <<EOF | |
292 | #include <libaio.h> | |
293 | #include <stddef.h> | |
294 | int main(void) | |
295 | { | |
296 | io_setup(0, NULL); | |
297 | return 0; | |
298 | } | |
299 | EOF | |
300 | if compile_prog "" "-laio" "libaio" ; then | |
301 | libaio=yes | |
302 | LIBS="-laio $LIBS" | |
303 | else | |
304 | if test "$libaio" = "yes" ; then | |
305 | feature_not_found "linux AIO" | |
306 | fi | |
307 | libaio=no | |
308 | fi | |
309 | echo "Linux AIO support $libaio" | |
310 | ||
311 | ########################################## | |
312 | # posix aio probe | |
313 | posix_aio="no" | |
314 | posix_aio_lrt="no" | |
315 | cat > $TMPC <<EOF | |
316 | #include <aio.h> | |
317 | int main(void) | |
318 | { | |
319 | struct aiocb cb; | |
320 | aio_read(&cb); | |
321 | return 0; | |
322 | } | |
323 | EOF | |
324 | if compile_prog "" "" "posixaio" ; then | |
325 | posix_aio="yes" | |
326 | elif compile_prog "" "-lrt" "posixaio"; then | |
327 | posix_aio="yes" | |
328 | posix_aio_lrt="yes" | |
329 | LIBS="-lrt $LIBS" | |
330 | fi | |
331 | echo "POSIX AIO support $posix_aio" | |
332 | echo "POSIX AIO support needs -lrt $posix_aio_lrt" | |
333 | ||
334 | ########################################## | |
335 | # posix aio fsync probe | |
336 | posix_aio_fsync="no" | |
337 | if test "$posix_aio" = "yes" ; then | |
338 | cat > $TMPC <<EOF | |
339 | #include <fcntl.h> | |
340 | #include <aio.h> | |
341 | int main(void) | |
342 | { | |
343 | struct aiocb cb; | |
344 | return aio_fsync(O_SYNC, &cb); | |
345 | return 0; | |
346 | } | |
347 | EOF | |
348 | if compile_prog "" "$LIBS" "posix_aio_fsync" ; then | |
349 | posix_aio_fsync=yes | |
350 | fi | |
351 | fi | |
352 | echo "POSIX AIO fsync $posix_aio_fsync" | |
353 | ||
354 | ########################################## | |
355 | # solaris aio probe | |
356 | solaris_aio="no" | |
357 | cat > $TMPC <<EOF | |
358 | #include <sys/types.h> | |
359 | #include <sys/asynch.h> | |
360 | #include <unistd.h> | |
361 | int main(void) | |
362 | { | |
363 | aio_result_t res; | |
364 | return aioread(0, NULL, 0, 0, SEEK_SET, &res); | |
365 | return 0; | |
366 | } | |
367 | EOF | |
368 | if compile_prog "" "-laio" "solarisaio" ; then | |
369 | solaris_aio=yes | |
370 | LIBS="-laio $LIBS" | |
371 | fi | |
372 | echo "Solaris AIO support $solaris_aio" | |
373 | ||
374 | ########################################## | |
375 | # __sync_fetch_and_and test | |
376 | sfaa="no" | |
377 | cat > $TMPC << EOF | |
378 | static int sfaa(int *ptr) | |
379 | { | |
380 | return __sync_fetch_and_and(ptr, 0); | |
381 | } | |
382 | ||
383 | int main(int argc, char **argv) | |
384 | { | |
385 | int val = 42; | |
386 | sfaa(&val); | |
387 | return val; | |
388 | } | |
389 | EOF | |
390 | if compile_prog "" "" "__sync_fetch_and_add()" ; then | |
391 | sfaa="yes" | |
392 | fi | |
393 | echo "__sync_fetch_and add $sfaa" | |
394 | ||
395 | ########################################## | |
396 | # libverbs probe | |
397 | libverbs="no" | |
398 | cat > $TMPC << EOF | |
399 | #include <stdio.h> | |
400 | #include <infiniband/arch.h> | |
401 | int main(int argc, char **argv) | |
402 | { | |
403 | struct ibv_pd *pd = ibv_alloc_pd(NULL); | |
404 | return 0; | |
405 | } | |
406 | EOF | |
407 | if compile_prog "" "-libverbs" "libverbs" ; then | |
408 | libverbs="yes" | |
409 | LIBS="-libverbs $LIBS" | |
410 | fi | |
411 | echo "libverbs $libverbs" | |
412 | ||
413 | ########################################## | |
414 | # rdmacm probe | |
415 | rdmacm="no" | |
416 | cat > $TMPC << EOF | |
417 | #include <stdio.h> | |
418 | #include <rdma/rdma_cma.h> | |
419 | int main(int argc, char **argv) | |
420 | { | |
421 | rdma_destroy_qp(NULL); | |
422 | return 0; | |
423 | } | |
424 | EOF | |
425 | if compile_prog "" "-lrdmacm" "rdma"; then | |
426 | rdmacm="yes" | |
427 | LIBS="-lrdmacm $LIBS" | |
428 | fi | |
429 | echo "rdmacm $rdmacm" | |
430 | ||
431 | ########################################## | |
432 | # Linux fallocate probe | |
433 | linux_fallocate="no" | |
434 | cat > $TMPC << EOF | |
435 | #include <stdio.h> | |
436 | #include <linux/falloc.h> | |
437 | int main(int argc, char **argv) | |
438 | { | |
439 | int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024); | |
440 | return r; | |
441 | } | |
442 | EOF | |
443 | if compile_prog "" "" "linux_fallocate"; then | |
444 | linux_fallocate="yes" | |
445 | fi | |
446 | echo "Linux fallocate $linux_fallocate" | |
447 | ||
448 | ########################################## | |
449 | # POSIX fadvise probe | |
450 | posix_fadvise="no" | |
451 | cat > $TMPC << EOF | |
452 | #include <stdio.h> | |
453 | #include <fcntl.h> | |
454 | int main(int argc, char **argv) | |
455 | { | |
456 | int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL); | |
457 | return r; | |
458 | } | |
459 | EOF | |
460 | if compile_prog "" "" "posix_fadvise"; then | |
461 | posix_fadvise="yes" | |
462 | fi | |
463 | echo "POSIX fadvise $posix_fadvise" | |
464 | ||
465 | ########################################## | |
466 | # POSIX fallocate probe | |
467 | posix_fallocate="no" | |
468 | cat > $TMPC << EOF | |
469 | #include <stdio.h> | |
470 | #include <fcntl.h> | |
471 | int main(int argc, char **argv) | |
472 | { | |
473 | int r = posix_fallocate(0, 0, 1024); | |
474 | return r; | |
475 | } | |
476 | EOF | |
477 | if compile_prog "" "" "posix_fallocate"; then | |
478 | posix_fallocate="yes" | |
479 | fi | |
480 | echo "POSIX fallocate $posix_fallocate" | |
481 | ||
482 | ########################################## | |
483 | # sched_set/getaffinity 2 or 3 argument test | |
484 | linux_2arg_affinity="no" | |
485 | linux_3arg_affinity="no" | |
486 | cat > $TMPC << EOF | |
67bf9823 JA |
487 | #include <sched.h> |
488 | int main(int argc, char **argv) | |
489 | { | |
490 | cpu_set_t mask; | |
491 | return sched_setaffinity(0, sizeof(mask), &mask); | |
492 | } | |
493 | EOF | |
494 | if compile_prog "" "" "sched_setaffinity(,,)"; then | |
495 | linux_3arg_affinity="yes" | |
496 | else | |
497 | cat > $TMPC << EOF | |
67bf9823 JA |
498 | #include <sched.h> |
499 | int main(int argc, char **argv) | |
500 | { | |
501 | cpu_set_t mask; | |
502 | return sched_setaffinity(0, &mask); | |
503 | } | |
504 | EOF | |
505 | if compile_prog "" "" "sched_setaffinity(,)"; then | |
506 | linux_2arg_affinity="yes" | |
507 | fi | |
508 | fi | |
509 | echo "sched_setaffinity(3 arg) $linux_3arg_affinity" | |
510 | echo "sched_setaffinity(2 arg) $linux_2arg_affinity" | |
511 | ||
512 | ########################################## | |
513 | # clock_gettime probe | |
514 | clock_gettime="no" | |
515 | cat > $TMPC << EOF | |
516 | #include <stdio.h> | |
517 | #include <time.h> | |
518 | int main(int argc, char **argv) | |
519 | { | |
520 | return clock_gettime(0, NULL); | |
521 | } | |
522 | EOF | |
523 | if compile_prog "" "" "clock_gettime"; then | |
524 | clock_gettime="yes" | |
525 | elif compile_prog "" "-lrt" "clock_gettime"; then | |
526 | clock_gettime="yes" | |
527 | LIBS="-lrt $LIBS" | |
528 | fi | |
529 | echo "clock_gettime $clock_gettime" | |
530 | ||
531 | ########################################## | |
532 | # CLOCK_MONOTONIC probe | |
533 | clock_monotonic="no" | |
534 | if test "$clock_gettime" = "yes" ; then | |
535 | cat > $TMPC << EOF | |
536 | #include <stdio.h> | |
537 | #include <time.h> | |
538 | int main(int argc, char **argv) | |
539 | { | |
540 | return clock_gettime(CLOCK_MONOTONIC, NULL); | |
541 | } | |
542 | EOF | |
543 | if compile_prog "" "$LIBS" "clock monotonic"; then | |
544 | clock_monotonic="yes" | |
545 | fi | |
546 | fi | |
547 | echo "CLOCK_MONOTONIC $clock_monotonic" | |
548 | ||
549 | ########################################## | |
550 | # CLOCK_MONOTONIC_PRECISE probe | |
551 | clock_monotonic_precise="no" | |
552 | if test "$clock_gettime" = "yes" ; then | |
553 | cat > $TMPC << EOF | |
554 | #include <stdio.h> | |
555 | #include <time.h> | |
556 | int main(int argc, char **argv) | |
557 | { | |
558 | return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL); | |
559 | } | |
560 | EOF | |
561 | if compile_prog "" "$LIBS" "clock monotonic precise"; then | |
562 | clock_monotonic_precise="yes" | |
563 | fi | |
564 | fi | |
565 | echo "CLOCK_MONOTONIC_PRECISE $clock_monotonic_precise" | |
566 | ||
567 | ########################################## | |
568 | # gettimeofday() probe | |
569 | gettimeofday="no" | |
570 | cat > $TMPC << EOF | |
571 | #include <sys/time.h> | |
572 | #include <stdio.h> | |
573 | int main(int argc, char **argv) | |
574 | { | |
575 | struct timeval tv; | |
576 | return gettimeofday(&tv, NULL); | |
577 | } | |
578 | EOF | |
579 | if compile_prog "" "" "gettimeofday"; then | |
580 | gettimeofday="yes" | |
581 | fi | |
582 | echo "gettimeofday $gettimeofday" | |
583 | ||
584 | ########################################## | |
585 | # fdatasync() probe | |
586 | fdatasync="no" | |
587 | cat > $TMPC << EOF | |
588 | #include <stdio.h> | |
589 | #include <unistd.h> | |
590 | int main(int argc, char **argv) | |
591 | { | |
592 | return fdatasync(0); | |
593 | } | |
594 | EOF | |
595 | if compile_prog "" "" "fdatasync"; then | |
596 | fdatasync="yes" | |
597 | fi | |
598 | echo "fdatasync $fdatasync" | |
599 | ||
600 | ########################################## | |
601 | # sync_file_range() probe | |
602 | sync_file_range="no" | |
603 | cat > $TMPC << EOF | |
604 | #include <stdio.h> | |
605 | #include <unistd.h> | |
67bf9823 JA |
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 | |
67bf9823 JA |
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 | ||
44404c5a JA |
792 | ########################################## |
793 | # Check whether we have getrusage(RUSAGE_THREAD) | |
794 | rusage_thread="no" | |
795 | cat > $TMPC << EOF | |
796 | #include <sys/time.h> | |
797 | #include <sys/resource.h> | |
798 | int main(int argc, char **argv) | |
799 | { | |
800 | struct rusage ru; | |
801 | getrusage(RUSAGE_THREAD, &ru); | |
802 | return 0; | |
803 | } | |
804 | EOF | |
805 | if compile_prog "" "" "RUSAGE_THREAD"; then | |
806 | rusage_thread="yes" | |
807 | fi | |
808 | echo "RUSAGE_THREAD $rusage_thread" | |
809 | ||
67bf9823 JA |
810 | ############################################################################# |
811 | ||
812 | echo "# Automatically generated by configure - do not modify" > $config_host_mak | |
813 | printf "# Configured with:" >> $config_host_mak | |
814 | printf " '%s'" "$0" "$@" >> $config_host_mak | |
815 | echo >> $config_host_mak | |
816 | ||
817 | if test "$wordsize" = "64" ; then | |
818 | echo "CONFIG_64BIT=y" >> $config_host_mak | |
819 | elif test "$wordsize" = "32" ; then | |
820 | echo "CONFIG_32BIT=y" >> $config_host_mak | |
821 | else | |
822 | echo "Unknown wordsize!" | |
823 | exit 1 | |
824 | fi | |
0dcebdf4 JA |
825 | if test "$bigendian" = "yes" ; then |
826 | echo "CONFIG_BIG_ENDIAN=y" >> $config_host_mak | |
827 | else | |
828 | echo "CONFIG_LITTLE_ENDIAN=y" >> $config_host_mak | |
829 | fi | |
67bf9823 JA |
830 | if test "$libaio" = "yes" ; then |
831 | echo "CONFIG_LIBAIO=y" >> $config_host_mak | |
832 | fi | |
833 | if test "$posix_aio" = "yes" ; then | |
834 | echo "CONFIG_POSIXAIO=y" >> $config_host_mak | |
835 | fi | |
836 | if test "$posix_aio_fsync" = "yes" ; then | |
837 | echo "CONFIG_POSIXAIO_FSYNC=y" >> $config_host_mak | |
838 | fi | |
839 | if test "$linux_fallocate" = "yes" ; then | |
840 | echo "CONFIG_LINUX_FALLOCATE=y" >> $config_host_mak | |
841 | fi | |
842 | if test "$posix_fallocate" = "yes" ; then | |
843 | echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak | |
844 | fi | |
845 | if test "$fdatasync" = "yes" ; then | |
846 | echo "CONFIG_FDATASYNC=y" >> $config_host_mak | |
847 | fi | |
848 | if test "$sync_file_range" = "yes" ; then | |
849 | echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak | |
850 | fi | |
851 | if test "$sfaa" = "yes" ; then | |
852 | echo "CONFIG_SFAA=y" >> $config_host_mak | |
853 | fi | |
854 | if test "$libverbs" = "yes" -o "rdmacm" = "yes" ; then | |
855 | echo "CONFIG_RDMA=y" >> $config_host_mak | |
856 | fi | |
857 | if test "$clock_gettime" = "yes" ; then | |
858 | echo "CONFIG_CLOCK_GETTIME=y" >> $config_host_mak | |
859 | fi | |
860 | if test "$clock_monotonic" = "yes" ; then | |
861 | echo "CONFIG_CLOCK_MONOTONIC=y" >> $config_host_mak | |
862 | fi | |
863 | if test "$clock_monotonic_precise" = "yes" ; then | |
864 | echo "CONFIG_CLOCK_MONOTONIC_PRECISE=y" >> $config_host_mak | |
865 | fi | |
866 | if test "$gettimeofday" = "yes" ; then | |
867 | echo "CONFIG_GETTIMEOFDAY=y" >> $config_host_mak | |
868 | fi | |
869 | if test "$posix_fadvise" = "yes" ; then | |
870 | echo "CONFIG_POSIX_FADVISE=y" >> $config_host_mak | |
871 | fi | |
872 | if test "$linux_3arg_affinity" = "yes" ; then | |
873 | echo "CONFIG_3ARG_AFFINITY=y" >> $config_host_mak | |
874 | elif test "$linux_2arg_affinity" = "yes" ; then | |
875 | echo "CONFIG_2ARG_AFFINITY=y" >> $config_host_mak | |
876 | fi | |
877 | if test "$strsep" = "yes" ; then | |
878 | echo "CONFIG_STRSEP=y" >> $config_host_mak | |
879 | fi | |
880 | if test "$getopt_long_only" = "yes" ; then | |
881 | echo "CONFIG_GETOPT_LONG_ONLY=y" >> $config_host_mak | |
882 | fi | |
883 | if test "$inet_aton" = "yes" ; then | |
884 | echo "CONFIG_INET_ATON=y" >> $config_host_mak | |
885 | fi | |
886 | if test "$socklen_t" = "yes" ; then | |
887 | echo "CONFIG_SOCKLEN_T=y" >> $config_host_mak | |
888 | fi | |
889 | if test "$ext4_me" = "yes" ; then | |
890 | echo "CONFIG_LINUX_EXT4_MOVE_EXTENT=y" >> $config_host_mak | |
891 | fi | |
892 | if test "$linux_splice" = "yes" ; then | |
893 | echo "CONFIG_LINUX_SPLICE=y" >> $config_host_mak | |
894 | fi | |
895 | if test "$guasi" = "yes" ; then | |
896 | echo "CONFIG_GUASI=y" >> $config_host_mak | |
897 | fi | |
898 | if test "$fusion_aw" = "yes" ; then | |
899 | echo "CONFIG_FUSION_AW=y" >> $config_host_mak | |
900 | fi | |
901 | if test "$libnuma" = "yes" ; then | |
902 | echo "CONFIG_LIBNUMA=y" >> $config_host_mak | |
903 | fi | |
904 | if test "$solaris_aio" = "yes" ; then | |
905 | echo "CONFIG_SOLARISAIO=y" >> $config_host_mak | |
906 | fi | |
907 | if test "$tls_thread" = "yes" ; then | |
908 | echo "CONFIG_TLS_THREAD=y" >> $config_host_mak | |
909 | fi | |
44404c5a JA |
910 | if test "$rusage_thread" = "yes" ; then |
911 | echo "CONFIG_RUSAGE_THREAD=y" >> $config_host_mak | |
912 | fi | |
67bf9823 JA |
913 | |
914 | echo "LIBS+=$LIBS" >> $config_host_mak | |
915 | echo "CC=$cc" >> $config_host_mak | |
44404c5a | 916 | echo "CFLAGS=$CFLAGS" >> $config_host_mak |