Add missing trailing \n in dprint()
[fio.git] / configure
CommitLineData
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
8if test ! -z "$TMPDIR" ; then
9 TMPDIR1="${TMPDIR}"
10elif test ! -z "$TEMPDIR" ; then
11 TMPDIR1="${TEMPDIR}"
12else
13 TMPDIR1="/tmp"
14fi
15
16TMPC="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.c"
17TMPO="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.o"
18TMPE="${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>
22trap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM
23
24rm -rf config.log
25
26config_host_mak="config-host.mak"
4feafb1e
JA
27config_host_h="config-host.h"
28
29rm -rf $config_host_mak
30rm -rf $config_host_h
67bf9823 31
d7145a78
JA
32fatal() {
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
41CFLAGS="-D_GNU_SOURCE -include config-host.h"
42BUILD_CFLAGS=""
67bf9823
JA
43
44# Print a helpful header at the top of config.log
45echo "# FIO configure log $(date)" >> config.log
46printf "# Configured with:" >> config.log
47printf " '%s'" "$0" "$@" >> config.log
48echo >> config.log
49echo "#" >> config.log
50
7560fe7c
JA
51# Print configure header at the top of $config_host_h
52echo "/*" > $config_host_h
53echo " * Automatically generated by configure - do not modify" >> $config_host_h
54printf " * Configured with:" >> $config_host_h
55printf " * '%s'" "$0" "$@" >> $config_host_h
56echo "" >> $config_host_h
57echo " */" >> $config_host_h
58
67bf9823
JA
59do_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
84compile_object() {
85 do_cc $CFLAGS -c -o $TMPO $TMPC
86}
87
88compile_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
95feature_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
108has() {
109 type "$1" >/dev/null 2>&1
110}
111
112check_define() {
113 cat > $TMPC <<EOF
114#if !defined($1)
115#error $1 not defined
116#endif
117int main(void)
118{
119 return 0;
120}
121EOF
122 compile_object
123}
124
4feafb1e
JA
125output_sym() {
126 echo "$1=y" >> $config_host_mak
127 echo "#define $1" >> $config_host_h
128}
129
67bf9823
JA
130targetos=""
131cpu=""
132
91f94d5b 133# default options
47f44635
JA
134show_help="no"
135exit_val=0
ebec2094 136gfio_check="no"
1b10477b 137libhdfs="no"
43f3cec2 138pmemblk="no"
cbb15e42 139devdax="no"
de26b824 140disable_lex=""
3ee2a3c1 141disable_pmem="no"
020d54bd 142prefix=/usr/local
91f94d5b 143
cb1125b0
JA
144# parse options
145for opt do
146 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
147 case "$opt" in
020d54bd
JA
148 --prefix=*) prefix="$optarg"
149 ;;
8b156d8e
JA
150 --cpu=*) cpu="$optarg"
151 ;;
c8931876
JA
152 # esx is cross compiled and cannot be detect through simple uname calls
153 --esx)
154 esx="yes"
155 ;;
cb1125b0
JA
156 --cc=*) CC="$optarg"
157 ;;
208e4c8b
JA
158 --extra-cflags=*) CFLAGS="$CFLAGS $optarg"
159 ;;
b7c12794 160 --build-32bit-win) build_32bit_win="yes"
7409711b 161 ;;
d2aeedb9
JA
162 --build-static) build_static="yes"
163 ;;
91f94d5b 164 --enable-gfio)
ebec2094 165 gfio_check="yes"
899fab33 166 ;;
44462517
CF
167 --disable-numa) disable_numa="yes"
168 ;;
ce18290e
TM
169 --disable-rbd) disable_rbd="yes"
170 ;;
a4c4c346 171 --disable-rbd-blkin) disable_rbd_blkin="yes"
172 ;;
ce18290e
TM
173 --disable-gfapi) disable_gfapi="yes"
174 ;;
1b10477b
MM
175 --enable-libhdfs) libhdfs="yes"
176 ;;
a655bbc4
JA
177 --disable-lex) disable_lex="yes"
178 ;;
de26b824
JA
179 --enable-lex) disable_lex="no"
180 ;;
61054f0d
JA
181 --disable-shm) no_shm="yes"
182 ;;
183 --disable-optimizations) disable_opt="yes"
ba40757e 184 ;;
3ee2a3c1
DJ
185 --disable-pmem) disable_pmem="yes"
186 ;;
827da4f5 187 --help)
47f44635 188 show_help="yes"
827da4f5 189 ;;
cb1125b0
JA
190 *)
191 echo "Bad option $opt"
47f44635
JA
192 show_help="yes"
193 exit_val=1
cb1125b0
JA
194 esac
195done
196
47f44635 197if test "$show_help" = "yes" ; then
020d54bd 198 echo "--prefix= Use this directory as installation prefix"
8b156d8e 199 echo "--cpu= Specify target CPU if auto-detect fails"
b7a99316 200 echo "--cc= Specify compiler to use"
899fab33 201 echo "--extra-cflags= Specify extra CFLAGS to pass to compiler"
b7c12794 202 echo "--build-32bit-win Enable 32-bit build on Windows"
d2aeedb9 203 echo "--build-static Build a static fio"
c8931876 204 echo "--esx Configure build options for esx"
b7a99316 205 echo "--enable-gfio Enable building of gtk gfio"
44462517 206 echo "--disable-numa Disable libnuma even if found"
c44ff511 207 echo "--disable-gfapi Disable gfapi"
1b10477b 208 echo "--enable-libhdfs Enable hdfs support"
a655bbc4 209 echo "--disable-lex Disable use of lex/yacc for math"
3ee2a3c1 210 echo "--disable-pmem Disable pmem based engines even if found"
de26b824 211 echo "--enable-lex Enable use of lex/yacc for math"
c44ff511 212 echo "--disable-shm Disable SHM support"
61054f0d 213 echo "--disable-optimizations Don't enable compiler optimizations"
b7a99316 214 exit $exit_val
47f44635
JA
215fi
216
47986339
SH
217cross_prefix=${cross_prefix-${CROSS_COMPILE}}
218cc="${CC-${cross_prefix}gcc}"
219
6d0e9f83
AC
220if check_define __ANDROID__ ; then
221 targetos="Android"
222elif check_define __linux__ ; then
67bf9823 223 targetos="Linux"
67bf9823
JA
224elif check_define __OpenBSD__ ; then
225 targetos='OpenBSD'
226elif check_define __sun__ ; then
227 targetos='SunOS'
7cb024f8 228 CFLAGS="$CFLAGS -D_REENTRANT"
b24f59ab
SH
229elif check_define _WIN32 ; then
230 targetos='CYGWIN'
67bf9823
JA
231else
232 targetos=`uname -s`
233fi
234
53cd4eee
AC
235echo "# Automatically generated by configure - do not modify" > $config_host_mak
236printf "# Configured with:" >> $config_host_mak
237printf " '%s'" "$0" "$@" >> $config_host_mak
238echo >> $config_host_mak
239echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak
240
61054f0d
JA
241if test "$no_shm" = "yes" ; then
242 output_sym "CONFIG_NO_SHM"
243fi
244
245if test "$disable_opt" = "yes" ; then
246 output_sym "CONFIG_FIO_NO_OPT"
247fi
248
67bf9823
JA
249# Some host OSes need non-standard checks for which CPU to use.
250# Note that these checks are broken for cross-compilation: if you're
251# cross-compiling to one of these OSes then you'll need to specify
252# the correct CPU with the --cpu option.
253case $targetos in
de26b824
JA
254AIX)
255 # Unless explicitly enabled, turn off lex.
256 if test -z "$disable_lex" ; then
257 disable_lex="yes"
daf705b5
JA
258 else
259 force_no_lex_o="yes"
de26b824
JA
260 fi
261 ;;
67bf9823
JA
262Darwin)
263 # on Leopard most of the system is 32-bit, so we have to ask the kernel if
264 # we can run 64-bit userspace code.
265 # If the user didn't specify a CPU explicitly and the kernel says this is
266 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual
267 # detection code.
268 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
269 cpu="x86_64"
270 fi
271 ;;
272SunOS)
273 # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
274 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
275 cpu="x86_64"
276 fi
adaa46d8 277 LIBS="-lnsl -lsocket"
cfd94f79
JA
278 ;;
279CYGWIN*)
280 echo "Forcing known good options on Windows"
4578d01f 281 if test -z "$CC" ; then
7409711b
HL
282 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
283 CC="i686-w64-mingw32-gcc"
284 else
285 CC="x86_64-w64-mingw32-gcc"
286 fi
4578d01f 287 fi
4feafb1e 288 output_sym "CONFIG_LITTLE_ENDIAN"
7409711b
HL
289 if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then
290 output_sym "CONFIG_32BIT"
291 else
292 output_sym "CONFIG_64BIT_LLP64"
293 fi
4feafb1e
JA
294 output_sym "CONFIG_FADVISE"
295 output_sym "CONFIG_SOCKLEN_T"
4feafb1e
JA
296 output_sym "CONFIG_FADVISE"
297 output_sym "CONFIG_SFAA"
298 output_sym "CONFIG_RUSAGE_THREAD"
299 output_sym "CONFIG_WINDOWSAIO"
300 output_sym "CONFIG_FDATASYNC"
59308a64 301 output_sym "CONFIG_CLOCK_MONOTONIC"
dc0518ca
BC
302 output_sym "CONFIG_GETTIMEOFDAY"
303 output_sym "CONFIG_CLOCK_GETTIME"
7e09a9f1 304 output_sym "CONFIG_SCHED_IDLE"
1eafa37a 305 output_sym "CONFIG_TCP_NODELAY"
7d6be13a 306 output_sym "CONFIG_TLS_THREAD"
ef07baa1 307 output_sym "CONFIG_IPV6"
4feafb1e 308 echo "CC=$CC" >> $config_host_mak
af4862b3 309 echo "BUILD_CFLAGS=$CFLAGS -include config-host.h -D_GNU_SOURCE" >> $config_host_mak
cfd94f79 310 exit 0
6d0e9f83 311 ;;
67bf9823
JA
312esac
313
314if test ! -z "$cpu" ; then
315 # command line argument
316 :
317elif check_define __i386__ ; then
318 cpu="i386"
319elif check_define __x86_64__ ; then
320 cpu="x86_64"
321elif check_define __sparc__ ; then
322 if check_define __arch64__ ; then
323 cpu="sparc64"
324 else
325 cpu="sparc"
326 fi
327elif check_define _ARCH_PPC ; then
328 if check_define _ARCH_PPC64 ; then
329 cpu="ppc64"
330 else
331 cpu="ppc"
332 fi
333elif check_define __mips__ ; then
334 cpu="mips"
335elif check_define __ia64__ ; then
336 cpu="ia64"
337elif check_define __s390__ ; then
338 if check_define __s390x__ ; then
339 cpu="s390x"
340 else
341 cpu="s390"
342 fi
343elif check_define __arm__ ; then
344 cpu="arm"
214e2d56 345elif check_define __aarch64__ ; then
346 cpu="aarch64"
67bf9823
JA
347elif check_define __hppa__ ; then
348 cpu="hppa"
349else
350 cpu=`uname -m`
351fi
352
353# Normalise host CPU name and set ARCH.
354case "$cpu" in
355 ia64|ppc|ppc64|s390|s390x|sparc64)
356 cpu="$cpu"
357 ;;
358 i386|i486|i586|i686|i86pc|BePC)
359 cpu="i386"
360 ;;
361 x86_64|amd64)
362 cpu="x86_64"
363 ;;
364 armv*b|armv*l|arm)
365 cpu="arm"
366 ;;
214e2d56 367 aarch64)
368 cpu="arm64"
369 ;;
67bf9823
JA
370 hppa|parisc|parisc64)
371 cpu="hppa"
372 ;;
373 mips*)
374 cpu="mips"
375 ;;
376 sparc|sun4[cdmuv])
377 cpu="sparc"
378 ;;
379 *)
8b156d8e 380 echo "Unknown CPU"
67bf9823
JA
381 ;;
382esac
383
dcbbf5b0 384if test -z "$CC" ; then
67bf9823
JA
385 if test "$targetos" = "FreeBSD"; then
386 if has clang; then
387 CC=clang
388 else
389 CC=gcc
390 fi
67bf9823
JA
391 fi
392fi
393
394cc="${CC-${cross_prefix}gcc}"
395
1a17cfdb
AC
396##########################################
397# check cross compile
398
399cross_compile="no"
400cat > $TMPC <<EOF
401int main(void)
402{
403 return 0;
404}
405EOF
406if compile_prog "" "" "cross"; then
407 $TMPE 2>/dev/null || cross_compile="yes"
408else
409 fatal "compile test failed"
410fi
411
0dcebdf4
JA
412##########################################
413# check endianness
414bigendian="no"
1a17cfdb
AC
415if test "$cross_compile" = "no" ; then
416 cat > $TMPC <<EOF
0dcebdf4
JA
417#include <inttypes.h>
418int main(void)
419{
420 volatile uint32_t i=0x01234567;
421 return (*((uint8_t*)(&i))) == 0x67;
422}
423EOF
1a17cfdb
AC
424 if compile_prog "" "" "endian"; then
425 $TMPE && bigendian="yes"
426 fi
427else
428 # If we're cross compiling, try our best to work it out and rely on the
429 # run-time check to fail if we get it wrong.
430 cat > $TMPC <<EOF
431#include <endian.h>
432int main(void)
433{
434#if __BYTE_ORDER != __BIG_ENDIAN
435# error "Unknown endianness"
436#endif
437}
438EOF
439 compile_prog "" "" "endian" && bigendian="yes"
440 check_define "__ARMEB__" && bigendian="yes"
441 check_define "__MIPSEB__" && bigendian="yes"
0dcebdf4
JA
442fi
443
444
67bf9823
JA
445echo "Operating system $targetos"
446echo "CPU $cpu"
0dcebdf4 447echo "Big endian $bigendian"
67bf9823 448echo "Compiler $cc"
1a17cfdb 449echo "Cross compile $cross_compile"
67bf9823
JA
450echo
451
d2aeedb9
JA
452##########################################
453# See if we need to build a static build
454if test "$build_static" = "yes" ; then
455 CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
456 LDFLAGS="$LDFLAGS -static -Wl,--gc-sections"
457else
458 build_static="no"
459fi
460echo "Static build $build_static"
461
67bf9823
JA
462##########################################
463# check for wordsize
464wordsize="0"
465cat > $TMPC <<EOF
142429e5
AC
466#include <limits.h>
467#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
67bf9823
JA
468int main(void)
469{
142429e5 470 BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE);
67bf9823
JA
471 return 0;
472}
473EOF
142429e5
AC
474if compile_prog "-DWORDSIZE=32" "" "wordsize"; then
475 wordsize="32"
476elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then
477 wordsize="64"
478else
479 fatal "Unknown wordsize"
67bf9823
JA
480fi
481echo "Wordsize $wordsize"
482
a9bca4aa
JA
483##########################################
484# zlib probe
485zlib="no"
486cat > $TMPC <<EOF
804a1e05 487#include <zlib.h>
a9bca4aa
JA
488int main(void)
489{
490 z_stream stream;
491 if (inflateInit(&stream) != Z_OK)
492 return 1;
493 return 0;
494}
495EOF
496if compile_prog "" "-lz" "zlib" ; then
497 zlib=yes
498 LIBS="-lz $LIBS"
a9bca4aa
JA
499fi
500echo "zlib $zlib"
501
67bf9823
JA
502##########################################
503# linux-aio probe
504libaio="no"
7c77ebef 505if test "$esx" != "yes" ; then
506 cat > $TMPC <<EOF
67bf9823
JA
507#include <libaio.h>
508#include <stddef.h>
509int main(void)
510{
511 io_setup(0, NULL);
512 return 0;
513}
514EOF
7c77ebef 515 if compile_prog "" "-laio" "libaio" ; then
516 libaio=yes
517 LIBS="-laio $LIBS"
518 else
519 if test "$libaio" = "yes" ; then
520 feature_not_found "linux AIO" "libaio-dev or libaio-devel"
521 fi
522 libaio=no
67bf9823 523 fi
67bf9823
JA
524fi
525echo "Linux AIO support $libaio"
526
527##########################################
528# posix aio probe
529posix_aio="no"
530posix_aio_lrt="no"
531cat > $TMPC <<EOF
532#include <aio.h>
533int main(void)
534{
535 struct aiocb cb;
536 aio_read(&cb);
537 return 0;
538}
539EOF
540if compile_prog "" "" "posixaio" ; then
541 posix_aio="yes"
542elif compile_prog "" "-lrt" "posixaio"; then
543 posix_aio="yes"
544 posix_aio_lrt="yes"
545 LIBS="-lrt $LIBS"
546fi
547echo "POSIX AIO support $posix_aio"
548echo "POSIX AIO support needs -lrt $posix_aio_lrt"
549
550##########################################
551# posix aio fsync probe
552posix_aio_fsync="no"
553if test "$posix_aio" = "yes" ; then
554 cat > $TMPC <<EOF
555#include <fcntl.h>
556#include <aio.h>
557int main(void)
558{
559 struct aiocb cb;
560 return aio_fsync(O_SYNC, &cb);
561 return 0;
562}
563EOF
564 if compile_prog "" "$LIBS" "posix_aio_fsync" ; then
565 posix_aio_fsync=yes
566 fi
567fi
568echo "POSIX AIO fsync $posix_aio_fsync"
569
570##########################################
571# solaris aio probe
572solaris_aio="no"
573cat > $TMPC <<EOF
574#include <sys/types.h>
575#include <sys/asynch.h>
576#include <unistd.h>
577int main(void)
578{
579 aio_result_t res;
580 return aioread(0, NULL, 0, 0, SEEK_SET, &res);
581 return 0;
582}
583EOF
584if compile_prog "" "-laio" "solarisaio" ; then
585 solaris_aio=yes
586 LIBS="-laio $LIBS"
587fi
588echo "Solaris AIO support $solaris_aio"
589
590##########################################
f5cd2907 591# __sync_fetch_and_add test
67bf9823
JA
592sfaa="no"
593cat > $TMPC << EOF
958886d8
JA
594#include <inttypes.h>
595static int sfaa(uint64_t *ptr)
67bf9823 596{
9c639a76 597 return __sync_fetch_and_add(ptr, 0);
67bf9823
JA
598}
599
600int main(int argc, char **argv)
601{
958886d8 602 uint64_t val = 42;
67bf9823
JA
603 sfaa(&val);
604 return val;
605}
606EOF
607if compile_prog "" "" "__sync_fetch_and_add()" ; then
608 sfaa="yes"
609fi
9c639a76 610echo "__sync_fetch_and_add $sfaa"
67bf9823
JA
611
612##########################################
613# libverbs probe
614libverbs="no"
615cat > $TMPC << EOF
616#include <stdio.h>
617#include <infiniband/arch.h>
618int main(int argc, char **argv)
619{
620 struct ibv_pd *pd = ibv_alloc_pd(NULL);
621 return 0;
622}
623EOF
624if compile_prog "" "-libverbs" "libverbs" ; then
625 libverbs="yes"
626 LIBS="-libverbs $LIBS"
627fi
628echo "libverbs $libverbs"
629
630##########################################
631# rdmacm probe
632rdmacm="no"
633cat > $TMPC << EOF
634#include <stdio.h>
635#include <rdma/rdma_cma.h>
636int main(int argc, char **argv)
637{
638 rdma_destroy_qp(NULL);
639 return 0;
640}
641EOF
642if compile_prog "" "-lrdmacm" "rdma"; then
643 rdmacm="yes"
644 LIBS="-lrdmacm $LIBS"
645fi
646echo "rdmacm $rdmacm"
647
648##########################################
649# Linux fallocate probe
650linux_fallocate="no"
651cat > $TMPC << EOF
652#include <stdio.h>
aa6738a5 653#include <fcntl.h>
67bf9823
JA
654#include <linux/falloc.h>
655int main(int argc, char **argv)
656{
657 int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024);
658 return r;
659}
660EOF
661if compile_prog "" "" "linux_fallocate"; then
662 linux_fallocate="yes"
663fi
664echo "Linux fallocate $linux_fallocate"
665
666##########################################
667# POSIX fadvise probe
668posix_fadvise="no"
669cat > $TMPC << EOF
670#include <stdio.h>
671#include <fcntl.h>
672int main(int argc, char **argv)
673{
674 int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL);
675 return r;
676}
677EOF
678if compile_prog "" "" "posix_fadvise"; then
679 posix_fadvise="yes"
680fi
681echo "POSIX fadvise $posix_fadvise"
682
683##########################################
684# POSIX fallocate probe
685posix_fallocate="no"
686cat > $TMPC << EOF
687#include <stdio.h>
688#include <fcntl.h>
689int main(int argc, char **argv)
690{
691 int r = posix_fallocate(0, 0, 1024);
692 return r;
693}
694EOF
695if compile_prog "" "" "posix_fallocate"; then
696 posix_fallocate="yes"
697fi
698echo "POSIX fallocate $posix_fallocate"
699
700##########################################
701# sched_set/getaffinity 2 or 3 argument test
702linux_2arg_affinity="no"
703linux_3arg_affinity="no"
704cat > $TMPC << EOF
67bf9823
JA
705#include <sched.h>
706int main(int argc, char **argv)
707{
708 cpu_set_t mask;
709 return sched_setaffinity(0, sizeof(mask), &mask);
710}
711EOF
712if compile_prog "" "" "sched_setaffinity(,,)"; then
713 linux_3arg_affinity="yes"
714else
715 cat > $TMPC << EOF
67bf9823
JA
716#include <sched.h>
717int main(int argc, char **argv)
718{
719 cpu_set_t mask;
720 return sched_setaffinity(0, &mask);
721}
722EOF
723 if compile_prog "" "" "sched_setaffinity(,)"; then
724 linux_2arg_affinity="yes"
725 fi
726fi
727echo "sched_setaffinity(3 arg) $linux_3arg_affinity"
728echo "sched_setaffinity(2 arg) $linux_2arg_affinity"
729
730##########################################
731# clock_gettime probe
732clock_gettime="no"
733cat > $TMPC << EOF
734#include <stdio.h>
735#include <time.h>
736int main(int argc, char **argv)
737{
738 return clock_gettime(0, NULL);
739}
740EOF
741if compile_prog "" "" "clock_gettime"; then
742 clock_gettime="yes"
743elif compile_prog "" "-lrt" "clock_gettime"; then
744 clock_gettime="yes"
745 LIBS="-lrt $LIBS"
746fi
747echo "clock_gettime $clock_gettime"
748
749##########################################
750# CLOCK_MONOTONIC probe
751clock_monotonic="no"
752if test "$clock_gettime" = "yes" ; then
753 cat > $TMPC << EOF
754#include <stdio.h>
755#include <time.h>
756int main(int argc, char **argv)
757{
758 return clock_gettime(CLOCK_MONOTONIC, NULL);
759}
760EOF
761 if compile_prog "" "$LIBS" "clock monotonic"; then
762 clock_monotonic="yes"
763 fi
764fi
765echo "CLOCK_MONOTONIC $clock_monotonic"
766
c544f604
SN
767##########################################
768# CLOCK_MONOTONIC_RAW probe
769clock_monotonic_raw="no"
770if test "$clock_gettime" = "yes" ; then
771 cat > $TMPC << EOF
772#include <stdio.h>
773#include <time.h>
774int main(int argc, char **argv)
775{
776 return clock_gettime(CLOCK_MONOTONIC_RAW, NULL);
777}
778EOF
779 if compile_prog "" "$LIBS" "clock monotonic"; then
780 clock_monotonic_raw="yes"
781 fi
782fi
783echo "CLOCK_MONOTONIC_RAW $clock_monotonic_raw"
784
67bf9823
JA
785##########################################
786# CLOCK_MONOTONIC_PRECISE probe
787clock_monotonic_precise="no"
788if test "$clock_gettime" = "yes" ; then
789 cat > $TMPC << EOF
790#include <stdio.h>
791#include <time.h>
792int main(int argc, char **argv)
793{
794 return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL);
795}
796EOF
797 if compile_prog "" "$LIBS" "clock monotonic precise"; then
798 clock_monotonic_precise="yes"
799 fi
800fi
801echo "CLOCK_MONOTONIC_PRECISE $clock_monotonic_precise"
802
25f8227d
JA
803##########################################
804# clockid_t probe
805clockid_t="no"
806cat > $TMPC << EOF
807#include <stdio.h>
a214d131 808#include <string.h>
25f8227d
JA
809#include <time.h>
810int main(int argc, char **argv)
811{
a214d131
JA
812 clockid_t cid;
813 memset(&cid, 0, sizeof(cid));
25f8227d
JA
814 return clock_gettime(cid, NULL);
815}
816EOF
817if compile_prog "" "$LIBS" "clockid_t"; then
818 clockid_t="yes"
819fi
820echo "clockid_t $clockid_t"
821
67bf9823
JA
822##########################################
823# gettimeofday() probe
824gettimeofday="no"
825cat > $TMPC << EOF
826#include <sys/time.h>
827#include <stdio.h>
828int main(int argc, char **argv)
829{
830 struct timeval tv;
831 return gettimeofday(&tv, NULL);
832}
833EOF
834if compile_prog "" "" "gettimeofday"; then
835 gettimeofday="yes"
836fi
837echo "gettimeofday $gettimeofday"
838
839##########################################
840# fdatasync() probe
841fdatasync="no"
842cat > $TMPC << EOF
843#include <stdio.h>
844#include <unistd.h>
845int main(int argc, char **argv)
846{
847 return fdatasync(0);
848}
849EOF
850if compile_prog "" "" "fdatasync"; then
851 fdatasync="yes"
852fi
853echo "fdatasync $fdatasync"
854
855##########################################
856# sync_file_range() probe
857sync_file_range="no"
858cat > $TMPC << EOF
859#include <stdio.h>
860#include <unistd.h>
67bf9823
JA
861#include <fcntl.h>
862#include <linux/fs.h>
863int main(int argc, char **argv)
864{
865 unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE |
866 SYNC_FILE_RANGE_WAIT_AFTER;
867 return sync_file_range(0, 0, 0, flags);
868}
869EOF
870if compile_prog "" "" "sync_file_range"; then
871 sync_file_range="yes"
872fi
873echo "sync_file_range $sync_file_range"
874
875##########################################
876# ext4 move extent probe
877ext4_me="no"
878cat > $TMPC << EOF
879#include <fcntl.h>
880#include <sys/ioctl.h>
881int main(int argc, char **argv)
882{
883 struct move_extent me;
884 return ioctl(0, EXT4_IOC_MOVE_EXT, &me);
885}
886EOF
c7165b8d
JA
887if compile_prog "" "" "ext4 move extent" ; then
888 ext4_me="yes"
889elif test $targetos = "Linux" ; then
890 # On Linux, just default to it on and let it error at runtime if we really
891 # don't have it. None of my updated systems have it defined, but it does
892 # work. Takes a while to bubble back.
67bf9823
JA
893 ext4_me="yes"
894fi
895echo "EXT4 move extent $ext4_me"
896
897##########################################
898# splice probe
899linux_splice="no"
900cat > $TMPC << EOF
67bf9823
JA
901#include <stdio.h>
902#include <fcntl.h>
903int main(int argc, char **argv)
904{
905 return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK);
906}
907EOF
908if compile_prog "" "" "linux splice"; then
909 linux_splice="yes"
910fi
911echo "Linux splice(2) $linux_splice"
912
913##########################################
914# GUASI probe
915guasi="no"
916cat > $TMPC << EOF
917#include <guasi.h>
918#include <guasi_syscalls.h>
919int main(int argc, char **argv)
920{
921 guasi_t ctx = guasi_create(0, 0, 0);
922 return 0;
923}
924EOF
925if compile_prog "" "" "guasi"; then
926 guasi="yes"
927fi
928echo "GUASI $guasi"
929
930##########################################
931# fusion-aw probe
932fusion_aw="no"
933cat > $TMPC << EOF
b2c77c25 934#include <nvm/nvm_primitives.h>
67bf9823
JA
935int main(int argc, char **argv)
936{
b2c77c25
SK
937 nvm_version_t ver_info;
938 nvm_handle_t handle;
939
940 handle = nvm_get_handle(0, &ver_info);
941 return nvm_atomic_write(handle, 0, 0, 0);
67bf9823
JA
942}
943EOF
92aef550
ARJ
944if compile_prog "" "-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread" "fusion-aw"; then
945 LIBS="-L/usr/lib/fio -L/usr/lib/nvm -lnvm-primitives -ldl -lpthread $LIBS"
67bf9823
JA
946 fusion_aw="yes"
947fi
948echo "Fusion-io atomic engine $fusion_aw"
949
950##########################################
951# libnuma probe
952libnuma="no"
953cat > $TMPC << EOF
954#include <numa.h>
955int main(int argc, char **argv)
956{
957 return numa_available();
958}
959EOF
44462517 960if test "$disable_numa" != "yes" && compile_prog "" "-lnuma" "libnuma"; then
67bf9823
JA
961 libnuma="yes"
962 LIBS="-lnuma $LIBS"
963fi
964echo "libnuma $libnuma"
965
50206d9b
JA
966##########################################
967# libnuma 2.x version API
968if test "$libnuma" = "yes" ; then
969libnuma_v2="no"
970cat > $TMPC << EOF
971#include <numa.h>
972int main(int argc, char **argv)
973{
974 struct bitmask *mask = numa_parse_nodestring(NULL);
61bde962 975 return mask->size == 0;
50206d9b
JA
976}
977EOF
978if compile_prog "" "" "libnuma api"; then
979 libnuma_v2="yes"
980fi
981echo "libnuma v2 $libnuma_v2"
982fi
983
67bf9823
JA
984##########################################
985# strsep() probe
986strsep="no"
987cat > $TMPC << EOF
988#include <string.h>
989int main(int argc, char **argv)
990{
ae156be6
JA
991 static char *string = "This is a string";
992 strsep(&string, "needle");
67bf9823
JA
993 return 0;
994}
995EOF
996if compile_prog "" "" "strsep"; then
997 strsep="yes"
998fi
999echo "strsep $strsep"
1000
9ad8da82
JA
1001##########################################
1002# strcasestr() probe
1003strcasestr="no"
1004cat > $TMPC << EOF
1005#include <string.h>
1006int main(int argc, char **argv)
1007{
aa6738a5 1008 return strcasestr(argv[0], argv[1]) != NULL;
9ad8da82
JA
1009}
1010EOF
1011if compile_prog "" "" "strcasestr"; then
1012 strcasestr="yes"
1013fi
1014echo "strcasestr $strcasestr"
1015
5ad7be56
KD
1016##########################################
1017# strlcat() probe
1018strlcat="no"
1019cat > $TMPC << EOF
1020#include <string.h>
1021int main(int argc, char **argv)
1022{
1023 static char dst[64];
1024 static char *string = "This is a string";
1025 memset(dst, 0, sizeof(dst));
1026 strlcat(dst, string, sizeof(dst));
1027 return 0;
1028}
1029EOF
1030if compile_prog "" "" "strlcat"; then
1031 strlcat="yes"
1032fi
1033echo "strlcat $strlcat"
1034
67bf9823
JA
1035##########################################
1036# getopt_long_only() probe
1037getopt_long_only="no"
1038cat > $TMPC << EOF
1039#include <unistd.h>
1040#include <stdio.h>
aa6738a5 1041#include <getopt.h>
67bf9823
JA
1042int main(int argc, char **argv)
1043{
1044 int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
1045 return c;
1046}
1047EOF
1048if compile_prog "" "" "getopt_long_only"; then
1049 getopt_long_only="yes"
1050fi
1051echo "getopt_long_only() $getopt_long_only"
1052
1053##########################################
1054# inet_aton() probe
1055inet_aton="no"
1056cat > $TMPC << EOF
1057#include <sys/socket.h>
1058#include <arpa/inet.h>
1059#include <stdio.h>
1060int main(int argc, char **argv)
1061{
1062 struct in_addr in;
1063 return inet_aton(NULL, &in);
1064}
1065EOF
1066if compile_prog "" "" "inet_aton"; then
1067 inet_aton="yes"
1068fi
1069echo "inet_aton $inet_aton"
1070
1071##########################################
1072# socklen_t probe
1073socklen_t="no"
1074cat > $TMPC << EOF
f6482613 1075#include <sys/socket.h>
67bf9823
JA
1076int main(int argc, char **argv)
1077{
1078 socklen_t len = 0;
1079 return len;
1080}
1081EOF
1082if compile_prog "" "" "socklen_t"; then
1083 socklen_t="yes"
1084fi
1085echo "socklen_t $socklen_t"
1086
1087##########################################
1088# Whether or not __thread is supported for TLS
1089tls_thread="no"
1090cat > $TMPC << EOF
1091#include <stdio.h>
aa6738a5 1092static __thread int ret;
67bf9823
JA
1093int main(int argc, char **argv)
1094{
1095 return ret;
1096}
1097EOF
1098if compile_prog "" "" "__thread"; then
1099 tls_thread="yes"
1100fi
1101echo "__thread $tls_thread"
1102
91f94d5b 1103##########################################
2639f056 1104# Check if we have required gtk/glib support for gfio
ebec2094
JA
1105gfio="no"
1106if test "$gfio_check" = "yes" ; then
91f94d5b
JA
1107 cat > $TMPC << EOF
1108#include <glib.h>
1109#include <cairo.h>
1110#include <gtk/gtk.h>
1111int main(void)
1112{
1113 gdk_threads_enter();
91f94d5b 1114 gdk_threads_leave();
b7a99316
JA
1115
1116 printf("%d", GTK_CHECK_VERSION(2, 18, 0));
91f94d5b
JA
1117}
1118EOF
1119GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0)
86719845
JA
1120ORG_LDFLAGS=$LDFLAGS
1121LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g)
91f94d5b
JA
1122if test "$?" != "0" ; then
1123 echo "configure: gtk and gthread not found"
1124 exit 1
1125fi
1126GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0)
1127if test "$?" != "0" ; then
1128 echo "configure: gtk and gthread not found"
1129 exit 1
1130fi
b7a99316
JA
1131if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
1132 r=$($TMPE)
1133 if test "$r" != "0" ; then
1134 gfio="yes"
86719845 1135 GFIO_LIBS="$LIBS $GTK_LIBS"
b7a99316
JA
1136 CFLAGS="$CFLAGS $GTK_CFLAGS"
1137 else
1138 echo "GTK found, but need version 2.18 or higher"
1139 gfio="no"
1140 fi
91f94d5b
JA
1141else
1142 echo "Please install gtk and gdk libraries"
1143 gfio="no"
1144fi
86719845 1145LDFLAGS=$ORG_LDFLAGS
91f94d5b
JA
1146fi
1147
ebec2094
JA
1148if test "$gfio_check" = "yes" ; then
1149 echo "gtk 2.18 or higher $gfio"
1150fi
91f94d5b 1151
44404c5a
JA
1152# Check whether we have getrusage(RUSAGE_THREAD)
1153rusage_thread="no"
1154cat > $TMPC << EOF
1155#include <sys/time.h>
1156#include <sys/resource.h>
1157int main(int argc, char **argv)
1158{
1159 struct rusage ru;
1160 getrusage(RUSAGE_THREAD, &ru);
1161 return 0;
1162}
1163EOF
1164if compile_prog "" "" "RUSAGE_THREAD"; then
1165 rusage_thread="yes"
1166fi
1167echo "RUSAGE_THREAD $rusage_thread"
1168
7e09a9f1
JA
1169##########################################
1170# Check whether we have SCHED_IDLE
1171sched_idle="no"
1172cat > $TMPC << EOF
1173#include <sched.h>
1174int main(int argc, char **argv)
1175{
1176 struct sched_param p;
1177 return sched_setscheduler(0, SCHED_IDLE, &p);
1178}
1179EOF
1180if compile_prog "" "" "SCHED_IDLE"; then
1181 sched_idle="yes"
1182fi
1183echo "SCHED_IDLE $sched_idle"
1184
1eafa37a
JA
1185##########################################
1186# Check whether we have TCP_NODELAY
1187tcp_nodelay="no"
1188cat > $TMPC << EOF
1189#include <stdio.h>
1190#include <sys/types.h>
1191#include <sys/socket.h>
1192#include <netinet/tcp.h>
1193int main(int argc, char **argv)
1194{
1195 return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
1196}
1197EOF
1198if compile_prog "" "" "TCP_NODELAY"; then
1199 tcp_nodelay="yes"
1200fi
1201echo "TCP_NODELAY $tcp_nodelay"
1202
1008602c
JA
1203##########################################
1204# Check whether we have SO_SNDBUF
1205window_size="no"
1206cat > $TMPC << EOF
1207#include <stdio.h>
1208#include <sys/types.h>
1209#include <sys/socket.h>
1210#include <netinet/tcp.h>
1211int main(int argc, char **argv)
1212{
1213 setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0);
1214 setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0);
1215}
1216EOF
1217if compile_prog "" "" "SO_SNDBUF"; then
1218 window_size="yes"
1219fi
1220echo "Net engine window_size $window_size"
1221
e5f34d95
JA
1222##########################################
1223# Check whether we have TCP_MAXSEG
1224mss="no"
1225cat > $TMPC << EOF
1226#include <stdio.h>
1227#include <sys/types.h>
1228#include <sys/socket.h>
1229#include <netinet/tcp.h>
1230#include <arpa/inet.h>
1231#include <netinet/in.h>
1232int main(int argc, char **argv)
1233{
1234 return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0);
1235}
1236EOF
1237if compile_prog "" "" "TCP_MAXSEG"; then
1238 mss="yes"
1239fi
1240echo "TCP_MAXSEG $mss"
1241
38b9354a
JA
1242##########################################
1243# Check whether we have RLIMIT_MEMLOCK
1244rlimit_memlock="no"
1245cat > $TMPC << EOF
1246#include <sys/time.h>
1247#include <sys/resource.h>
1248int main(int argc, char **argv)
1249{
1250 struct rlimit rl;
1251 return getrlimit(RLIMIT_MEMLOCK, &rl);
1252}
1253EOF
1254if compile_prog "" "" "RLIMIT_MEMLOCK"; then
1255 rlimit_memlock="yes"
1256fi
1257echo "RLIMIT_MEMLOCK $rlimit_memlock"
1258
07fc0acd
JA
1259##########################################
1260# Check whether we have pwritev/preadv
1261pwritev="no"
1262cat > $TMPC << EOF
1263#include <stdio.h>
1264#include <sys/uio.h>
1265int main(int argc, char **argv)
1266{
1267 return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0);
1268}
1269EOF
1270if compile_prog "" "" "pwritev"; then
1271 pwritev="yes"
1272fi
1273echo "pwritev/preadv $pwritev"
1274
2cafffbe
JA
1275##########################################
1276# Check whether we have pwritev2/preadv2
1277pwritev2="no"
1278cat > $TMPC << EOF
1279#include <stdio.h>
1280#include <sys/uio.h>
1281int main(int argc, char **argv)
1282{
1283 return pwritev2(0, NULL, 1, 0, 0) + preadv2(0, NULL, 1, 0, 0);
1284}
1285EOF
1286if compile_prog "" "" "pwritev2"; then
1287 pwritev2="yes"
1288fi
1289echo "pwritev2/preadv2 $pwritev2"
1290
ecad55e9
JA
1291##########################################
1292# Check whether we have the required functions for ipv6
1293ipv6="no"
1294cat > $TMPC << EOF
1295#include <sys/types.h>
1296#include <sys/socket.h>
d219028d 1297#include <netinet/in.h>
ecad55e9
JA
1298#include <netdb.h>
1299#include <stdio.h>
1300int main(int argc, char **argv)
1301{
1302 struct addrinfo hints;
1303 struct in6_addr addr;
1304 int ret;
1305
1306 ret = getaddrinfo(NULL, NULL, &hints, NULL);
1307 freeaddrinfo(NULL);
1308 printf("%s\n", gai_strerror(ret));
1309 addr = in6addr_any;
1310 return 0;
1311}
1312EOF
1313if compile_prog "" "" "ipv6"; then
1314 ipv6="yes"
1315fi
1316echo "IPv6 helpers $ipv6"
07fc0acd 1317
fc5c0345
DG
1318##########################################
1319# check for rbd
1320rbd="no"
1321cat > $TMPC << EOF
1322#include <rbd/librbd.h>
1323
1324int main(int argc, char **argv)
1325{
1326
1327 rados_t cluster;
1328 rados_ioctx_t io_ctx;
1329 const char pool[] = "rbd";
1330
1331 int major, minor, extra;
1332 rbd_version(&major, &minor, &extra);
1333
1334 rados_ioctx_create(cluster, pool, &io_ctx);
1335 return 0;
1336}
1337EOF
ce18290e 1338if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then
fc5c0345
DG
1339 LIBS="-lrbd -lrados $LIBS"
1340 rbd="yes"
1341fi
1342echo "Rados Block Device engine $rbd"
1343
53b6c979
PL
1344##########################################
1345# check for rbd_poll
1346rbd_poll="no"
1347if test "$rbd" = "yes"; then
1348cat > $TMPC << EOF
1349#include <rbd/librbd.h>
1350#include <sys/eventfd.h>
1351
1352int main(int argc, char **argv)
1353{
1354 rbd_image_t image;
1355 rbd_completion_t comp;
1356
1357 int fd = eventfd(0, EFD_NONBLOCK);
1358 rbd_set_image_notification(image, fd, EVENT_TYPE_EVENTFD);
1359 rbd_poll_io_events(image, comp, 1);
1360
1361 return 0;
1362}
1363EOF
1364if compile_prog "" "-lrbd -lrados" "rbd"; then
1365 rbd_poll="yes"
1366fi
1367echo "rbd_poll $rbd_poll"
1368fi
1369
903b2812
JA
1370##########################################
1371# check for rbd_invaidate_cache()
1372rbd_inval="no"
1373if test "$rbd" = "yes"; then
1374cat > $TMPC << EOF
1375#include <rbd/librbd.h>
1376
1377int main(int argc, char **argv)
1378{
1379 rbd_image_t image;
1380
1381 return rbd_invalidate_cache(image);
1382}
1383EOF
1384if compile_prog "" "-lrbd -lrados" "rbd"; then
1385 rbd_inval="yes"
1386fi
1387echo "rbd_invalidate_cache $rbd_inval"
1388fi
1389
a4c4c346 1390##########################################
1391# check for blkin
1392rbd_blkin="no"
1393cat > $TMPC << EOF
1394#include <rbd/librbd.h>
1395#include <zipkin_c.h>
1396
1397int main(int argc, char **argv)
1398{
1399 int r;
1400 struct blkin_trace_info t_info;
1401 blkin_init_trace_info(&t_info);
1402 rbd_completion_t completion;
1403 rbd_image_t image;
1404 uint64_t off;
1405 size_t len;
1406 const char *buf;
1407 r = rbd_aio_write_traced(image, off, len, buf, completion, &t_info);
1408 return 0;
1409}
1410EOF
1411if test "$disable_rbd" != "yes" && test "$disable_rbd_blkin" != "yes" \
1412 && compile_prog "" "-lrbd -lrados -lblkin" "rbd_blkin"; then
1413 LIBS="-lblkin $LIBS"
1414 rbd_blkin="yes"
1415fi
1416echo "rbd blkin tracing $rbd_blkin"
1417
2e802282
JA
1418##########################################
1419# Check whether we have setvbuf
1420setvbuf="no"
1421cat > $TMPC << EOF
1422#include <stdio.h>
1423int main(int argc, char **argv)
1424{
1425 FILE *f = NULL;
1426 char buf[80];
1427 setvbuf(f, buf, _IOFBF, sizeof(buf));
1428 return 0;
1429}
1430EOF
1431if compile_prog "" "" "setvbuf"; then
1432 setvbuf="yes"
1433fi
1434echo "setvbuf $setvbuf"
fc5c0345 1435
6e7d7dfb 1436# check for gfapi
1437gfapi="no"
1438cat > $TMPC << EOF
1439#include <glusterfs/api/glfs.h>
1440
1441int main(int argc, char **argv)
1442{
1443
1444 glfs_t *g = glfs_new("foo");
1445
1446 return 0;
1447}
1448EOF
ce18290e 1449if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
6e7d7dfb 1450 LIBS="-lgfapi -lglusterfs $LIBS"
1451 gfapi="yes"
1452fi
6fa14b99 1453 echo "Gluster API engine $gfapi"
6e7d7dfb 1454
6fa14b99 1455##########################################
1456# check for gfapi fadvise support
6876c98c 1457if test "$gfapi" = "yes" ; then
6fa14b99 1458gf_fadvise="no"
1459cat > $TMPC << EOF
1460#include <glusterfs/api/glfs.h>
1461
1462int main(int argc, char **argv)
1463{
1464 struct glfs_fd *fd;
1465 int ret = glfs_fadvise(fd, 0, 0, 1);
1466
1467 return 0;
1468}
1469EOF
6fa14b99 1470if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
1471 gf_fadvise="yes"
1472fi
1473echo "Gluster API use fadvise $gf_fadvise"
6876c98c
JA
1474fi
1475
1476##########################################
1477# check for gfapi trim support
1478gf_trim="no"
1479if test "$gfapi" = "yes" ; then
1480cat > $TMPC << EOF
1481#include <glusterfs/api/glfs.h>
1482
1483int main(int argc, char **argv)
1484{
1485 return glfs_discard_async(NULL, 0, 0);
1486}
1487EOF
1488if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then
1489 gf_trim="yes"
1490fi
1491echo "Gluster API trim support $gf_trim"
1492fi
fc5c0345 1493
81795ce3
CE
1494##########################################
1495# Check if we support stckf on s390
1496s390_z196_facilities="no"
1497cat > $TMPC << EOF
1498#define STFLE_BITS_Z196 45 /* various z196 facilities ... */
1499int main(int argc, char **argv)
1500{
1501 /* We want just 1 double word to be returned. */
1502 register unsigned long reg0 asm("0") = 0;
1503 unsigned long stfle_bits;
1504 asm volatile(".machine push" "\n\t"
1505 ".machine \"z9-109\"" "\n\t"
1506 "stfle %0" "\n\t"
1507 ".machine pop" "\n"
1508 : "=QS" (stfle_bits), "+d" (reg0)
1509 : : "cc");
1510
1511 if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0)
1512 return 0;
1513 else
1514 return -1;
1515}
1516EOF
1517if compile_prog "" "" "s390_z196_facilities"; then
1518 $TMPE
1519 if [[ $? -eq 0 ]]; then
1520 s390_z196_facilities="yes"
1521 fi
1522fi
1523echo "s390_z196_facilities $s390_z196_facilities"
1b10477b
MM
1524
1525##########################################
1526# Check if we have required environment variables configured for libhdfs
1527if test "$libhdfs" = "yes" ; then
1528 hdfs_conf_error=0
1529 if test "$JAVA_HOME" = "" ; then
1530 echo "configure: JAVA_HOME should be defined to jdk/jvm path"
1531 hdfs_conf_error=1
1532 fi
1533 if test "$FIO_LIBHDFS_INCLUDE" = "" ; then
1534 echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path"
1535 hdfs_conf_error=1
1536 fi
1537 if test "$FIO_LIBHDFS_LIB" = "" ; then
1538 echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path"
1539 hdfs_conf_error=1
1540 fi
1541 if test "$hdfs_conf_error" = "1" ; then
1542 exit 1
1543 fi
247e5436
JA
1544 FIO_HDFS_CPU=$cpu
1545 if test "$FIO_HDFS_CPU" = "x86_64" ; then
1546 FIO_HDFS_CPU="amd64"
1547 fi
1b10477b
MM
1548fi
1549echo "HDFS engine $libhdfs"
1550
b8116a87
DE
1551##########################################
1552# Check whether we have MTD
1553mtd="no"
1554cat > $TMPC << EOF
0e1c454a 1555#include <string.h>
b8116a87
DE
1556#include <mtd/mtd-user.h>
1557#include <sys/ioctl.h>
1558int main(int argc, char **argv)
1559{
0e1c454a 1560 struct mtd_write_req ops;
b8116a87 1561 struct mtd_info_user info;
0e1c454a 1562 memset(&ops, 0, sizeof(ops));
400cd0ff 1563 info.type = MTD_MLCNANDFLASH;
b8116a87
DE
1564 return ioctl(0, MEMGETINFO, &info);
1565}
1566EOF
1567if compile_prog "" "" "mtd"; then
1568 mtd="yes"
1569fi
1570echo "MTD $mtd"
1571
3ee2a3c1
DJ
1572##########################################
1573# Check whether we have libpmem
1574libpmem="no"
1575cat > $TMPC << EOF
1576#include <libpmem.h>
1577int main(int argc, char **argv)
1578{
1579 int rc;
1580 rc = pmem_is_pmem(0, 0);
1581 return 0;
1582}
1583EOF
1584if compile_prog "" "-lpmem" "libpmem"; then
1585 libpmem="yes"
1586fi
1587echo "libpmem $libpmem"
1588
1589##########################################
1590# Check whether we have libpmemblk
1591libpmemblk="no"
1592cat > $TMPC << EOF
1593#include <libpmemblk.h>
1594int main(int argc, char **argv)
1595{
1596 int rc;
1597 rc = pmemblk_open("", 0);
1598 return 0;
1599}
1600EOF
1601if compile_prog "" "-lpmemblk -lpmem" "libpmemblk"; then
1602 libpmemblk="yes"
1603fi
1604echo "libpmemblk $libpmemblk"
1605
1606if test "$libpmem" = "yes" && test "$disable_pmem" = "no"; then
1607 devdax="yes"
1608 if test "$libpmemblk" = "yes"; then
1609 pmemblk="yes"
1610 fi
1611fi
1612
43f3cec2
BB
1613##########################################
1614# Report whether pmemblk engine is enabled
1615echo "NVML libpmemblk engine $pmemblk"
1616
cbb15e42
DJ
1617##########################################
1618# Report whether dev-dax engine is enabled
3ee2a3c1 1619echo "NVML Device Dax engine $devdax"
cbb15e42 1620
b470a02c
SC
1621# Check if we have lex/yacc available
1622yacc="no"
e7b2c7a3 1623yacc_is_bison="no"
b470a02c
SC
1624lex="no"
1625arith="no"
de26b824 1626if test "$disable_lex" = "no" || test -z "$disable_lex" ; then
cf6dd80e 1627if test "$targetos" != "SunOS" ; then
e7b2c7a3 1628LEX=$(which lex 2> /dev/null)
b470a02c
SC
1629if test -x "$LEX" ; then
1630 lex="yes"
1631fi
7e0049e9 1632YACC=$(which bison 2> /dev/null)
b470a02c
SC
1633if test -x "$YACC" ; then
1634 yacc="yes"
7e0049e9 1635 yacc_is_bison="yes"
e7b2c7a3 1636else
7e0049e9 1637 YACC=$(which yacc 2> /dev/null)
e7b2c7a3
JA
1638 if test -x "$YACC" ; then
1639 yacc="yes"
e7b2c7a3 1640 fi
b470a02c
SC
1641fi
1642if test "$yacc" = "yes" && test "$lex" = "yes" ; then
1643 arith="yes"
1644fi
1645
1646if test "$arith" = "yes" ; then
1647cat > $TMPC << EOF
1648extern int yywrap(void);
1649
1650int main(int argc, char **argv)
1651{
1652 yywrap();
1653 return 0;
1654}
1655EOF
719cda03
JA
1656if compile_prog "" "-ll" "lex"; then
1657 LIBS="-ll $LIBS"
b470a02c
SC
1658else
1659 arith="no"
1660fi
1661fi
cf6dd80e 1662fi
a655bbc4 1663fi
b470a02c 1664
63bda378
JA
1665# Check if lex fails using -o
1666if test "$arith" = "yes" ; then
daf705b5
JA
1667if test "$force_no_lex_o" = "yes" ; then
1668 lex_use_o="no"
1669else
63bda378
JA
1670$LEX -o lex.yy.c exp/expression-parser.l 2> /dev/null
1671if test "$?" = "0" ; then
1672 lex_use_o="yes"
1673else
1674 lex_use_o="no"
1675fi
1676fi
daf705b5 1677fi
63bda378 1678
b470a02c
SC
1679echo "lex/yacc for arithmetic $arith"
1680
aae599ba
JA
1681##########################################
1682# Check whether we have setmntent/getmntent
1683getmntent="no"
1684cat > $TMPC << EOF
1685#include <stdio.h>
1686#include <mntent.h>
1687int main(int argc, char **argv)
1688{
1689 FILE *mtab = setmntent(NULL, "r");
1690 struct mntent *mnt = getmntent(mtab);
1581b82a 1691 endmntent(mtab);
aae599ba
JA
1692 return 0;
1693}
1694EOF
1695if compile_prog "" "" "getmntent"; then
1696 getmntent="yes"
1697fi
1698echo "getmntent $getmntent"
1699
e7e136da
TK
1700##########################################
1701# Check whether we have getmntinfo
b765bec0
TK
1702# These are originally added for BSDs, but may also work
1703# on other operating systems with getmntinfo(3).
1704
1705# getmntinfo(3) for FreeBSD/DragonFlyBSD/OpenBSD.
1706# Note that NetBSD needs -Werror to catch warning as error.
e7e136da
TK
1707getmntinfo="no"
1708cat > $TMPC << EOF
1709#include <stdio.h>
1710#include <sys/param.h>
1711#include <sys/mount.h>
1712int main(int argc, char **argv)
1713{
9ada751d 1714 struct statfs *st;
e7e136da
TK
1715 return getmntinfo(&st, MNT_NOWAIT);
1716}
1717EOF
b765bec0 1718if compile_prog "-Werror" "" "getmntinfo"; then
e7e136da
TK
1719 getmntinfo="yes"
1720fi
1721echo "getmntinfo $getmntinfo"
1722
b765bec0
TK
1723# getmntinfo(3) for NetBSD.
1724getmntinfo_statvfs="no"
1725cat > $TMPC << EOF
1726#include <stdio.h>
1727#include <sys/statvfs.h>
1728int main(int argc, char **argv)
1729{
1730 struct statvfs *st;
1731 return getmntinfo(&st, MNT_NOWAIT);
1732}
1733EOF
1734# Skip the test if the one with statfs arg is detected.
1735if test "$getmntinfo" != "yes" && compile_prog "-Werror" "" "getmntinfo_statvfs"; then
1736 getmntinfo_statvfs="yes"
1737 echo "getmntinfo_statvfs $getmntinfo_statvfs"
1738fi
1739
5018f79f
AH
1740##########################################
1741# Check whether we have _Static_assert
1742static_assert="no"
1743cat > $TMPC << EOF
1744#include <assert.h>
94815a5c
JA
1745#include <stdlib.h>
1746#undef offsetof
1747#ifdef __compiler_offsetof
1748#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
1749#else
1750#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
1751#endif
1752
1753#define container_of(ptr, type, member) ({ \
1754 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
1755 (type *)( (char *)__mptr - offsetof(type,member) );})
1756
1757struct foo {
1758 int a, b;
1759};
1760
5018f79f
AH
1761int main(int argc, char **argv)
1762{
94815a5c 1763 _Static_assert(offsetof(struct foo, a) == 0 , "Check");
5018f79f
AH
1764 return 0 ;
1765}
1766EOF
1767if compile_prog "" "" "static_assert"; then
1768 static_assert="yes"
1769fi
1770echo "Static Assert $static_assert"
e39c0676
JA
1771
1772##########################################
1773# Check whether we have bool / stdbool.h
1774have_bool="no"
1775cat > $TMPC << EOF
1776#include <stdbool.h>
1777int main(int argc, char **argv)
1778{
1779 bool var = true;
1780 return var != false;
1781}
1782EOF
1783if compile_prog "" "" "bool"; then
1784 have_bool="yes"
1785fi
1786echo "bool $have_bool"
1787
214e2d56 1788##########################################
1789# check march=armv8-a+crc+crypto
1790march_armv8_a_crc_crypto="no"
1791if test "$cpu" = "arm64" ; then
1792 cat > $TMPC <<EOF
1793int main(void)
1794{
1795 return 0;
1796}
1797EOF
1798 if compile_prog "-march=armv8-a+crc+crypto" "" ""; then
1799 march_armv8_a_crc_crypto="yes"
1800 CFLAGS="$CFLAGS -march=armv8-a+crc+crypto -DARCH_HAVE_CRC_CRYPTO"
1801 fi
1802fi
1803echo "march_armv8_a_crc_crypto $march_armv8_a_crc_crypto"
1804
1805
67bf9823
JA
1806#############################################################################
1807
67bf9823 1808if test "$wordsize" = "64" ; then
4feafb1e 1809 output_sym "CONFIG_64BIT"
67bf9823 1810elif test "$wordsize" = "32" ; then
4feafb1e 1811 output_sym "CONFIG_32BIT"
67bf9823 1812else
d7145a78 1813 fatal "Unknown wordsize!"
67bf9823 1814fi
0dcebdf4 1815if test "$bigendian" = "yes" ; then
4feafb1e 1816 output_sym "CONFIG_BIG_ENDIAN"
0dcebdf4 1817else
4feafb1e 1818 output_sym "CONFIG_LITTLE_ENDIAN"
0dcebdf4 1819fi
3989b143
JA
1820if test "$zlib" = "yes" ; then
1821 output_sym "CONFIG_ZLIB"
1822fi
67bf9823 1823if test "$libaio" = "yes" ; then
4feafb1e 1824 output_sym "CONFIG_LIBAIO"
67bf9823
JA
1825fi
1826if test "$posix_aio" = "yes" ; then
4feafb1e 1827 output_sym "CONFIG_POSIXAIO"
67bf9823
JA
1828fi
1829if test "$posix_aio_fsync" = "yes" ; then
4feafb1e 1830 output_sym "CONFIG_POSIXAIO_FSYNC"
67bf9823
JA
1831fi
1832if test "$linux_fallocate" = "yes" ; then
4feafb1e 1833 output_sym "CONFIG_LINUX_FALLOCATE"
67bf9823
JA
1834fi
1835if test "$posix_fallocate" = "yes" ; then
4feafb1e 1836 output_sym "CONFIG_POSIX_FALLOCATE"
67bf9823
JA
1837fi
1838if test "$fdatasync" = "yes" ; then
4feafb1e 1839 output_sym "CONFIG_FDATASYNC"
67bf9823
JA
1840fi
1841if test "$sync_file_range" = "yes" ; then
4feafb1e 1842 output_sym "CONFIG_SYNC_FILE_RANGE"
67bf9823
JA
1843fi
1844if test "$sfaa" = "yes" ; then
4feafb1e 1845 output_sym "CONFIG_SFAA"
67bf9823 1846fi
954cd73a 1847if test "$libverbs" = "yes" -a "$rdmacm" = "yes" ; then
4feafb1e 1848 output_sym "CONFIG_RDMA"
67bf9823
JA
1849fi
1850if test "$clock_gettime" = "yes" ; then
4feafb1e 1851 output_sym "CONFIG_CLOCK_GETTIME"
67bf9823
JA
1852fi
1853if test "$clock_monotonic" = "yes" ; then
4feafb1e 1854 output_sym "CONFIG_CLOCK_MONOTONIC"
67bf9823 1855fi
c544f604
SN
1856if test "$clock_monotonic_raw" = "yes" ; then
1857 output_sym "CONFIG_CLOCK_MONOTONIC_RAW"
1858fi
67bf9823 1859if test "$clock_monotonic_precise" = "yes" ; then
4feafb1e 1860 output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
67bf9823 1861fi
25f8227d
JA
1862if test "$clockid_t" = "yes"; then
1863 output_sym "CONFIG_CLOCKID_T"
1864fi
67bf9823 1865if test "$gettimeofday" = "yes" ; then
4feafb1e 1866 output_sym "CONFIG_GETTIMEOFDAY"
67bf9823
JA
1867fi
1868if test "$posix_fadvise" = "yes" ; then
4feafb1e 1869 output_sym "CONFIG_POSIX_FADVISE"
67bf9823
JA
1870fi
1871if test "$linux_3arg_affinity" = "yes" ; then
4feafb1e 1872 output_sym "CONFIG_3ARG_AFFINITY"
67bf9823 1873elif test "$linux_2arg_affinity" = "yes" ; then
4feafb1e 1874 output_sym "CONFIG_2ARG_AFFINITY"
67bf9823
JA
1875fi
1876if test "$strsep" = "yes" ; then
4feafb1e 1877 output_sym "CONFIG_STRSEP"
67bf9823 1878fi
9ad8da82
JA
1879if test "$strcasestr" = "yes" ; then
1880 output_sym "CONFIG_STRCASESTR"
1881fi
5ad7be56
KD
1882if test "$strlcat" = "yes" ; then
1883 output_sym "CONFIG_STRLCAT"
1884fi
67bf9823 1885if test "$getopt_long_only" = "yes" ; then
4feafb1e 1886 output_sym "CONFIG_GETOPT_LONG_ONLY"
67bf9823
JA
1887fi
1888if test "$inet_aton" = "yes" ; then
4feafb1e 1889 output_sym "CONFIG_INET_ATON"
67bf9823
JA
1890fi
1891if test "$socklen_t" = "yes" ; then
4feafb1e 1892 output_sym "CONFIG_SOCKLEN_T"
67bf9823
JA
1893fi
1894if test "$ext4_me" = "yes" ; then
4feafb1e 1895 output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT"
67bf9823
JA
1896fi
1897if test "$linux_splice" = "yes" ; then
4feafb1e 1898 output_sym "CONFIG_LINUX_SPLICE"
67bf9823
JA
1899fi
1900if test "$guasi" = "yes" ; then
4feafb1e 1901 output_sym "CONFIG_GUASI"
67bf9823
JA
1902fi
1903if test "$fusion_aw" = "yes" ; then
4feafb1e 1904 output_sym "CONFIG_FUSION_AW"
67bf9823 1905fi
50206d9b 1906if test "$libnuma_v2" = "yes" ; then
4feafb1e 1907 output_sym "CONFIG_LIBNUMA"
67bf9823
JA
1908fi
1909if test "$solaris_aio" = "yes" ; then
4feafb1e 1910 output_sym "CONFIG_SOLARISAIO"
67bf9823
JA
1911fi
1912if test "$tls_thread" = "yes" ; then
4feafb1e 1913 output_sym "CONFIG_TLS_THREAD"
67bf9823 1914fi
44404c5a 1915if test "$rusage_thread" = "yes" ; then
4feafb1e 1916 output_sym "CONFIG_RUSAGE_THREAD"
67bf9823 1917fi
91f94d5b
JA
1918if test "$gfio" = "yes" ; then
1919 echo "CONFIG_GFIO=y" >> $config_host_mak
1920fi
c8931876
JA
1921if test "$esx" = "yes" ; then
1922 output_sym "CONFIG_ESX"
1923 output_sym "CONFIG_NO_SHM"
1924fi
7e09a9f1
JA
1925if test "$sched_idle" = "yes" ; then
1926 output_sym "CONFIG_SCHED_IDLE"
1927fi
1eafa37a
JA
1928if test "$tcp_nodelay" = "yes" ; then
1929 output_sym "CONFIG_TCP_NODELAY"
1930fi
1008602c
JA
1931if test "$window_size" = "yes" ; then
1932 output_sym "CONFIG_NET_WINDOWSIZE"
1933fi
e5f34d95
JA
1934if test "$mss" = "yes" ; then
1935 output_sym "CONFIG_NET_MSS"
1936fi
38b9354a
JA
1937if test "$rlimit_memlock" = "yes" ; then
1938 output_sym "CONFIG_RLIMIT_MEMLOCK"
1939fi
07fc0acd
JA
1940if test "$pwritev" = "yes" ; then
1941 output_sym "CONFIG_PWRITEV"
1942fi
2cafffbe
JA
1943if test "$pwritev2" = "yes" ; then
1944 output_sym "CONFIG_PWRITEV2"
1945fi
ecad55e9
JA
1946if test "$ipv6" = "yes" ; then
1947 output_sym "CONFIG_IPV6"
1948fi
fc5c0345
DG
1949if test "$rbd" = "yes" ; then
1950 output_sym "CONFIG_RBD"
1951fi
53b6c979
PL
1952if test "$rbd_poll" = "yes" ; then
1953 output_sym "CONFIG_RBD_POLL"
1954fi
903b2812
JA
1955if test "$rbd_inval" = "yes" ; then
1956 output_sym "CONFIG_RBD_INVAL"
1957fi
a4c4c346 1958if test "$rbd_blkin" = "yes" ; then
1959 output_sym "CONFIG_RBD_BLKIN"
1960fi
2e802282
JA
1961if test "$setvbuf" = "yes" ; then
1962 output_sym "CONFIG_SETVBUF"
1963fi
81795ce3
CE
1964if test "$s390_z196_facilities" = "yes" ; then
1965 output_sym "CONFIG_S390_Z196_FACILITIES"
1966 CFLAGS="$CFLAGS -march=z9-109"
1967fi
6e7d7dfb 1968if test "$gfapi" = "yes" ; then
1969 output_sym "CONFIG_GFAPI"
1970fi
6fa14b99 1971if test "$gf_fadvise" = "yes" ; then
1972 output_sym "CONFIG_GF_FADVISE"
1973fi
6876c98c
JA
1974if test "$gf_trim" = "yes" ; then
1975 output_sym "CONFIG_GF_TRIM"
1976fi
1b10477b
MM
1977if test "$libhdfs" = "yes" ; then
1978 output_sym "CONFIG_LIBHDFS"
247e5436 1979 echo "FIO_HDFS_CPU=$FIO_HDFS_CPU" >> $config_host_mak
1527dc50
FB
1980 echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak
1981 echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak
1982 echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak
1983 fi
b8116a87
DE
1984if test "$mtd" = "yes" ; then
1985 output_sym "CONFIG_MTD"
1986fi
43f3cec2
BB
1987if test "$pmemblk" = "yes" ; then
1988 output_sym "CONFIG_PMEMBLK"
1989fi
cbb15e42
DJ
1990if test "$devdax" = "yes" ; then
1991 output_sym "CONFIG_LINUX_DEVDAX"
1992fi
b470a02c
SC
1993if test "$arith" = "yes" ; then
1994 output_sym "CONFIG_ARITHMETIC"
e7b2c7a3
JA
1995 if test "$yacc_is_bison" = "yes" ; then
1996 echo "YACC=$YACC -y" >> $config_host_mak
1997 else
1998 echo "YACC=$YACC" >> $config_host_mak
1999 fi
63bda378
JA
2000 if test "$lex_use_o" = "yes" ; then
2001 echo "CONFIG_LEX_USE_O=y" >> $config_host_mak
2002 fi
b470a02c 2003fi
aae599ba
JA
2004if test "$getmntent" = "yes" ; then
2005 output_sym "CONFIG_GETMNTENT"
2006fi
e7e136da
TK
2007if test "$getmntinfo" = "yes" ; then
2008 output_sym "CONFIG_GETMNTINFO"
2009fi
b765bec0
TK
2010if test "$getmntinfo_statvfs" = "yes" ; then
2011 output_sym "CONFIG_GETMNTINFO_STATVFS"
2012fi
5018f79f
AH
2013if test "$static_assert" = "yes" ; then
2014 output_sym "CONFIG_STATIC_ASSERT"
2015fi
e39c0676
JA
2016if test "$have_bool" = "yes" ; then
2017 output_sym "CONFIG_HAVE_BOOL"
2018fi
67bf9823 2019
605cf82e
JA
2020if test "$zlib" = "no" ; then
2021 echo "Consider installing zlib-dev (zlib-devel), some fio features depend on it."
2022fi
2023
67bf9823 2024echo "LIBS+=$LIBS" >> $config_host_mak
86719845 2025echo "GFIO_LIBS+=$GFIO_LIBS" >> $config_host_mak
91f94d5b 2026echo "CFLAGS+=$CFLAGS" >> $config_host_mak
d2aeedb9 2027echo "LDFLAGS+=$LDFLAGS" >> $config_host_mak
67bf9823 2028echo "CC=$cc" >> $config_host_mak
af4862b3 2029echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak
020d54bd 2030echo "INSTALL_PREFIX=$prefix" >> $config_host_mak
c61a3a44 2031
59d8f412 2032if [ `dirname $0` != "." -a ! -e Makefile ]; then
c61a3a44
JF
2033 cat > Makefile <<EOF
2034SRCDIR:=`dirname $0`
2035include \$(SRCDIR)/Makefile
2036EOF
2037fi