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