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