]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - m4/package_libcdev.m4
xfs_io: configure tests for preadv/pwritev & sync_file_range
[thirdparty/xfsprogs-dev.git] / m4 / package_libcdev.m4
1 #
2 # Check if we have a working fadvise system call
3 #
4 AC_DEFUN([AC_HAVE_FADVISE],
5 [ AC_MSG_CHECKING([for fadvise ])
6 AC_TRY_COMPILE([
7 #define _GNU_SOURCE
8 #define _FILE_OFFSET_BITS 64
9 #include <fcntl.h>
10 ], [
11 posix_fadvise(0, 1, 0, POSIX_FADV_NORMAL);
12 ], have_fadvise=yes
13 AC_MSG_RESULT(yes),
14 AC_MSG_RESULT(no))
15 AC_SUBST(have_fadvise)
16 ])
17
18 #
19 # Check if we have a working madvise system call
20 #
21 AC_DEFUN([AC_HAVE_MADVISE],
22 [ AC_MSG_CHECKING([for madvise ])
23 AC_TRY_COMPILE([
24 #define _GNU_SOURCE
25 #define _FILE_OFFSET_BITS 64
26 #include <sys/mman.h>
27 ], [
28 posix_madvise(0, 0, MADV_NORMAL);
29 ], have_madvise=yes
30 AC_MSG_RESULT(yes),
31 AC_MSG_RESULT(no))
32 AC_SUBST(have_madvise)
33 ])
34
35 #
36 # Check if we have a working mincore system call
37 #
38 AC_DEFUN([AC_HAVE_MINCORE],
39 [ AC_MSG_CHECKING([for mincore ])
40 AC_TRY_COMPILE([
41 #define _GNU_SOURCE
42 #define _FILE_OFFSET_BITS 64
43 #include <sys/mman.h>
44 ], [
45 mincore(0, 0, 0);
46 ], have_mincore=yes
47 AC_MSG_RESULT(yes),
48 AC_MSG_RESULT(no))
49 AC_SUBST(have_mincore)
50 ])
51
52 #
53 # Check if we have a working sendfile system call
54 #
55 AC_DEFUN([AC_HAVE_SENDFILE],
56 [ AC_MSG_CHECKING([for sendfile ])
57 AC_TRY_COMPILE([
58 #define _GNU_SOURCE
59 #define _FILE_OFFSET_BITS 64
60 #include <sys/sendfile.h>
61 ], [
62 sendfile(0, 0, 0, 0);
63 ], have_sendfile=yes
64 AC_MSG_RESULT(yes),
65 AC_MSG_RESULT(no))
66 AC_SUBST(have_sendfile)
67 ])
68
69 #
70 # Check if we have a getmntent libc call (IRIX, Linux)
71 #
72 AC_DEFUN([AC_HAVE_GETMNTENT],
73 [ AC_MSG_CHECKING([for getmntent ])
74 AC_TRY_COMPILE([
75 #include <stdio.h>
76 #include <mntent.h>
77 ], [
78 getmntent(0);
79 ], have_getmntent=yes
80 AC_MSG_RESULT(yes),
81 AC_MSG_RESULT(no))
82 AC_SUBST(have_getmntent)
83 ])
84
85 #
86 # Check if we have a getmntinfo libc call (FreeBSD, Mac OS X)
87 #
88 AC_DEFUN([AC_HAVE_GETMNTINFO],
89 [ AC_MSG_CHECKING([for getmntinfo ])
90 AC_TRY_COMPILE([
91 #include <sys/param.h>
92 #include <sys/ucred.h>
93 #include <sys/mount.h>
94 ], [
95 getmntinfo(0, 0);
96 ], have_getmntinfo=yes
97 AC_MSG_RESULT(yes),
98 AC_MSG_RESULT(no))
99 AC_SUBST(have_getmntinfo)
100 ])
101
102 #
103 # Check if we have a fallocate libc call (Linux)
104 #
105 AC_DEFUN([AC_HAVE_FALLOCATE],
106 [ AC_MSG_CHECKING([for fallocate])
107 AC_TRY_LINK([
108 #define _GNU_SOURCE
109 #define _FILE_OFFSET_BITS 64
110 #include <fcntl.h>
111 #include <linux/falloc.h>
112 ], [
113 fallocate(0, 0, 0, 0);
114 ], have_fallocate=yes
115 AC_MSG_RESULT(yes),
116 AC_MSG_RESULT(no))
117 AC_SUBST(have_fallocate)
118 ])
119
120 #
121 # Check if we have the fiemap ioctl (Linux)
122 #
123 AC_DEFUN([AC_HAVE_FIEMAP],
124 [ AC_MSG_CHECKING([for fiemap])
125 AC_TRY_LINK([
126 #define _GNU_SOURCE
127 #define _FILE_OFFSET_BITS 64
128 #include <linux/fs.h>
129 #include <linux/fiemap.h>
130 ], [
131 struct fiemap *fiemap;
132 ioctl(0, FS_IOC_FIEMAP, (unsigned long)fiemap);
133 ], have_fiemap=yes
134 AC_MSG_RESULT(yes),
135 AC_MSG_RESULT(no))
136 AC_SUBST(have_fiemap)
137 ])
138
139 #
140 # Check if we have a preadv libc call (Linux)
141 #
142 AC_DEFUN([AC_HAVE_PREADV],
143 [ AC_MSG_CHECKING([for preadv])
144 AC_TRY_LINK([
145 #define _FILE_OFFSET_BITS 64
146 #define _BSD_SOURCE
147 #include <sys/uio.h>
148 ], [
149 preadv(0, 0, 0, 0);
150 ], have_preadv=yes
151 AC_MSG_RESULT(yes),
152 AC_MSG_RESULT(no))
153 AC_SUBST(have_preadv)
154 ])
155
156 #
157 # Check if we have a sync_file_range libc call (Linux)
158 #
159 AC_DEFUN([AC_HAVE_SYNC_FILE_RANGE],
160 [ AC_MSG_CHECKING([for sync_file_range])
161 AC_TRY_LINK([
162 #define _GNU_SOURCE
163 #define _FILE_OFFSET_BITS 64
164 #include <fcntl.h>
165 ], [
166 sync_file_range(0, 0, 0, 0);
167 ], have_sync_file_range=yes
168 AC_MSG_RESULT(yes),
169 AC_MSG_RESULT(no))
170 AC_SUBST(have_sync_file_range)
171 ])
172