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