1 | AC_PREREQ(2.59) |
|
|
2 | AC_INIT |
1 | AC_INIT |
3 | AC_CONFIG_SRCDIR([libeio/eio.h]) |
2 | AC_CONFIG_SRCDIR([libeio/eio.h]) |
4 | AC_CONFIG_HEADERS([libeio/config.h]) |
3 | AC_CONFIG_HEADERS([config.h]) |
|
|
4 | |
|
|
5 | AC_PREREQ(2.60) |
|
|
6 | AC_USE_SYSTEM_EXTENSIONS |
5 | |
7 | |
6 | AC_PROG_CC |
8 | AC_PROG_CC |
7 | |
9 | |
8 | m4_include([libeio/libeio.m4]) |
10 | m4_include([libeio/libeio.m4]) |
|
|
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 main (void) |
|
|
18 | { |
|
|
19 | struct rlimit srl; |
|
|
20 | int res; |
|
|
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) |
9 | |
28 | |
10 | dnl at least uclibc defines _POSIX_ADVISORY_INFO without *any* of the required |
29 | dnl at least uclibc defines _POSIX_ADVISORY_INFO without *any* of the required |
11 | dnl functionality actually being present. ugh. |
30 | dnl functionality actually being present. ugh. |
12 | AC_CACHE_CHECK(for posix_madvise, ac_cv_posix_madvise, [AC_LINK_IFELSE([ |
31 | AC_CACHE_CHECK(for posix_madvise, ac_cv_posix_madvise, [AC_LINK_IFELSE([AC_LANG_SOURCE([ |
13 | #include <sys/mman.h> |
32 | #include <sys/mman.h> |
14 | int main (void) |
33 | int main (void) |
15 | { |
34 | { |
16 | int res = posix_madvise ((void *)0, (size_t)0, POSIX_MADV_NORMAL); |
35 | int res = posix_madvise ((void *)0, (size_t)0, POSIX_MADV_NORMAL); |
17 | int a = POSIX_MADV_SEQUENTIAL; |
36 | int a = POSIX_MADV_SEQUENTIAL; |
18 | int b = POSIX_MADV_RANDOM; |
37 | int b = POSIX_MADV_RANDOM; |
19 | int c = POSIX_MADV_WILLNEED; |
38 | int c = POSIX_MADV_WILLNEED; |
20 | int d = POSIX_MADV_DONTNEED; |
39 | int d = POSIX_MADV_DONTNEED; |
21 | return 0; |
40 | return 0; |
22 | } |
41 | } |
23 | ],ac_cv_posix_madvise=yes,ac_cv_posix_madvise=no)]) |
42 | ])],ac_cv_posix_madvise=yes,ac_cv_posix_madvise=no)]) |
24 | test $ac_cv_posix_madvise = yes && AC_DEFINE(HAVE_POSIX_MADVISE, 1, posix_madvise(2) is available) |
43 | test $ac_cv_posix_madvise = yes && AC_DEFINE(HAVE_POSIX_MADVISE, 1, posix_madvise(2) is available) |
25 | |
44 | |
26 | AC_CACHE_CHECK(for posix_fadvise, ac_cv_posix_fadvise, [AC_LINK_IFELSE([ |
45 | AC_CACHE_CHECK(for posix_fadvise, ac_cv_posix_fadvise, [AC_LINK_IFELSE([AC_LANG_SOURCE([ |
27 | #define _XOPEN_SOURCE 600 |
46 | #define _XOPEN_SOURCE 600 |
28 | #include <fcntl.h> |
47 | #include <fcntl.h> |
29 | int main (void) |
48 | int main (void) |
30 | { |
49 | { |
31 | int res = posix_fadvise ((int)0, (off_t)0, (off_t)0, POSIX_FADV_NORMAL); |
50 | int res = posix_fadvise ((int)0, (off_t)0, (off_t)0, POSIX_FADV_NORMAL); |
… | |
… | |
34 | int c = POSIX_FADV_RANDOM; |
53 | int c = POSIX_FADV_RANDOM; |
35 | int d = POSIX_FADV_WILLNEED; |
54 | int d = POSIX_FADV_WILLNEED; |
36 | int e = POSIX_FADV_DONTNEED; |
55 | int e = POSIX_FADV_DONTNEED; |
37 | return 0; |
56 | return 0; |
38 | } |
57 | } |
39 | ],ac_cv_posix_fadvise=yes,ac_cv_posix_fadvise=no)]) |
58 | ])],ac_cv_posix_fadvise=yes,ac_cv_posix_fadvise=no)]) |
40 | test $ac_cv_posix_fadvise = yes && AC_DEFINE(HAVE_POSIX_FADVISE, 1, posix_fadvise(2) is available) |
59 | test $ac_cv_posix_fadvise = yes && AC_DEFINE(HAVE_POSIX_FADVISE, 1, posix_fadvise(2) is available) |
41 | |
60 | |
|
|
61 | dnl lots of linux specifics |
|
|
62 | AC_CHECK_HEADERS([linux/fs.h linux/fiemap.h]) |
|
|
63 | |
|
|
64 | dnl glibc major/minor macros |
|
|
65 | AC_CHECK_HEADERS([sys/sysmacros.h]) |
|
|
66 | |
|
|
67 | dnl solaris major/minor |
|
|
68 | AC_CHECK_HEADERS([sys/mkdev.h]) |
|
|
69 | |
|
|
70 | dnl readv / preadv, vmsplice |
|
|
71 | AC_CHECK_HEADERS([sys/uio.h]) |
|
|
72 | |
|
|
73 | |
|
|
74 | AC_CACHE_CHECK([for splice, vmsplice and tee], ac_cv_linux_splice, [AC_LINK_IFELSE([AC_LANG_SOURCE([ |
|
|
75 | #include <sys/types.h> |
|
|
76 | #include <fcntl.h> |
|
|
77 | #include <sys/uio.h> |
|
|
78 | int main (void) |
|
|
79 | { |
|
|
80 | ssize_t res; |
|
|
81 | res = splice ((int)0, (loff_t)0, (int)0, (loff_t *)0, (size_t)0, SPLICE_F_MOVE | SPLICE_F_NONBLOCK | SPLICE_F_MORE); |
|
|
82 | res = tee ((int)0, (int)0, (size_t)0, SPLICE_F_NONBLOCK); |
|
|
83 | res = vmsplice ((int)0, (struct iovec *)0, 0, SPLICE_F_NONBLOCK | SPLICE_F_GIFT); |
|
|
84 | return 0; |
|
|
85 | } |
|
|
86 | ])],ac_cv_linux_splice=yes,ac_cv_linux_splice=no)]) |
|
|
87 | test $ac_cv_linux_splice = yes && AC_DEFINE(HAVE_LINUX_SPLICE, 1, splice/vmsplice/tee(2) are available) |
|
|
88 | |
|
|
89 | AC_CACHE_CHECK(for pipe2, ac_cv_pipe2, [AC_LINK_IFELSE([AC_LANG_SOURCE([[ |
|
|
90 | #include <fcntl.h> |
|
|
91 | #include <unistd.h> |
|
|
92 | int main (void) |
|
|
93 | { |
|
|
94 | int res; |
|
|
95 | res = pipe2 (0, 0); |
|
|
96 | return 0; |
|
|
97 | } |
|
|
98 | ]])],ac_cv_pipe2=yes,ac_cv_pipe2=no)]) |
|
|
99 | test $ac_cv_pipe2 = yes && AC_DEFINE(HAVE_PIPE2, 1, pipe2(2) is available) |
|
|
100 | |
|
|
101 | AC_CACHE_CHECK(for eventfd, ac_cv_eventfd, [AC_LINK_IFELSE([AC_LANG_SOURCE([[ |
|
|
102 | #include <sys/eventfd.h> |
|
|
103 | int main (void) |
|
|
104 | { |
|
|
105 | int res; |
|
|
106 | res = eventfd (1, EFD_CLOEXEC | EFD_NONBLOCK); |
|
|
107 | return 0; |
|
|
108 | } |
|
|
109 | ]])],ac_cv_eventfd=yes,ac_cv_eventfd=no)]) |
|
|
110 | test $ac_cv_eventfd = yes && AC_DEFINE(HAVE_EVENTFD, 1, eventfd(2) is available) |
|
|
111 | |
|
|
112 | AC_CACHE_CHECK(for timerfd_*, ac_cv_timerfd, [AC_LINK_IFELSE([AC_LANG_SOURCE([[ |
|
|
113 | #include <sys/timerfd.h> |
|
|
114 | int main (void) |
|
|
115 | { |
|
|
116 | struct itimerspec its; |
|
|
117 | int res; |
|
|
118 | res = timerfd_create (CLOCK_REALTIME, TFD_CLOEXEC | TFD_NONBLOCK); |
|
|
119 | res = timerfd_settime (res, TFD_TIMER_ABSTIME /*| TFD_TIMER_CANCEL_ON_SET*/, &its, 0); |
|
|
120 | res = timerfd_gettime (res, &its); |
|
|
121 | return 0; |
|
|
122 | } |
|
|
123 | ]])],ac_cv_timerfd=yes,ac_cv_timerfd=no)]) |
|
|
124 | test $ac_cv_timerfd = yes && AC_DEFINE(HAVE_TIMERFD, 1, timerfd_*(2) are available) |
|
|
125 | |
|
|
126 | AC_CACHE_CHECK(for memfd_create, ac_cv_memfd_create, [AC_LINK_IFELSE([AC_LANG_SOURCE([[ |
|
|
127 | #include <sys/mman.h> |
|
|
128 | int main (void) |
|
|
129 | { |
|
|
130 | int res = memfd_create ("name", MFD_CLOEXEC | MFD_ALLOW_SEALING); |
|
|
131 | return 0; |
|
|
132 | } |
|
|
133 | ]])],ac_cv_memfd_create=yes,ac_cv_memfd_create=no)]) |
|
|
134 | test $ac_cv_memfd_create = yes && AC_DEFINE(HAVE_MEMFD_CREATE, 1, memfd_create(2) is available) |
|
|
135 | |
|
|
136 | AC_CACHE_CHECK(for copy_file_range, ac_cv_copy_file_range, [AC_LINK_IFELSE([AC_LANG_SOURCE([[ |
|
|
137 | #include <unistd.h> |
|
|
138 | #include <sys/syscall.h> |
|
|
139 | /*#include <linux/copy.h>*/ |
|
|
140 | int main (void) |
|
|
141 | { |
|
|
142 | int res; |
|
|
143 | /*res = syscall (SYS_copy_file_range, 0, 0, 0, 0, 0, COPY_FR_REFLINK | COPY_FR_DEDUP | COPY_FR_COPY);*/ |
|
|
144 | res = syscall (SYS_copy_file_range, 0, 0, 0, 0, 0, 0); |
|
|
145 | return 0; |
|
|
146 | } |
|
|
147 | ]])],ac_cv_copy_file_range=yes,ac_cv_copy_file_range=no)]) |
|
|
148 | test $ac_cv_copy_file_range = yes && AC_DEFINE(HAVE_COPY_FILE_RANGE, 1, copy_file_range(2) is available) |
|
|
149 | |
|
|
150 | AC_CACHE_CHECK(for st_xtimensec, ac_cv_xtimensec, [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ |
|
|
151 | #include "EXTERN.h" |
|
|
152 | #include "perl.h" |
|
|
153 | #include "XSUB.h" |
|
|
154 | |
|
|
155 | int main (void) |
|
|
156 | { |
|
|
157 | return PL_statcache.st_atimensec |
|
|
158 | + PL_statcache.st_mtimensec |
|
|
159 | + PL_statcache.st_ctimensec; |
|
|
160 | } |
|
|
161 | ]])],ac_cv_xtimensec=yes,ac_cv_xtimensec=no)]) |
|
|
162 | test $ac_cv_xtimensec = yes && AC_DEFINE(HAVE_ST_XTIMENSEC, 1, stat nanosecond access by st_xtimensec) |
|
|
163 | |
|
|
164 | AC_CACHE_CHECK(for st_xtimespec, ac_cv_xtimespec, [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ |
|
|
165 | #include "EXTERN.h" |
|
|
166 | #include "perl.h" |
|
|
167 | #include "XSUB.h" |
|
|
168 | |
|
|
169 | int main (void) |
|
|
170 | { |
|
|
171 | return PL_statcache.st_atim.tv_nsec |
|
|
172 | + PL_statcache.st_mtim.tv_nsec |
|
|
173 | + PL_statcache.st_ctim.tv_nsec; |
|
|
174 | } |
|
|
175 | ]])],ac_cv_xtimespec=yes,ac_cv_xtimespec=no)]) |
|
|
176 | test $ac_cv_xtimespec = yes && AC_DEFINE(HAVE_ST_XTIMESPEC, 1, stat nanosecond access by st_xtimespec) |
|
|
177 | |
|
|
178 | # apparently, True64 uses st_u[amc]time, aix uses at_[amc]time_n and apple uses st_[amc,birth]timespec? |
|
|
179 | |
|
|
180 | AC_CACHE_CHECK(for st_birthtimensec, ac_cv_birthtimensec, [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ |
|
|
181 | #include "EXTERN.h" |
|
|
182 | #include "perl.h" |
|
|
183 | #include "XSUB.h" |
|
|
184 | |
|
|
185 | int main (void) |
|
|
186 | { |
|
|
187 | return PL_statcache.st_birthtime + PL_statcache.st_birthtimensec; |
|
|
188 | } |
|
|
189 | ]])],ac_cv_birthtimensec=yes,ac_cv_birthtimensec=no)]) |
|
|
190 | test $ac_cv_birthtimensec = yes && AC_DEFINE(HAVE_ST_BIRTHTIMENSEC, 1, birthtime nanosecond access by st_birthtimensec) |
|
|
191 | |
|
|
192 | AC_CACHE_CHECK(for st_birthtimespec, ac_cv_birthtimespec, [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ |
|
|
193 | #include "EXTERN.h" |
|
|
194 | #include "perl.h" |
|
|
195 | #include "XSUB.h" |
|
|
196 | |
|
|
197 | int main (void) |
|
|
198 | { |
|
|
199 | return PL_statcache.st_birthtim.tv_sec + PL_statcache.st_birthtim.tv_nsec; |
|
|
200 | } |
|
|
201 | ]])],ac_cv_birthtimespec=yes,ac_cv_birthtimespec=no)]) |
|
|
202 | test $ac_cv_birthtimespec = yes && AC_DEFINE(HAVE_ST_BIRTHTIMESPEC, 1, birthtime nanosecond access by st_birthtimespec) |
|
|
203 | |
|
|
204 | AC_CACHE_CHECK(for st_gen, ac_cv_st_gen, [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ |
|
|
205 | #include "EXTERN.h" |
|
|
206 | #include "perl.h" |
|
|
207 | #include "XSUB.h" |
|
|
208 | |
|
|
209 | int main (void) |
|
|
210 | { |
|
|
211 | return PL_statcache.st_gen; |
|
|
212 | } |
|
|
213 | ]])],ac_cv_st_gen=yes,ac_cv_st_gen=no)]) |
|
|
214 | test $ac_cv_st_gen = yes && AC_DEFINE(HAVE_ST_GEN, 1, stat st_gen member) |
|
|
215 | |
|
|
216 | AC_CACHE_CHECK(for statx, ac_cv_statx, [AC_LINK_IFELSE([AC_LANG_SOURCE([[ |
|
|
217 | #include <sys/types.h> |
|
|
218 | #include <sys/stat.h> |
|
|
219 | #include <unistd.h> |
|
|
220 | #include <fcntl.h> |
|
|
221 | int res; |
|
|
222 | int main (void) |
|
|
223 | { |
|
|
224 | struct statx sx; |
|
|
225 | int res; |
|
|
226 | res = statx (AT_FDCWD, ".", |
|
|
227 | AT_EMPTY_PATH | AT_NO_AUTOMOUNT | AT_SYMLINK_NOFOLLOW | AT_STATX_SYNC_AS_STAT | AT_STATX_FORCE_SYNC | AT_STATX_DONT_SYNC, |
|
|
228 | STATX_ALL, &sx); |
|
|
229 | STATX_TYPE; STATX_MODE; STATX_NLINK; STATX_UID; STATX_GID; STATX_ATIME; STATX_MTIME; STATX_CTIME; |
|
|
230 | STATX_INO; STATX_SIZE; STATX_BLOCKS; STATX_BASIC_STATS; STATX_BTIME; STATX_ALL; |
|
|
231 | STATX_ATTR_COMPRESSED; STATX_ATTR_IMMUTABLE; STATX_ATTR_APPEND; STATX_ATTR_NODUMP; STATX_ATTR_ENCRYPTED; |
|
|
232 | return 0; |
|
|
233 | } |
|
|
234 | ]])],ac_cv_statx=yes,ac_cv_statx=no)]) |
|
|
235 | test $ac_cv_statx = yes && AC_DEFINE(HAVE_STATX, 1, statx(2) is available) |
|
|
236 | |
42 | AC_OUTPUT |
237 | AC_OUTPUT |
|
|
238 | |