1 |
root |
1.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 |
root |
1.3 |
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 |
|
|
#endif |
58 |
|
|
int main(void) |
59 |
|
|
{ |
60 |
|
|
int fd = 0; |
61 |
|
|
off_t offset = 1; |
62 |
|
|
size_t count = 2; |
63 |
|
|
ssize_t res; |
64 |
|
|
#if __linux |
65 |
|
|
res = sendfile (fd, fd, offset, count); |
66 |
|
|
#elif __freebsd |
67 |
|
|
res = sendfile (fd, fd, offset, count, 0, &offset, 0); |
68 |
|
|
#elif __hpux |
69 |
|
|
res = sendfile (fd, fd, offset, count, 0, 0); |
70 |
|
|
#endif |
71 |
|
|
return 0; |
72 |
|
|
} |
73 |
|
|
],ac_cv_sendfile=yes,ac_cv_sendfile=no)]) |
74 |
|
|
test $ac_cv_sendfile = yes && AC_DEFINE(HAVE_SENDFILE, 1, sendfile(2) is available and supported) |
75 |
|
|
|
76 |
root |
1.1 |
AC_OUTPUT |