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