]>
Commit | Line | Data |
---|---|---|
0bba1a49 NS |
1 | # |
2 | # Check if we have a working fadvise system call | |
f8149110 | 3 | # |
0bba1a49 NS |
4 | AC_DEFUN([AC_HAVE_FADVISE], |
5 | [ AC_MSG_CHECKING([for fadvise ]) | |
6 | AC_TRY_COMPILE([ | |
7 | #define _GNU_SOURCE | |
0bba1a49 NS |
8 | #include <fcntl.h> |
9 | ], [ | |
38c187fe | 10 | posix_fadvise(0, 1, 0, POSIX_FADV_NORMAL); |
0bba1a49 NS |
11 | ], have_fadvise=yes |
12 | AC_MSG_RESULT(yes), | |
13 | AC_MSG_RESULT(no)) | |
14 | AC_SUBST(have_fadvise) | |
15 | ]) | |
16 | ||
f8149110 | 17 | # |
0bba1a49 | 18 | # Check if we have a working madvise system call |
f8149110 | 19 | # |
0bba1a49 NS |
20 | AC_DEFUN([AC_HAVE_MADVISE], |
21 | [ AC_MSG_CHECKING([for madvise ]) | |
22 | AC_TRY_COMPILE([ | |
23 | #define _GNU_SOURCE | |
0bba1a49 NS |
24 | #include <sys/mman.h> |
25 | ], [ | |
26 | posix_madvise(0, 0, MADV_NORMAL); | |
27 | ], have_madvise=yes | |
28 | AC_MSG_RESULT(yes), | |
29 | AC_MSG_RESULT(no)) | |
30 | AC_SUBST(have_madvise) | |
31 | ]) | |
32 | ||
f8149110 | 33 | # |
0bba1a49 | 34 | # Check if we have a working mincore system call |
f8149110 | 35 | # |
0bba1a49 NS |
36 | AC_DEFUN([AC_HAVE_MINCORE], |
37 | [ AC_MSG_CHECKING([for mincore ]) | |
38 | AC_TRY_COMPILE([ | |
39 | #define _GNU_SOURCE | |
0bba1a49 NS |
40 | #include <sys/mman.h> |
41 | ], [ | |
42 | mincore(0, 0, 0); | |
43 | ], have_mincore=yes | |
44 | AC_MSG_RESULT(yes), | |
45 | AC_MSG_RESULT(no)) | |
46 | AC_SUBST(have_mincore) | |
47 | ]) | |
48 | ||
f8149110 | 49 | # |
0bba1a49 | 50 | # Check if we have a working sendfile system call |
f8149110 | 51 | # |
0bba1a49 NS |
52 | AC_DEFUN([AC_HAVE_SENDFILE], |
53 | [ AC_MSG_CHECKING([for sendfile ]) | |
54 | AC_TRY_COMPILE([ | |
55 | #define _GNU_SOURCE | |
0bba1a49 NS |
56 | #include <sys/sendfile.h> |
57 | ], [ | |
58 | sendfile(0, 0, 0, 0); | |
59 | ], have_sendfile=yes | |
60 | AC_MSG_RESULT(yes), | |
61 | AC_MSG_RESULT(no)) | |
62 | AC_SUBST(have_sendfile) | |
63 | ]) | |
cfe6e3f0 NS |
64 | |
65 | # | |
66 | # Check if we have a getmntent libc call (IRIX, Linux) | |
67 | # | |
68 | AC_DEFUN([AC_HAVE_GETMNTENT], | |
69 | [ AC_MSG_CHECKING([for getmntent ]) | |
70 | AC_TRY_COMPILE([ | |
71 | #include <stdio.h> | |
72 | #include <mntent.h> | |
73 | ], [ | |
74 | getmntent(0); | |
75 | ], have_getmntent=yes | |
76 | AC_MSG_RESULT(yes), | |
77 | AC_MSG_RESULT(no)) | |
78 | AC_SUBST(have_getmntent) | |
79 | ]) | |
80 | ||
81 | # | |
82 | # Check if we have a getmntinfo libc call (FreeBSD, Mac OS X) | |
83 | # | |
84 | AC_DEFUN([AC_HAVE_GETMNTINFO], | |
85 | [ AC_MSG_CHECKING([for getmntinfo ]) | |
86 | AC_TRY_COMPILE([ | |
87 | #include <sys/param.h> | |
88 | #include <sys/ucred.h> | |
89 | #include <sys/mount.h> | |
90 | ], [ | |
91 | getmntinfo(0, 0); | |
92 | ], have_getmntinfo=yes | |
93 | AC_MSG_RESULT(yes), | |
94 | AC_MSG_RESULT(no)) | |
95 | AC_SUBST(have_getmntinfo) | |
96 | ]) | |
c0b5232a ES |
97 | |
98 | # | |
99 | # Check if we have a fallocate libc call (Linux) | |
100 | # | |
101 | AC_DEFUN([AC_HAVE_FALLOCATE], | |
102 | [ AC_MSG_CHECKING([for fallocate]) | |
103 | AC_TRY_LINK([ | |
c17c73e2 | 104 | #define _GNU_SOURCE |
c17c73e2 | 105 | #include <fcntl.h> |
c0b5232a ES |
106 | #include <linux/falloc.h> |
107 | ], [ | |
108 | fallocate(0, 0, 0, 0); | |
109 | ], have_fallocate=yes | |
110 | AC_MSG_RESULT(yes), | |
111 | AC_MSG_RESULT(no)) | |
112 | AC_SUBST(have_fallocate) | |
113 | ]) | |
8f0e0912 CH |
114 | |
115 | # | |
116 | # Check if we have the fiemap ioctl (Linux) | |
117 | # | |
118 | AC_DEFUN([AC_HAVE_FIEMAP], | |
2912da5d NS |
119 | [ AC_MSG_CHECKING([for fiemap]) |
120 | AC_TRY_LINK([ | |
121 | #define _GNU_SOURCE | |
2912da5d NS |
122 | #include <linux/fs.h> |
123 | #include <linux/fiemap.h> | |
124 | ], [ | |
125 | struct fiemap *fiemap; | |
126 | ioctl(0, FS_IOC_FIEMAP, (unsigned long)fiemap); | |
127 | ], have_fiemap=yes | |
128 | AC_MSG_RESULT(yes), | |
129 | AC_MSG_RESULT(no)) | |
8f0e0912 CH |
130 | AC_SUBST(have_fiemap) |
131 | ]) | |
197d5828 ES |
132 | |
133 | # | |
134 | # Check if we have a preadv libc call (Linux) | |
135 | # | |
136 | AC_DEFUN([AC_HAVE_PREADV], | |
137 | [ AC_MSG_CHECKING([for preadv]) | |
138 | AC_TRY_LINK([ | |
197d5828 | 139 | #define _BSD_SOURCE |
c1436573 | 140 | #define _DEFAULT_SOURCE |
197d5828 ES |
141 | #include <sys/uio.h> |
142 | ], [ | |
143 | preadv(0, 0, 0, 0); | |
144 | ], have_preadv=yes | |
145 | AC_MSG_RESULT(yes), | |
146 | AC_MSG_RESULT(no)) | |
147 | AC_SUBST(have_preadv) | |
148 | ]) | |
149 | ||
c5deeac9 GR |
150 | # |
151 | # Check if we have a pwritev2 libc call (Linux) | |
152 | # | |
153 | AC_DEFUN([AC_HAVE_PWRITEV2], | |
154 | [ AC_MSG_CHECKING([for pwritev2]) | |
155 | AC_TRY_LINK([ | |
156 | #define _BSD_SOURCE | |
157 | #include <sys/uio.h> | |
158 | ], [ | |
159 | pwritev2(0, 0, 0, 0, 0); | |
160 | ], have_pwritev2=yes | |
161 | AC_MSG_RESULT(yes), | |
162 | AC_MSG_RESULT(no)) | |
163 | AC_SUBST(have_pwritev2) | |
164 | ]) | |
165 | ||
628e112a AS |
166 | # |
167 | # Check if we have a copy_file_range system call (Linux) | |
168 | # | |
169 | AC_DEFUN([AC_HAVE_COPY_FILE_RANGE], | |
170 | [ AC_MSG_CHECKING([for copy_file_range]) | |
171 | AC_TRY_LINK([ | |
172 | #define _GNU_SOURCE | |
173 | #include <sys/syscall.h> | |
174 | #include <unistd.h> | |
175 | ], [ | |
176 | syscall(__NR_copy_file_range, 0, 0, 0, 0, 0, 0); | |
177 | ], have_copy_file_range=yes | |
178 | AC_MSG_RESULT(yes), | |
179 | AC_MSG_RESULT(no)) | |
180 | AC_SUBST(have_copy_file_range) | |
181 | ]) | |
182 | ||
197d5828 ES |
183 | # |
184 | # Check if we have a sync_file_range libc call (Linux) | |
185 | # | |
186 | AC_DEFUN([AC_HAVE_SYNC_FILE_RANGE], | |
187 | [ AC_MSG_CHECKING([for sync_file_range]) | |
188 | AC_TRY_LINK([ | |
189 | #define _GNU_SOURCE | |
197d5828 ES |
190 | #include <fcntl.h> |
191 | ], [ | |
192 | sync_file_range(0, 0, 0, 0); | |
193 | ], have_sync_file_range=yes | |
194 | AC_MSG_RESULT(yes), | |
195 | AC_MSG_RESULT(no)) | |
196 | AC_SUBST(have_sync_file_range) | |
197 | ]) | |
198 | ||
c7dd81c7 ES |
199 | # |
200 | # Check if we have a syncfs libc call (Linux) | |
201 | # | |
202 | AC_DEFUN([AC_HAVE_SYNCFS], | |
203 | [ AC_MSG_CHECKING([for syncfs]) | |
204 | AC_TRY_LINK([ | |
205 | #define _GNU_SOURCE | |
c7dd81c7 ES |
206 | #include <unistd.h> |
207 | ], [ | |
208 | syncfs(0); | |
eb24bcff | 209 | ], have_syncfs=yes |
c7dd81c7 ES |
210 | AC_MSG_RESULT(yes), |
211 | AC_MSG_RESULT(no)) | |
212 | AC_SUBST(have_syncfs) | |
213 | ]) | |
214 | ||
3bc05641 BF |
215 | # |
216 | # Check if we have a readdir libc call | |
217 | # | |
218 | AC_DEFUN([AC_HAVE_READDIR], | |
219 | [ AC_MSG_CHECKING([for readdir]) | |
220 | AC_TRY_LINK([ | |
221 | #include <dirent.h> | |
222 | ], [ | |
223 | readdir(0); | |
224 | ], have_readdir=yes | |
225 | AC_MSG_RESULT(yes), | |
226 | AC_MSG_RESULT(no)) | |
227 | AC_SUBST(have_readdir) | |
228 | ]) | |
229 | ||
5121281b JT |
230 | # |
231 | # Check if we have a flc call (Mac OS X) | |
232 | # | |
233 | AC_DEFUN([AC_HAVE_FLS], | |
234 | [ AC_CHECK_DECL([fls], | |
235 | have_fls=yes, | |
236 | [], | |
237 | [#include <string.h>] | |
238 | ) | |
239 | AC_SUBST(have_fls) | |
240 | ]) | |
241 | ||
c14c7b79 JT |
242 | # |
243 | # Check if we have a fsetxattr call (Mac OS X) | |
244 | # | |
245 | AC_DEFUN([AC_HAVE_FSETXATTR], | |
246 | [ AC_CHECK_DECL([fsetxattr], | |
247 | have_fsetxattr=yes, | |
248 | [], | |
249 | [#include <sys/types.h> | |
250 | #include <attr/xattr.h>] | |
251 | ) | |
252 | AC_SUBST(have_fsetxattr) | |
253 | ]) | |
254 | ||
5ae294ea JT |
255 | # |
256 | # Check if there is mntent.h | |
257 | # | |
258 | AC_DEFUN([AC_HAVE_MNTENT], | |
259 | [ AC_CHECK_HEADERS(mntent.h, | |
260 | have_mntent=yes) | |
261 | AC_SUBST(have_mntent) | |
262 | ]) | |
a49984b3 JT |
263 | |
264 | # | |
265 | # Check if we have a mremap call (not on Mac OS X) | |
266 | # | |
267 | AC_DEFUN([AC_HAVE_MREMAP], | |
268 | [ AC_CHECK_DECL([mremap], | |
269 | have_mremap=yes, | |
270 | [], | |
271 | [#define _GNU_SOURCE | |
272 | #include <sys/mman.h>] | |
273 | ) | |
274 | AC_SUBST(have_mremap) | |
275 | ]) | |
6529e656 DW |
276 | |
277 | # | |
278 | # Check if we need to override the system struct fsxattr with | |
279 | # the internal definition. This /only/ happens if the system | |
280 | # actually defines struct fsxattr /and/ the system definition | |
281 | # is missing certain fields. | |
282 | # | |
283 | AC_DEFUN([AC_NEED_INTERNAL_FSXATTR], | |
284 | [ | |
1e51132f DW |
285 | AC_CHECK_TYPE(struct fsxattr, |
286 | [ | |
287 | AC_CHECK_MEMBER(struct fsxattr.fsx_cowextsize, | |
288 | , | |
289 | need_internal_fsxattr=yes, | |
290 | [#include <linux/fs.h>] | |
291 | ) | |
292 | ],, | |
293 | [#include <linux/fs.h>] | |
294 | ) | |
6529e656 DW |
295 | AC_SUBST(need_internal_fsxattr) |
296 | ]) | |
71956d72 DW |
297 | |
298 | # | |
299 | # Check if we have a FS_IOC_GETFSMAP ioctl (Linux) | |
300 | # | |
301 | AC_DEFUN([AC_HAVE_GETFSMAP], | |
302 | [ AC_MSG_CHECKING([for GETFSMAP]) | |
303 | AC_TRY_LINK([ | |
304 | #define _GNU_SOURCE | |
305 | #include <sys/syscall.h> | |
306 | #include <unistd.h> | |
307 | #include <linux/fs.h> | |
308 | #include <linux/fsmap.h> | |
309 | ], [ | |
310 | unsigned long x = FS_IOC_GETFSMAP; | |
311 | struct fsmap_head fh; | |
312 | ], have_getfsmap=yes | |
313 | AC_MSG_RESULT(yes), | |
314 | AC_MSG_RESULT(no)) | |
315 | AC_SUBST(have_getfsmap) | |
316 | ]) | |
ce9adab0 JM |
317 | |
318 | AC_DEFUN([AC_HAVE_STATFS_FLAGS], | |
319 | [ | |
320 | AC_CHECK_TYPE(struct statfs, | |
321 | [ | |
322 | AC_CHECK_MEMBER(struct statfs.f_flags, | |
323 | have_statfs_flags=yes,, | |
324 | [#include <sys/vfs.h>] | |
325 | ) | |
326 | ],, | |
327 | [#include <sys/vfs.h>] | |
328 | ) | |
329 | AC_SUBST(have_statfs_flags) | |
330 | ]) |