2 # Check if we have a working fadvise system call
4 AC_DEFUN([AC_HAVE_FADVISE],
5 [ AC_MSG_CHECKING([for fadvise ])
10 posix_fadvise(0, 1, 0, POSIX_FADV_NORMAL);
14 AC_SUBST(have_fadvise)
18 # Check if we have a working madvise system call
20 AC_DEFUN([AC_HAVE_MADVISE],
21 [ AC_MSG_CHECKING([for madvise ])
26 posix_madvise(0, 0, MADV_NORMAL);
30 AC_SUBST(have_madvise)
34 # Check if we have a working mincore system call
36 AC_DEFUN([AC_HAVE_MINCORE],
37 [ AC_MSG_CHECKING([for mincore ])
46 AC_SUBST(have_mincore)
50 # Check if we have a working sendfile system call
52 AC_DEFUN([AC_HAVE_SENDFILE],
53 [ AC_MSG_CHECKING([for sendfile ])
56 #include <sys/sendfile.h>
62 AC_SUBST(have_sendfile)
66 # Check if we have a getmntent libc call (IRIX, Linux)
68 AC_DEFUN([AC_HAVE_GETMNTENT],
69 [ AC_MSG_CHECKING([for getmntent ])
78 AC_SUBST(have_getmntent)
82 # Check if we have a getmntinfo libc call (FreeBSD, Mac OS X)
84 AC_DEFUN([AC_HAVE_GETMNTINFO],
85 [ AC_MSG_CHECKING([for getmntinfo ])
87 #include <sys/param.h>
88 #include <sys/ucred.h>
89 #include <sys/mount.h>
92 ], have_getmntinfo=yes
95 AC_SUBST(have_getmntinfo)
99 # Check if we have a fallocate libc call (Linux)
101 AC_DEFUN([AC_HAVE_FALLOCATE],
102 [ AC_MSG_CHECKING([for fallocate])
106 #include <linux/falloc.h>
108 fallocate(0, 0, 0, 0);
109 ], have_fallocate=yes
112 AC_SUBST(have_fallocate)
116 # Check if we have the fiemap ioctl (Linux)
118 AC_DEFUN([AC_HAVE_FIEMAP],
119 [ AC_MSG_CHECKING([for fiemap])
122 #include <linux/fs.h>
123 #include <linux/fiemap.h>
125 struct fiemap *fiemap;
126 ioctl(0, FS_IOC_FIEMAP, (unsigned long)fiemap);
130 AC_SUBST(have_fiemap)
134 # Check if we have a preadv libc call (Linux)
136 AC_DEFUN([AC_HAVE_PREADV],
137 [ AC_MSG_CHECKING([for preadv])
140 #define _DEFAULT_SOURCE
147 AC_SUBST(have_preadv)
151 # Check if we have a pwritev2 libc call (Linux)
153 AC_DEFUN([AC_HAVE_PWRITEV2],
154 [ AC_MSG_CHECKING([for pwritev2])
159 pwritev2(0, 0, 0, 0, 0);
163 AC_SUBST(have_pwritev2)
167 # Check if we have a copy_file_range system call (Linux)
169 AC_DEFUN([AC_HAVE_COPY_FILE_RANGE],
170 [ AC_MSG_CHECKING([for copy_file_range])
173 #include <sys/syscall.h>
176 syscall(__NR_copy_file_range, 0, 0, 0, 0, 0, 0);
177 ], have_copy_file_range=yes
180 AC_SUBST(have_copy_file_range)
184 # Check if we have a sync_file_range libc call (Linux)
186 AC_DEFUN([AC_HAVE_SYNC_FILE_RANGE],
187 [ AC_MSG_CHECKING([for sync_file_range])
192 sync_file_range(0, 0, 0, 0);
193 ], have_sync_file_range=yes
196 AC_SUBST(have_sync_file_range)
200 # Check if we have a syncfs libc call (Linux)
202 AC_DEFUN([AC_HAVE_SYNCFS],
203 [ AC_MSG_CHECKING([for syncfs])
212 AC_SUBST(have_syncfs)
216 # Check if we have a readdir libc call
218 AC_DEFUN([AC_HAVE_READDIR],
219 [ AC_MSG_CHECKING([for readdir])
227 AC_SUBST(have_readdir)
231 # Check if we have a flc call (Mac OS X)
233 AC_DEFUN([AC_HAVE_FLS],
234 [ AC_CHECK_DECL([fls],
237 [#include <string.h>]
243 # Check if we have a fsetxattr call (Mac OS X)
245 AC_DEFUN([AC_HAVE_FSETXATTR],
246 [ AC_CHECK_DECL([fsetxattr],
249 [#include <sys/types.h>
250 #include <attr/xattr.h>]
252 AC_SUBST(have_fsetxattr)
256 # Check if there is mntent.h
258 AC_DEFUN([AC_HAVE_MNTENT],
259 [ AC_CHECK_HEADERS(mntent.h,
261 AC_SUBST(have_mntent)
265 # Check if we have a mremap call (not on Mac OS X)
267 AC_DEFUN([AC_HAVE_MREMAP],
268 [ AC_CHECK_DECL([mremap],
272 #include <sys/mman.h>]
274 AC_SUBST(have_mremap)
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.
283 AC_DEFUN([AC_NEED_INTERNAL_FSXATTR],
285 AC_CHECK_TYPE(struct fsxattr,
287 AC_CHECK_MEMBER(struct fsxattr.fsx_cowextsize,
289 need_internal_fsxattr=yes,
290 [#include <linux/fs.h>]
293 [#include <linux/fs.h>]
295 AC_SUBST(need_internal_fsxattr)
299 # Check if we have a FS_IOC_GETFSMAP ioctl (Linux)
301 AC_DEFUN([AC_HAVE_GETFSMAP],
302 [ AC_MSG_CHECKING([for GETFSMAP])
305 #include <sys/syscall.h>
307 #include <linux/fs.h>
308 #include <linux/fsmap.h>
310 unsigned long x = FS_IOC_GETFSMAP;
311 struct fsmap_head fh;
315 AC_SUBST(have_getfsmap)