ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/IO-AIO/configure.ac
Revision: 1.21
Committed: Thu Dec 14 10:08:20 2023 UTC (5 months ago) by root
Branch: MAIN
CVS Tags: rel-4_81
Changes since 1.20: +2 -1 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 AC_INIT
2 AC_CONFIG_SRCDIR([libeio/eio.h])
3 AC_CONFIG_HEADERS([config.h])
4
5 AC_PREREQ(2.60)
6 AC_USE_SYSTEM_EXTENSIONS
7
8 AC_PROG_CC
9
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)
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 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 dnl fexecve has always been in the single unix specification
74 dnl but some atrocities (like opsnbsd and osx) claim implementing it
75 dnl but then not definining it. ugh. garbage. and fexecve would be
76 dnl useful for security, but, no, not on openbsd. we'd rather lie
77 dnl about it.
78 AC_CACHE_CHECK(for fexecve, ac_cv_fexecve, [AC_LINK_IFELSE([AC_LANG_SOURCE([[
79 #include <fcntl.h>
80 #include <unistd.h>
81 int main (void)
82 {
83 char *const argv[] = { "foo", "bar", 0 };
84 int res = fexecve (-1, argv, 0);
85 return 0;
86 }
87 ]])],ac_cv_fexecve=yes,ac_cv_fexecve=no)])
88 test $ac_cv_fexecve = yes && AC_DEFINE(HAVE_FEXECVE, 1, fexecve(2) is available)
89
90 AC_CACHE_CHECK([for siginfo_t], ac_cv_siginfo_t, [AC_LINK_IFELSE([AC_LANG_SOURCE([
91 #include <signal.h>
92 int main (void)
93 {
94 siginfo_t si;
95 si.si_code;
96 si.si_pid;
97 si.si_uid;
98 si.si_value.sival_int;
99 si.si_value.sival_ptr;
100 return 0;
101 }
102 ])],ac_cv_siginfo_t=yes,ac_cv_siginfo_t=no)])
103 test $ac_cv_siginfo_t = yes && AC_DEFINE(HAVE_SIGINFO_T, 1, have siginfo_t in signal.h)
104
105 AC_CACHE_CHECK([for unix-style syscall interface], ac_cv_syscall, [AC_LINK_IFELSE([AC_LANG_SOURCE([
106 #include <unistd.h>
107 #include <sys/syscall.h>
108 int main (void)
109 {
110 long res = syscall (SYS_exit, 0);
111 return 0;
112 }
113 ])],ac_cv_syscall=yes,ac_cv_syscall=no)])
114 test $ac_cv_syscall = yes && AC_DEFINE(HAVE_SYSCALL, 1, unix syscall interface)
115
116 AC_CACHE_CHECK([for splice, vmsplice and tee], ac_cv_linux_splice, [AC_LINK_IFELSE([AC_LANG_SOURCE([
117 #include <sys/types.h>
118 #include <fcntl.h>
119 #include <sys/uio.h>
120 int main (void)
121 {
122 ssize_t res;
123 res = splice ((int)0, (loff_t)0, (int)0, (loff_t *)0, (size_t)0, SPLICE_F_MOVE | SPLICE_F_NONBLOCK | SPLICE_F_MORE);
124 res = tee ((int)0, (int)0, (size_t)0, SPLICE_F_NONBLOCK);
125 res = vmsplice ((int)0, (struct iovec *)0, 0, SPLICE_F_NONBLOCK | SPLICE_F_GIFT);
126 return 0;
127 }
128 ])],ac_cv_linux_splice=yes,ac_cv_linux_splice=no)])
129 test $ac_cv_linux_splice = yes && AC_DEFINE(HAVE_LINUX_SPLICE, 1, splice/vmsplice/tee(2) are available)
130
131 AC_CACHE_CHECK(for pipe2, ac_cv_pipe2, [AC_LINK_IFELSE([AC_LANG_SOURCE([[
132 #include <fcntl.h>
133 #include <unistd.h>
134 int main (void)
135 {
136 int res;
137 res = pipe2 (0, 0);
138 return 0;
139 }
140 ]])],ac_cv_pipe2=yes,ac_cv_pipe2=no)])
141 test $ac_cv_pipe2 = yes && AC_DEFINE(HAVE_PIPE2, 1, pipe2(2) is available)
142
143 AC_CACHE_CHECK(for eventfd, ac_cv_eventfd, [AC_LINK_IFELSE([AC_LANG_SOURCE([[
144 #include <sys/eventfd.h>
145 int main (void)
146 {
147 int res;
148 res = eventfd (1, EFD_CLOEXEC | EFD_NONBLOCK);
149 return 0;
150 }
151 ]])],ac_cv_eventfd=yes,ac_cv_eventfd=no)])
152 test $ac_cv_eventfd = yes && AC_DEFINE(HAVE_EVENTFD, 1, eventfd(2) is available)
153
154 AC_CACHE_CHECK(for timerfd_*, ac_cv_timerfd, [AC_LINK_IFELSE([AC_LANG_SOURCE([[
155 #include <sys/timerfd.h>
156 int main (void)
157 {
158 struct itimerspec its;
159 int res;
160 res = timerfd_create (CLOCK_REALTIME, TFD_CLOEXEC | TFD_NONBLOCK);
161 res = timerfd_settime (res, TFD_TIMER_ABSTIME /*| TFD_TIMER_CANCEL_ON_SET*/, &its, 0);
162 res = timerfd_gettime (res, &its);
163 return 0;
164 }
165 ]])],ac_cv_timerfd=yes,ac_cv_timerfd=no)])
166 test $ac_cv_timerfd = yes && AC_DEFINE(HAVE_TIMERFD, 1, timerfd_*(2) are available)
167
168 AC_CACHE_CHECK(for memfd_create, ac_cv_memfd_create, [AC_LINK_IFELSE([AC_LANG_SOURCE([[
169 #include <sys/mman.h>
170 int main (void)
171 {
172 int res = memfd_create ("name", MFD_CLOEXEC | MFD_ALLOW_SEALING);
173 return 0;
174 }
175 ]])],ac_cv_memfd_create=yes,ac_cv_memfd_create=no)])
176 test $ac_cv_memfd_create = yes && AC_DEFINE(HAVE_MEMFD_CREATE, 1, memfd_create(2) is available)
177
178 AC_CACHE_CHECK(for copy_file_range, ac_cv_copy_file_range, [AC_LINK_IFELSE([AC_LANG_SOURCE([[
179 #include <unistd.h>
180 #include <sys/syscall.h>
181 /*#include <linux/copy.h>*/
182 int main (void)
183 {
184 int res;
185 /*res = syscall (SYS_copy_file_range, 0, 0, 0, 0, 0, COPY_FR_REFLINK | COPY_FR_DEDUP | COPY_FR_COPY);*/
186 res = syscall (SYS_copy_file_range, 0, 0, 0, 0, 0, 0);
187 return 0;
188 }
189 ]])],ac_cv_copy_file_range=yes,ac_cv_copy_file_range=no)])
190 test $ac_cv_copy_file_range = yes && AC_DEFINE(HAVE_COPY_FILE_RANGE, 1, copy_file_range(2) is available)
191
192 AC_CACHE_CHECK(for st_xtimensec, ac_cv_xtimensec, [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_atimensec
200 + PL_statcache.st_mtimensec
201 + PL_statcache.st_ctimensec;
202 }
203 ]])],ac_cv_xtimensec=yes,ac_cv_xtimensec=no)])
204 test $ac_cv_xtimensec = yes && AC_DEFINE(HAVE_ST_XTIMENSEC, 1, stat nanosecond access by st_xtimensec)
205
206 AC_CACHE_CHECK(for st_xtimespec, ac_cv_xtimespec, [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
207 #include "EXTERN.h"
208 #include "perl.h"
209 #include "XSUB.h"
210
211 int main (void)
212 {
213 return PL_statcache.st_atim.tv_nsec
214 + PL_statcache.st_mtim.tv_nsec
215 + PL_statcache.st_ctim.tv_nsec;
216 }
217 ]])],ac_cv_xtimespec=yes,ac_cv_xtimespec=no)])
218 test $ac_cv_xtimespec = yes && AC_DEFINE(HAVE_ST_XTIMESPEC, 1, stat nanosecond access by st_xtimespec)
219
220 # apparently, True64 uses st_u[amc]time, aix uses at_[amc]time_n and apple uses st_[amc,birth]timespec?
221
222 AC_CACHE_CHECK(for st_birthtimensec, ac_cv_birthtimensec, [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
223 #include "EXTERN.h"
224 #include "perl.h"
225 #include "XSUB.h"
226
227 int main (void)
228 {
229 return PL_statcache.st_birthtime + PL_statcache.st_birthtimensec;
230 }
231 ]])],ac_cv_birthtimensec=yes,ac_cv_birthtimensec=no)])
232 test $ac_cv_birthtimensec = yes && AC_DEFINE(HAVE_ST_BIRTHTIMENSEC, 1, birthtime nanosecond access by st_birthtimensec)
233
234 AC_CACHE_CHECK(for st_birthtimespec, ac_cv_birthtimespec, [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
235 #include "EXTERN.h"
236 #include "perl.h"
237 #include "XSUB.h"
238
239 int main (void)
240 {
241 return PL_statcache.st_birthtim.tv_sec + PL_statcache.st_birthtim.tv_nsec;
242 }
243 ]])],ac_cv_birthtimespec=yes,ac_cv_birthtimespec=no)])
244 test $ac_cv_birthtimespec = yes && AC_DEFINE(HAVE_ST_BIRTHTIMESPEC, 1, birthtime nanosecond access by st_birthtimespec)
245
246 AC_CACHE_CHECK(for st_gen, ac_cv_st_gen, [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
247 #include "EXTERN.h"
248 #include "perl.h"
249 #include "XSUB.h"
250
251 int main (void)
252 {
253 return PL_statcache.st_gen;
254 }
255 ]])],ac_cv_st_gen=yes,ac_cv_st_gen=no)])
256 test $ac_cv_st_gen = yes && AC_DEFINE(HAVE_ST_GEN, 1, stat st_gen member)
257
258 AC_CACHE_CHECK(for statx, ac_cv_statx, [AC_LINK_IFELSE([AC_LANG_SOURCE([[
259 #include <sys/types.h>
260 #include <sys/stat.h>
261 #include <unistd.h>
262 #include <fcntl.h>
263 int res;
264 int main (void)
265 {
266 struct statx sx;
267 int res;
268 res = statx (AT_FDCWD, ".",
269 AT_EMPTY_PATH | AT_NO_AUTOMOUNT | AT_SYMLINK_NOFOLLOW | AT_STATX_SYNC_AS_STAT | AT_STATX_FORCE_SYNC | AT_STATX_DONT_SYNC,
270 STATX_ALL, &sx);
271 STATX_TYPE; STATX_MODE; STATX_NLINK; STATX_UID; STATX_GID; STATX_ATIME; STATX_MTIME; STATX_CTIME;
272 STATX_INO; STATX_SIZE; STATX_BLOCKS; STATX_BASIC_STATS; STATX_BTIME; STATX_ALL;
273 STATX_ATTR_COMPRESSED; STATX_ATTR_IMMUTABLE; STATX_ATTR_APPEND; STATX_ATTR_NODUMP; STATX_ATTR_ENCRYPTED;
274 return 0;
275 }
276 ]])],ac_cv_statx=yes,ac_cv_statx=no)])
277 test $ac_cv_statx = yes && AC_DEFINE(HAVE_STATX, 1, statx(2) is available)
278
279 AC_CACHE_CHECK(for accept4, ac_cv_accept4, [AC_LINK_IFELSE([AC_LANG_SOURCE([[
280 #include <sys/types.h>
281 #include <sys/socket.h>
282 int main (void)
283 {
284 int res = accept4 (1, (struct sockaddr *)0, (socklen_t)0, SOCK_NONBLOCK | SOCK_CLOEXEC);
285 return 0;
286 }
287 ]])],ac_cv_accept4=yes,ac_cv_accept4=no)])
288 test $ac_cv_accept4 = yes && AC_DEFINE(HAVE_ACCEPT4, 1, accept4(2) is available)
289
290 AC_CHECK_HEADERS([sys/mount.h])
291 AC_CACHE_CHECK(for mount, ac_cv_mount, [AC_LINK_IFELSE([AC_LANG_SOURCE([[
292 #include <sys/mount.h>
293 int main (void)
294 {
295 int res = mount ("path", "path", "fstype", MS_RDONLY, 0);
296 return 0;
297 }
298 ]])],ac_cv_mount=yes,ac_cv_mount=no)])
299 test $ac_cv_mount = yes && AC_DEFINE(HAVE_MOUNT, 1, mount is available)
300 AC_CACHE_CHECK(for umount, ac_cv_umount, [AC_LINK_IFELSE([AC_LANG_SOURCE([[
301 #include <sys/mount.h>
302 int main (void)
303 {
304 int res = umount ("path");
305 return 0;
306 }
307 ]])],ac_cv_umount=yes,ac_cv_umount=no)])
308 test $ac_cv_umount = yes && AC_DEFINE(HAVE_UMOUNT, 1, umount is available)
309 AC_CACHE_CHECK(for umount2, ac_cv_umount2, [AC_LINK_IFELSE([AC_LANG_SOURCE([[
310 #include <sys/mount.h>
311 int main (void)
312 {
313 int res = umount2 ("path", MNT_FORCE|MNT_DETACH);
314 return 0;
315 }
316 ]])],ac_cv_umount2=yes,ac_cv_umount2=no)])
317 test $ac_cv_umount2 = yes && AC_DEFINE(HAVE_UMOUNT2, 1, umount2 is available)
318
319 AC_OUTPUT
320