]>
Commit | Line | Data |
---|---|---|
c5deeac9 GR |
1 | # |
2 | # Check if we have a pwritev2 libc call (Linux) | |
3 | # | |
4 | AC_DEFUN([AC_HAVE_PWRITEV2], | |
5 | [ AC_MSG_CHECKING([for pwritev2]) | |
69d66277 DC |
6 | AC_LINK_IFELSE( |
7 | [ AC_LANG_PROGRAM([[ | |
d6642ab8 | 8 | #define _GNU_SOURCE |
c5deeac9 | 9 | #include <sys/uio.h> |
69d66277 DC |
10 | ]], [[ |
11 | pwritev2(0, 0, 0, 0, 0); | |
12 | ]]) | |
c5deeac9 GR |
13 | ], have_pwritev2=yes |
14 | AC_MSG_RESULT(yes), | |
15 | AC_MSG_RESULT(no)) | |
16 | AC_SUBST(have_pwritev2) | |
17 | ]) | |
18 | ||
628e112a AS |
19 | # |
20 | # Check if we have a copy_file_range system call (Linux) | |
21 | # | |
22 | AC_DEFUN([AC_HAVE_COPY_FILE_RANGE], | |
23 | [ AC_MSG_CHECKING([for copy_file_range]) | |
69d66277 DC |
24 | AC_LINK_IFELSE( |
25 | [ AC_LANG_PROGRAM([[ | |
628e112a AS |
26 | #define _GNU_SOURCE |
27 | #include <sys/syscall.h> | |
28 | #include <unistd.h> | |
69d66277 DC |
29 | ]], [[ |
30 | syscall(__NR_copy_file_range, 0, 0, 0, 0, 0, 0); | |
31 | ]]) | |
628e112a AS |
32 | ], have_copy_file_range=yes |
33 | AC_MSG_RESULT(yes), | |
34 | AC_MSG_RESULT(no)) | |
35 | AC_SUBST(have_copy_file_range) | |
36 | ]) | |
37 | ||
6529e656 DW |
38 | # |
39 | # Check if we need to override the system struct fsxattr with | |
40 | # the internal definition. This /only/ happens if the system | |
41 | # actually defines struct fsxattr /and/ the system definition | |
42 | # is missing certain fields. | |
43 | # | |
44 | AC_DEFUN([AC_NEED_INTERNAL_FSXATTR], | |
45 | [ | |
1e51132f DW |
46 | AC_CHECK_TYPE(struct fsxattr, |
47 | [ | |
48 | AC_CHECK_MEMBER(struct fsxattr.fsx_cowextsize, | |
49 | , | |
50 | need_internal_fsxattr=yes, | |
51 | [#include <linux/fs.h>] | |
52 | ) | |
53 | ],, | |
54 | [#include <linux/fs.h>] | |
55 | ) | |
6529e656 DW |
56 | AC_SUBST(need_internal_fsxattr) |
57 | ]) | |
71956d72 | 58 | |
dfe209d8 EB |
59 | # |
60 | # Check if we need to override the system struct fscrypt_add_key_arg | |
61 | # with the internal definition. This /only/ happens if the system | |
62 | # actually defines struct fscrypt_add_key_arg /and/ the system | |
63 | # definition is missing certain fields. | |
64 | # | |
65 | AC_DEFUN([AC_NEED_INTERNAL_FSCRYPT_ADD_KEY_ARG], | |
66 | [ | |
67 | AC_CHECK_TYPE(struct fscrypt_add_key_arg, | |
68 | [ | |
69 | AC_CHECK_MEMBER(struct fscrypt_add_key_arg.key_id, | |
70 | , | |
71 | need_internal_fscrypt_add_key_arg=yes, | |
72 | [#include <linux/fs.h>] | |
73 | ) | |
74 | ],, | |
75 | [#include <linux/fs.h>] | |
76 | ) | |
77 | AC_SUBST(need_internal_fscrypt_add_key_arg) | |
78 | ]) | |
79 | ||
e97caf71 EB |
80 | # |
81 | # Check if we need to override the system struct fscrypt_policy_v2 | |
82 | # with the internal definition. This /only/ happens if the system | |
83 | # actually defines struct fscrypt_policy_v2 /and/ the system | |
84 | # definition is missing certain fields. | |
85 | # | |
86 | AC_DEFUN([AC_NEED_INTERNAL_FSCRYPT_POLICY_V2], | |
87 | [ | |
88 | AC_CHECK_TYPE(struct fscrypt_policy_v2, | |
89 | [ | |
90 | AC_CHECK_MEMBER(struct fscrypt_policy_v2.log2_data_unit_size, | |
91 | , | |
92 | need_internal_fscrypt_policy_v2=yes, | |
93 | [#include <linux/fs.h>] | |
94 | ) | |
95 | ],, | |
96 | [#include <linux/fs.h>] | |
97 | ) | |
98 | AC_SUBST(need_internal_fscrypt_policy_v2) | |
99 | ]) | |
100 | ||
71956d72 DW |
101 | # |
102 | # Check if we have a FS_IOC_GETFSMAP ioctl (Linux) | |
103 | # | |
104 | AC_DEFUN([AC_HAVE_GETFSMAP], | |
105 | [ AC_MSG_CHECKING([for GETFSMAP]) | |
69d66277 DC |
106 | AC_LINK_IFELSE( |
107 | [ AC_LANG_PROGRAM([[ | |
71956d72 DW |
108 | #define _GNU_SOURCE |
109 | #include <sys/syscall.h> | |
110 | #include <unistd.h> | |
111 | #include <linux/fs.h> | |
112 | #include <linux/fsmap.h> | |
69d66277 DC |
113 | ]], [[ |
114 | unsigned long x = FS_IOC_GETFSMAP; | |
115 | struct fsmap_head fh; | |
116 | ]]) | |
71956d72 DW |
117 | ], have_getfsmap=yes |
118 | AC_MSG_RESULT(yes), | |
119 | AC_MSG_RESULT(no)) | |
120 | AC_SUBST(have_getfsmap) | |
121 | ]) | |
ce9adab0 | 122 | |
dad79683 RZ |
123 | # |
124 | # Check if we have MAP_SYNC defines (Linux) | |
125 | # | |
126 | AC_DEFUN([AC_HAVE_MAP_SYNC], | |
127 | [ AC_MSG_CHECKING([for MAP_SYNC]) | |
69d66277 DC |
128 | AC_COMPILE_IFELSE( |
129 | [ AC_LANG_PROGRAM([[ | |
28965957 | 130 | #include <sys/mman.h> |
69d66277 DC |
131 | ]], [[ |
132 | int flags = MAP_SYNC | MAP_SHARED_VALIDATE; | |
133 | ]]) | |
dad79683 RZ |
134 | ], have_map_sync=yes |
135 | AC_MSG_RESULT(yes), | |
136 | AC_MSG_RESULT(no)) | |
137 | AC_SUBST(have_map_sync) | |
138 | ]) | |
173a0283 DW |
139 | |
140 | # | |
141 | # Check if we have a mallinfo libc call | |
142 | # | |
143 | AC_DEFUN([AC_HAVE_MALLINFO], | |
144 | [ AC_MSG_CHECKING([for mallinfo ]) | |
69d66277 DC |
145 | AC_COMPILE_IFELSE( |
146 | [ AC_LANG_PROGRAM([[ | |
173a0283 | 147 | #include <malloc.h> |
69d66277 DC |
148 | ]], [[ |
149 | struct mallinfo test; | |
173a0283 | 150 | |
69d66277 DC |
151 | test.arena = 0; test.hblkhd = 0; test.uordblks = 0; test.fordblks = 0; |
152 | test = mallinfo(); | |
153 | ]]) | |
173a0283 DW |
154 | ], have_mallinfo=yes |
155 | AC_MSG_RESULT(yes), | |
156 | AC_MSG_RESULT(no)) | |
157 | AC_SUBST(have_mallinfo) | |
158 | ]) | |
b364a9c0 | 159 | |
c74f0468 DW |
160 | # |
161 | # Check if we have a mallinfo2 libc call | |
162 | # | |
163 | AC_DEFUN([AC_HAVE_MALLINFO2], | |
164 | [ AC_MSG_CHECKING([for mallinfo2 ]) | |
1a35c8df DW |
165 | AC_COMPILE_IFELSE( |
166 | [ AC_LANG_PROGRAM([[ | |
c74f0468 | 167 | #include <malloc.h> |
1a35c8df DW |
168 | ]], [[ |
169 | struct mallinfo2 test; | |
c74f0468 | 170 | |
1a35c8df DW |
171 | test.arena = 0; test.hblkhd = 0; test.uordblks = 0; test.fordblks = 0; |
172 | test = mallinfo2(); | |
173 | ]]) | |
c74f0468 DW |
174 | ], have_mallinfo2=yes |
175 | AC_MSG_RESULT(yes), | |
176 | AC_MSG_RESULT(no)) | |
177 | AC_SUBST(have_mallinfo2) | |
178 | ]) | |
179 | ||
b364a9c0 DW |
180 | # |
181 | # Check if we have a openat call | |
182 | # | |
183 | AC_DEFUN([AC_HAVE_OPENAT], | |
184 | [ AC_CHECK_DECL([openat], | |
185 | have_openat=yes, | |
186 | [], | |
187 | [#include <sys/types.h> | |
188 | #include <sys/stat.h> | |
189 | #include <fcntl.h>] | |
190 | ) | |
191 | AC_SUBST(have_openat) | |
192 | ]) | |
193 | ||
194 | # | |
195 | # Check if we have a fstatat call | |
196 | # | |
197 | AC_DEFUN([AC_HAVE_FSTATAT], | |
198 | [ AC_CHECK_DECL([fstatat], | |
199 | have_fstatat=yes, | |
200 | [], | |
201 | [#define _GNU_SOURCE | |
202 | #include <sys/types.h> | |
203 | #include <sys/stat.h> | |
204 | #include <unistd.h>]) | |
205 | AC_SUBST(have_fstatat) | |
206 | ]) | |
03c0cd8f DW |
207 | |
208 | # | |
209 | # Check if we have the SG_IO ioctl | |
210 | # | |
211 | AC_DEFUN([AC_HAVE_SG_IO], | |
212 | [ AC_MSG_CHECKING([for struct sg_io_hdr ]) | |
69d66277 DC |
213 | AC_COMPILE_IFELSE( |
214 | [ AC_LANG_PROGRAM([[ | |
215 | #include <scsi/sg.h> | |
d6642ab8 | 216 | #include <sys/ioctl.h> |
69d66277 DC |
217 | ]], [[ |
218 | struct sg_io_hdr hdr; | |
219 | ioctl(0, SG_IO, &hdr); | |
220 | ]]) | |
03c0cd8f DW |
221 | ], have_sg_io=yes |
222 | AC_MSG_RESULT(yes), | |
223 | AC_MSG_RESULT(no)) | |
224 | AC_SUBST(have_sg_io) | |
225 | ]) | |
226 | ||
227 | # | |
228 | # Check if we have the HDIO_GETGEO ioctl | |
229 | # | |
230 | AC_DEFUN([AC_HAVE_HDIO_GETGEO], | |
231 | [ AC_MSG_CHECKING([for struct hd_geometry ]) | |
69d66277 DC |
232 | AC_COMPILE_IFELSE( |
233 | [ AC_LANG_PROGRAM([[ | |
d6642ab8 AS |
234 | #include <linux/hdreg.h> |
235 | #include <sys/ioctl.h> | |
69d66277 DC |
236 | ]], [[ |
237 | struct hd_geometry hdr; | |
238 | ioctl(0, HDIO_GETGEO, &hdr); | |
239 | ]]) | |
03c0cd8f DW |
240 | ], have_hdio_getgeo=yes |
241 | AC_MSG_RESULT(yes), | |
242 | AC_MSG_RESULT(no)) | |
243 | AC_SUBST(have_hdio_getgeo) | |
244 | ]) | |
1b0adc71 | 245 | |
e61f1552 DW |
246 | AC_DEFUN([AC_PACKAGE_CHECK_LTO], |
247 | [ AC_MSG_CHECKING([if C compiler supports LTO]) | |
248 | OLD_CFLAGS="$CFLAGS" | |
249 | OLD_LDFLAGS="$LDFLAGS" | |
250 | LTO_FLAGS="-flto -ffat-lto-objects" | |
251 | CFLAGS="$CFLAGS $LTO_FLAGS" | |
252 | LDFLAGS="$LDFLAGS $LTO_FLAGS" | |
253 | AC_LINK_IFELSE([AC_LANG_PROGRAM([])], | |
254 | [AC_MSG_RESULT([yes])] | |
255 | [lto_cflags=$LTO_FLAGS] | |
256 | [lto_ldflags=$LTO_FLAGS] | |
257 | [AC_PATH_PROG(gcc_ar, gcc-ar,,)] | |
258 | [AC_PATH_PROG(gcc_ranlib, gcc-ranlib,,)], | |
259 | [AC_MSG_RESULT([no])]) | |
260 | if test -x "$gcc_ar" && test -x "$gcc_ranlib"; then | |
261 | have_lto=yes | |
262 | fi | |
263 | CFLAGS="${OLD_CFLAGS}" | |
264 | LDFLAGS="${OLD_LDFLAGS}" | |
265 | AC_SUBST(gcc_ar) | |
266 | AC_SUBST(gcc_ranlib) | |
267 | AC_SUBST(have_lto) | |
268 | AC_SUBST(lto_cflags) | |
269 | AC_SUBST(lto_ldflags) | |
270 | ]) |