1AC_DEFUN([ZFS_AC_LICENSE], [ 2 AC_MSG_CHECKING([zfs author]) 3 AC_MSG_RESULT([$ZFS_META_AUTHOR]) 4 5 AC_MSG_CHECKING([zfs license]) 6 AC_MSG_RESULT([$ZFS_META_LICENSE]) 7]) 8 9AC_DEFUN([ZFS_AC_DEBUG_ENABLE], [ 10 DEBUG_CFLAGS="-Werror" 11 DEBUG_CPPFLAGS="-DDEBUG -UNDEBUG" 12 DEBUG_LDFLAGS="" 13 DEBUG_ZFS="_with_debug" 14 WITH_DEBUG="true" 15 AC_DEFINE(ZFS_DEBUG, 1, [zfs debugging enabled]) 16 17 KERNEL_DEBUG_CFLAGS="-Werror" 18 KERNEL_DEBUG_CPPFLAGS="-DDEBUG -UNDEBUG" 19]) 20 21AC_DEFUN([ZFS_AC_DEBUG_DISABLE], [ 22 DEBUG_CFLAGS="" 23 DEBUG_CPPFLAGS="-UDEBUG -DNDEBUG" 24 DEBUG_LDFLAGS="" 25 DEBUG_ZFS="_without_debug" 26 WITH_DEBUG="" 27 28 KERNEL_DEBUG_CFLAGS="" 29 KERNEL_DEBUG_CPPFLAGS="-UDEBUG -DNDEBUG" 30]) 31 32dnl # 33dnl # When debugging is enabled: 34dnl # - Enable all ASSERTs (-DDEBUG) 35dnl # - Promote all compiler warnings to errors (-Werror) 36dnl # 37dnl # (If INVARIANTS is detected, we need to force DEBUG, or strange panics 38dnl # can ensue.) 39dnl # 40AC_DEFUN([ZFS_AC_DEBUG], [ 41 AC_MSG_CHECKING([whether assertion support will be enabled]) 42 AC_ARG_ENABLE([debug], 43 [AS_HELP_STRING([--enable-debug], 44 [Enable compiler and code assertions @<:@default=no@:>@])], 45 [], 46 [enable_debug=no]) 47 48 AS_CASE(["x$enable_debug"], 49 ["xyes"], 50 [ZFS_AC_DEBUG_ENABLE], 51 ["xno"], 52 [ZFS_AC_DEBUG_DISABLE], 53 [AC_MSG_ERROR([Unknown option $enable_debug])]) 54 55 AS_CASE(["x$enable_invariants"], 56 ["xyes"], 57 [], 58 ["xno"], 59 [], 60 [ZFS_AC_DEBUG_INVARIANTS_DETECT]) 61 62 AS_CASE(["x$enable_invariants"], 63 ["xyes"], 64 [ZFS_AC_DEBUG_ENABLE], 65 ["xno"], 66 [], 67 [AC_MSG_ERROR([Unknown option $enable_invariants])]) 68 69 AC_SUBST(DEBUG_CFLAGS) 70 AC_SUBST(DEBUG_CPPFLAGS) 71 AC_SUBST(DEBUG_LDFLAGS) 72 AC_SUBST(DEBUG_ZFS) 73 AC_SUBST(WITH_DEBUG) 74 75 AC_SUBST(KERNEL_DEBUG_CFLAGS) 76 AC_SUBST(KERNEL_DEBUG_CPPFLAGS) 77 78 AC_MSG_RESULT([$enable_debug]) 79]) 80 81AC_DEFUN([ZFS_AC_DEBUGINFO_ENABLE], [ 82 DEBUG_CFLAGS="$DEBUG_CFLAGS -g -fno-inline $NO_IPA_SRA" 83 84 KERNEL_DEBUG_CFLAGS="$KERNEL_DEBUG_CFLAGS -fno-inline $NO_IPA_SRA" 85 KERNEL_MAKE="$KERNEL_MAKE CONFIG_DEBUG_INFO=y" 86 87 DEBUGINFO_ZFS="_with_debuginfo" 88]) 89 90AC_DEFUN([ZFS_AC_DEBUGINFO_DISABLE], [ 91 DEBUGINFO_ZFS="_without_debuginfo" 92]) 93 94AC_DEFUN([ZFS_AC_DEBUGINFO], [ 95 AC_MSG_CHECKING([whether debuginfo support will be forced]) 96 AC_ARG_ENABLE([debuginfo], 97 [AS_HELP_STRING([--enable-debuginfo], 98 [Force generation of debuginfo @<:@default=no@:>@])], 99 [], 100 [enable_debuginfo=no]) 101 102 AS_CASE(["x$enable_debuginfo"], 103 ["xyes"], 104 [ZFS_AC_DEBUGINFO_ENABLE], 105 ["xno"], 106 [ZFS_AC_DEBUGINFO_DISABLE], 107 [AC_MSG_ERROR([Unknown option $enable_debuginfo])]) 108 109 AC_SUBST(DEBUG_CFLAGS) 110 AC_SUBST(DEBUGINFO_ZFS) 111 112 AC_SUBST(KERNEL_DEBUG_CFLAGS) 113 AC_SUBST(KERNEL_MAKE) 114 115 AC_MSG_RESULT([$enable_debuginfo]) 116]) 117 118dnl # 119dnl # Disabled by default, provides basic memory tracking. Track the total 120dnl # number of bytes allocated with kmem_alloc() and freed with kmem_free(). 121dnl # Then at module unload time if any bytes were leaked it will be reported 122dnl # on the console. 123dnl # 124AC_DEFUN([ZFS_AC_DEBUG_KMEM], [ 125 AC_MSG_CHECKING([whether basic kmem accounting is enabled]) 126 AC_ARG_ENABLE([debug-kmem], 127 [AS_HELP_STRING([--enable-debug-kmem], 128 [Enable basic kmem accounting @<:@default=no@:>@])], 129 [], 130 [enable_debug_kmem=no]) 131 132 AS_IF([test "x$enable_debug_kmem" = xyes], [ 133 KERNEL_DEBUG_CPPFLAGS="${KERNEL_DEBUG_CPPFLAGS} -DDEBUG_KMEM" 134 DEBUG_KMEM_ZFS="_with_debug_kmem" 135 ], [ 136 DEBUG_KMEM_ZFS="_without_debug_kmem" 137 ]) 138 139 AC_SUBST(KERNEL_DEBUG_CPPFLAGS) 140 AC_SUBST(DEBUG_KMEM_ZFS) 141 142 AC_MSG_RESULT([$enable_debug_kmem]) 143]) 144 145dnl # 146dnl # Disabled by default, provides detailed memory tracking. This feature 147dnl # also requires --enable-debug-kmem to be set. When enabled not only will 148dnl # total bytes be tracked but also the location of every kmem_alloc() and 149dnl # kmem_free(). When the module is unloaded a list of all leaked addresses 150dnl # and where they were allocated will be dumped to the console. Enabling 151dnl # this feature has a significant impact on performance but it makes finding 152dnl # memory leaks straight forward. 153dnl # 154AC_DEFUN([ZFS_AC_DEBUG_KMEM_TRACKING], [ 155 AC_MSG_CHECKING([whether detailed kmem tracking is enabled]) 156 AC_ARG_ENABLE([debug-kmem-tracking], 157 [AS_HELP_STRING([--enable-debug-kmem-tracking], 158 [Enable detailed kmem tracking @<:@default=no@:>@])], 159 [], 160 [enable_debug_kmem_tracking=no]) 161 162 AS_IF([test "x$enable_debug_kmem_tracking" = xyes], [ 163 KERNEL_DEBUG_CPPFLAGS="${KERNEL_DEBUG_CPPFLAGS} -DDEBUG_KMEM_TRACKING" 164 DEBUG_KMEM_TRACKING_ZFS="_with_debug_kmem_tracking" 165 ], [ 166 DEBUG_KMEM_TRACKING_ZFS="_without_debug_kmem_tracking" 167 ]) 168 169 AC_SUBST(KERNEL_DEBUG_CPPFLAGS) 170 AC_SUBST(DEBUG_KMEM_TRACKING_ZFS) 171 172 AC_MSG_RESULT([$enable_debug_kmem_tracking]) 173]) 174 175AC_DEFUN([ZFS_AC_DEBUG_INVARIANTS_DETECT_FREEBSD], [ 176 AS_IF([sysctl -n kern.conftxt | fgrep -qx $'options\tINVARIANTS'], 177 [enable_invariants="yes"], 178 [enable_invariants="no"]) 179]) 180 181AC_DEFUN([ZFS_AC_DEBUG_INVARIANTS_DETECT], [ 182 AM_COND_IF([BUILD_FREEBSD], 183 [ZFS_AC_DEBUG_INVARIANTS_DETECT_FREEBSD], 184 [enable_invariants="no"]) 185]) 186 187dnl # 188dnl # Detected for the running kernel by default, enables INVARIANTS features 189dnl # in the FreeBSD kernel module. This feature must be used when building 190dnl # for a FreeBSD kernel with "options INVARIANTS" in the KERNCONF and must 191dnl # not be used when the INVARIANTS option is absent. 192dnl # 193AC_DEFUN([ZFS_AC_DEBUG_INVARIANTS], [ 194 AC_MSG_CHECKING([whether FreeBSD kernel INVARIANTS checks are enabled]) 195 AC_ARG_ENABLE([invariants], 196 [AS_HELP_STRING([--enable-invariants], 197 [Enable FreeBSD kernel INVARIANTS checks [[default: detect]]])], 198 [], [ZFS_AC_DEBUG_INVARIANTS_DETECT]) 199 200 AS_IF([test "x$enable_invariants" = xyes], 201 [WITH_INVARIANTS="true"], 202 [WITH_INVARIANTS=""]) 203 AC_SUBST(WITH_INVARIANTS) 204 205 AC_MSG_RESULT([$enable_invariants]) 206]) 207 208AC_DEFUN([ZFS_AC_CONFIG_ALWAYS], [ 209 AX_COUNT_CPUS([]) 210 AC_SUBST(CPU_COUNT) 211 212 ZFS_AC_CONFIG_ALWAYS_CC_NO_UNUSED_BUT_SET_VARIABLE 213 ZFS_AC_CONFIG_ALWAYS_CC_NO_BOOL_COMPARE 214 ZFS_AC_CONFIG_ALWAYS_CC_IMPLICIT_FALLTHROUGH 215 ZFS_AC_CONFIG_ALWAYS_CC_FRAME_LARGER_THAN 216 ZFS_AC_CONFIG_ALWAYS_CC_NO_FORMAT_TRUNCATION 217 ZFS_AC_CONFIG_ALWAYS_CC_NO_FORMAT_ZERO_LENGTH 218 ZFS_AC_CONFIG_ALWAYS_CC_NO_OMIT_FRAME_POINTER 219 ZFS_AC_CONFIG_ALWAYS_CC_NO_IPA_SRA 220 ZFS_AC_CONFIG_ALWAYS_CC_ASAN 221 ZFS_AC_CONFIG_ALWAYS_TOOLCHAIN_SIMD 222 ZFS_AC_CONFIG_ALWAYS_SYSTEM 223 ZFS_AC_CONFIG_ALWAYS_ARCH 224 ZFS_AC_CONFIG_ALWAYS_PYTHON 225 ZFS_AC_CONFIG_ALWAYS_PYZFS 226 ZFS_AC_CONFIG_ALWAYS_SED 227 ZFS_AC_CONFIG_ALWAYS_CPPCHECK 228 ZFS_AC_CONFIG_ALWAYS_SHELLCHECK 229]) 230 231AC_DEFUN([ZFS_AC_CONFIG], [ 232 233 dnl # Remove the previous build test directory. 234 rm -Rf build 235 236 ZFS_CONFIG=all 237 AC_ARG_WITH([config], 238 AS_HELP_STRING([--with-config=CONFIG], 239 [Config file 'kernel|user|all|srpm']), 240 [ZFS_CONFIG="$withval"]) 241 AC_ARG_ENABLE([linux-builtin], 242 [AS_HELP_STRING([--enable-linux-builtin], 243 [Configure for builtin in-tree kernel modules @<:@default=no@:>@])], 244 [], 245 [enable_linux_builtin=no]) 246 247 AC_MSG_CHECKING([zfs config]) 248 AC_MSG_RESULT([$ZFS_CONFIG]); 249 AC_SUBST(ZFS_CONFIG) 250 251 ZFS_AC_CONFIG_ALWAYS 252 253 AM_COND_IF([BUILD_LINUX], [ 254 AC_ARG_VAR([TEST_JOBS], [simultaneous jobs during configure]) 255 if test "x$ac_cv_env_TEST_JOBS_set" != "xset"; then 256 TEST_JOBS=$CPU_COUNT 257 fi 258 AC_SUBST(TEST_JOBS) 259 ]) 260 261 case "$ZFS_CONFIG" in 262 kernel) ZFS_AC_CONFIG_KERNEL ;; 263 user) ZFS_AC_CONFIG_USER ;; 264 all) ZFS_AC_CONFIG_USER 265 ZFS_AC_CONFIG_KERNEL ;; 266 srpm) ;; 267 *) 268 AC_MSG_RESULT([Error!]) 269 AC_MSG_ERROR([Bad value "$ZFS_CONFIG" for --with-config, 270 user kernel|user|all|srpm]) ;; 271 esac 272 273 AM_CONDITIONAL([CONFIG_USER], 274 [test "$ZFS_CONFIG" = user -o "$ZFS_CONFIG" = all]) 275 AM_CONDITIONAL([CONFIG_KERNEL], 276 [test "$ZFS_CONFIG" = kernel -o "$ZFS_CONFIG" = all] && 277 [test "x$enable_linux_builtin" != xyes ]) 278 AM_CONDITIONAL([CONFIG_QAT], 279 [test "$ZFS_CONFIG" = kernel -o "$ZFS_CONFIG" = all] && 280 [test "x$qatsrc" != x ]) 281 AM_CONDITIONAL([WANT_DEVNAME2DEVID], [test "x$user_libudev" = xyes ]) 282 AM_CONDITIONAL([WANT_MMAP_LIBAIO], [test "x$user_libaio" = xyes ]) 283 AM_CONDITIONAL([PAM_ZFS_ENABLED], [test "x$enable_pam" = xyes]) 284]) 285 286dnl # 287dnl # Check for rpm+rpmbuild to build RPM packages. If these tools 288dnl # are missing it is non-fatal but you will not be able to build 289dnl # RPM packages and will be warned if you try too. 290dnl # 291dnl # By default the generic spec file will be used because it requires 292dnl # minimal dependencies. Distribution specific spec files can be 293dnl # placed under the 'rpm/<distribution>' directory and enabled using 294dnl # the --with-spec=<distribution> configure option. 295dnl # 296AC_DEFUN([ZFS_AC_RPM], [ 297 RPM=rpm 298 RPMBUILD=rpmbuild 299 300 AC_MSG_CHECKING([whether $RPM is available]) 301 AS_IF([tmp=$($RPM --version 2>/dev/null)], [ 302 RPM_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }') 303 HAVE_RPM=yes 304 AC_MSG_RESULT([$HAVE_RPM ($RPM_VERSION)]) 305 ],[ 306 HAVE_RPM=no 307 AC_MSG_RESULT([$HAVE_RPM]) 308 ]) 309 310 AC_MSG_CHECKING([whether $RPMBUILD is available]) 311 AS_IF([tmp=$($RPMBUILD --version 2>/dev/null)], [ 312 RPMBUILD_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }') 313 HAVE_RPMBUILD=yes 314 AC_MSG_RESULT([$HAVE_RPMBUILD ($RPMBUILD_VERSION)]) 315 ],[ 316 HAVE_RPMBUILD=no 317 AC_MSG_RESULT([$HAVE_RPMBUILD]) 318 ]) 319 320 RPM_DEFINE_COMMON='--define "$(DEBUG_ZFS) 1"' 321 RPM_DEFINE_COMMON=${RPM_DEFINE_COMMON}' --define "$(DEBUGINFO_ZFS) 1"' 322 RPM_DEFINE_COMMON=${RPM_DEFINE_COMMON}' --define "$(DEBUG_KMEM_ZFS) 1"' 323 RPM_DEFINE_COMMON=${RPM_DEFINE_COMMON}' --define "$(DEBUG_KMEM_TRACKING_ZFS) 1"' 324 RPM_DEFINE_COMMON=${RPM_DEFINE_COMMON}' --define "$(ASAN_ZFS) 1"' 325 326 RPM_DEFINE_UTIL=' --define "_initconfdir $(initconfdir)"' 327 328 dnl # Make the next three RPM_DEFINE_UTIL additions conditional, since 329 dnl # their values may not be set when running: 330 dnl # 331 dnl # ./configure --with-config=srpm 332 dnl # 333 AS_IF([test -n "$dracutdir" ], [ 334 RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' --define "_dracutdir $(dracutdir)"' 335 ]) 336 AS_IF([test -n "$udevdir" ], [ 337 RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' --define "_udevdir $(udevdir)"' 338 ]) 339 AS_IF([test -n "$udevruledir" ], [ 340 RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' --define "_udevruledir $(udevruledir)"' 341 ]) 342 RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' $(DEFINE_SYSTEMD)' 343 RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' $(DEFINE_PYZFS)' 344 RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' $(DEFINE_PAM)' 345 RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' $(DEFINE_PYTHON_VERSION)' 346 RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' $(DEFINE_PYTHON_PKG_VERSION)' 347 348 dnl # Override default lib directory on Debian/Ubuntu systems. The 349 dnl # provided /usr/lib/rpm/platform/<arch>/macros files do not 350 dnl # specify the correct path for multiarch systems as described 351 dnl # by the packaging guidelines. 352 dnl # 353 dnl # https://wiki.ubuntu.com/MultiarchSpec 354 dnl # https://wiki.debian.org/Multiarch/Implementation 355 dnl # 356 AS_IF([test "$DEFAULT_PACKAGE" = "deb"], [ 357 MULTIARCH_LIBDIR="lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)" 358 RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' --define "_lib $(MULTIARCH_LIBDIR)"' 359 AC_SUBST(MULTIARCH_LIBDIR) 360 ]) 361 362 dnl # Make RPM_DEFINE_KMOD additions conditional on CONFIG_KERNEL, 363 dnl # since the values will not be set otherwise. The spec files 364 dnl # provide defaults for them. 365 dnl # 366 RPM_DEFINE_KMOD='--define "_wrong_version_format_terminate_build 0"' 367 AM_COND_IF([CONFIG_KERNEL], [ 368 RPM_DEFINE_KMOD=${RPM_DEFINE_KMOD}' --define "kernels $(LINUX_VERSION)"' 369 RPM_DEFINE_KMOD=${RPM_DEFINE_KMOD}' --define "ksrc $(LINUX)"' 370 RPM_DEFINE_KMOD=${RPM_DEFINE_KMOD}' --define "kobj $(LINUX_OBJ)"' 371 ]) 372 373 RPM_DEFINE_DKMS='' 374 375 SRPM_DEFINE_COMMON='--define "build_src_rpm 1"' 376 SRPM_DEFINE_UTIL= 377 SRPM_DEFINE_KMOD= 378 SRPM_DEFINE_DKMS= 379 380 RPM_SPEC_DIR="rpm/generic" 381 AC_ARG_WITH([spec], 382 AS_HELP_STRING([--with-spec=SPEC], 383 [Spec files 'generic|redhat']), 384 [RPM_SPEC_DIR="rpm/$withval"]) 385 386 AC_MSG_CHECKING([whether spec files are available]) 387 AC_MSG_RESULT([yes ($RPM_SPEC_DIR/*.spec.in)]) 388 389 AC_SUBST(HAVE_RPM) 390 AC_SUBST(RPM) 391 AC_SUBST(RPM_VERSION) 392 393 AC_SUBST(HAVE_RPMBUILD) 394 AC_SUBST(RPMBUILD) 395 AC_SUBST(RPMBUILD_VERSION) 396 397 AC_SUBST(RPM_SPEC_DIR) 398 AC_SUBST(RPM_DEFINE_UTIL) 399 AC_SUBST(RPM_DEFINE_KMOD) 400 AC_SUBST(RPM_DEFINE_DKMS) 401 AC_SUBST(RPM_DEFINE_COMMON) 402 AC_SUBST(SRPM_DEFINE_UTIL) 403 AC_SUBST(SRPM_DEFINE_KMOD) 404 AC_SUBST(SRPM_DEFINE_DKMS) 405 AC_SUBST(SRPM_DEFINE_COMMON) 406]) 407 408dnl # 409dnl # Check for dpkg+dpkg-buildpackage to build DEB packages. If these 410dnl # tools are missing it is non-fatal but you will not be able to build 411dnl # DEB packages and will be warned if you try too. 412dnl # 413AC_DEFUN([ZFS_AC_DPKG], [ 414 DPKG=dpkg 415 DPKGBUILD=dpkg-buildpackage 416 417 AC_MSG_CHECKING([whether $DPKG is available]) 418 AS_IF([tmp=$($DPKG --version 2>/dev/null)], [ 419 DPKG_VERSION=$(echo $tmp | $AWK '/Debian/ { print $[7] }') 420 HAVE_DPKG=yes 421 AC_MSG_RESULT([$HAVE_DPKG ($DPKG_VERSION)]) 422 ],[ 423 HAVE_DPKG=no 424 AC_MSG_RESULT([$HAVE_DPKG]) 425 ]) 426 427 AC_MSG_CHECKING([whether $DPKGBUILD is available]) 428 AS_IF([tmp=$($DPKGBUILD --version 2>/dev/null)], [ 429 DPKGBUILD_VERSION=$(echo $tmp | \ 430 $AWK '/Debian/ { print $[4] }' | cut -f-4 -d'.') 431 HAVE_DPKGBUILD=yes 432 AC_MSG_RESULT([$HAVE_DPKGBUILD ($DPKGBUILD_VERSION)]) 433 ],[ 434 HAVE_DPKGBUILD=no 435 AC_MSG_RESULT([$HAVE_DPKGBUILD]) 436 ]) 437 438 AC_SUBST(HAVE_DPKG) 439 AC_SUBST(DPKG) 440 AC_SUBST(DPKG_VERSION) 441 442 AC_SUBST(HAVE_DPKGBUILD) 443 AC_SUBST(DPKGBUILD) 444 AC_SUBST(DPKGBUILD_VERSION) 445]) 446 447dnl # 448dnl # Until native packaging for various different packing systems 449dnl # can be added the least we can do is attempt to use alien to 450dnl # convert the RPM packages to the needed package type. This is 451dnl # a hack but so far it has worked reasonable well. 452dnl # 453AC_DEFUN([ZFS_AC_ALIEN], [ 454 ALIEN=alien 455 456 AC_MSG_CHECKING([whether $ALIEN is available]) 457 AS_IF([tmp=$($ALIEN --version 2>/dev/null)], [ 458 ALIEN_VERSION=$(echo $tmp | $AWK '{ print $[3] }') 459 ALIEN_MAJOR=$(echo ${ALIEN_VERSION} | $AWK -F'.' '{ print $[1] }') 460 ALIEN_MINOR=$(echo ${ALIEN_VERSION} | $AWK -F'.' '{ print $[2] }') 461 ALIEN_POINT=$(echo ${ALIEN_VERSION} | $AWK -F'.' '{ print $[3] }') 462 HAVE_ALIEN=yes 463 AC_MSG_RESULT([$HAVE_ALIEN ($ALIEN_VERSION)]) 464 ],[ 465 HAVE_ALIEN=no 466 AC_MSG_RESULT([$HAVE_ALIEN]) 467 ]) 468 469 AC_SUBST(HAVE_ALIEN) 470 AC_SUBST(ALIEN) 471 AC_SUBST(ALIEN_VERSION) 472 AC_SUBST(ALIEN_MAJOR) 473 AC_SUBST(ALIEN_MINOR) 474 AC_SUBST(ALIEN_POINT) 475]) 476 477dnl # 478dnl # Using the VENDOR tag from config.guess set the default 479dnl # package type for 'make pkg': (rpm | deb | tgz) 480dnl # 481AC_DEFUN([ZFS_AC_DEFAULT_PACKAGE], [ 482 AC_MSG_CHECKING([os distribution]) 483 AC_ARG_WITH([vendor], 484 [AS_HELP_STRING([--with-vendor], 485 [Distribution vendor @<:@default=check@:>@])], 486 [with_vendor=$withval], 487 [with_vendor=check]) 488 AS_IF([test "x$with_vendor" = "xcheck"],[ 489 if test -f /etc/toss-release ; then 490 VENDOR=toss ; 491 elif test -f /etc/fedora-release ; then 492 VENDOR=fedora ; 493 elif test -f /etc/redhat-release ; then 494 VENDOR=redhat ; 495 elif test -f /etc/gentoo-release ; then 496 VENDOR=gentoo ; 497 elif test -f /etc/arch-release ; then 498 VENDOR=arch ; 499 elif test -f /etc/SuSE-release ; then 500 VENDOR=sles ; 501 elif test -f /etc/slackware-version ; then 502 VENDOR=slackware ; 503 elif test -f /etc/lunar.release ; then 504 VENDOR=lunar ; 505 elif test -f /etc/lsb-release ; then 506 VENDOR=ubuntu ; 507 elif test -f /etc/debian_version ; then 508 VENDOR=debian ; 509 elif test -f /etc/alpine-release ; then 510 VENDOR=alpine ; 511 elif test -f /bin/freebsd-version ; then 512 VENDOR=freebsd ; 513 else 514 VENDOR= ; 515 fi], 516 [ test "x${with_vendor}" != x],[ 517 VENDOR="$with_vendor" ], 518 [ VENDOR= ; ] 519 ) 520 AC_MSG_RESULT([$VENDOR]) 521 AC_SUBST(VENDOR) 522 523 AC_MSG_CHECKING([default package type]) 524 case "$VENDOR" in 525 toss) DEFAULT_PACKAGE=rpm ;; 526 redhat) DEFAULT_PACKAGE=rpm ;; 527 fedora) DEFAULT_PACKAGE=rpm ;; 528 gentoo) DEFAULT_PACKAGE=tgz ;; 529 alpine) DEFAULT_PACKAGE=tgz ;; 530 arch) DEFAULT_PACKAGE=tgz ;; 531 sles) DEFAULT_PACKAGE=rpm ;; 532 slackware) DEFAULT_PACKAGE=tgz ;; 533 lunar) DEFAULT_PACKAGE=tgz ;; 534 ubuntu) DEFAULT_PACKAGE=deb ;; 535 debian) DEFAULT_PACKAGE=deb ;; 536 freebsd) DEFAULT_PACKAGE=pkg ;; 537 *) DEFAULT_PACKAGE=rpm ;; 538 esac 539 AC_MSG_RESULT([$DEFAULT_PACKAGE]) 540 AC_SUBST(DEFAULT_PACKAGE) 541 542 AC_MSG_CHECKING([default init directory]) 543 case "$VENDOR" in 544 freebsd) initdir=$sysconfdir/rc.d ;; 545 *) initdir=$sysconfdir/init.d;; 546 esac 547 AC_MSG_RESULT([$initdir]) 548 AC_SUBST(initdir) 549 550 AC_MSG_CHECKING([default init script type and shell]) 551 case "$VENDOR" in 552 toss) DEFAULT_INIT_SCRIPT=redhat ;; 553 redhat) DEFAULT_INIT_SCRIPT=redhat ;; 554 fedora) DEFAULT_INIT_SCRIPT=fedora ;; 555 gentoo) DEFAULT_INIT_SCRIPT=openrc ;; 556 alpine) DEFAULT_INIT_SCRIPT=openrc ;; 557 arch) DEFAULT_INIT_SCRIPT=lsb ;; 558 sles) DEFAULT_INIT_SCRIPT=lsb ;; 559 slackware) DEFAULT_INIT_SCRIPT=lsb ;; 560 lunar) DEFAULT_INIT_SCRIPT=lunar ;; 561 ubuntu) DEFAULT_INIT_SCRIPT=lsb ;; 562 debian) DEFAULT_INIT_SCRIPT=lsb ;; 563 freebsd) DEFAULT_INIT_SCRIPT=freebsd;; 564 *) DEFAULT_INIT_SCRIPT=lsb ;; 565 esac 566 567 case "$VENDOR" in 568 gentoo) DEFAULT_INIT_SHELL="/sbin/openrc-run";; 569 alpine) DEFAULT_INIT_SHELL="/sbin/openrc-run";; 570 *) DEFAULT_INIT_SHELL="/bin/sh" ;; 571 esac 572 573 AC_MSG_RESULT([$DEFAULT_INIT_SCRIPT:$DEFAULT_INIT_SHELL]) 574 AC_SUBST(DEFAULT_INIT_SCRIPT) 575 AC_SUBST(DEFAULT_INIT_SHELL) 576 577 AC_MSG_CHECKING([default nfs server init script]) 578 AS_IF([test "$VENDOR" = "debian"], 579 [DEFAULT_INIT_NFS_SERVER="nfs-kernel-server"], 580 [DEFAULT_INIT_NFS_SERVER="nfs"] 581 ) 582 AC_MSG_RESULT([$DEFAULT_INIT_NFS_SERVER]) 583 AC_SUBST(DEFAULT_INIT_NFS_SERVER) 584 585 AC_MSG_CHECKING([default init config directory]) 586 case "$VENDOR" in 587 alpine) initconfdir=/etc/conf.d ;; 588 gentoo) initconfdir=/etc/conf.d ;; 589 toss) initconfdir=/etc/sysconfig ;; 590 redhat) initconfdir=/etc/sysconfig ;; 591 fedora) initconfdir=/etc/sysconfig ;; 592 sles) initconfdir=/etc/sysconfig ;; 593 ubuntu) initconfdir=/etc/default ;; 594 debian) initconfdir=/etc/default ;; 595 freebsd) initconfdir=$sysconfdir/rc.conf.d;; 596 *) initconfdir=/etc/default ;; 597 esac 598 AC_MSG_RESULT([$initconfdir]) 599 AC_SUBST(initconfdir) 600 601 AC_MSG_CHECKING([whether initramfs-tools is available]) 602 if test -d /usr/share/initramfs-tools ; then 603 RPM_DEFINE_INITRAMFS='--define "_initramfs 1"' 604 AC_MSG_RESULT([yes]) 605 else 606 RPM_DEFINE_INITRAMFS='' 607 AC_MSG_RESULT([no]) 608 fi 609 AC_SUBST(RPM_DEFINE_INITRAMFS) 610]) 611 612dnl # 613dnl # Default ZFS package configuration 614dnl # 615AC_DEFUN([ZFS_AC_PACKAGE], [ 616 ZFS_AC_DEFAULT_PACKAGE 617 AS_IF([test x$VENDOR != xfreebsd], [ 618 ZFS_AC_RPM 619 ZFS_AC_DPKG 620 ZFS_AC_ALIEN 621 ]) 622]) 623