]>
Commit | Line | Data |
---|---|---|
c9c0d073 | 1 | dnl # |
fc0c72b1 | 2 | dnl # Default ZFS kernel configuration |
c9c0d073 BB |
3 | dnl # |
4 | AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [ | |
9f0a21e6 MM |
5 | AM_COND_IF([BUILD_LINUX], [ |
6 | dnl # Setup the kernel build environment. | |
7 | ZFS_AC_KERNEL | |
8 | ZFS_AC_QAT | |
608f8749 | 9 | |
9f0a21e6 | 10 | dnl # Sanity checks for module building and CONFIG_* defines |
9f0a21e6 | 11 | ZFS_AC_KERNEL_CONFIG_DEFINED |
a0dfd98a | 12 | ZFS_AC_MODULE_SYMVERS |
608f8749 | 13 | |
9f0a21e6 MM |
14 | dnl # Sequential ZFS_LINUX_TRY_COMPILE tests |
15 | ZFS_AC_KERNEL_FPU_HEADER | |
8c7d604c | 16 | ZFS_AC_KERNEL_OBJTOOL_HEADER |
9f0a21e6 MM |
17 | ZFS_AC_KERNEL_WAIT_QUEUE_ENTRY_T |
18 | ZFS_AC_KERNEL_MISC_MINOR | |
19 | ZFS_AC_KERNEL_DECLARE_EVENT_CLASS | |
608f8749 | 20 | |
9f0a21e6 MM |
21 | dnl # Parallel ZFS_LINUX_TEST_SRC / ZFS_LINUX_TEST_RESULT tests |
22 | ZFS_AC_KERNEL_TEST_SRC | |
23 | ZFS_AC_KERNEL_TEST_RESULT | |
608f8749 | 24 | |
9f0a21e6 MM |
25 | AS_IF([test "$LINUX_OBJ" != "$LINUX"], [ |
26 | KERNEL_MAKE="$KERNEL_MAKE O=$LINUX_OBJ" | |
27 | ]) | |
608f8749 | 28 | |
9f0a21e6 MM |
29 | AC_SUBST(KERNEL_MAKE) |
30 | ]) | |
608f8749 BB |
31 | ]) |
32 | ||
33 | dnl # | |
34 | dnl # Generate and compile all of the kernel API test cases to determine | |
35 | dnl # which interfaces are available. By invoking the kernel build system | |
36 | dnl # only once the compilation can be done in parallel significantly | |
37 | dnl # speeding up the process. | |
38 | dnl # | |
39 | AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [ | |
40 | ZFS_AC_KERNEL_SRC_OBJTOOL | |
41 | ZFS_AC_KERNEL_SRC_GLOBAL_PAGE_STATE | |
42 | ZFS_AC_KERNEL_SRC_ACCESS_OK_TYPE | |
608f8749 BB |
43 | ZFS_AC_KERNEL_SRC_PDE_DATA |
44 | ZFS_AC_KERNEL_SRC_FALLOCATE | |
320f0c60 FY |
45 | ZFS_AC_KERNEL_SRC_FADVISE |
46 | ZFS_AC_KERNEL_SRC_GENERIC_FADVISE | |
608f8749 BB |
47 | ZFS_AC_KERNEL_SRC_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE |
48 | ZFS_AC_KERNEL_SRC_RWSEM | |
49 | ZFS_AC_KERNEL_SRC_SCHED | |
50 | ZFS_AC_KERNEL_SRC_USLEEP_RANGE | |
51 | ZFS_AC_KERNEL_SRC_KMEM_CACHE | |
66955885 | 52 | ZFS_AC_KERNEL_SRC_KVMALLOC |
080102a1 | 53 | ZFS_AC_KERNEL_SRC_VMALLOC_PAGE_KERNEL |
608f8749 BB |
54 | ZFS_AC_KERNEL_SRC_WAIT |
55 | ZFS_AC_KERNEL_SRC_INODE_TIMES | |
56 | ZFS_AC_KERNEL_SRC_INODE_LOCK | |
57 | ZFS_AC_KERNEL_SRC_GROUP_INFO_GID | |
58 | ZFS_AC_KERNEL_SRC_RW | |
59 | ZFS_AC_KERNEL_SRC_TIMER_SETUP | |
608f8749 | 60 | ZFS_AC_KERNEL_SRC_SUPER_USER_NS |
0dd73648 | 61 | ZFS_AC_KERNEL_SRC_PROC_OPERATIONS |
608f8749 | 62 | ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS |
066e8252 BB |
63 | ZFS_AC_KERNEL_SRC_BIO |
64 | ZFS_AC_KERNEL_SRC_BLKDEV | |
65 | ZFS_AC_KERNEL_SRC_BLK_QUEUE | |
026f126b | 66 | ZFS_AC_KERNEL_SRC_GENHD_FLAGS |
19697e45 | 67 | ZFS_AC_KERNEL_SRC_REVALIDATE_DISK |
608f8749 BB |
68 | ZFS_AC_KERNEL_SRC_GET_DISK_RO |
69 | ZFS_AC_KERNEL_SRC_GENERIC_READLINK_GLOBAL | |
70 | ZFS_AC_KERNEL_SRC_DISCARD_GRANULARITY | |
71 | ZFS_AC_KERNEL_SRC_INODE_OWNER_OR_CAPABLE | |
72 | ZFS_AC_KERNEL_SRC_XATTR | |
73 | ZFS_AC_KERNEL_SRC_ACL | |
d4dc53da | 74 | ZFS_AC_KERNEL_SRC_INODE_SETATTR |
608f8749 BB |
75 | ZFS_AC_KERNEL_SRC_INODE_GETATTR |
76 | ZFS_AC_KERNEL_SRC_INODE_SET_FLAGS | |
77 | ZFS_AC_KERNEL_SRC_INODE_SET_IVERSION | |
78 | ZFS_AC_KERNEL_SRC_SHOW_OPTIONS | |
79 | ZFS_AC_KERNEL_SRC_FILE_INODE | |
80 | ZFS_AC_KERNEL_SRC_FILE_DENTRY | |
81 | ZFS_AC_KERNEL_SRC_FSYNC | |
82 | ZFS_AC_KERNEL_SRC_AIO_FSYNC | |
83 | ZFS_AC_KERNEL_SRC_EVICT_INODE | |
84 | ZFS_AC_KERNEL_SRC_DIRTY_INODE | |
85 | ZFS_AC_KERNEL_SRC_SHRINKER | |
e2a82961 | 86 | ZFS_AC_KERNEL_SRC_MKDIR |
066e8252 | 87 | ZFS_AC_KERNEL_SRC_LOOKUP_FLAGS |
e2a82961 | 88 | ZFS_AC_KERNEL_SRC_CREATE |
eebfd28e | 89 | ZFS_AC_KERNEL_SRC_PERMISSION |
608f8749 BB |
90 | ZFS_AC_KERNEL_SRC_GET_LINK |
91 | ZFS_AC_KERNEL_SRC_PUT_LINK | |
92 | ZFS_AC_KERNEL_SRC_TMPFILE | |
608f8749 BB |
93 | ZFS_AC_KERNEL_SRC_AUTOMOUNT |
94 | ZFS_AC_KERNEL_SRC_ENCODE_FH_WITH_INODE | |
95 | ZFS_AC_KERNEL_SRC_COMMIT_METADATA | |
96 | ZFS_AC_KERNEL_SRC_CLEAR_INODE | |
97 | ZFS_AC_KERNEL_SRC_SETATTR_PREPARE | |
98 | ZFS_AC_KERNEL_SRC_INSERT_INODE_LOCKED | |
99 | ZFS_AC_KERNEL_SRC_DENTRY | |
86db35c4 | 100 | ZFS_AC_KERNEL_SRC_DENTRY_ALIAS_D_U |
608f8749 BB |
101 | ZFS_AC_KERNEL_SRC_TRUNCATE_SETSIZE |
102 | ZFS_AC_KERNEL_SRC_SECURITY_INODE | |
103 | ZFS_AC_KERNEL_SRC_FST_MOUNT | |
104 | ZFS_AC_KERNEL_SRC_BDI | |
105 | ZFS_AC_KERNEL_SRC_SET_NLINK | |
608f8749 BB |
106 | ZFS_AC_KERNEL_SRC_SGET |
107 | ZFS_AC_KERNEL_SRC_LSEEK_EXECUTE | |
7dde17e8 | 108 | ZFS_AC_KERNEL_SRC_VFS_FILEMAP_DIRTY_FOLIO |
c2c2e7bb | 109 | ZFS_AC_KERNEL_SRC_VFS_READ_FOLIO |
608f8749 BB |
110 | ZFS_AC_KERNEL_SRC_VFS_GETATTR |
111 | ZFS_AC_KERNEL_SRC_VFS_FSYNC_2ARGS | |
112 | ZFS_AC_KERNEL_SRC_VFS_ITERATE | |
113 | ZFS_AC_KERNEL_SRC_VFS_DIRECT_IO | |
b9d98453 BB |
114 | ZFS_AC_KERNEL_SRC_VFS_READPAGES |
115 | ZFS_AC_KERNEL_SRC_VFS_SET_PAGE_DIRTY_NOBUFFERS | |
608f8749 BB |
116 | ZFS_AC_KERNEL_SRC_VFS_RW_ITERATE |
117 | ZFS_AC_KERNEL_SRC_VFS_GENERIC_WRITE_CHECKS | |
1c2358c1 | 118 | ZFS_AC_KERNEL_SRC_VFS_IOV_ITER |
5a35c68b RN |
119 | ZFS_AC_KERNEL_SRC_VFS_COPY_FILE_RANGE |
120 | ZFS_AC_KERNEL_SRC_VFS_GENERIC_COPY_FILE_RANGE | |
121 | ZFS_AC_KERNEL_SRC_VFS_REMAP_FILE_RANGE | |
122 | ZFS_AC_KERNEL_SRC_VFS_CLONE_FILE_RANGE | |
123 | ZFS_AC_KERNEL_SRC_VFS_DEDUPE_FILE_RANGE | |
6b0a4be5 | 124 | ZFS_AC_KERNEL_SRC_VFS_FILE_OPERATIONS_EXTEND |
608f8749 BB |
125 | ZFS_AC_KERNEL_SRC_KMAP_ATOMIC_ARGS |
126 | ZFS_AC_KERNEL_SRC_FOLLOW_DOWN_ONE | |
127 | ZFS_AC_KERNEL_SRC_MAKE_REQUEST_FN | |
128 | ZFS_AC_KERNEL_SRC_GENERIC_IO_ACCT | |
129 | ZFS_AC_KERNEL_SRC_FPU | |
130 | ZFS_AC_KERNEL_SRC_FMODE_T | |
131 | ZFS_AC_KERNEL_SRC_KUIDGID_T | |
132 | ZFS_AC_KERNEL_SRC_KUID_HELPERS | |
e2a82961 | 133 | ZFS_AC_KERNEL_SRC_RENAME |
608f8749 BB |
134 | ZFS_AC_KERNEL_SRC_CURRENT_TIME |
135 | ZFS_AC_KERNEL_SRC_USERNS_CAPABILITIES | |
136 | ZFS_AC_KERNEL_SRC_IN_COMPAT_SYSCALL | |
ff5587d6 | 137 | ZFS_AC_KERNEL_SRC_KTIME |
608f8749 BB |
138 | ZFS_AC_KERNEL_SRC_TOTALRAM_PAGES_FUNC |
139 | ZFS_AC_KERNEL_SRC_TOTALHIGH_PAGES | |
140 | ZFS_AC_KERNEL_SRC_KSTRTOUL | |
ec1fea45 | 141 | ZFS_AC_KERNEL_SRC_PERCPU |
60a4c7d2 | 142 | ZFS_AC_KERNEL_SRC_CPU_HOTPLUG |
d4dc53da | 143 | ZFS_AC_KERNEL_SRC_GENERIC_FILLATTR |
e2a82961 CK |
144 | ZFS_AC_KERNEL_SRC_MKNOD |
145 | ZFS_AC_KERNEL_SRC_SYMLINK | |
ffd6978e | 146 | ZFS_AC_KERNEL_SRC_BIO_MAX_SEGS |
414f7249 PD |
147 | ZFS_AC_KERNEL_SRC_SIGNAL_STOP |
148 | ZFS_AC_KERNEL_SRC_SIGINFO | |
0cdda2ed | 149 | ZFS_AC_KERNEL_SRC_SYSFS |
414f7249 | 150 | ZFS_AC_KERNEL_SRC_SET_SPECIAL_STATE |
a3588c68 | 151 | ZFS_AC_KERNEL_SRC_STANDALONE_LINUX_STDARG |
c0fb44c5 | 152 | ZFS_AC_KERNEL_SRC_PAGEMAP_FOLIO_WAIT_BIT |
12fa250d | 153 | ZFS_AC_KERNEL_SRC_ADD_DISK |
a9856574 | 154 | ZFS_AC_KERNEL_SRC_KTHREAD |
becc717f | 155 | ZFS_AC_KERNEL_SRC_ZERO_PAGE |
849c14e0 | 156 | ZFS_AC_KERNEL_SRC___COPY_FROM_USER_INATOMIC |
4ed5e250 | 157 | ZFS_AC_KERNEL_SRC_USER_NS_COMMON_INUM |
2a068a13 | 158 | ZFS_AC_KERNEL_SRC_IDMAP_MNT_API |
f224eddf | 159 | ZFS_AC_KERNEL_SRC_IATTR_VFSID |
3fc92adc | 160 | ZFS_AC_KERNEL_SRC_FILEMAP |
8eb2f260 | 161 | ZFS_AC_KERNEL_SRC_WRITEPAGE_T |
f8447cf2 | 162 | ZFS_AC_KERNEL_SRC_RECLAIMED |
b35374fd | 163 | ZFS_AC_KERNEL_SRC_REGISTER_SYSCTL_TABLE |
589f59b5 W |
164 | case "$host_cpu" in |
165 | powerpc*) | |
166 | ZFS_AC_KERNEL_SRC_CPU_HAS_FEATURE | |
167 | ZFS_AC_KERNEL_SRC_FLUSH_DCACHE_PAGE | |
168 | ;; | |
169 | esac | |
608f8749 BB |
170 | |
171 | AC_MSG_CHECKING([for available kernel interfaces]) | |
172 | ZFS_LINUX_TEST_COMPILE_ALL([kabi]) | |
173 | AC_MSG_RESULT([done]) | |
174 | ]) | |
175 | ||
176 | dnl # | |
177 | dnl # Check results of kernel interface tests. | |
178 | dnl # | |
179 | AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [ | |
180 | ZFS_AC_KERNEL_ACCESS_OK_TYPE | |
181 | ZFS_AC_KERNEL_GLOBAL_PAGE_STATE | |
650383f2 | 182 | ZFS_AC_KERNEL_OBJTOOL |
93ce2b4c | 183 | ZFS_AC_KERNEL_PDE_DATA |
93ce2b4c | 184 | ZFS_AC_KERNEL_FALLOCATE |
320f0c60 FY |
185 | ZFS_AC_KERNEL_FADVISE |
186 | ZFS_AC_KERNEL_GENERIC_FADVISE | |
93ce2b4c | 187 | ZFS_AC_KERNEL_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE |
608f8749 BB |
188 | ZFS_AC_KERNEL_RWSEM |
189 | ZFS_AC_KERNEL_SCHED | |
93ce2b4c | 190 | ZFS_AC_KERNEL_USLEEP_RANGE |
608f8749 | 191 | ZFS_AC_KERNEL_KMEM_CACHE |
66955885 | 192 | ZFS_AC_KERNEL_KVMALLOC |
080102a1 | 193 | ZFS_AC_KERNEL_VMALLOC_PAGE_KERNEL |
608f8749 | 194 | ZFS_AC_KERNEL_WAIT |
6413c95f | 195 | ZFS_AC_KERNEL_INODE_TIMES |
93ce2b4c BB |
196 | ZFS_AC_KERNEL_INODE_LOCK |
197 | ZFS_AC_KERNEL_GROUP_INFO_GID | |
608f8749 | 198 | ZFS_AC_KERNEL_RW |
8b8b44d0 | 199 | ZFS_AC_KERNEL_TIMER_SETUP |
938cfeb0 | 200 | ZFS_AC_KERNEL_SUPER_USER_NS |
0dd73648 | 201 | ZFS_AC_KERNEL_PROC_OPERATIONS |
608f8749 | 202 | ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS |
066e8252 BB |
203 | ZFS_AC_KERNEL_BIO |
204 | ZFS_AC_KERNEL_BLKDEV | |
205 | ZFS_AC_KERNEL_BLK_QUEUE | |
026f126b | 206 | ZFS_AC_KERNEL_GENHD_FLAGS |
19697e45 | 207 | ZFS_AC_KERNEL_REVALIDATE_DISK |
c9c0d073 | 208 | ZFS_AC_KERNEL_GET_DISK_RO |
a5e046ea | 209 | ZFS_AC_KERNEL_GENERIC_READLINK_GLOBAL |
ee5fd0bb | 210 | ZFS_AC_KERNEL_DISCARD_GRANULARITY |
023699cd | 211 | ZFS_AC_KERNEL_INODE_OWNER_OR_CAPABLE |
608f8749 BB |
212 | ZFS_AC_KERNEL_XATTR |
213 | ZFS_AC_KERNEL_ACL | |
d4dc53da | 214 | ZFS_AC_KERNEL_INODE_SETATTR |
608f8749 | 215 | ZFS_AC_KERNEL_INODE_GETATTR |
a5248129 | 216 | ZFS_AC_KERNEL_INODE_SET_FLAGS |
18f57327 | 217 | ZFS_AC_KERNEL_INODE_SET_IVERSION |
47621f3d | 218 | ZFS_AC_KERNEL_SHOW_OPTIONS |
534759fa | 219 | ZFS_AC_KERNEL_FILE_INODE |
d9c97ec0 | 220 | ZFS_AC_KERNEL_FILE_DENTRY |
adcd70bd | 221 | ZFS_AC_KERNEL_FSYNC |
7ca25051 | 222 | ZFS_AC_KERNEL_AIO_FSYNC |
608f8749 BB |
223 | ZFS_AC_KERNEL_EVICT_INODE |
224 | ZFS_AC_KERNEL_DIRTY_INODE | |
225 | ZFS_AC_KERNEL_SHRINKER | |
e2a82961 | 226 | ZFS_AC_KERNEL_MKDIR |
066e8252 | 227 | ZFS_AC_KERNEL_LOOKUP_FLAGS |
e2a82961 | 228 | ZFS_AC_KERNEL_CREATE |
eebfd28e | 229 | ZFS_AC_KERNEL_PERMISSION |
beeed459 | 230 | ZFS_AC_KERNEL_GET_LINK |
bd29109f | 231 | ZFS_AC_KERNEL_PUT_LINK |
ace1eae8 | 232 | ZFS_AC_KERNEL_TMPFILE |
ebe7e575 | 233 | ZFS_AC_KERNEL_AUTOMOUNT |
756c3e5a | 234 | ZFS_AC_KERNEL_ENCODE_FH_WITH_INODE |
393b44c7 | 235 | ZFS_AC_KERNEL_COMMIT_METADATA |
739a1a82 | 236 | ZFS_AC_KERNEL_CLEAR_INODE |
3b0ba3ba | 237 | ZFS_AC_KERNEL_SETATTR_PREPARE |
bdf4328b | 238 | ZFS_AC_KERNEL_INSERT_INODE_LOCKED |
608f8749 | 239 | ZFS_AC_KERNEL_DENTRY |
86db35c4 | 240 | ZFS_AC_KERNEL_DENTRY_ALIAS_D_U |
b3129792 | 241 | ZFS_AC_KERNEL_TRUNCATE_SETSIZE |
608f8749 | 242 | ZFS_AC_KERNEL_SECURITY_INODE |
93b43af1 | 243 | ZFS_AC_KERNEL_FST_MOUNT |
7dae2c81 | 244 | ZFS_AC_KERNEL_BDI |
28eb9213 | 245 | ZFS_AC_KERNEL_SET_NLINK |
608f8749 | 246 | ZFS_AC_KERNEL_SGET |
802e7b5f | 247 | ZFS_AC_KERNEL_LSEEK_EXECUTE |
7dde17e8 | 248 | ZFS_AC_KERNEL_VFS_FILEMAP_DIRTY_FOLIO |
c2c2e7bb | 249 | ZFS_AC_KERNEL_VFS_READ_FOLIO |
608f8749 BB |
250 | ZFS_AC_KERNEL_VFS_GETATTR |
251 | ZFS_AC_KERNEL_VFS_FSYNC_2ARGS | |
0f37d0c8 | 252 | ZFS_AC_KERNEL_VFS_ITERATE |
a584ef26 | 253 | ZFS_AC_KERNEL_VFS_DIRECT_IO |
b9d98453 BB |
254 | ZFS_AC_KERNEL_VFS_READPAGES |
255 | ZFS_AC_KERNEL_VFS_SET_PAGE_DIRTY_NOBUFFERS | |
608f8749 BB |
256 | ZFS_AC_KERNEL_VFS_RW_ITERATE |
257 | ZFS_AC_KERNEL_VFS_GENERIC_WRITE_CHECKS | |
1c2358c1 | 258 | ZFS_AC_KERNEL_VFS_IOV_ITER |
5a35c68b RN |
259 | ZFS_AC_KERNEL_VFS_COPY_FILE_RANGE |
260 | ZFS_AC_KERNEL_VFS_GENERIC_COPY_FILE_RANGE | |
261 | ZFS_AC_KERNEL_VFS_REMAP_FILE_RANGE | |
262 | ZFS_AC_KERNEL_VFS_CLONE_FILE_RANGE | |
263 | ZFS_AC_KERNEL_VFS_DEDUPE_FILE_RANGE | |
6b0a4be5 | 264 | ZFS_AC_KERNEL_VFS_FILE_OPERATIONS_EXTEND |
17888ae3 | 265 | ZFS_AC_KERNEL_KMAP_ATOMIC_ARGS |
278bee93 | 266 | ZFS_AC_KERNEL_FOLLOW_DOWN_ONE |
37f9dac5 | 267 | ZFS_AC_KERNEL_MAKE_REQUEST_FN |
608f8749 | 268 | ZFS_AC_KERNEL_GENERIC_IO_ACCT |
fc0c72b1 | 269 | ZFS_AC_KERNEL_FPU |
608f8749 BB |
270 | ZFS_AC_KERNEL_FMODE_T |
271 | ZFS_AC_KERNEL_KUIDGID_T | |
82a1b2d6 | 272 | ZFS_AC_KERNEL_KUID_HELPERS |
e2a82961 | 273 | ZFS_AC_KERNEL_RENAME |
2946a1a1 | 274 | ZFS_AC_KERNEL_CURRENT_TIME |
0e85048f | 275 | ZFS_AC_KERNEL_USERNS_CAPABILITIES |
e897a23e | 276 | ZFS_AC_KERNEL_IN_COMPAT_SYSCALL |
ff5587d6 | 277 | ZFS_AC_KERNEL_KTIME |
031cea17 | 278 | ZFS_AC_KERNEL_TOTALRAM_PAGES_FUNC |
de3e0b91 | 279 | ZFS_AC_KERNEL_TOTALHIGH_PAGES |
8708fd88 | 280 | ZFS_AC_KERNEL_KSTRTOUL |
ec1fea45 | 281 | ZFS_AC_KERNEL_PERCPU |
60a4c7d2 | 282 | ZFS_AC_KERNEL_CPU_HOTPLUG |
d4dc53da | 283 | ZFS_AC_KERNEL_GENERIC_FILLATTR |
e2a82961 CK |
284 | ZFS_AC_KERNEL_MKNOD |
285 | ZFS_AC_KERNEL_SYMLINK | |
ffd6978e | 286 | ZFS_AC_KERNEL_BIO_MAX_SEGS |
414f7249 PD |
287 | ZFS_AC_KERNEL_SIGNAL_STOP |
288 | ZFS_AC_KERNEL_SIGINFO | |
0cdda2ed | 289 | ZFS_AC_KERNEL_SYSFS |
414f7249 | 290 | ZFS_AC_KERNEL_SET_SPECIAL_STATE |
a3588c68 | 291 | ZFS_AC_KERNEL_STANDALONE_LINUX_STDARG |
c0fb44c5 | 292 | ZFS_AC_KERNEL_PAGEMAP_FOLIO_WAIT_BIT |
12fa250d | 293 | ZFS_AC_KERNEL_ADD_DISK |
a9856574 | 294 | ZFS_AC_KERNEL_KTHREAD |
becc717f | 295 | ZFS_AC_KERNEL_ZERO_PAGE |
849c14e0 | 296 | ZFS_AC_KERNEL___COPY_FROM_USER_INATOMIC |
4ed5e250 | 297 | ZFS_AC_KERNEL_USER_NS_COMMON_INUM |
2a068a13 | 298 | ZFS_AC_KERNEL_IDMAP_MNT_API |
f224eddf | 299 | ZFS_AC_KERNEL_IATTR_VFSID |
3fc92adc | 300 | ZFS_AC_KERNEL_FILEMAP |
8eb2f260 | 301 | ZFS_AC_KERNEL_WRITEPAGE_T |
f8447cf2 | 302 | ZFS_AC_KERNEL_RECLAIMED |
b35374fd | 303 | ZFS_AC_KERNEL_REGISTER_SYSCTL_TABLE |
589f59b5 W |
304 | case "$host_cpu" in |
305 | powerpc*) | |
306 | ZFS_AC_KERNEL_CPU_HAS_FEATURE | |
307 | ZFS_AC_KERNEL_FLUSH_DCACHE_PAGE | |
308 | ;; | |
309 | esac | |
c9c0d073 BB |
310 | ]) |
311 | ||
312 | dnl # | |
313 | dnl # Detect name used for Module.symvers file in kernel | |
314 | dnl # | |
315 | AC_DEFUN([ZFS_AC_MODULE_SYMVERS], [ | |
316 | modpost=$LINUX/scripts/Makefile.modpost | |
317 | AC_MSG_CHECKING([kernel file name for module symbols]) | |
319a99a3 | 318 | AS_IF([test "x$enable_linux_builtin" != xyes -a -f "$modpost"], [ |
8366cd6a | 319 | AS_IF([grep -q Modules.symvers $modpost], [ |
c9c0d073 | 320 | LINUX_SYMBOLS=Modules.symvers |
8366cd6a | 321 | ], [ |
c9c0d073 | 322 | LINUX_SYMBOLS=Module.symvers |
8366cd6a | 323 | ]) |
a60b1c0a | 324 | |
8366cd6a | 325 | AS_IF([test ! -f "$LINUX_OBJ/$LINUX_SYMBOLS"], [ |
a60b1c0a BB |
326 | AC_MSG_ERROR([ |
327 | *** Please make sure the kernel devel package for your distribution | |
608f8749 BB |
328 | *** is installed. If you are building with a custom kernel, make sure |
329 | *** the kernel is configured, built, and the '--with-linux=PATH' | |
330 | *** configure option refers to the location of the kernel source. | |
331 | ]) | |
8366cd6a PS |
332 | ]) |
333 | ], [ | |
c9c0d073 | 334 | LINUX_SYMBOLS=NONE |
8366cd6a | 335 | ]) |
c9c0d073 BB |
336 | AC_MSG_RESULT($LINUX_SYMBOLS) |
337 | AC_SUBST(LINUX_SYMBOLS) | |
338 | ]) | |
339 | ||
340 | dnl # | |
341 | dnl # Detect the kernel to be built against | |
342 | dnl # | |
72f3c8b1 DS |
343 | dnl # Most modern Linux distributions have separate locations for bare |
344 | dnl # source (source) and prebuilt (build) files. Additionally, there are | |
345 | dnl # `source` and `build` symlinks in `/lib/modules/$(KERNEL_VERSION)` | |
346 | dnl # pointing to them. The directory search order is now: | |
347 | dnl # | |
348 | dnl # - `configure` command line values if both `--with-linux` and | |
349 | dnl # `--with-linux-obj` were defined | |
350 | dnl # | |
351 | dnl # - If only `--with-linux` was defined, `--with-linux-obj` is assumed | |
352 | dnl # to have the same value as `--with-linux` | |
353 | dnl # | |
354 | dnl # - If neither `--with-linux` nor `--with-linux-obj` were defined | |
355 | dnl # autodetection is used: | |
356 | dnl # | |
357 | dnl # - `/lib/modules/$(uname -r)/{source,build}` respectively, if exist. | |
358 | dnl # | |
359 | dnl # - If only `/lib/modules/$(uname -r)/build` exists, it is assumed | |
360 | dnl # to be both source and build directory. | |
361 | dnl # | |
362 | dnl # - The first directory in `/lib/modules` with the highest version | |
363 | dnl # number according to `sort -V` which contains both `source` and | |
364 | dnl # `build` symlinks/directories. If module directory contains only | |
365 | dnl # `build` component, it is assumed to be both source and build | |
366 | dnl # directory. | |
367 | dnl # | |
368 | dnl # - Last resort: the first directory matching `/usr/src/kernels/*` | |
369 | dnl # and `/usr/src/linux-*` with the highest version number according | |
370 | dnl # to `sort -V` is assumed to be both source and build directory. | |
371 | dnl # | |
c9c0d073 BB |
372 | AC_DEFUN([ZFS_AC_KERNEL], [ |
373 | AC_ARG_WITH([linux], | |
374 | AS_HELP_STRING([--with-linux=PATH], | |
375 | [Path to kernel source]), | |
376 | [kernelsrc="$withval"]) | |
377 | ||
378 | AC_ARG_WITH(linux-obj, | |
379 | AS_HELP_STRING([--with-linux-obj=PATH], | |
380 | [Path to kernel build objects]), | |
381 | [kernelbuild="$withval"]) | |
382 | ||
72f3c8b1 DS |
383 | AC_MSG_CHECKING([kernel source and build directories]) |
384 | AS_IF([test -n "$kernelsrc" && test -z "$kernelbuild"], [ | |
385 | kernelbuild="$kernelsrc" | |
386 | ], [test -z "$kernelsrc"], [ | |
387 | AS_IF([test -e "/lib/modules/$(uname -r)/source" && \ | |
388 | test -e "/lib/modules/$(uname -r)/build"], [ | |
389 | src="/lib/modules/$(uname -r)/source" | |
390 | build="/lib/modules/$(uname -r)/build" | |
8366cd6a | 391 | ], [test -e "/lib/modules/$(uname -r)/build"], [ |
72f3c8b1 DS |
392 | build="/lib/modules/$(uname -r)/build" |
393 | src="$build" | |
8366cd6a | 394 | ], [ |
72f3c8b1 DS |
395 | src= |
396 | ||
397 | for d in $(ls -1d /lib/modules/* 2>/dev/null | sort -Vr); do | |
398 | if test -e "$d/source" && test -e "$d/build"; then | |
399 | src="$d/source" | |
400 | build="$d/build" | |
401 | break | |
402 | fi | |
403 | ||
404 | if test -e "$d/build"; then | |
405 | src="$d/build" | |
406 | build="$d/build" | |
407 | break | |
408 | fi | |
409 | done | |
410 | ||
411 | # the least reliable method | |
412 | if test -z "$src"; then | |
413 | src=$(ls -1d /usr/src/kernels/* /usr/src/linux-* \ | |
414 | 2>/dev/null | grep -v obj | sort -Vr | head -1) | |
415 | build="$src" | |
416 | fi | |
8366cd6a | 417 | ]) |
c9c0d073 | 418 | |
72f3c8b1 DS |
419 | AS_IF([test -n "$src" && test -e "$src"], [ |
420 | kernelsrc=$(readlink -e "$src") | |
8366cd6a | 421 | ], [ |
56a517ae | 422 | kernelsrc="[Not found]" |
8366cd6a | 423 | ]) |
72f3c8b1 DS |
424 | AS_IF([test -n "$build" && test -e "$build"], [ |
425 | kernelbuild=$(readlink -e "$build") | |
426 | ], [ | |
427 | kernelbuild="[Not found]" | |
428 | ]) | |
8366cd6a PS |
429 | ], [ |
430 | AS_IF([test "$kernelsrc" = "NONE"], [ | |
c9c0d073 | 431 | kernsrcver=NONE |
8366cd6a | 432 | ]) |
1d8da991 | 433 | withlinux=yes |
8366cd6a | 434 | ]) |
c9c0d073 | 435 | |
72f3c8b1 DS |
436 | AC_MSG_RESULT([done]) |
437 | AC_MSG_CHECKING([kernel source directory]) | |
c9c0d073 | 438 | AC_MSG_RESULT([$kernelsrc]) |
72f3c8b1 DS |
439 | AC_MSG_CHECKING([kernel build directory]) |
440 | AC_MSG_RESULT([$kernelbuild]) | |
441 | AS_IF([test ! -d "$kernelsrc" || test ! -d "$kernelbuild"], [ | |
56a517ae BB |
442 | AC_MSG_ERROR([ |
443 | *** Please make sure the kernel devel package for your distribution | |
4e95cc99 | 444 | *** is installed and then try again. If that fails, you can specify the |
72f3c8b1 DS |
445 | *** location of the kernel source and build with the '--with-linux=PATH' and |
446 | *** '--with-linux-obj=PATH' options respectively.]) | |
8366cd6a | 447 | ]) |
c9c0d073 BB |
448 | |
449 | AC_MSG_CHECKING([kernel source version]) | |
450 | utsrelease1=$kernelbuild/include/linux/version.h | |
451 | utsrelease2=$kernelbuild/include/linux/utsrelease.h | |
452 | utsrelease3=$kernelbuild/include/generated/utsrelease.h | |
d30577c9 | 453 | AS_IF([test -r $utsrelease1 && grep -qF UTS_RELEASE $utsrelease1], [ |
06346cc5 | 454 | utsrelease=$utsrelease1 |
d30577c9 | 455 | ], [test -r $utsrelease2 && grep -qF UTS_RELEASE $utsrelease2], [ |
06346cc5 | 456 | utsrelease=$utsrelease2 |
d30577c9 | 457 | ], [test -r $utsrelease3 && grep -qF UTS_RELEASE $utsrelease3], [ |
06346cc5 | 458 | utsrelease=$utsrelease3 |
8366cd6a | 459 | ]) |
c9c0d073 | 460 | |
06346cc5 BB |
461 | AS_IF([test -n "$utsrelease"], [ |
462 | kernsrcver=$($AWK '/UTS_RELEASE/ { gsub(/"/, "", $[3]); print $[3] }' $utsrelease) | |
8366cd6a | 463 | AS_IF([test -z "$kernsrcver"], [ |
c9c0d073 | 464 | AC_MSG_RESULT([Not found]) |
608f8749 BB |
465 | AC_MSG_ERROR([ |
466 | *** Cannot determine kernel version. | |
467 | ]) | |
8366cd6a PS |
468 | ]) |
469 | ], [ | |
c9c0d073 | 470 | AC_MSG_RESULT([Not found]) |
319a99a3 | 471 | if test "x$enable_linux_builtin" != xyes; then |
608f8749 BB |
472 | AC_MSG_ERROR([ |
473 | *** Cannot find UTS_RELEASE definition. | |
474 | ]) | |
319a99a3 ED |
475 | else |
476 | AC_MSG_ERROR([ | |
477 | *** Cannot find UTS_RELEASE definition. | |
478 | *** Please run 'make prepare' inside the kernel source tree.]) | |
479 | fi | |
8366cd6a | 480 | ]) |
c9c0d073 BB |
481 | |
482 | AC_MSG_RESULT([$kernsrcver]) | |
483 | ||
066e8252 BB |
484 | AS_VERSION_COMPARE([$kernsrcver], [$ZFS_META_KVER_MIN], [ |
485 | AC_MSG_ERROR([ | |
486 | *** Cannot build against kernel version $kernsrcver. | |
487 | *** The minimum supported kernel version is $ZFS_META_KVER_MIN. | |
488 | ]) | |
489 | ]) | |
490 | ||
c9c0d073 BB |
491 | LINUX=${kernelsrc} |
492 | LINUX_OBJ=${kernelbuild} | |
493 | LINUX_VERSION=${kernsrcver} | |
494 | ||
495 | AC_SUBST(LINUX) | |
496 | AC_SUBST(LINUX_OBJ) | |
497 | AC_SUBST(LINUX_VERSION) | |
c9c0d073 BB |
498 | ]) |
499 | ||
6a9d6359 | 500 | dnl # |
608f8749 BB |
501 | dnl # Detect the QAT module to be built against, QAT provides hardware |
502 | dnl # acceleration for data compression: | |
503 | dnl # | |
504 | dnl # https://01.org/intel-quickassist-technology | |
505 | dnl # | |
506 | dnl # 1) Download and install QAT driver from the above link | |
507 | dnl # 2) Start QAT driver in your system: | |
508 | dnl # service qat_service start | |
509 | dnl # 3) Enable QAT in ZFS, e.g.: | |
510 | dnl # ./configure --with-qat=<qat-driver-path>/QAT1.6 | |
511 | dnl # make | |
512 | dnl # 4) Set GZIP compression in ZFS dataset: | |
513 | dnl # zfs set compression = gzip <dataset> | |
514 | dnl # | |
515 | dnl # Then the data written to this ZFS pool is compressed by QAT accelerator | |
516 | dnl # automatically, and de-compressed by QAT when read from the pool. | |
517 | dnl # | |
518 | dnl # 1) Get QAT hardware statistics with: | |
519 | dnl # cat /proc/icp_dh895xcc_dev/qat | |
520 | dnl # 2) To disable QAT: | |
521 | dnl # insmod zfs.ko zfs_qat_disable=1 | |
6a9d6359 | 522 | dnl # |
523 | AC_DEFUN([ZFS_AC_QAT], [ | |
524 | AC_ARG_WITH([qat], | |
525 | AS_HELP_STRING([--with-qat=PATH], | |
526 | [Path to qat source]), | |
527 | AS_IF([test "$withval" = "yes"], | |
528 | AC_MSG_ERROR([--with-qat=PATH requires a PATH]), | |
529 | [qatsrc="$withval"])) | |
530 | ||
531 | AC_ARG_WITH([qat-obj], | |
532 | AS_HELP_STRING([--with-qat-obj=PATH], | |
533 | [Path to qat build objects]), | |
534 | [qatbuild="$withval"]) | |
535 | ||
536 | AS_IF([test ! -z "${qatsrc}"], [ | |
537 | AC_MSG_CHECKING([qat source directory]) | |
538 | AC_MSG_RESULT([$qatsrc]) | |
539 | QAT_SRC="${qatsrc}/quickassist" | |
540 | AS_IF([ test ! -e "$QAT_SRC/include/cpa.h"], [ | |
541 | AC_MSG_ERROR([ | |
608f8749 BB |
542 | *** Please make sure the qat driver package is installed |
543 | *** and specify the location of the qat source with the | |
544 | *** '--with-qat=PATH' option then try again. Failed to | |
545 | *** find cpa.h in: | |
546 | ${QAT_SRC}/include]) | |
6a9d6359 | 547 | ]) |
548 | ]) | |
549 | ||
550 | AS_IF([test ! -z "${qatsrc}"], [ | |
551 | AC_MSG_CHECKING([qat build directory]) | |
552 | AS_IF([test -z "$qatbuild"], [ | |
553 | qatbuild="${qatsrc}/build" | |
554 | ]) | |
555 | ||
556 | AC_MSG_RESULT([$qatbuild]) | |
557 | QAT_OBJ=${qatbuild} | |
1cfdb0e6 | 558 | AS_IF([ ! test -e "$QAT_OBJ/icp_qa_al.ko" && ! test -e "$QAT_OBJ/qat_api.ko"], [ |
6a9d6359 | 559 | AC_MSG_ERROR([ |
608f8749 BB |
560 | *** Please make sure the qat driver is installed then try again. |
561 | *** Failed to find icp_qa_al.ko or qat_api.ko in: | |
562 | $QAT_OBJ]) | |
6a9d6359 | 563 | ]) |
564 | ||
565 | AC_SUBST(QAT_SRC) | |
566 | AC_SUBST(QAT_OBJ) | |
567 | ||
568 | AC_DEFINE(HAVE_QAT, 1, | |
569 | [qat is enabled and existed]) | |
570 | ]) | |
571 | ||
572 | dnl # | |
573 | dnl # Detect the name used for the QAT Module.symvers file. | |
574 | dnl # | |
575 | AS_IF([test ! -z "${qatsrc}"], [ | |
576 | AC_MSG_CHECKING([qat file for module symbols]) | |
577 | QAT_SYMBOLS=$QAT_SRC/lookaside/access_layer/src/Module.symvers | |
578 | ||
579 | AS_IF([test -r $QAT_SYMBOLS], [ | |
580 | AC_MSG_RESULT([$QAT_SYMBOLS]) | |
581 | AC_SUBST(QAT_SYMBOLS) | |
582 | ],[ | |
608f8749 BB |
583 | AC_MSG_ERROR([ |
584 | *** Please make sure the qat driver is installed then try again. | |
585 | *** Failed to find Module.symvers in: | |
586 | $QAT_SYMBOLS | |
6a9d6359 | 587 | ]) |
588 | ]) | |
589 | ]) | |
590 | ]) | |
591 | ||
15805c77 | 592 | dnl # |
608f8749 | 593 | dnl # ZFS_LINUX_CONFTEST_H |
15805c77 | 594 | dnl # |
608f8749 BB |
595 | AC_DEFUN([ZFS_LINUX_CONFTEST_H], [ |
596 | test -d build/$2 || mkdir -p build/$2 | |
597 | cat - <<_ACEOF >build/$2/$2.h | |
598 | $1 | |
599 | _ACEOF | |
600 | ]) | |
e5b85622 | 601 | |
608f8749 BB |
602 | dnl # |
603 | dnl # ZFS_LINUX_CONFTEST_C | |
604 | dnl # | |
605 | AC_DEFUN([ZFS_LINUX_CONFTEST_C], [ | |
606 | test -d build/$2 || mkdir -p build/$2 | |
607 | cat confdefs.h - <<_ACEOF >build/$2/$2.c | |
608 | $1 | |
609 | _ACEOF | |
e5b85622 BB |
610 | ]) |
611 | ||
b58986ee | 612 | dnl # |
608f8749 | 613 | dnl # ZFS_LINUX_CONFTEST_MAKEFILE |
b58986ee | 614 | dnl # |
608f8749 BB |
615 | dnl # $1 - test case name |
616 | dnl # $2 - add to top-level Makefile | |
617 | dnl # $3 - additional build flags | |
b58986ee | 618 | dnl # |
608f8749 BB |
619 | AC_DEFUN([ZFS_LINUX_CONFTEST_MAKEFILE], [ |
620 | test -d build || mkdir -p build | |
621 | test -d build/$1 || mkdir -p build/$1 | |
622 | ||
623 | file=build/$1/Makefile | |
624 | ||
625 | dnl # Example command line to manually build source. | |
626 | cat - <<_ACEOF >$file | |
627 | # Example command line to manually build source | |
628 | # make modules -C $LINUX_OBJ $ARCH_UM M=$PWD/build/$1 | |
629 | ||
630 | ccflags-y := -Werror $FRAME_LARGER_THAN | |
631 | _ACEOF | |
632 | ||
633 | dnl # Additional custom CFLAGS as requested. | |
634 | m4_ifval($3, [echo "ccflags-y += $3" >>$file], []) | |
635 | ||
636 | dnl # Test case source | |
637 | echo "obj-m := $1.o" >>$file | |
638 | ||
639 | AS_IF([test "x$2" = "xyes"], [echo "obj-m += $1/" >>build/Makefile], []) | |
b58986ee BB |
640 | ]) |
641 | ||
e5b85622 | 642 | dnl # |
608f8749 | 643 | dnl # ZFS_LINUX_TEST_PROGRAM(C)([PROLOGUE], [BODY]) |
e5b85622 | 644 | dnl # |
608f8749 | 645 | m4_define([ZFS_LINUX_TEST_PROGRAM], [ |
c347fac5 | 646 | #include <linux/module.h> |
608f8749 | 647 | $1 |
c347fac5 | 648 | |
608f8749 BB |
649 | int |
650 | main (void) | |
651 | { | |
652 | $2 | |
653 | ; | |
654 | return 0; | |
655 | } | |
c347fac5 BB |
656 | |
657 | MODULE_DESCRIPTION("conftest"); | |
658 | MODULE_AUTHOR(ZFS_META_AUTHOR); | |
659 | MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE); | |
660 | MODULE_LICENSE($3); | |
608f8749 BB |
661 | ]) |
662 | ||
e5b85622 | 663 | dnl # |
608f8749 | 664 | dnl # ZFS_LINUX_TEST_REMOVE |
e5b85622 | 665 | dnl # |
608f8749 BB |
666 | dnl # Removes the specified test source and results. |
667 | dnl # | |
668 | AC_DEFUN([ZFS_LINUX_TEST_REMOVE], [ | |
669 | test -d build/$1 && rm -Rf build/$1 | |
670 | test -f build/Makefile && sed '/$1/d' build/Makefile | |
671 | ]) | |
e5b85622 | 672 | |
608f8749 BB |
673 | dnl # |
674 | dnl # ZFS_LINUX_COMPILE | |
675 | dnl # | |
676 | dnl # $1 - build dir | |
677 | dnl # $2 - test command | |
678 | dnl # $3 - pass command | |
679 | dnl # $4 - fail command | |
680 | dnl # $5 - set KBUILD_MODPOST_NOFINAL='yes' | |
681 | dnl # $6 - set KBUILD_MODPOST_WARN='yes' | |
682 | dnl # | |
683 | dnl # Used internally by ZFS_LINUX_TEST_{COMPILE,MODPOST} | |
684 | dnl # | |
685 | AC_DEFUN([ZFS_LINUX_COMPILE], [ | |
b66140c6 PL |
686 | AC_ARG_VAR([KERNEL_CC], [C compiler for |
687 | building kernel modules]) | |
688 | AC_ARG_VAR([KERNEL_LD], [Linker for | |
689 | building kernel modules]) | |
690 | AC_ARG_VAR([KERNEL_LLVM], [Binary option to | |
691 | build kernel modules with LLVM/CLANG toolchain]) | |
608f8749 BB |
692 | AC_TRY_COMMAND([ |
693 | KBUILD_MODPOST_NOFINAL="$5" KBUILD_MODPOST_WARN="$6" | |
a0dfd98a DS |
694 | make modules -k -j$TEST_JOBS ${KERNEL_CC:+CC=$KERNEL_CC} |
695 | ${KERNEL_LD:+LD=$KERNEL_LD} ${KERNEL_LLVM:+LLVM=$KERNEL_LLVM} | |
696 | CONFIG_MODULES=y CFLAGS_MODULE=-DCONFIG_MODULES | |
697 | -C $LINUX_OBJ $ARCH_UM M=$PWD/$1 >$1/build.log 2>&1]) | |
608f8749 | 698 | AS_IF([AC_TRY_COMMAND([$2])], [$3], [$4]) |
c9c0d073 BB |
699 | ]) |
700 | ||
701 | dnl # | |
608f8749 | 702 | dnl # ZFS_LINUX_TEST_COMPILE |
93ce2b4c | 703 | dnl # |
608f8749 | 704 | dnl # Perform a full compile excluding the final modpost phase. |
93ce2b4c | 705 | dnl # |
608f8749 BB |
706 | AC_DEFUN([ZFS_LINUX_TEST_COMPILE], [ |
707 | ZFS_LINUX_COMPILE([$2], [test -f $2/build.log], [ | |
708 | mv $2/Makefile $2/Makefile.compile.$1 | |
709 | mv $2/build.log $2/build.log.$1 | |
93ce2b4c | 710 | ],[ |
608f8749 BB |
711 | AC_MSG_ERROR([ |
712 | *** Unable to compile test source to determine kernel interfaces.]) | |
713 | ], [yes], []) | |
93ce2b4c BB |
714 | ]) |
715 | ||
716 | dnl # | |
608f8749 | 717 | dnl # ZFS_LINUX_TEST_MODPOST |
c9c0d073 | 718 | dnl # |
608f8749 BB |
719 | dnl # Perform a full compile including the modpost phase. This may |
720 | dnl # be an incremental build if the objects have already been built. | |
721 | dnl # | |
722 | AC_DEFUN([ZFS_LINUX_TEST_MODPOST], [ | |
723 | ZFS_LINUX_COMPILE([$2], [test -f $2/build.log], [ | |
724 | mv $2/Makefile $2/Makefile.modpost.$1 | |
725 | cat $2/build.log >>build/build.log.$1 | |
726 | ],[ | |
727 | AC_MSG_ERROR([ | |
728 | *** Unable to modpost test source to determine kernel interfaces.]) | |
729 | ], [], [yes]) | |
0b39b9f9 PS |
730 | ]) |
731 | ||
732 | dnl # | |
608f8749 | 733 | dnl # Perform the compilation of the test cases in two phases. |
0b39b9f9 | 734 | dnl # |
608f8749 BB |
735 | dnl # Phase 1) attempt to build the object files for all of the tests |
736 | dnl # defined by the ZFS_LINUX_TEST_SRC macro. But do not | |
737 | dnl # perform the final modpost stage. | |
738 | dnl # | |
739 | dnl # Phase 2) disable all tests which failed the initial compilation, | |
740 | dnl # then invoke the final modpost step for the remaining tests. | |
741 | dnl # | |
742 | dnl # This allows us efficiently build the test cases in parallel while | |
743 | dnl # remaining resilient to build failures which are expected when | |
744 | dnl # detecting the available kernel interfaces. | |
745 | dnl # | |
746 | dnl # The maximum allowed parallelism can be controlled by setting the | |
747 | dnl # TEST_JOBS environment variable. Otherwise, it default to $(nproc). | |
748 | dnl # | |
749 | AC_DEFUN([ZFS_LINUX_TEST_COMPILE_ALL], [ | |
750 | dnl # Phase 1 - Compilation only, final linking is skipped. | |
751 | ZFS_LINUX_TEST_COMPILE([$1], [build]) | |
752 | ||
753 | dnl # | |
754 | dnl # Phase 2 - When building external modules disable test cases | |
755 | dnl # which failed to compile and invoke modpost to verify the | |
756 | dnl # final linking. | |
757 | dnl # | |
758 | dnl # Test names suffixed with '_license' call modpost independently | |
759 | dnl # to ensure that a single incompatibility does not result in the | |
760 | dnl # modpost phase exiting early. This check is not performed on | |
761 | dnl # every symbol since the majority are compatible and doing so | |
762 | dnl # would significantly slow down this phase. | |
763 | dnl # | |
764 | dnl # When configuring for builtin (--enable-linux-builtin) | |
765 | dnl # fake the linking step artificially create the expected .ko | |
766 | dnl # files for tests which did compile. This is required for | |
767 | dnl # kernels which do not have loadable module support or have | |
768 | dnl # not yet been built. | |
769 | dnl # | |
770 | AS_IF([test "x$enable_linux_builtin" = "xno"], [ | |
771 | for dir in $(awk '/^obj-m/ { print [$]3 }' \ | |
772 | build/Makefile.compile.$1); do | |
773 | name=${dir%/} | |
774 | AS_IF([test -f build/$name/$name.o], [ | |
775 | AS_IF([test "${name##*_}" = "license"], [ | |
776 | ZFS_LINUX_TEST_MODPOST([$1], | |
777 | [build/$name]) | |
778 | echo "obj-n += $dir" >>build/Makefile | |
779 | ], [ | |
780 | echo "obj-m += $dir" >>build/Makefile | |
781 | ]) | |
782 | ], [ | |
783 | echo "obj-n += $dir" >>build/Makefile | |
784 | ]) | |
785 | done | |
786 | ||
787 | ZFS_LINUX_TEST_MODPOST([$1], [build]) | |
788 | ], [ | |
789 | for dir in $(awk '/^obj-m/ { print [$]3 }' \ | |
790 | build/Makefile.compile.$1); do | |
791 | name=${dir%/} | |
792 | AS_IF([test -f build/$name/$name.o], [ | |
793 | touch build/$name/$name.ko | |
794 | ]) | |
795 | done | |
796 | ]) | |
c9c0d073 BB |
797 | ]) |
798 | ||
799 | dnl # | |
608f8749 | 800 | dnl # ZFS_LINUX_TEST_SRC |
c9c0d073 | 801 | dnl # |
608f8749 BB |
802 | dnl # $1 - name |
803 | dnl # $2 - global | |
804 | dnl # $3 - source | |
805 | dnl # $4 - extra cflags | |
806 | dnl # $5 - check license-compatibility | |
807 | dnl # | |
c347fac5 BB |
808 | dnl # Check if the test source is buildable at all and then if it is |
809 | dnl # license compatible. | |
810 | dnl # | |
608f8749 BB |
811 | dnl # N.B because all of the test cases are compiled in parallel they |
812 | dnl # must never depend on the results of previous tests. Each test | |
813 | dnl # needs to be entirely independent. | |
814 | dnl # | |
815 | AC_DEFUN([ZFS_LINUX_TEST_SRC], [ | |
c347fac5 BB |
816 | ZFS_LINUX_CONFTEST_C([ZFS_LINUX_TEST_PROGRAM([[$2]], [[$3]], |
817 | [["Dual BSD/GPL"]])], [$1]) | |
608f8749 BB |
818 | ZFS_LINUX_CONFTEST_MAKEFILE([$1], [yes], [$4]) |
819 | ||
820 | AS_IF([ test -n "$5" ], [ | |
c347fac5 BB |
821 | ZFS_LINUX_CONFTEST_C([ZFS_LINUX_TEST_PROGRAM( |
822 | [[$2]], [[$3]], [[$5]])], [$1_license]) | |
608f8749 BB |
823 | ZFS_LINUX_CONFTEST_MAKEFILE([$1_license], [yes], [$4]) |
824 | ]) | |
c9c0d073 BB |
825 | ]) |
826 | ||
827 | dnl # | |
608f8749 | 828 | dnl # ZFS_LINUX_TEST_RESULT |
c9c0d073 | 829 | dnl # |
608f8749 BB |
830 | dnl # $1 - name of a test source (ZFS_LINUX_TEST_SRC) |
831 | dnl # $2 - run on success (valid .ko generated) | |
832 | dnl # $3 - run on failure (unable to compile) | |
833 | dnl # | |
834 | AC_DEFUN([ZFS_LINUX_TEST_RESULT], [ | |
835 | AS_IF([test -d build/$1], [ | |
836 | AS_IF([test -f build/$1/$1.ko], [$2], [$3]) | |
837 | ], [ | |
838 | AC_MSG_ERROR([ | |
839 | *** No matching source for the "$1" test, check that | |
840 | *** both the test source and result macros refer to the same name. | |
841 | ]) | |
842 | ]) | |
c9c0d073 BB |
843 | ]) |
844 | ||
845 | dnl # | |
608f8749 | 846 | dnl # ZFS_LINUX_TEST_ERROR |
c9c0d073 | 847 | dnl # |
608f8749 BB |
848 | dnl # Generic error message which can be used when none of the expected |
849 | dnl # kernel interfaces were detected. | |
850 | dnl # | |
851 | AC_DEFUN([ZFS_LINUX_TEST_ERROR], [ | |
852 | AC_MSG_ERROR([ | |
853 | *** None of the expected "$1" interfaces were detected. | |
854 | *** This may be because your kernel version is newer than what is | |
855 | *** supported, or you are using a patched custom kernel with | |
856 | *** incompatible modifications. | |
857 | *** | |
858 | *** ZFS Version: $ZFS_META_ALIAS | |
859 | *** Compatible Kernels: $ZFS_META_KVER_MIN - $ZFS_META_KVER_MAX | |
860 | ]) | |
c9c0d073 BB |
861 | ]) |
862 | ||
863 | dnl # | |
608f8749 | 864 | dnl # ZFS_LINUX_TEST_RESULT_SYMBOL |
c9c0d073 | 865 | dnl # |
608f8749 BB |
866 | dnl # Like ZFS_LINUX_TEST_RESULT except ZFS_CHECK_SYMBOL_EXPORT is called to |
867 | dnl # verify symbol exports, unless --enable-linux-builtin was provided to | |
868 | dnl # configure. | |
869 | dnl # | |
870 | AC_DEFUN([ZFS_LINUX_TEST_RESULT_SYMBOL], [ | |
871 | AS_IF([ ! test -f build/$1/$1.ko], [ | |
872 | $5 | |
873 | ], [ | |
874 | AS_IF([test "x$enable_linux_builtin" != "xyes"], [ | |
875 | ZFS_CHECK_SYMBOL_EXPORT([$2], [$3], [$4], [$5]) | |
876 | ], [ | |
877 | $4 | |
878 | ]) | |
c9c0d073 BB |
879 | ]) |
880 | ]) | |
881 | ||
608f8749 BB |
882 | dnl # |
883 | dnl # ZFS_LINUX_COMPILE_IFELSE | |
884 | dnl # | |
885 | AC_DEFUN([ZFS_LINUX_COMPILE_IFELSE], [ | |
886 | ZFS_LINUX_TEST_REMOVE([conftest]) | |
887 | ||
888 | m4_ifvaln([$1], [ZFS_LINUX_CONFTEST_C([$1], [conftest])]) | |
889 | m4_ifvaln([$5], [ZFS_LINUX_CONFTEST_H([$5], [conftest])], | |
890 | [ZFS_LINUX_CONFTEST_H([], [conftest])]) | |
891 | ||
892 | ZFS_LINUX_CONFTEST_MAKEFILE([conftest], [no], | |
893 | [m4_ifvaln([$5], [-I$PWD/build/conftest], [])]) | |
894 | ZFS_LINUX_COMPILE([build/conftest], [$2], [$3], [$4], [], []) | |
895 | ]) | |
896 | ||
897 | dnl # | |
898 | dnl # ZFS_LINUX_TRY_COMPILE | |
899 | dnl # | |
900 | dnl # $1 - global | |
901 | dnl # $2 - source | |
902 | dnl # $3 - run on success (valid .ko generated) | |
903 | dnl # $4 - run on failure (unable to compile) | |
904 | dnl # | |
3f99a3ab BB |
905 | dnl # When configuring as builtin (--enable-linux-builtin) for kernels |
906 | dnl # without loadable module support (CONFIG_MODULES=n) only the object | |
907 | dnl # file is created. See ZFS_LINUX_TEST_COMPILE_ALL for details. | |
908 | dnl # | |
608f8749 | 909 | AC_DEFUN([ZFS_LINUX_TRY_COMPILE], [ |
3f99a3ab BB |
910 | AS_IF([test "x$enable_linux_builtin" = "xyes"], [ |
911 | ZFS_LINUX_COMPILE_IFELSE( | |
c347fac5 BB |
912 | [ZFS_LINUX_TEST_PROGRAM([[$1]], [[$2]], |
913 | [[ZFS_META_LICENSE]])], | |
3f99a3ab BB |
914 | [test -f build/conftest/conftest.o], [$3], [$4]) |
915 | ], [ | |
916 | ZFS_LINUX_COMPILE_IFELSE( | |
c347fac5 BB |
917 | [ZFS_LINUX_TEST_PROGRAM([[$1]], [[$2]], |
918 | [[ZFS_META_LICENSE]])], | |
3f99a3ab BB |
919 | [test -f build/conftest/conftest.ko], [$3], [$4]) |
920 | ]) | |
608f8749 BB |
921 | ]) |
922 | ||
c9c0d073 BB |
923 | dnl # |
924 | dnl # ZFS_CHECK_SYMBOL_EXPORT | |
608f8749 BB |
925 | dnl # |
926 | dnl # Check if a symbol is exported on not by consulting the symbols | |
927 | dnl # file, or optionally the source code. | |
c9c0d073 | 928 | dnl # |
70574182 | 929 | AC_DEFUN([ZFS_CHECK_SYMBOL_EXPORT], [ |
c9c0d073 BB |
930 | grep -q -E '[[[:space:]]]$1[[[:space:]]]' \ |
931 | $LINUX_OBJ/$LINUX_SYMBOLS 2>/dev/null | |
932 | rc=$? | |
70574182 | 933 | if test $rc -ne 0; then |
c9c0d073 BB |
934 | export=0 |
935 | for file in $2; do | |
70574182 ED |
936 | grep -q -E "EXPORT_SYMBOL.*($1)" \ |
937 | "$LINUX/$file" 2>/dev/null | |
c9c0d073 | 938 | rc=$? |
70574182 | 939 | if test $rc -eq 0; then |
8366cd6a PS |
940 | export=1 |
941 | break; | |
70574182 | 942 | fi |
c9c0d073 | 943 | done |
70574182 | 944 | if test $export -eq 0; then : |
c9c0d073 | 945 | $4 |
70574182 | 946 | else : |
c9c0d073 | 947 | $3 |
70574182 ED |
948 | fi |
949 | else : | |
c9c0d073 | 950 | $3 |
70574182 ED |
951 | fi |
952 | ]) | |
953 | ||
954 | dnl # | |
955 | dnl # ZFS_LINUX_TRY_COMPILE_SYMBOL | |
608f8749 BB |
956 | dnl # |
957 | dnl # Like ZFS_LINUX_TRY_COMPILER except ZFS_CHECK_SYMBOL_EXPORT is called | |
958 | dnl # to verify symbol exports, unless --enable-linux-builtin was provided | |
959 | dnl # to configure. | |
70574182 ED |
960 | dnl # |
961 | AC_DEFUN([ZFS_LINUX_TRY_COMPILE_SYMBOL], [ | |
962 | ZFS_LINUX_TRY_COMPILE([$1], [$2], [rc=0], [rc=1]) | |
963 | if test $rc -ne 0; then : | |
964 | $6 | |
965 | else | |
966 | if test "x$enable_linux_builtin" != xyes; then | |
967 | ZFS_CHECK_SYMBOL_EXPORT([$3], [$4], [rc=0], [rc=1]) | |
968 | fi | |
969 | if test $rc -ne 0; then : | |
970 | $6 | |
971 | else : | |
972 | $5 | |
973 | fi | |
974 | fi | |
c9c0d073 | 975 | ]) |
0b39b9f9 PS |
976 | |
977 | dnl # | |
978 | dnl # ZFS_LINUX_TRY_COMPILE_HEADER | |
979 | dnl # like ZFS_LINUX_TRY_COMPILE, except the contents conftest.h are | |
980 | dnl # provided via the fifth parameter | |
981 | dnl # | |
608f8749 | 982 | AC_DEFUN([ZFS_LINUX_TRY_COMPILE_HEADER], [ |
ab49df48 AL |
983 | AS_IF([test "x$enable_linux_builtin" = "xyes"], [ |
984 | ZFS_LINUX_COMPILE_IFELSE( | |
985 | [ZFS_LINUX_TEST_PROGRAM([[$1]], [[$2]], | |
986 | [[ZFS_META_LICENSE]])], | |
987 | [test -f build/conftest/conftest.o], [$3], [$4], [$5]) | |
988 | ], [ | |
989 | ZFS_LINUX_COMPILE_IFELSE( | |
990 | [ZFS_LINUX_TEST_PROGRAM([[$1]], [[$2]], | |
991 | [[ZFS_META_LICENSE]])], | |
992 | [test -f build/conftest/conftest.ko], [$3], [$4], [$5]) | |
993 | ]) | |
0b39b9f9 | 994 | ]) |
556ed095 AR |
995 | |
996 | dnl # | |
997 | dnl # AS_VERSION_COMPARE_LE | |
998 | dnl # like AS_VERSION_COMPARE_LE, but runs $3 if (and only if) $1 <= $2 | |
999 | dnl # AS_VERSION_COMPARE_LE (version-1, version-2, [action-if-less-or-equal], [action-if-greater]) | |
1000 | dnl # | |
1001 | AC_DEFUN([AS_VERSION_COMPARE_LE], [ | |
1002 | AS_VERSION_COMPARE([$1], [$2], [$3], [$3], [$4]) | |
1003 | ]) | |
1004 | ||
1005 | dnl # | |
1006 | dnl # ZFS_LINUX_REQUIRE_API | |
1007 | dnl # like ZFS_LINUX_TEST_ERROR, except only fails if the kernel is | |
1008 | dnl # at least some specified version. | |
1009 | dnl # | |
1010 | AC_DEFUN([ZFS_LINUX_REQUIRE_API], [ | |
1011 | AS_VERSION_COMPARE_LE([$2], [$kernsrcver], [ | |
1012 | AC_MSG_ERROR([ | |
1013 | *** None of the expected "$1" interfaces were detected. This | |
1014 | *** interface is expected for kernels version "$2" and above. | |
1015 | *** This may be because your kernel version is newer than what is | |
1016 | *** supported, or you are using a patched custom kernel with | |
1017 | *** incompatible modifications. Newer kernels may have incompatible | |
1018 | *** APIs. | |
1019 | *** | |
1020 | *** ZFS Version: $ZFS_META_ALIAS | |
1021 | *** Compatible Kernels: $ZFS_META_KVER_MIN - $ZFS_META_KVER_MAX | |
1022 | ]) | |
1023 | ], [ | |
1024 | AC_MSG_RESULT(no) | |
1025 | ]) | |
1026 | ]) |