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