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" | |
4feafb1e JA |
27 | config_host_h="config-host.h" |
28 | ||
29 | rm -rf $config_host_mak | |
30 | rm -rf $config_host_h | |
67bf9823 | 31 | |
d7145a78 JA |
32 | fatal() { |
33 | echo $@ | |
34 | echo "Configure failed, check config.log and/or the above output" | |
35 | rm -rf $config_host_mak | |
36 | rm -rf $config_host_h | |
37 | exit 1 | |
38 | } | |
39 | ||
44404c5a | 40 | # Default CFLAGS |
af4862b3 JA |
41 | CFLAGS="-D_GNU_SOURCE -include config-host.h" |
42 | BUILD_CFLAGS="" | |
67bf9823 JA |
43 | |
44 | # Print a helpful header at the top of config.log | |
45 | echo "# FIO configure log $(date)" >> config.log | |
46 | printf "# Configured with:" >> config.log | |
47 | printf " '%s'" "$0" "$@" >> config.log | |
48 | echo >> config.log | |
49 | echo "#" >> config.log | |
50 | ||
7560fe7c JA |
51 | # Print configure header at the top of $config_host_h |
52 | echo "/*" > $config_host_h | |
53 | echo " * Automatically generated by configure - do not modify" >> $config_host_h | |
54 | printf " * Configured with:" >> $config_host_h | |
55 | printf " * '%s'" "$0" "$@" >> $config_host_h | |
56 | echo "" >> $config_host_h | |
57 | echo " */" >> $config_host_h | |
58 | ||
67bf9823 JA |
59 | do_cc() { |
60 | # Run the compiler, capturing its output to the log. | |
61 | echo $cc "$@" >> config.log | |
62 | $cc "$@" >> config.log 2>&1 || return $? | |
63 | # Test passed. If this is an --enable-werror build, rerun | |
64 | # the test with -Werror and bail out if it fails. This | |
65 | # makes warning-generating-errors in configure test code | |
66 | # obvious to developers. | |
67 | if test "$werror" != "yes"; then | |
68 | return 0 | |
69 | fi | |
70 | # Don't bother rerunning the compile if we were already using -Werror | |
71 | case "$*" in | |
72 | *-Werror*) | |
73 | return 0 | |
74 | ;; | |
75 | esac | |
76 | echo $cc -Werror "$@" >> config.log | |
77 | $cc -Werror "$@" >> config.log 2>&1 && return $? | |
78 | echo "ERROR: configure test passed without -Werror but failed with -Werror." | |
79 | echo "This is probably a bug in the configure script. The failing command" | |
80 | echo "will be at the bottom of config.log." | |
d7145a78 | 81 | fatal "You can run configure with --disable-werror to bypass this check." |
67bf9823 JA |
82 | } |
83 | ||
84 | compile_object() { | |
85 | do_cc $CFLAGS -c -o $TMPO $TMPC | |
86 | } | |
87 | ||
88 | compile_prog() { | |
89 | local_cflags="$1" | |
adaa46d8 | 90 | local_ldflags="$2 $LIBS" |
67bf9823 JA |
91 | echo "Compiling test case $3" >> config.log |
92 | do_cc $CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags | |
93 | } | |
94 | ||
95 | feature_not_found() { | |
96 | feature=$1 | |
c55d728b | 97 | packages=$2 |
67bf9823 JA |
98 | |
99 | echo "ERROR" | |
100 | echo "ERROR: User requested feature $feature" | |
c55d728b JA |
101 | if test ! -z "$packages" ; then |
102 | echo "ERROR: That feature needs $packages installed" | |
103 | fi | |
67bf9823 | 104 | echo "ERROR: configure was not able to find it" |
d7145a78 | 105 | fatal "ERROR" |
67bf9823 JA |
106 | } |
107 | ||
108 | has() { | |
109 | type "$1" >/dev/null 2>&1 | |
110 | } | |
111 | ||
112 | check_define() { | |
113 | cat > $TMPC <<EOF | |
114 | #if !defined($1) | |
115 | #error $1 not defined | |
116 | #endif | |
117 | int main(void) | |
118 | { | |
119 | return 0; | |
120 | } | |
121 | EOF | |
122 | compile_object | |
123 | } | |
124 | ||
4feafb1e JA |
125 | output_sym() { |
126 | echo "$1=y" >> $config_host_mak | |
127 | echo "#define $1" >> $config_host_h | |
128 | } | |
129 | ||
67bf9823 JA |
130 | targetos="" |
131 | cpu="" | |
132 | ||
91f94d5b | 133 | # default options |
47f44635 JA |
134 | show_help="no" |
135 | exit_val=0 | |
135be493 | 136 | gfio="no" |
91f94d5b | 137 | |
cb1125b0 JA |
138 | # parse options |
139 | for opt do | |
140 | optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` | |
141 | case "$opt" in | |
8b156d8e JA |
142 | --cpu=*) cpu="$optarg" |
143 | ;; | |
c8931876 JA |
144 | # esx is cross compiled and cannot be detect through simple uname calls |
145 | --esx) | |
146 | esx="yes" | |
147 | ;; | |
cb1125b0 JA |
148 | --cc=*) CC="$optarg" |
149 | ;; | |
208e4c8b JA |
150 | --extra-cflags=*) CFLAGS="$CFLAGS $optarg" |
151 | ;; | |
b7c12794 | 152 | --build-32bit-win) build_32bit_win="yes" |
7409711b | 153 | ;; |
91f94d5b | 154 | --enable-gfio) |
9db01ef9 | 155 | gfio="yes" |
899fab33 | 156 | ;; |
44462517 CF |
157 | --disable-numa) disable_numa="yes" |
158 | ;; | |
ce18290e TM |
159 | --disable-rbd) disable_rbd="yes" |
160 | ;; | |
161 | --disable-gfapi) disable_gfapi="yes" | |
162 | ;; | |
827da4f5 | 163 | --help) |
47f44635 | 164 | show_help="yes" |
827da4f5 | 165 | ;; |
cb1125b0 JA |
166 | *) |
167 | echo "Bad option $opt" | |
47f44635 JA |
168 | show_help="yes" |
169 | exit_val=1 | |
cb1125b0 JA |
170 | esac |
171 | done | |
172 | ||
47f44635 | 173 | if test "$show_help" = "yes" ; then |
8b156d8e | 174 | echo "--cpu= Specify target CPU if auto-detect fails" |
b7a99316 | 175 | echo "--cc= Specify compiler to use" |
899fab33 | 176 | echo "--extra-cflags= Specify extra CFLAGS to pass to compiler" |
b7c12794 | 177 | echo "--build-32bit-win Enable 32-bit build on Windows" |
c8931876 | 178 | echo "--esx Configure build options for esx" |
b7a99316 | 179 | echo "--enable-gfio Enable building of gtk gfio" |
44462517 | 180 | echo "--disable-numa Disable libnuma even if found" |
b7a99316 | 181 | exit $exit_val |
47f44635 JA |
182 | fi |
183 | ||
47986339 SH |
184 | cross_prefix=${cross_prefix-${CROSS_COMPILE}} |
185 | cc="${CC-${cross_prefix}gcc}" | |
186 | ||
6d0e9f83 AC |
187 | if check_define __ANDROID__ ; then |
188 | targetos="Android" | |
189 | elif check_define __linux__ ; then | |
67bf9823 | 190 | targetos="Linux" |
67bf9823 JA |
191 | elif check_define __OpenBSD__ ; then |
192 | targetos='OpenBSD' | |
193 | elif check_define __sun__ ; then | |
194 | targetos='SunOS' | |
7cb024f8 | 195 | CFLAGS="$CFLAGS -D_REENTRANT" |
b24f59ab SH |
196 | elif check_define _WIN32 ; then |
197 | targetos='CYGWIN' | |
67bf9823 JA |
198 | else |
199 | targetos=`uname -s` | |
200 | fi | |
201 | ||
53cd4eee AC |
202 | echo "# Automatically generated by configure - do not modify" > $config_host_mak |
203 | printf "# Configured with:" >> $config_host_mak | |
204 | printf " '%s'" "$0" "$@" >> $config_host_mak | |
205 | echo >> $config_host_mak | |
206 | echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak | |
207 | ||
67bf9823 JA |
208 | # Some host OSes need non-standard checks for which CPU to use. |
209 | # Note that these checks are broken for cross-compilation: if you're | |
210 | # cross-compiling to one of these OSes then you'll need to specify | |
211 | # the correct CPU with the --cpu option. | |
212 | case $targetos in | |
213 | Darwin) | |
214 | # on Leopard most of the system is 32-bit, so we have to ask the kernel if | |
215 | # we can run 64-bit userspace code. | |
216 | # If the user didn't specify a CPU explicitly and the kernel says this is | |
217 | # 64 bit hw, then assume x86_64. Otherwise fall through to the usual | |
218 | # detection code. | |
219 | if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then | |
220 | cpu="x86_64" | |
221 | fi | |
222 | ;; | |
223 | SunOS) | |
224 | # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo | |
225 | if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then | |
226 | cpu="x86_64" | |
227 | fi | |
adaa46d8 | 228 | LIBS="-lnsl -lsocket" |
cfd94f79 JA |
229 | ;; |
230 | CYGWIN*) | |
231 | echo "Forcing known good options on Windows" | |
4578d01f | 232 | if test -z "$CC" ; then |
7409711b HL |
233 | if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then |
234 | CC="i686-w64-mingw32-gcc" | |
235 | else | |
236 | CC="x86_64-w64-mingw32-gcc" | |
237 | fi | |
4578d01f | 238 | fi |
4feafb1e | 239 | output_sym "CONFIG_LITTLE_ENDIAN" |
7409711b HL |
240 | if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then |
241 | output_sym "CONFIG_32BIT" | |
242 | else | |
243 | output_sym "CONFIG_64BIT_LLP64" | |
244 | fi | |
4feafb1e JA |
245 | output_sym "CONFIG_FADVISE" |
246 | output_sym "CONFIG_SOCKLEN_T" | |
4feafb1e JA |
247 | output_sym "CONFIG_FADVISE" |
248 | output_sym "CONFIG_SFAA" | |
249 | output_sym "CONFIG_RUSAGE_THREAD" | |
250 | output_sym "CONFIG_WINDOWSAIO" | |
251 | output_sym "CONFIG_FDATASYNC" | |
59308a64 | 252 | output_sym "CONFIG_CLOCK_MONOTONIC" |
dc0518ca BC |
253 | output_sym "CONFIG_GETTIMEOFDAY" |
254 | output_sym "CONFIG_CLOCK_GETTIME" | |
7e09a9f1 | 255 | output_sym "CONFIG_SCHED_IDLE" |
1eafa37a | 256 | output_sym "CONFIG_TCP_NODELAY" |
7d6be13a | 257 | output_sym "CONFIG_TLS_THREAD" |
ef07baa1 | 258 | output_sym "CONFIG_IPV6" |
4feafb1e | 259 | echo "CC=$CC" >> $config_host_mak |
af4862b3 | 260 | echo "BUILD_CFLAGS=$CFLAGS -include config-host.h -D_GNU_SOURCE" >> $config_host_mak |
cfd94f79 | 261 | exit 0 |
6d0e9f83 | 262 | ;; |
67bf9823 JA |
263 | esac |
264 | ||
265 | if test ! -z "$cpu" ; then | |
266 | # command line argument | |
267 | : | |
268 | elif check_define __i386__ ; then | |
269 | cpu="i386" | |
270 | elif check_define __x86_64__ ; then | |
271 | cpu="x86_64" | |
272 | elif check_define __sparc__ ; then | |
273 | if check_define __arch64__ ; then | |
274 | cpu="sparc64" | |
275 | else | |
276 | cpu="sparc" | |
277 | fi | |
278 | elif check_define _ARCH_PPC ; then | |
279 | if check_define _ARCH_PPC64 ; then | |
280 | cpu="ppc64" | |
281 | else | |
282 | cpu="ppc" | |
283 | fi | |
284 | elif check_define __mips__ ; then | |
285 | cpu="mips" | |
286 | elif check_define __ia64__ ; then | |
287 | cpu="ia64" | |
288 | elif check_define __s390__ ; then | |
289 | if check_define __s390x__ ; then | |
290 | cpu="s390x" | |
291 | else | |
292 | cpu="s390" | |
293 | fi | |
294 | elif check_define __arm__ ; then | |
295 | cpu="arm" | |
296 | elif check_define __hppa__ ; then | |
297 | cpu="hppa" | |
298 | else | |
299 | cpu=`uname -m` | |
300 | fi | |
301 | ||
302 | # Normalise host CPU name and set ARCH. | |
303 | case "$cpu" in | |
304 | ia64|ppc|ppc64|s390|s390x|sparc64) | |
305 | cpu="$cpu" | |
306 | ;; | |
307 | i386|i486|i586|i686|i86pc|BePC) | |
308 | cpu="i386" | |
309 | ;; | |
310 | x86_64|amd64) | |
311 | cpu="x86_64" | |
312 | ;; | |
313 | armv*b|armv*l|arm) | |
314 | cpu="arm" | |
315 | ;; | |
316 | hppa|parisc|parisc64) | |
317 | cpu="hppa" | |
318 | ;; | |
319 | mips*) | |
320 | cpu="mips" | |
321 | ;; | |
322 | sparc|sun4[cdmuv]) | |
323 | cpu="sparc" | |
324 | ;; | |
325 | *) | |
8b156d8e | 326 | echo "Unknown CPU" |
67bf9823 JA |
327 | ;; |
328 | esac | |
329 | ||
dcbbf5b0 | 330 | if test -z "$CC" ; then |
67bf9823 JA |
331 | if test "$targetos" = "FreeBSD"; then |
332 | if has clang; then | |
333 | CC=clang | |
334 | else | |
335 | CC=gcc | |
336 | fi | |
67bf9823 JA |
337 | fi |
338 | fi | |
339 | ||
340 | cc="${CC-${cross_prefix}gcc}" | |
341 | ||
1a17cfdb AC |
342 | ########################################## |
343 | # check cross compile | |
344 | ||
345 | cross_compile="no" | |
346 | cat > $TMPC <<EOF | |
347 | int main(void) | |
348 | { | |
349 | return 0; | |
350 | } | |
351 | EOF | |
352 | if compile_prog "" "" "cross"; then | |
353 | $TMPE 2>/dev/null || cross_compile="yes" | |
354 | else | |
355 | fatal "compile test failed" | |
356 | fi | |
357 | ||
0dcebdf4 JA |
358 | ########################################## |
359 | # check endianness | |
360 | bigendian="no" | |
1a17cfdb AC |
361 | if test "$cross_compile" = "no" ; then |
362 | cat > $TMPC <<EOF | |
0dcebdf4 JA |
363 | #include <inttypes.h> |
364 | int main(void) | |
365 | { | |
366 | volatile uint32_t i=0x01234567; | |
367 | return (*((uint8_t*)(&i))) == 0x67; | |
368 | } | |
369 | EOF | |
1a17cfdb AC |
370 | if compile_prog "" "" "endian"; then |
371 | $TMPE && bigendian="yes" | |
372 | fi | |
373 | else | |
374 | # If we're cross compiling, try our best to work it out and rely on the | |
375 | # run-time check to fail if we get it wrong. | |
376 | cat > $TMPC <<EOF | |
377 | #include <endian.h> | |
378 | int main(void) | |
379 | { | |
380 | #if __BYTE_ORDER != __BIG_ENDIAN | |
381 | # error "Unknown endianness" | |
382 | #endif | |
383 | } | |
384 | EOF | |
385 | compile_prog "" "" "endian" && bigendian="yes" | |
386 | check_define "__ARMEB__" && bigendian="yes" | |
387 | check_define "__MIPSEB__" && bigendian="yes" | |
0dcebdf4 JA |
388 | fi |
389 | ||
390 | ||
67bf9823 JA |
391 | echo "Operating system $targetos" |
392 | echo "CPU $cpu" | |
0dcebdf4 | 393 | echo "Big endian $bigendian" |
67bf9823 | 394 | echo "Compiler $cc" |
1a17cfdb | 395 | echo "Cross compile $cross_compile" |
67bf9823 JA |
396 | echo |
397 | ||
398 | ########################################## | |
399 | # check for wordsize | |
400 | wordsize="0" | |
401 | cat > $TMPC <<EOF | |
142429e5 AC |
402 | #include <limits.h> |
403 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) | |
67bf9823 JA |
404 | int main(void) |
405 | { | |
142429e5 | 406 | BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE); |
67bf9823 JA |
407 | return 0; |
408 | } | |
409 | EOF | |
142429e5 AC |
410 | if compile_prog "-DWORDSIZE=32" "" "wordsize"; then |
411 | wordsize="32" | |
412 | elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then | |
413 | wordsize="64" | |
414 | else | |
415 | fatal "Unknown wordsize" | |
67bf9823 JA |
416 | fi |
417 | echo "Wordsize $wordsize" | |
418 | ||
a9bca4aa JA |
419 | ########################################## |
420 | # zlib probe | |
421 | zlib="no" | |
422 | cat > $TMPC <<EOF | |
423 | #include <zlib.h> | |
424 | int main(void) | |
425 | { | |
426 | z_stream stream; | |
427 | if (inflateInit(&stream) != Z_OK) | |
428 | return 1; | |
429 | return 0; | |
430 | } | |
431 | EOF | |
432 | if compile_prog "" "-lz" "zlib" ; then | |
433 | zlib=yes | |
434 | LIBS="-lz $LIBS" | |
a9bca4aa JA |
435 | fi |
436 | echo "zlib $zlib" | |
437 | ||
67bf9823 JA |
438 | ########################################## |
439 | # linux-aio probe | |
440 | libaio="no" | |
441 | cat > $TMPC <<EOF | |
442 | #include <libaio.h> | |
443 | #include <stddef.h> | |
444 | int main(void) | |
445 | { | |
446 | io_setup(0, NULL); | |
447 | return 0; | |
448 | } | |
449 | EOF | |
450 | if compile_prog "" "-laio" "libaio" ; then | |
451 | libaio=yes | |
452 | LIBS="-laio $LIBS" | |
453 | else | |
454 | if test "$libaio" = "yes" ; then | |
c55d728b | 455 | feature_not_found "linux AIO" "libaio-dev or libaio-devel" |
67bf9823 JA |
456 | fi |
457 | libaio=no | |
458 | fi | |
459 | echo "Linux AIO support $libaio" | |
460 | ||
461 | ########################################## | |
462 | # posix aio probe | |
463 | posix_aio="no" | |
464 | posix_aio_lrt="no" | |
465 | cat > $TMPC <<EOF | |
466 | #include <aio.h> | |
467 | int main(void) | |
468 | { | |
469 | struct aiocb cb; | |
470 | aio_read(&cb); | |
471 | return 0; | |
472 | } | |
473 | EOF | |
474 | if compile_prog "" "" "posixaio" ; then | |
475 | posix_aio="yes" | |
476 | elif compile_prog "" "-lrt" "posixaio"; then | |
477 | posix_aio="yes" | |
478 | posix_aio_lrt="yes" | |
479 | LIBS="-lrt $LIBS" | |
480 | fi | |
481 | echo "POSIX AIO support $posix_aio" | |
482 | echo "POSIX AIO support needs -lrt $posix_aio_lrt" | |
483 | ||
484 | ########################################## | |
485 | # posix aio fsync probe | |
486 | posix_aio_fsync="no" | |
487 | if test "$posix_aio" = "yes" ; then | |
488 | cat > $TMPC <<EOF | |
489 | #include <fcntl.h> | |
490 | #include <aio.h> | |
491 | int main(void) | |
492 | { | |
493 | struct aiocb cb; | |
494 | return aio_fsync(O_SYNC, &cb); | |
495 | return 0; | |
496 | } | |
497 | EOF | |
498 | if compile_prog "" "$LIBS" "posix_aio_fsync" ; then | |
499 | posix_aio_fsync=yes | |
500 | fi | |
501 | fi | |
502 | echo "POSIX AIO fsync $posix_aio_fsync" | |
503 | ||
504 | ########################################## | |
505 | # solaris aio probe | |
506 | solaris_aio="no" | |
507 | cat > $TMPC <<EOF | |
508 | #include <sys/types.h> | |
509 | #include <sys/asynch.h> | |
510 | #include <unistd.h> | |
511 | int main(void) | |
512 | { | |
513 | aio_result_t res; | |
514 | return aioread(0, NULL, 0, 0, SEEK_SET, &res); | |
515 | return 0; | |
516 | } | |
517 | EOF | |
518 | if compile_prog "" "-laio" "solarisaio" ; then | |
519 | solaris_aio=yes | |
520 | LIBS="-laio $LIBS" | |
521 | fi | |
522 | echo "Solaris AIO support $solaris_aio" | |
523 | ||
524 | ########################################## | |
525 | # __sync_fetch_and_and test | |
526 | sfaa="no" | |
527 | cat > $TMPC << EOF | |
528 | static int sfaa(int *ptr) | |
529 | { | |
9c639a76 | 530 | return __sync_fetch_and_add(ptr, 0); |
67bf9823 JA |
531 | } |
532 | ||
533 | int main(int argc, char **argv) | |
534 | { | |
535 | int val = 42; | |
536 | sfaa(&val); | |
537 | return val; | |
538 | } | |
539 | EOF | |
540 | if compile_prog "" "" "__sync_fetch_and_add()" ; then | |
541 | sfaa="yes" | |
542 | fi | |
9c639a76 | 543 | echo "__sync_fetch_and_add $sfaa" |
67bf9823 JA |
544 | |
545 | ########################################## | |
546 | # libverbs probe | |
547 | libverbs="no" | |
548 | cat > $TMPC << EOF | |
549 | #include <stdio.h> | |
550 | #include <infiniband/arch.h> | |
551 | int main(int argc, char **argv) | |
552 | { | |
553 | struct ibv_pd *pd = ibv_alloc_pd(NULL); | |
554 | return 0; | |
555 | } | |
556 | EOF | |
557 | if compile_prog "" "-libverbs" "libverbs" ; then | |
558 | libverbs="yes" | |
559 | LIBS="-libverbs $LIBS" | |
560 | fi | |
561 | echo "libverbs $libverbs" | |
562 | ||
563 | ########################################## | |
564 | # rdmacm probe | |
565 | rdmacm="no" | |
566 | cat > $TMPC << EOF | |
567 | #include <stdio.h> | |
568 | #include <rdma/rdma_cma.h> | |
569 | int main(int argc, char **argv) | |
570 | { | |
571 | rdma_destroy_qp(NULL); | |
572 | return 0; | |
573 | } | |
574 | EOF | |
575 | if compile_prog "" "-lrdmacm" "rdma"; then | |
576 | rdmacm="yes" | |
577 | LIBS="-lrdmacm $LIBS" | |
578 | fi | |
579 | echo "rdmacm $rdmacm" | |
580 | ||
581 | ########################################## | |
582 | # Linux fallocate probe | |
583 | linux_fallocate="no" | |
584 | cat > $TMPC << EOF | |
585 | #include <stdio.h> | |
aa6738a5 | 586 | #include <fcntl.h> |
67bf9823 JA |
587 | #include <linux/falloc.h> |
588 | int main(int argc, char **argv) | |
589 | { | |
590 | int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024); | |
591 | return r; | |
592 | } | |
593 | EOF | |
594 | if compile_prog "" "" "linux_fallocate"; then | |
595 | linux_fallocate="yes" | |
596 | fi | |
597 | echo "Linux fallocate $linux_fallocate" | |
598 | ||
599 | ########################################## | |
600 | # POSIX fadvise probe | |
601 | posix_fadvise="no" | |
602 | cat > $TMPC << EOF | |
603 | #include <stdio.h> | |
604 | #include <fcntl.h> | |
605 | int main(int argc, char **argv) | |
606 | { | |
607 | int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL); | |
608 | return r; | |
609 | } | |
610 | EOF | |
611 | if compile_prog "" "" "posix_fadvise"; then | |
612 | posix_fadvise="yes" | |
613 | fi | |
614 | echo "POSIX fadvise $posix_fadvise" | |
615 | ||
616 | ########################################## | |
617 | # POSIX fallocate probe | |
618 | posix_fallocate="no" | |
619 | cat > $TMPC << EOF | |
620 | #include <stdio.h> | |
621 | #include <fcntl.h> | |
622 | int main(int argc, char **argv) | |
623 | { | |
624 | int r = posix_fallocate(0, 0, 1024); | |
625 | return r; | |
626 | } | |
627 | EOF | |
628 | if compile_prog "" "" "posix_fallocate"; then | |
629 | posix_fallocate="yes" | |
630 | fi | |
631 | echo "POSIX fallocate $posix_fallocate" | |
632 | ||
633 | ########################################## | |
634 | # sched_set/getaffinity 2 or 3 argument test | |
635 | linux_2arg_affinity="no" | |
636 | linux_3arg_affinity="no" | |
637 | cat > $TMPC << EOF | |
67bf9823 JA |
638 | #include <sched.h> |
639 | int main(int argc, char **argv) | |
640 | { | |
641 | cpu_set_t mask; | |
642 | return sched_setaffinity(0, sizeof(mask), &mask); | |
643 | } | |
644 | EOF | |
645 | if compile_prog "" "" "sched_setaffinity(,,)"; then | |
646 | linux_3arg_affinity="yes" | |
647 | else | |
648 | cat > $TMPC << EOF | |
67bf9823 JA |
649 | #include <sched.h> |
650 | int main(int argc, char **argv) | |
651 | { | |
652 | cpu_set_t mask; | |
653 | return sched_setaffinity(0, &mask); | |
654 | } | |
655 | EOF | |
656 | if compile_prog "" "" "sched_setaffinity(,)"; then | |
657 | linux_2arg_affinity="yes" | |
658 | fi | |
659 | fi | |
660 | echo "sched_setaffinity(3 arg) $linux_3arg_affinity" | |
661 | echo "sched_setaffinity(2 arg) $linux_2arg_affinity" | |
662 | ||
663 | ########################################## | |
664 | # clock_gettime probe | |
665 | clock_gettime="no" | |
666 | cat > $TMPC << EOF | |
667 | #include <stdio.h> | |
668 | #include <time.h> | |
669 | int main(int argc, char **argv) | |
670 | { | |
671 | return clock_gettime(0, NULL); | |
672 | } | |
673 | EOF | |
674 | if compile_prog "" "" "clock_gettime"; then | |
675 | clock_gettime="yes" | |
676 | elif compile_prog "" "-lrt" "clock_gettime"; then | |
677 | clock_gettime="yes" | |
678 | LIBS="-lrt $LIBS" | |
679 | fi | |
680 | echo "clock_gettime $clock_gettime" | |
681 | ||
682 | ########################################## | |
683 | # CLOCK_MONOTONIC probe | |
684 | clock_monotonic="no" | |
685 | if test "$clock_gettime" = "yes" ; then | |
686 | cat > $TMPC << EOF | |
687 | #include <stdio.h> | |
688 | #include <time.h> | |
689 | int main(int argc, char **argv) | |
690 | { | |
691 | return clock_gettime(CLOCK_MONOTONIC, NULL); | |
692 | } | |
693 | EOF | |
694 | if compile_prog "" "$LIBS" "clock monotonic"; then | |
695 | clock_monotonic="yes" | |
696 | fi | |
697 | fi | |
698 | echo "CLOCK_MONOTONIC $clock_monotonic" | |
699 | ||
700 | ########################################## | |
701 | # CLOCK_MONOTONIC_PRECISE probe | |
702 | clock_monotonic_precise="no" | |
703 | if test "$clock_gettime" = "yes" ; then | |
704 | cat > $TMPC << EOF | |
705 | #include <stdio.h> | |
706 | #include <time.h> | |
707 | int main(int argc, char **argv) | |
708 | { | |
709 | return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL); | |
710 | } | |
711 | EOF | |
712 | if compile_prog "" "$LIBS" "clock monotonic precise"; then | |
713 | clock_monotonic_precise="yes" | |
714 | fi | |
715 | fi | |
716 | echo "CLOCK_MONOTONIC_PRECISE $clock_monotonic_precise" | |
717 | ||
718 | ########################################## | |
719 | # gettimeofday() probe | |
720 | gettimeofday="no" | |
721 | cat > $TMPC << EOF | |
722 | #include <sys/time.h> | |
723 | #include <stdio.h> | |
724 | int main(int argc, char **argv) | |
725 | { | |
726 | struct timeval tv; | |
727 | return gettimeofday(&tv, NULL); | |
728 | } | |
729 | EOF | |
730 | if compile_prog "" "" "gettimeofday"; then | |
731 | gettimeofday="yes" | |
732 | fi | |
733 | echo "gettimeofday $gettimeofday" | |
734 | ||
735 | ########################################## | |
736 | # fdatasync() probe | |
737 | fdatasync="no" | |
738 | cat > $TMPC << EOF | |
739 | #include <stdio.h> | |
740 | #include <unistd.h> | |
741 | int main(int argc, char **argv) | |
742 | { | |
743 | return fdatasync(0); | |
744 | } | |
745 | EOF | |
746 | if compile_prog "" "" "fdatasync"; then | |
747 | fdatasync="yes" | |
748 | fi | |
749 | echo "fdatasync $fdatasync" | |
750 | ||
751 | ########################################## | |
752 | # sync_file_range() probe | |
753 | sync_file_range="no" | |
754 | cat > $TMPC << EOF | |
755 | #include <stdio.h> | |
756 | #include <unistd.h> | |
67bf9823 JA |
757 | #include <fcntl.h> |
758 | #include <linux/fs.h> | |
759 | int main(int argc, char **argv) | |
760 | { | |
761 | unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE | | |
762 | SYNC_FILE_RANGE_WAIT_AFTER; | |
763 | return sync_file_range(0, 0, 0, flags); | |
764 | } | |
765 | EOF | |
766 | if compile_prog "" "" "sync_file_range"; then | |
767 | sync_file_range="yes" | |
768 | fi | |
769 | echo "sync_file_range $sync_file_range" | |
770 | ||
771 | ########################################## | |
772 | # ext4 move extent probe | |
773 | ext4_me="no" | |
774 | cat > $TMPC << EOF | |
775 | #include <fcntl.h> | |
776 | #include <sys/ioctl.h> | |
777 | int main(int argc, char **argv) | |
778 | { | |
779 | struct move_extent me; | |
780 | return ioctl(0, EXT4_IOC_MOVE_EXT, &me); | |
781 | } | |
782 | EOF | |
c7165b8d JA |
783 | if compile_prog "" "" "ext4 move extent" ; then |
784 | ext4_me="yes" | |
785 | elif test $targetos = "Linux" ; then | |
786 | # On Linux, just default to it on and let it error at runtime if we really | |
787 | # don't have it. None of my updated systems have it defined, but it does | |
788 | # work. Takes a while to bubble back. | |
67bf9823 JA |
789 | ext4_me="yes" |
790 | fi | |
791 | echo "EXT4 move extent $ext4_me" | |
792 | ||
793 | ########################################## | |
794 | # splice probe | |
795 | linux_splice="no" | |
796 | cat > $TMPC << EOF | |
67bf9823 JA |
797 | #include <stdio.h> |
798 | #include <fcntl.h> | |
799 | int main(int argc, char **argv) | |
800 | { | |
801 | return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK); | |
802 | } | |
803 | EOF | |
804 | if compile_prog "" "" "linux splice"; then | |
805 | linux_splice="yes" | |
806 | fi | |
807 | echo "Linux splice(2) $linux_splice" | |
808 | ||
809 | ########################################## | |
810 | # GUASI probe | |
811 | guasi="no" | |
812 | cat > $TMPC << EOF | |
813 | #include <guasi.h> | |
814 | #include <guasi_syscalls.h> | |
815 | int main(int argc, char **argv) | |
816 | { | |
817 | guasi_t ctx = guasi_create(0, 0, 0); | |
818 | return 0; | |
819 | } | |
820 | EOF | |
821 | if compile_prog "" "" "guasi"; then | |
822 | guasi="yes" | |
823 | fi | |
824 | echo "GUASI $guasi" | |
825 | ||
826 | ########################################## | |
827 | # fusion-aw probe | |
828 | fusion_aw="no" | |
829 | cat > $TMPC << EOF | |
b2c77c25 | 830 | #include <nvm/nvm_primitives.h> |
67bf9823 JA |
831 | int main(int argc, char **argv) |
832 | { | |
b2c77c25 SK |
833 | nvm_version_t ver_info; |
834 | nvm_handle_t handle; | |
835 | ||
836 | handle = nvm_get_handle(0, &ver_info); | |
837 | return nvm_atomic_write(handle, 0, 0, 0); | |
67bf9823 JA |
838 | } |
839 | EOF | |
b2c77c25 SK |
840 | if compile_prog "" "-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -lvsl -ldl" "fusion-aw"; then |
841 | LIBS="-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -lvsl -ldl $LIBS" | |
67bf9823 JA |
842 | fusion_aw="yes" |
843 | fi | |
844 | echo "Fusion-io atomic engine $fusion_aw" | |
845 | ||
846 | ########################################## | |
847 | # libnuma probe | |
848 | libnuma="no" | |
849 | cat > $TMPC << EOF | |
850 | #include <numa.h> | |
851 | int main(int argc, char **argv) | |
852 | { | |
853 | return numa_available(); | |
854 | } | |
855 | EOF | |
44462517 | 856 | if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then |
67bf9823 JA |
857 | libnuma="yes" |
858 | LIBS="-lnuma $LIBS" | |
859 | fi | |
860 | echo "libnuma $libnuma" | |
861 | ||
50206d9b JA |
862 | ########################################## |
863 | # libnuma 2.x version API | |
864 | if test "$libnuma" = "yes" ; then | |
865 | libnuma_v2="no" | |
866 | cat > $TMPC << EOF | |
867 | #include <numa.h> | |
868 | int main(int argc, char **argv) | |
869 | { | |
870 | struct bitmask *mask = numa_parse_nodestring(NULL); | |
871 | return 0; | |
872 | } | |
873 | EOF | |
874 | if compile_prog "" "" "libnuma api"; then | |
875 | libnuma_v2="yes" | |
876 | fi | |
877 | echo "libnuma v2 $libnuma_v2" | |
878 | fi | |
879 | ||
67bf9823 JA |
880 | ########################################## |
881 | # strsep() probe | |
882 | strsep="no" | |
883 | cat > $TMPC << EOF | |
884 | #include <string.h> | |
885 | int main(int argc, char **argv) | |
886 | { | |
887 | strsep(NULL, NULL); | |
888 | return 0; | |
889 | } | |
890 | EOF | |
891 | if compile_prog "" "" "strsep"; then | |
892 | strsep="yes" | |
893 | fi | |
894 | echo "strsep $strsep" | |
895 | ||
9ad8da82 JA |
896 | ########################################## |
897 | # strcasestr() probe | |
898 | strcasestr="no" | |
899 | cat > $TMPC << EOF | |
900 | #include <string.h> | |
901 | int main(int argc, char **argv) | |
902 | { | |
aa6738a5 | 903 | return strcasestr(argv[0], argv[1]) != NULL; |
9ad8da82 JA |
904 | } |
905 | EOF | |
906 | if compile_prog "" "" "strcasestr"; then | |
907 | strcasestr="yes" | |
908 | fi | |
909 | echo "strcasestr $strcasestr" | |
910 | ||
67bf9823 JA |
911 | ########################################## |
912 | # getopt_long_only() probe | |
913 | getopt_long_only="no" | |
914 | cat > $TMPC << EOF | |
915 | #include <unistd.h> | |
916 | #include <stdio.h> | |
aa6738a5 | 917 | #include <getopt.h> |
67bf9823 JA |
918 | int main(int argc, char **argv) |
919 | { | |
920 | int c = getopt_long_only(argc, argv, NULL, NULL, NULL); | |
921 | return c; | |
922 | } | |
923 | EOF | |
924 | if compile_prog "" "" "getopt_long_only"; then | |
925 | getopt_long_only="yes" | |
926 | fi | |
927 | echo "getopt_long_only() $getopt_long_only" | |
928 | ||
929 | ########################################## | |
930 | # inet_aton() probe | |
931 | inet_aton="no" | |
932 | cat > $TMPC << EOF | |
933 | #include <sys/socket.h> | |
934 | #include <arpa/inet.h> | |
935 | #include <stdio.h> | |
936 | int main(int argc, char **argv) | |
937 | { | |
938 | struct in_addr in; | |
939 | return inet_aton(NULL, &in); | |
940 | } | |
941 | EOF | |
942 | if compile_prog "" "" "inet_aton"; then | |
943 | inet_aton="yes" | |
944 | fi | |
945 | echo "inet_aton $inet_aton" | |
946 | ||
947 | ########################################## | |
948 | # socklen_t probe | |
949 | socklen_t="no" | |
950 | cat > $TMPC << EOF | |
f6482613 | 951 | #include <sys/socket.h> |
67bf9823 JA |
952 | int main(int argc, char **argv) |
953 | { | |
954 | socklen_t len = 0; | |
955 | return len; | |
956 | } | |
957 | EOF | |
958 | if compile_prog "" "" "socklen_t"; then | |
959 | socklen_t="yes" | |
960 | fi | |
961 | echo "socklen_t $socklen_t" | |
962 | ||
963 | ########################################## | |
964 | # Whether or not __thread is supported for TLS | |
965 | tls_thread="no" | |
966 | cat > $TMPC << EOF | |
967 | #include <stdio.h> | |
aa6738a5 | 968 | static __thread int ret; |
67bf9823 JA |
969 | int main(int argc, char **argv) |
970 | { | |
971 | return ret; | |
972 | } | |
973 | EOF | |
974 | if compile_prog "" "" "__thread"; then | |
975 | tls_thread="yes" | |
976 | fi | |
977 | echo "__thread $tls_thread" | |
978 | ||
91f94d5b | 979 | ########################################## |
2639f056 | 980 | # Check if we have required gtk/glib support for gfio |
91f94d5b JA |
981 | if test "$gfio" = "yes" ; then |
982 | cat > $TMPC << EOF | |
983 | #include <glib.h> | |
984 | #include <cairo.h> | |
985 | #include <gtk/gtk.h> | |
986 | int main(void) | |
987 | { | |
988 | gdk_threads_enter(); | |
91f94d5b | 989 | gdk_threads_leave(); |
b7a99316 JA |
990 | |
991 | printf("%d", GTK_CHECK_VERSION(2, 18, 0)); | |
91f94d5b JA |
992 | } |
993 | EOF | |
994 | GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0) | |
995 | if test "$?" != "0" ; then | |
996 | echo "configure: gtk and gthread not found" | |
997 | exit 1 | |
998 | fi | |
999 | GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0) | |
1000 | if test "$?" != "0" ; then | |
1001 | echo "configure: gtk and gthread not found" | |
1002 | exit 1 | |
1003 | fi | |
b7a99316 JA |
1004 | if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then |
1005 | r=$($TMPE) | |
1006 | if test "$r" != "0" ; then | |
1007 | gfio="yes" | |
1008 | LIBS="$LIBS $GTK_LIBS" | |
1009 | CFLAGS="$CFLAGS $GTK_CFLAGS" | |
1010 | else | |
1011 | echo "GTK found, but need version 2.18 or higher" | |
1012 | gfio="no" | |
1013 | fi | |
91f94d5b JA |
1014 | else |
1015 | echo "Please install gtk and gdk libraries" | |
1016 | gfio="no" | |
1017 | fi | |
1018 | fi | |
1019 | ||
2639f056 | 1020 | echo "gtk 2.18 or higher $gfio" |
91f94d5b | 1021 | |
44404c5a JA |
1022 | # Check whether we have getrusage(RUSAGE_THREAD) |
1023 | rusage_thread="no" | |
1024 | cat > $TMPC << EOF | |
1025 | #include <sys/time.h> | |
1026 | #include <sys/resource.h> | |
1027 | int main(int argc, char **argv) | |
1028 | { | |
1029 | struct rusage ru; | |
1030 | getrusage(RUSAGE_THREAD, &ru); | |
1031 | return 0; | |
1032 | } | |
1033 | EOF | |
1034 | if compile_prog "" "" "RUSAGE_THREAD"; then | |
1035 | rusage_thread="yes" | |
1036 | fi | |
1037 | echo "RUSAGE_THREAD $rusage_thread" | |
1038 | ||
7e09a9f1 JA |
1039 | ########################################## |
1040 | # Check whether we have SCHED_IDLE | |
1041 | sched_idle="no" | |
1042 | cat > $TMPC << EOF | |
1043 | #include <sched.h> | |
1044 | int main(int argc, char **argv) | |
1045 | { | |
1046 | struct sched_param p; | |
1047 | return sched_setscheduler(0, SCHED_IDLE, &p); | |
1048 | } | |
1049 | EOF | |
1050 | if compile_prog "" "" "SCHED_IDLE"; then | |
1051 | sched_idle="yes" | |
1052 | fi | |
1053 | echo "SCHED_IDLE $sched_idle" | |
1054 | ||
1eafa37a JA |
1055 | ########################################## |
1056 | # Check whether we have TCP_NODELAY | |
1057 | tcp_nodelay="no" | |
1058 | cat > $TMPC << EOF | |
1059 | #include <stdio.h> | |
1060 | #include <sys/types.h> | |
1061 | #include <sys/socket.h> | |
1062 | #include <netinet/tcp.h> | |
1063 | int main(int argc, char **argv) | |
1064 | { | |
1065 | return getsockopt(0, 0, TCP_NODELAY, NULL, NULL); | |
1066 | } | |
1067 | EOF | |
1068 | if compile_prog "" "" "TCP_NODELAY"; then | |
1069 | tcp_nodelay="yes" | |
1070 | fi | |
1071 | echo "TCP_NODELAY $tcp_nodelay" | |
1072 | ||
38b9354a JA |
1073 | ########################################## |
1074 | # Check whether we have RLIMIT_MEMLOCK | |
1075 | rlimit_memlock="no" | |
1076 | cat > $TMPC << EOF | |
1077 | #include <sys/time.h> | |
1078 | #include <sys/resource.h> | |
1079 | int main(int argc, char **argv) | |
1080 | { | |
1081 | struct rlimit rl; | |
1082 | return getrlimit(RLIMIT_MEMLOCK, &rl); | |
1083 | } | |
1084 | EOF | |
1085 | if compile_prog "" "" "RLIMIT_MEMLOCK"; then | |
1086 | rlimit_memlock="yes" | |
1087 | fi | |
1088 | echo "RLIMIT_MEMLOCK $rlimit_memlock" | |
1089 | ||
07fc0acd JA |
1090 | ########################################## |
1091 | # Check whether we have pwritev/preadv | |
1092 | pwritev="no" | |
1093 | cat > $TMPC << EOF | |
1094 | #include <stdio.h> | |
1095 | #include <sys/uio.h> | |
1096 | int main(int argc, char **argv) | |
1097 | { | |
1098 | return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0); | |
1099 | } | |
1100 | EOF | |
1101 | if compile_prog "" "" "pwritev"; then | |
1102 | pwritev="yes" | |
1103 | fi | |
1104 | echo "pwritev/preadv $pwritev" | |
1105 | ||
ecad55e9 JA |
1106 | ########################################## |
1107 | # Check whether we have the required functions for ipv6 | |
1108 | ipv6="no" | |
1109 | cat > $TMPC << EOF | |
1110 | #include <sys/types.h> | |
1111 | #include <sys/socket.h> | |
d219028d | 1112 | #include <netinet/in.h> |
ecad55e9 JA |
1113 | #include <netdb.h> |
1114 | #include <stdio.h> | |
1115 | int main(int argc, char **argv) | |
1116 | { | |
1117 | struct addrinfo hints; | |
1118 | struct in6_addr addr; | |
1119 | int ret; | |
1120 | ||
1121 | ret = getaddrinfo(NULL, NULL, &hints, NULL); | |
1122 | freeaddrinfo(NULL); | |
1123 | printf("%s\n", gai_strerror(ret)); | |
1124 | addr = in6addr_any; | |
1125 | return 0; | |
1126 | } | |
1127 | EOF | |
1128 | if compile_prog "" "" "ipv6"; then | |
1129 | ipv6="yes" | |
1130 | fi | |
1131 | echo "IPv6 helpers $ipv6" | |
07fc0acd | 1132 | |
fc5c0345 DG |
1133 | ########################################## |
1134 | # check for rbd | |
1135 | rbd="no" | |
1136 | cat > $TMPC << EOF | |
1137 | #include <rbd/librbd.h> | |
1138 | ||
1139 | int main(int argc, char **argv) | |
1140 | { | |
1141 | ||
1142 | rados_t cluster; | |
1143 | rados_ioctx_t io_ctx; | |
1144 | const char pool[] = "rbd"; | |
1145 | ||
1146 | int major, minor, extra; | |
1147 | rbd_version(&major, &minor, &extra); | |
1148 | ||
1149 | rados_ioctx_create(cluster, pool, &io_ctx); | |
1150 | return 0; | |
1151 | } | |
1152 | EOF | |
ce18290e | 1153 | if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then |
fc5c0345 DG |
1154 | LIBS="-lrbd -lrados $LIBS" |
1155 | rbd="yes" | |
1156 | fi | |
1157 | echo "Rados Block Device engine $rbd" | |
1158 | ||
2e802282 JA |
1159 | ########################################## |
1160 | # Check whether we have setvbuf | |
1161 | setvbuf="no" | |
1162 | cat > $TMPC << EOF | |
1163 | #include <stdio.h> | |
1164 | int main(int argc, char **argv) | |
1165 | { | |
1166 | FILE *f = NULL; | |
1167 | char buf[80]; | |
1168 | setvbuf(f, buf, _IOFBF, sizeof(buf)); | |
1169 | return 0; | |
1170 | } | |
1171 | EOF | |
1172 | if compile_prog "" "" "setvbuf"; then | |
1173 | setvbuf="yes" | |
1174 | fi | |
1175 | echo "setvbuf $setvbuf" | |
fc5c0345 | 1176 | |
6e7d7dfb | 1177 | # check for gfapi |
1178 | gfapi="no" | |
1179 | cat > $TMPC << EOF | |
1180 | #include <glusterfs/api/glfs.h> | |
1181 | ||
1182 | int main(int argc, char **argv) | |
1183 | { | |
1184 | ||
1185 | glfs_t *g = glfs_new("foo"); | |
1186 | ||
1187 | return 0; | |
1188 | } | |
1189 | EOF | |
ce18290e | 1190 | if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then |
6e7d7dfb | 1191 | LIBS="-lgfapi -lglusterfs $LIBS" |
1192 | gfapi="yes" | |
1193 | fi | |
6fa14b99 | 1194 | echo "Gluster API engine $gfapi" |
6e7d7dfb | 1195 | |
6fa14b99 | 1196 | ########################################## |
1197 | # check for gfapi fadvise support | |
1198 | gf_fadvise="no" | |
1199 | cat > $TMPC << EOF | |
1200 | #include <glusterfs/api/glfs.h> | |
1201 | ||
1202 | int main(int argc, char **argv) | |
1203 | { | |
1204 | struct glfs_fd *fd; | |
1205 | int ret = glfs_fadvise(fd, 0, 0, 1); | |
1206 | ||
1207 | return 0; | |
1208 | } | |
1209 | EOF | |
1210 | ||
1211 | if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then | |
1212 | gf_fadvise="yes" | |
1213 | fi | |
1214 | echo "Gluster API use fadvise $gf_fadvise" | |
fc5c0345 | 1215 | |
81795ce3 CE |
1216 | ########################################## |
1217 | # Check if we support stckf on s390 | |
1218 | s390_z196_facilities="no" | |
1219 | cat > $TMPC << EOF | |
1220 | #define STFLE_BITS_Z196 45 /* various z196 facilities ... */ | |
1221 | int main(int argc, char **argv) | |
1222 | { | |
1223 | /* We want just 1 double word to be returned. */ | |
1224 | register unsigned long reg0 asm("0") = 0; | |
1225 | unsigned long stfle_bits; | |
1226 | asm volatile(".machine push" "\n\t" | |
1227 | ".machine \"z9-109\"" "\n\t" | |
1228 | "stfle %0" "\n\t" | |
1229 | ".machine pop" "\n" | |
1230 | : "=QS" (stfle_bits), "+d" (reg0) | |
1231 | : : "cc"); | |
1232 | ||
1233 | if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0) | |
1234 | return 0; | |
1235 | else | |
1236 | return -1; | |
1237 | } | |
1238 | EOF | |
1239 | if compile_prog "" "" "s390_z196_facilities"; then | |
1240 | $TMPE | |
1241 | if [[ $? -eq 0 ]]; then | |
1242 | s390_z196_facilities="yes" | |
1243 | fi | |
1244 | fi | |
1245 | echo "s390_z196_facilities $s390_z196_facilities" | |
67bf9823 JA |
1246 | ############################################################################# |
1247 | ||
67bf9823 | 1248 | if test "$wordsize" = "64" ; then |
4feafb1e | 1249 | output_sym "CONFIG_64BIT" |
67bf9823 | 1250 | elif test "$wordsize" = "32" ; then |
4feafb1e | 1251 | output_sym "CONFIG_32BIT" |
67bf9823 | 1252 | else |
d7145a78 | 1253 | fatal "Unknown wordsize!" |
67bf9823 | 1254 | fi |
0dcebdf4 | 1255 | if test "$bigendian" = "yes" ; then |
4feafb1e | 1256 | output_sym "CONFIG_BIG_ENDIAN" |
0dcebdf4 | 1257 | else |
4feafb1e | 1258 | output_sym "CONFIG_LITTLE_ENDIAN" |
0dcebdf4 | 1259 | fi |
3989b143 JA |
1260 | if test "$zlib" = "yes" ; then |
1261 | output_sym "CONFIG_ZLIB" | |
1262 | fi | |
67bf9823 | 1263 | if test "$libaio" = "yes" ; then |
4feafb1e | 1264 | output_sym "CONFIG_LIBAIO" |
67bf9823 JA |
1265 | fi |
1266 | if test "$posix_aio" = "yes" ; then | |
4feafb1e | 1267 | output_sym "CONFIG_POSIXAIO" |
67bf9823 JA |
1268 | fi |
1269 | if test "$posix_aio_fsync" = "yes" ; then | |
4feafb1e | 1270 | output_sym "CONFIG_POSIXAIO_FSYNC" |
67bf9823 JA |
1271 | fi |
1272 | if test "$linux_fallocate" = "yes" ; then | |
4feafb1e | 1273 | output_sym "CONFIG_LINUX_FALLOCATE" |
67bf9823 JA |
1274 | fi |
1275 | if test "$posix_fallocate" = "yes" ; then | |
4feafb1e | 1276 | output_sym "CONFIG_POSIX_FALLOCATE" |
67bf9823 JA |
1277 | fi |
1278 | if test "$fdatasync" = "yes" ; then | |
4feafb1e | 1279 | output_sym "CONFIG_FDATASYNC" |
67bf9823 JA |
1280 | fi |
1281 | if test "$sync_file_range" = "yes" ; then | |
4feafb1e | 1282 | output_sym "CONFIG_SYNC_FILE_RANGE" |
67bf9823 JA |
1283 | fi |
1284 | if test "$sfaa" = "yes" ; then | |
4feafb1e | 1285 | output_sym "CONFIG_SFAA" |
67bf9823 | 1286 | fi |
954cd73a | 1287 | if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then |
4feafb1e | 1288 | output_sym "CONFIG_RDMA" |
67bf9823 JA |
1289 | fi |
1290 | if test "$clock_gettime" = "yes" ; then | |
4feafb1e | 1291 | output_sym "CONFIG_CLOCK_GETTIME" |
67bf9823 JA |
1292 | fi |
1293 | if test "$clock_monotonic" = "yes" ; then | |
4feafb1e | 1294 | output_sym "CONFIG_CLOCK_MONOTONIC" |
67bf9823 JA |
1295 | fi |
1296 | if test "$clock_monotonic_precise" = "yes" ; then | |
4feafb1e | 1297 | output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE" |
67bf9823 JA |
1298 | fi |
1299 | if test "$gettimeofday" = "yes" ; then | |
4feafb1e | 1300 | output_sym "CONFIG_GETTIMEOFDAY" |
67bf9823 JA |
1301 | fi |
1302 | if test "$posix_fadvise" = "yes" ; then | |
4feafb1e | 1303 | output_sym "CONFIG_POSIX_FADVISE" |
67bf9823 JA |
1304 | fi |
1305 | if test "$linux_3arg_affinity" = "yes" ; then | |
4feafb1e | 1306 | output_sym "CONFIG_3ARG_AFFINITY" |
67bf9823 | 1307 | elif test "$linux_2arg_affinity" = "yes" ; then |
4feafb1e | 1308 | output_sym "CONFIG_2ARG_AFFINITY" |
67bf9823 JA |
1309 | fi |
1310 | if test "$strsep" = "yes" ; then | |
4feafb1e | 1311 | output_sym "CONFIG_STRSEP" |
67bf9823 | 1312 | fi |
9ad8da82 JA |
1313 | if test "$strcasestr" = "yes" ; then |
1314 | output_sym "CONFIG_STRCASESTR" | |
1315 | fi | |
67bf9823 | 1316 | if test "$getopt_long_only" = "yes" ; then |
4feafb1e | 1317 | output_sym "CONFIG_GETOPT_LONG_ONLY" |
67bf9823 JA |
1318 | fi |
1319 | if test "$inet_aton" = "yes" ; then | |
4feafb1e | 1320 | output_sym "CONFIG_INET_ATON" |
67bf9823 JA |
1321 | fi |
1322 | if test "$socklen_t" = "yes" ; then | |
4feafb1e | 1323 | output_sym "CONFIG_SOCKLEN_T" |
67bf9823 JA |
1324 | fi |
1325 | if test "$ext4_me" = "yes" ; then | |
4feafb1e | 1326 | output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT" |
67bf9823 JA |
1327 | fi |
1328 | if test "$linux_splice" = "yes" ; then | |
4feafb1e | 1329 | output_sym "CONFIG_LINUX_SPLICE" |
67bf9823 JA |
1330 | fi |
1331 | if test "$guasi" = "yes" ; then | |
4feafb1e | 1332 | output_sym "CONFIG_GUASI" |
67bf9823 JA |
1333 | fi |
1334 | if test "$fusion_aw" = "yes" ; then | |
4feafb1e | 1335 | output_sym "CONFIG_FUSION_AW" |
67bf9823 | 1336 | fi |
50206d9b | 1337 | if test "$libnuma_v2" = "yes" ; then |
4feafb1e | 1338 | output_sym "CONFIG_LIBNUMA" |
67bf9823 JA |
1339 | fi |
1340 | if test "$solaris_aio" = "yes" ; then | |
4feafb1e | 1341 | output_sym "CONFIG_SOLARISAIO" |
67bf9823 JA |
1342 | fi |
1343 | if test "$tls_thread" = "yes" ; then | |
4feafb1e | 1344 | output_sym "CONFIG_TLS_THREAD" |
67bf9823 | 1345 | fi |
44404c5a | 1346 | if test "$rusage_thread" = "yes" ; then |
4feafb1e | 1347 | output_sym "CONFIG_RUSAGE_THREAD" |
67bf9823 | 1348 | fi |
91f94d5b JA |
1349 | if test "$gfio" = "yes" ; then |
1350 | echo "CONFIG_GFIO=y" >> $config_host_mak | |
1351 | fi | |
c8931876 JA |
1352 | if test "$esx" = "yes" ; then |
1353 | output_sym "CONFIG_ESX" | |
1354 | output_sym "CONFIG_NO_SHM" | |
1355 | fi | |
7e09a9f1 JA |
1356 | if test "$sched_idle" = "yes" ; then |
1357 | output_sym "CONFIG_SCHED_IDLE" | |
1358 | fi | |
1eafa37a JA |
1359 | if test "$tcp_nodelay" = "yes" ; then |
1360 | output_sym "CONFIG_TCP_NODELAY" | |
1361 | fi | |
38b9354a JA |
1362 | if test "$rlimit_memlock" = "yes" ; then |
1363 | output_sym "CONFIG_RLIMIT_MEMLOCK" | |
1364 | fi | |
07fc0acd JA |
1365 | if test "$pwritev" = "yes" ; then |
1366 | output_sym "CONFIG_PWRITEV" | |
1367 | fi | |
ecad55e9 JA |
1368 | if test "$ipv6" = "yes" ; then |
1369 | output_sym "CONFIG_IPV6" | |
1370 | fi | |
fc5c0345 DG |
1371 | if test "$rbd" = "yes" ; then |
1372 | output_sym "CONFIG_RBD" | |
1373 | fi | |
2e802282 JA |
1374 | if test "$setvbuf" = "yes" ; then |
1375 | output_sym "CONFIG_SETVBUF" | |
1376 | fi | |
81795ce3 CE |
1377 | if test "$s390_z196_facilities" = "yes" ; then |
1378 | output_sym "CONFIG_S390_Z196_FACILITIES" | |
1379 | CFLAGS="$CFLAGS -march=z9-109" | |
1380 | fi | |
6e7d7dfb | 1381 | if test "$gfapi" = "yes" ; then |
1382 | output_sym "CONFIG_GFAPI" | |
1383 | fi | |
6fa14b99 | 1384 | if test "$gf_fadvise" = "yes" ; then |
1385 | output_sym "CONFIG_GF_FADVISE" | |
1386 | fi | |
67bf9823 JA |
1387 | |
1388 | echo "LIBS+=$LIBS" >> $config_host_mak | |
91f94d5b | 1389 | echo "CFLAGS+=$CFLAGS" >> $config_host_mak |
67bf9823 | 1390 | echo "CC=$cc" >> $config_host_mak |
af4862b3 | 1391 | echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak |