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