1 | AC_INIT |
1 | AC_INIT |
2 | AC_CONFIG_SRCDIR([libeio/eio.h]) |
2 | AC_CONFIG_SRCDIR([libeio/eio.h]) |
3 | AC_CONFIG_HEADERS([libeio/config.h]) |
3 | AC_CONFIG_HEADERS([config.h]) |
4 | |
4 | |
5 | AC_PREREQ(2.60) |
5 | AC_PREREQ(2.60) |
6 | AC_USE_SYSTEM_EXTENSIONS |
6 | AC_USE_SYSTEM_EXTENSIONS |
7 | |
7 | |
8 | AC_PROG_CC |
8 | AC_PROG_CC |
9 | |
9 | |
10 | m4_include([libeio/libeio.m4]) |
10 | m4_include([libeio/libeio.m4]) |
11 | |
11 | |
|
|
12 | # for these to work, you need to run autoheader in IO::AIO, not libeio :( |
|
|
13 | |
|
|
14 | AC_CACHE_CHECK(for set/getrlimit, ac_cv_rlimits, [AC_LINK_IFELSE([AC_LANG_SOURCE([[ |
|
|
15 | #include <sys/time.h> |
|
|
16 | #include <sys/resource.h> |
|
|
17 | int res; |
|
|
18 | int main (void) |
|
|
19 | { |
|
|
20 | struct rlimit srl; |
|
|
21 | srl.rlim_cur = srl.rlim_max = RLIM_INFINITY; |
|
|
22 | res = getrlimit (RLIMIT_NOFILE, &srl); |
|
|
23 | res = setrlimit (RLIMIT_NOFILE, &srl); |
|
|
24 | return 0; |
|
|
25 | } |
|
|
26 | ]])],ac_cv_rlimits=yes,ac_cv_rlimits=no)]) |
|
|
27 | test $ac_cv_rlimits = yes && AC_DEFINE(HAVE_RLIMITS, 1, setrlimit/getrlimit is available) |
|
|
28 | |
|
|
29 | dnl at least uclibc defines _POSIX_ADVISORY_INFO without *any* of the required |
|
|
30 | dnl functionality actually being present. ugh. |
|
|
31 | AC_CACHE_CHECK(for posix_madvise, ac_cv_posix_madvise, [AC_LINK_IFELSE([AC_LANG_SOURCE([ |
|
|
32 | #include <sys/mman.h> |
|
|
33 | int main (void) |
|
|
34 | { |
|
|
35 | int res = posix_madvise ((void *)0, (size_t)0, POSIX_MADV_NORMAL); |
|
|
36 | int a = POSIX_MADV_SEQUENTIAL; |
|
|
37 | int b = POSIX_MADV_RANDOM; |
|
|
38 | int c = POSIX_MADV_WILLNEED; |
|
|
39 | int d = POSIX_MADV_DONTNEED; |
|
|
40 | return 0; |
|
|
41 | } |
|
|
42 | ])],ac_cv_posix_madvise=yes,ac_cv_posix_madvise=no)]) |
|
|
43 | test $ac_cv_posix_madvise = yes && AC_DEFINE(HAVE_POSIX_MADVISE, 1, posix_madvise(2) is available) |
|
|
44 | |
|
|
45 | AC_CACHE_CHECK(for posix_fadvise, ac_cv_posix_fadvise, [AC_LINK_IFELSE([AC_LANG_SOURCE([ |
|
|
46 | #define _XOPEN_SOURCE 600 |
|
|
47 | #include <fcntl.h> |
|
|
48 | int main (void) |
|
|
49 | { |
|
|
50 | int res = posix_fadvise ((int)0, (off_t)0, (off_t)0, POSIX_FADV_NORMAL); |
|
|
51 | int a = POSIX_FADV_SEQUENTIAL; |
|
|
52 | int b = POSIX_FADV_NOREUSE; |
|
|
53 | int c = POSIX_FADV_RANDOM; |
|
|
54 | int d = POSIX_FADV_WILLNEED; |
|
|
55 | int e = POSIX_FADV_DONTNEED; |
|
|
56 | return 0; |
|
|
57 | } |
|
|
58 | ])],ac_cv_posix_fadvise=yes,ac_cv_posix_fadvise=no)]) |
|
|
59 | test $ac_cv_posix_fadvise = yes && AC_DEFINE(HAVE_POSIX_FADVISE, 1, posix_fadvise(2) is available) |
|
|
60 | |
|
|
61 | dnl lots of linux specifics |
|
|
62 | AC_CHECK_HEADERS([linux/fs.h linux/fiemap.h]) |
|
|
63 | |
|
|
64 | AC_CACHE_CHECK([for splice, vmsplice and tee], ac_cv_linux_splice, [AC_LINK_IFELSE([AC_LANG_SOURCE([ |
|
|
65 | #include <fcntl.h> |
|
|
66 | int main (void) |
|
|
67 | { |
|
|
68 | ssize_t res; |
|
|
69 | res = splice ((int)0, (loff_t)0, (int)0, (loff_t *)0, (size_t)0, SPLICE_F_MOVE | SPLICE_F_NONBLOCK | SPLICE_F_MORE); |
|
|
70 | res = tee ((int)0, (int)0, (size_t)0, SPLICE_F_NONBLOCK); |
|
|
71 | res = vmsplice ((int)0, (struct iovec *)0, 0, SPLICE_F_NONBLOCK | SPLICE_F_GIFT); |
|
|
72 | return 0; |
|
|
73 | } |
|
|
74 | ])],ac_cv_linux_splice=yes,ac_cv_linux_splice=no)]) |
|
|
75 | test $ac_cv_linux_splice = yes && AC_DEFINE(HAVE_LINUX_SPLICE, 1, splice/vmsplice/tee(2) are available) |
|
|
76 | |
|
|
77 | AC_CACHE_CHECK(for pipe2, ac_cv_pipe2, [AC_LINK_IFELSE([AC_LANG_SOURCE([[ |
|
|
78 | #include <fcntl.h> |
|
|
79 | #include <unistd.h> |
|
|
80 | int res; |
|
|
81 | int main (void) |
|
|
82 | { |
|
|
83 | res = pipe2 (0, 0); |
|
|
84 | return 0; |
|
|
85 | } |
|
|
86 | ]])],ac_cv_pipe2=yes,ac_cv_pipe2=no)]) |
|
|
87 | test $ac_cv_pipe2 = yes && AC_DEFINE(HAVE_PIPE2, 1, pipe2(2) is available) |
|
|
88 | |
|
|
89 | AC_CACHE_CHECK(for eventfd, ac_cv_eventfd, [AC_LINK_IFELSE([AC_LANG_SOURCE([[ |
|
|
90 | #include <sys/eventfd.h> |
|
|
91 | int res; |
|
|
92 | int main (void) |
|
|
93 | { |
|
|
94 | res = eventfd (1, EFD_CLOEXEC | EFD_NONBLOCK); |
|
|
95 | return 0; |
|
|
96 | } |
|
|
97 | ]])],ac_cv_eventfd=yes,ac_cv_eventfd=no)]) |
|
|
98 | test $ac_cv_eventfd = yes && AC_DEFINE(HAVE_EVENTFD, 1, eventfd(2) is available) |
|
|
99 | |
|
|
100 | AC_CACHE_CHECK(for timerfd, ac_cv_timerfd, [AC_LINK_IFELSE([AC_LANG_SOURCE([[ |
|
|
101 | #include <sys/timerfd.h> |
|
|
102 | int res; |
|
|
103 | int main (void) |
|
|
104 | { |
|
|
105 | struct itimerspec its; |
|
|
106 | res = timerfd_create (CLOCK_REALTIME, TFD_CLOEXEC | TFD_NONBLOCK); |
|
|
107 | res = timerfd_settime (res, TFD_TIMER_ABSTIME /*| TFD_TIMER_CANCEL_ON_SET*/, &its, 0); |
|
|
108 | res = timerfd_gettime (res, &its); |
|
|
109 | return 0; |
|
|
110 | } |
|
|
111 | ]])],ac_cv_timerfd=yes,ac_cv_timerfd=no)]) |
|
|
112 | test $ac_cv_timerfd = yes && AC_DEFINE(HAVE_TIMERFD, 1, timerfd_*(2) are available) |
|
|
113 | |
|
|
114 | AC_CACHE_CHECK(for copy_file_range, ac_cv_copy_file_range, [AC_LINK_IFELSE([AC_LANG_SOURCE([[ |
|
|
115 | #include <unistd.h> |
|
|
116 | #include <sys/syscall.h> |
|
|
117 | /*#include <linux/copy.h>*/ |
|
|
118 | int res; |
|
|
119 | int main (void) |
|
|
120 | { |
|
|
121 | /*res = syscall (SYS_copy_file_range, 0, 0, 0, 0, 0, COPY_FR_REFLINK | COPY_FR_DEDUP | COPY_FR_COPY);*/ |
|
|
122 | res = syscall (SYS_copy_file_range, 0, 0, 0, 0, 0, 0); |
|
|
123 | return 0; |
|
|
124 | } |
|
|
125 | ]])],ac_cv_copy_file_range=yes,ac_cv_copy_file_range=no)]) |
|
|
126 | test $ac_cv_copy_file_range = yes && AC_DEFINE(HAVE_COPY_FILE_RANGE, 1, copy_file_range(2) is available) |
|
|
127 | |
|
|
128 | AC_CACHE_CHECK(for st_xtimensec, ac_cv_xtimensec, [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ |
|
|
129 | #include "EXTERN.h" |
|
|
130 | #include "perl.h" |
|
|
131 | #include "XSUB.h" |
|
|
132 | |
|
|
133 | int res; |
|
|
134 | int main (void) |
|
|
135 | { |
|
|
136 | return PL_statcache.st_atimensec |
|
|
137 | + PL_statcache.st_mtimensec |
|
|
138 | + PL_statcache.st_ctimensec; |
|
|
139 | return 0; |
|
|
140 | } |
|
|
141 | ]])],ac_cv_xtimensec=yes,ac_cv_xtimensec=no)]) |
|
|
142 | test $ac_cv_xtimensec = yes && AC_DEFINE(HAVE_ST_XTIMENSEC, 1, stat nanosecond access by st_xtimensec) |
|
|
143 | |
|
|
144 | AC_CACHE_CHECK(for st_xtimespec, ac_cv_xtimespec, [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ |
|
|
145 | #include "EXTERN.h" |
|
|
146 | #include "perl.h" |
|
|
147 | #include "XSUB.h" |
|
|
148 | |
|
|
149 | int res; |
|
|
150 | int main (void) |
|
|
151 | { |
|
|
152 | return PL_statcache.st_atim.tv_nsec |
|
|
153 | + PL_statcache.st_mtim.tv_nsec |
|
|
154 | + PL_statcache.st_ctim.tv_nsec; |
|
|
155 | } |
|
|
156 | ]])],ac_cv_xtimespec=yes,ac_cv_xtimespec=no)]) |
|
|
157 | test $ac_cv_xtimespec = yes && AC_DEFINE(HAVE_ST_XTIMESPEC, 1, stat nanosecond access by st_xtimespec) |
|
|
158 | |
12 | AC_OUTPUT |
159 | AC_OUTPUT |
|
|
160 | |