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 readdir_r, ac_cv_readdir_r, [AC_LINK_IFELSE([ |
49 |
#include <dirent.h> |
50 |
int main(void) |
51 |
{ |
52 |
DIR *dir = 0; |
53 |
struct dirent ent, *eres; |
54 |
int res = readdir_r (dir, &ent, &eres); |
55 |
return 0; |
56 |
} |
57 |
],ac_cv_readdir_r=yes,ac_cv_readdir_r=no)]) |
58 |
test $ac_cv_readdir_r = yes && AC_DEFINE(HAVE_READDIR_R, 1, readdir_r is available) |
59 |
|
60 |
AC_CACHE_CHECK(for sendfile, ac_cv_sendfile, [AC_LINK_IFELSE([ |
61 |
# include <sys/types.h> |
62 |
#if __linux |
63 |
# include <sys/sendfile.h> |
64 |
#elif __freebsd |
65 |
# include <sys/socket.h> |
66 |
# include <sys/uio.h> |
67 |
#elif __hpux |
68 |
# include <sys/socket.h> |
69 |
#else |
70 |
# error unsupported architecture |
71 |
#endif |
72 |
int main(void) |
73 |
{ |
74 |
int fd = 0; |
75 |
off_t offset = 1; |
76 |
size_t count = 2; |
77 |
ssize_t res; |
78 |
#if __linux |
79 |
res = sendfile (fd, fd, offset, count); |
80 |
#elif __freebsd |
81 |
res = sendfile (fd, fd, offset, count, 0, &offset, 0); |
82 |
#elif __hpux |
83 |
res = sendfile (fd, fd, offset, count, 0, 0); |
84 |
#endif |
85 |
return 0; |
86 |
} |
87 |
],ac_cv_sendfile=yes,ac_cv_sendfile=no)]) |
88 |
test $ac_cv_sendfile = yes && AC_DEFINE(HAVE_SENDFILE, 1, sendfile(2) is available and supported) |
89 |
|
90 |
AC_OUTPUT |