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