1 |
AC_PREREQ(2.59) |
2 |
AC_INIT |
3 |
AC_CONFIG_HEADERS([config.h]) |
4 |
|
5 |
AC_PROG_CC |
6 |
|
7 |
AC_CACHE_CHECK(for readahead, ac_cv_readahead, [AC_LINK_IFELSE([ |
8 |
#include <fcntl.h> |
9 |
int main(void) |
10 |
{ |
11 |
int fd = 0; |
12 |
off64_t offset = 1; |
13 |
size_t count = 2; |
14 |
ssize_t res; |
15 |
res = readahead (fd, offset, count); |
16 |
return 0; |
17 |
} |
18 |
],ac_cv_readahead=yes,ac_cv_readahead=no)]) |
19 |
test $ac_cv_readahead = yes && AC_DEFINE(HAVE_READAHEAD, 1, readahead(2) is available (linux)) |
20 |
|
21 |
AC_CACHE_CHECK(for fdatasync, ac_cv_fdatasync, [AC_LINK_IFELSE([ |
22 |
#include <unistd.h> |
23 |
int main(void) |
24 |
{ |
25 |
int fd = 0; |
26 |
fdatasync (fd); |
27 |
return 0; |
28 |
} |
29 |
],ac_cv_fdatasync=yes,ac_cv_fdatasync=no)]) |
30 |
test $ac_cv_fdatasync = yes && AC_DEFINE(HAVE_FDATASYNC, 1, fdatasync(2) is available) |
31 |
|
32 |
AC_CACHE_CHECK(for pread and pwrite, ac_cv_preadwrite, [AC_LINK_IFELSE([ |
33 |
#include <unistd.h> |
34 |
int main(void) |
35 |
{ |
36 |
int fd = 0; |
37 |
size_t count = 1; |
38 |
char buf; |
39 |
off_t offset = 1; |
40 |
ssize_t res; |
41 |
res = pread (fd, &buf, count, offset); |
42 |
res = pwrite (fd, &buf, count, offset); |
43 |
return 0; |
44 |
} |
45 |
],ac_cv_preadwrite=yes,ac_cv_preadwrite=no)]) |
46 |
test $ac_cv_preadwrite = yes && AC_DEFINE(HAVE_PREADWRITE, 1, pread(2) and pwrite(2) are available) |
47 |
|
48 |
AC_CACHE_CHECK(for sendfile, ac_cv_sendfile, [AC_LINK_IFELSE([ |
49 |
# include <sys/types.h> |
50 |
#if __linux |
51 |
# include <sys/sendfile.h> |
52 |
#elif __freebsd |
53 |
# include <sys/socket.h> |
54 |
# include <sys/uio.h> |
55 |
#elif __hpux |
56 |
# include <sys/socket.h> |
57 |
#else |
58 |
# error unsupported architecture |
59 |
#endif |
60 |
int main(void) |
61 |
{ |
62 |
int fd = 0; |
63 |
off_t offset = 1; |
64 |
size_t count = 2; |
65 |
ssize_t res; |
66 |
#if __linux |
67 |
res = sendfile (fd, fd, offset, count); |
68 |
#elif __freebsd |
69 |
res = sendfile (fd, fd, offset, count, 0, &offset, 0); |
70 |
#elif __hpux |
71 |
res = sendfile (fd, fd, offset, count, 0, 0); |
72 |
#endif |
73 |
return 0; |
74 |
} |
75 |
],ac_cv_sendfile=yes,ac_cv_sendfile=no)]) |
76 |
test $ac_cv_sendfile = yes && AC_DEFINE(HAVE_SENDFILE, 1, sendfile(2) is available and supported) |
77 |
|
78 |
AC_OUTPUT |