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 | grep -Fqx $'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_CLOBBERED 213 ZFS_AC_CONFIG_ALWAYS_CC_IMPLICIT_FALLTHROUGH 214 ZFS_AC_CONFIG_ALWAYS_CC_FRAME_LARGER_THAN 215 ZFS_AC_CONFIG_ALWAYS_CC_NO_FORMAT_TRUNCATION 216 ZFS_AC_CONFIG_ALWAYS_CC_NO_FORMAT_ZERO_LENGTH 217 ZFS_AC_CONFIG_ALWAYS_CC_NO_OMIT_FRAME_POINTER 218 ZFS_AC_CONFIG_ALWAYS_CC_NO_IPA_SRA 219 ZFS_AC_CONFIG_ALWAYS_CC_ASAN 220 ZFS_AC_CONFIG_ALWAYS_CC_UBSAN 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 ZFS_AC_CONFIG_ALWAYS_PARALLEL 230]) 231 232AC_DEFUN([ZFS_AC_CONFIG], [ 233 234 dnl # Remove the previous build test directory. 235 rm -Rf build 236 237 ZFS_CONFIG=all 238 AC_ARG_WITH([config], 239 AS_HELP_STRING([--with-config=CONFIG], 240 [Config file 'kernel|user|all|srpm']), 241 [ZFS_CONFIG="$withval"]) 242 AC_ARG_ENABLE([linux-builtin], 243 [AS_HELP_STRING([--enable-linux-builtin], 244 [Configure for builtin in-tree kernel modules @<:@default=no@:>@])], 245 [], 246 [enable_linux_builtin=no]) 247 248 AC_MSG_CHECKING([zfs config]) 249 AC_MSG_RESULT([$ZFS_CONFIG]); 250 AC_SUBST(ZFS_CONFIG) 251 252 ZFS_AC_CONFIG_ALWAYS 253 254 AM_COND_IF([BUILD_LINUX], [ 255 AC_ARG_VAR([TEST_JOBS], [simultaneous jobs during configure]) 256 if test "x$ac_cv_env_TEST_JOBS_set" != "xset"; then 257 TEST_JOBS=$CPU_COUNT 258 fi 259 AC_SUBST(TEST_JOBS) 260 ]) 261 262 ZFS_INIT_SYSV= 263 ZFS_INIT_SYSTEMD= 264 ZFS_WANT_MODULES_LOAD_D= 265 266 case "$ZFS_CONFIG" in 267 kernel) ZFS_AC_CONFIG_KERNEL ;; 268 user) ZFS_AC_CONFIG_USER ;; 269 all) ZFS_AC_CONFIG_USER 270 ZFS_AC_CONFIG_KERNEL ;; 271 dist) ;; 272 srpm) ;; 273 *) 274 AC_MSG_RESULT([Error!]) 275 AC_MSG_ERROR([Bad value "$ZFS_CONFIG" for --with-config, 276 user kernel|user|all|srpm]) ;; 277 esac 278 279 AM_CONDITIONAL([INIT_SYSV], [test "x$ZFS_INIT_SYSV" = "xyes"]) 280 AM_CONDITIONAL([INIT_SYSTEMD], [test "x$ZFS_INIT_SYSTEMD" = "xyes"]) 281 AM_CONDITIONAL([WANT_MODULES_LOAD_D], [test "x$ZFS_WANT_MODULES_LOAD_D" = "xyes"]) 282 283 AM_CONDITIONAL([CONFIG_USER], 284 [test "$ZFS_CONFIG" = user -o "$ZFS_CONFIG" = all]) 285 AM_CONDITIONAL([CONFIG_KERNEL], 286 [test "$ZFS_CONFIG" = kernel -o "$ZFS_CONFIG" = all] && 287 [test "x$enable_linux_builtin" != xyes ]) 288 AM_CONDITIONAL([CONFIG_QAT], 289 [test "$ZFS_CONFIG" = kernel -o "$ZFS_CONFIG" = all] && 290 [test "x$qatsrc" != x ]) 291 AM_CONDITIONAL([WANT_DEVNAME2DEVID], [test "x$user_libudev" = xyes ]) 292 AM_CONDITIONAL([WANT_MMAP_LIBAIO], [test "x$user_libaio" = xyes ]) 293 AM_CONDITIONAL([PAM_ZFS_ENABLED], [test "x$enable_pam" = xyes]) 294]) 295 296dnl # 297dnl # Check for rpm+rpmbuild to build RPM packages. If these tools 298dnl # are missing it is non-fatal but you will not be able to build 299dnl # RPM packages and will be warned if you try too. 300dnl # 301dnl # By default the generic spec file will be used because it requires 302dnl # minimal dependencies. Distribution specific spec files can be 303dnl # placed under the 'rpm/<distribution>' directory and enabled using 304dnl # the --with-spec=<distribution> configure option. 305dnl # 306AC_DEFUN([ZFS_AC_RPM], [ 307 RPM=rpm 308 RPMBUILD=rpmbuild 309 310 AC_MSG_CHECKING([whether $RPM is available]) 311 AS_IF([tmp=$($RPM --version 2>/dev/null)], [ 312 RPM_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }') 313 HAVE_RPM=yes 314 AC_MSG_RESULT([$HAVE_RPM ($RPM_VERSION)]) 315 ],[ 316 HAVE_RPM=no 317 AC_MSG_RESULT([$HAVE_RPM]) 318 ]) 319 320 AC_MSG_CHECKING([whether $RPMBUILD is available]) 321 AS_IF([tmp=$($RPMBUILD --version 2>/dev/null)], [ 322 RPMBUILD_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }') 323 HAVE_RPMBUILD=yes 324 AC_MSG_RESULT([$HAVE_RPMBUILD ($RPMBUILD_VERSION)]) 325 ],[ 326 HAVE_RPMBUILD=no 327 AC_MSG_RESULT([$HAVE_RPMBUILD]) 328 ]) 329 330 RPM_DEFINE_COMMON='--define "$(DEBUG_ZFS) 1"' 331 RPM_DEFINE_COMMON=${RPM_DEFINE_COMMON}' --define "$(DEBUGINFO_ZFS) 1"' 332 RPM_DEFINE_COMMON=${RPM_DEFINE_COMMON}' --define "$(DEBUG_KMEM_ZFS) 1"' 333 RPM_DEFINE_COMMON=${RPM_DEFINE_COMMON}' --define "$(DEBUG_KMEM_TRACKING_ZFS) 1"' 334 RPM_DEFINE_COMMON=${RPM_DEFINE_COMMON}' --define "$(ASAN_ZFS) 1"' 335 RPM_DEFINE_COMMON=${RPM_DEFINE_COMMON}' --define "$(UBSAN_ZFS) 1"' 336 337 AS_IF([test "x$enable_debuginfo" = xyes], [ 338 RPM_DEFINE_COMMON=${RPM_DEFINE_COMMON}' --define "__strip /bin/true"' 339 ]) 340 341 RPM_DEFINE_UTIL=' --define "_initconfdir $(initconfdir)"' 342 343 dnl # Make the next three RPM_DEFINE_UTIL additions conditional, since 344 dnl # their values may not be set when running: 345 dnl # 346 dnl # ./configure --with-config=srpm 347 dnl # 348 AS_IF([test -n "$dracutdir" ], [ 349 RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' --define "_dracutdir $(dracutdir)"' 350 ]) 351 AS_IF([test -n "$udevdir" ], [ 352 RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' --define "_udevdir $(udevdir)"' 353 ]) 354 AS_IF([test -n "$udevruledir" ], [ 355 RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' --define "_udevruledir $(udevruledir)"' 356 ]) 357 RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' $(DEFINE_SYSTEMD)' 358 RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' $(DEFINE_PYZFS)' 359 RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' $(DEFINE_PAM)' 360 RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' $(DEFINE_PYTHON_VERSION)' 361 RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' $(DEFINE_PYTHON_PKG_VERSION)' 362 363 dnl # Override default lib directory on Debian/Ubuntu systems. The 364 dnl # provided /usr/lib/rpm/platform/<arch>/macros files do not 365 dnl # specify the correct path for multiarch systems as described 366 dnl # by the packaging guidelines. 367 dnl # 368 dnl # https://wiki.ubuntu.com/MultiarchSpec 369 dnl # https://wiki.debian.org/Multiarch/Implementation 370 dnl # 371 AS_IF([test "$DEFAULT_PACKAGE" = "deb"], [ 372 MULTIARCH_LIBDIR="lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)" 373 RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' --define "_lib $(MULTIARCH_LIBDIR)"' 374 AC_SUBST(MULTIARCH_LIBDIR) 375 ]) 376 377 dnl # Make RPM_DEFINE_KMOD additions conditional on CONFIG_KERNEL, 378 dnl # since the values will not be set otherwise. The spec files 379 dnl # provide defaults for them. 380 dnl # 381 RPM_DEFINE_KMOD='--define "_wrong_version_format_terminate_build 0"' 382 AM_COND_IF([CONFIG_KERNEL], [ 383 RPM_DEFINE_KMOD=${RPM_DEFINE_KMOD}' --define "kernels $(LINUX_VERSION)"' 384 RPM_DEFINE_KMOD=${RPM_DEFINE_KMOD}' --define "ksrc $(LINUX)"' 385 RPM_DEFINE_KMOD=${RPM_DEFINE_KMOD}' --define "kobj $(LINUX_OBJ)"' 386 RPM_DEFINE_KMOD=${RPM_DEFINE_KMOD}' --define "kernel_cc KERNEL_CC=$(KERNEL_CC)"' 387 RPM_DEFINE_KMOD=${RPM_DEFINE_KMOD}' --define "kernel_ld KERNEL_LD=$(KERNEL_LD)"' 388 RPM_DEFINE_KMOD=${RPM_DEFINE_KMOD}' --define "kernel_llvm KERNEL_LLVM=$(KERNEL_LLVM)"' 389 ]) 390 391 RPM_DEFINE_DKMS='' 392 393 SRPM_DEFINE_COMMON='--define "build_src_rpm 1"' 394 SRPM_DEFINE_UTIL= 395 SRPM_DEFINE_KMOD= 396 SRPM_DEFINE_DKMS= 397 398 RPM_SPEC_DIR="rpm/generic" 399 AC_ARG_WITH([spec], 400 AS_HELP_STRING([--with-spec=SPEC], 401 [Spec files 'generic|redhat']), 402 [RPM_SPEC_DIR="rpm/$withval"]) 403 404 AC_MSG_CHECKING([whether spec files are available]) 405 AC_MSG_RESULT([yes ($RPM_SPEC_DIR/*.spec.in)]) 406 407 AC_SUBST(HAVE_RPM) 408 AC_SUBST(RPM) 409 AC_SUBST(RPM_VERSION) 410 411 AC_SUBST(HAVE_RPMBUILD) 412 AC_SUBST(RPMBUILD) 413 AC_SUBST(RPMBUILD_VERSION) 414 415 AC_SUBST(RPM_SPEC_DIR) 416 AC_SUBST(RPM_DEFINE_UTIL) 417 AC_SUBST(RPM_DEFINE_KMOD) 418 AC_SUBST(RPM_DEFINE_DKMS) 419 AC_SUBST(RPM_DEFINE_COMMON) 420 AC_SUBST(SRPM_DEFINE_UTIL) 421 AC_SUBST(SRPM_DEFINE_KMOD) 422 AC_SUBST(SRPM_DEFINE_DKMS) 423 AC_SUBST(SRPM_DEFINE_COMMON) 424]) 425 426dnl # 427dnl # Check for dpkg+dpkg-buildpackage to build DEB packages. If these 428dnl # tools are missing it is non-fatal but you will not be able to build 429dnl # DEB packages and will be warned if you try too. 430dnl # 431AC_DEFUN([ZFS_AC_DPKG], [ 432 DPKG=dpkg 433 DPKGBUILD=dpkg-buildpackage 434 435 AC_MSG_CHECKING([whether $DPKG is available]) 436 AS_IF([tmp=$($DPKG --version 2>/dev/null)], [ 437 DPKG_VERSION=$(echo $tmp | $AWK '/Debian/ { print $[7] }') 438 HAVE_DPKG=yes 439 AC_MSG_RESULT([$HAVE_DPKG ($DPKG_VERSION)]) 440 ],[ 441 HAVE_DPKG=no 442 AC_MSG_RESULT([$HAVE_DPKG]) 443 ]) 444 445 AC_MSG_CHECKING([whether $DPKGBUILD is available]) 446 AS_IF([tmp=$($DPKGBUILD --version 2>/dev/null)], [ 447 DPKGBUILD_VERSION=$(echo $tmp | \ 448 $AWK '/Debian/ { print $[4] }' | cut -f-4 -d'.') 449 HAVE_DPKGBUILD=yes 450 AC_MSG_RESULT([$HAVE_DPKGBUILD ($DPKGBUILD_VERSION)]) 451 ],[ 452 HAVE_DPKGBUILD=no 453 AC_MSG_RESULT([$HAVE_DPKGBUILD]) 454 ]) 455 456 AC_SUBST(HAVE_DPKG) 457 AC_SUBST(DPKG) 458 AC_SUBST(DPKG_VERSION) 459 460 AC_SUBST(HAVE_DPKGBUILD) 461 AC_SUBST(DPKGBUILD) 462 AC_SUBST(DPKGBUILD_VERSION) 463]) 464 465dnl # 466dnl # Until native packaging for various different packing systems 467dnl # can be added the least we can do is attempt to use alien to 468dnl # convert the RPM packages to the needed package type. This is 469dnl # a hack but so far it has worked reasonable well. 470dnl # 471AC_DEFUN([ZFS_AC_ALIEN], [ 472 ALIEN=alien 473 474 AC_MSG_CHECKING([whether $ALIEN is available]) 475 AS_IF([tmp=$($ALIEN --version 2>/dev/null)], [ 476 ALIEN_VERSION=$(echo $tmp | $AWK '{ print $[3] }') 477 ALIEN_MAJOR=$(echo ${ALIEN_VERSION} | $AWK -F'.' '{ print $[1] }') 478 ALIEN_MINOR=$(echo ${ALIEN_VERSION} | $AWK -F'.' '{ print $[2] }') 479 ALIEN_POINT=$(echo ${ALIEN_VERSION} | $AWK -F'.' '{ print $[3] }') 480 HAVE_ALIEN=yes 481 AC_MSG_RESULT([$HAVE_ALIEN ($ALIEN_VERSION)]) 482 ],[ 483 HAVE_ALIEN=no 484 AC_MSG_RESULT([$HAVE_ALIEN]) 485 ]) 486 487 AC_SUBST(HAVE_ALIEN) 488 AC_SUBST(ALIEN) 489 AC_SUBST(ALIEN_VERSION) 490 AC_SUBST(ALIEN_MAJOR) 491 AC_SUBST(ALIEN_MINOR) 492 AC_SUBST(ALIEN_POINT) 493]) 494 495dnl # 496dnl # Using the VENDOR tag from config.guess set the default 497dnl # package type for 'make pkg': (rpm | deb | tgz) 498dnl # 499AC_DEFUN([ZFS_AC_DEFAULT_PACKAGE], [ 500 AC_MSG_CHECKING([os distribution]) 501 AC_ARG_WITH([vendor], 502 [AS_HELP_STRING([--with-vendor], 503 [Distribution vendor @<:@default=check@:>@])], 504 [with_vendor=$withval], 505 [with_vendor=check]) 506 AS_IF([test "x$with_vendor" = "xcheck"],[ 507 if test -f /etc/toss-release ; then 508 VENDOR=toss ; 509 elif test -f /etc/fedora-release ; then 510 VENDOR=fedora ; 511 elif test -f /etc/redhat-release ; then 512 VENDOR=redhat ; 513 elif test -f /etc/gentoo-release ; then 514 VENDOR=gentoo ; 515 elif test -f /etc/arch-release ; then 516 VENDOR=arch ; 517 elif test -f /etc/SuSE-release ; then 518 VENDOR=sles ; 519 elif test -f /etc/slackware-version ; then 520 VENDOR=slackware ; 521 elif test -f /etc/lunar.release ; then 522 VENDOR=lunar ; 523 elif test -f /etc/lsb-release ; then 524 VENDOR=ubuntu ; 525 elif test -f /etc/debian_version ; then 526 VENDOR=debian ; 527 elif test -f /etc/alpine-release ; then 528 VENDOR=alpine ; 529 elif test -f /bin/freebsd-version ; then 530 VENDOR=freebsd ; 531 else 532 VENDOR= ; 533 fi], 534 [ test "x${with_vendor}" != x],[ 535 VENDOR="$with_vendor" ], 536 [ VENDOR= ; ] 537 ) 538 AC_MSG_RESULT([$VENDOR]) 539 AC_SUBST(VENDOR) 540 541 AC_MSG_CHECKING([default package type]) 542 case "$VENDOR" in 543 toss) DEFAULT_PACKAGE=rpm ;; 544 redhat) DEFAULT_PACKAGE=rpm ;; 545 fedora) DEFAULT_PACKAGE=rpm ;; 546 gentoo) DEFAULT_PACKAGE=tgz ;; 547 alpine) DEFAULT_PACKAGE=tgz ;; 548 arch) DEFAULT_PACKAGE=tgz ;; 549 sles) DEFAULT_PACKAGE=rpm ;; 550 slackware) DEFAULT_PACKAGE=tgz ;; 551 lunar) DEFAULT_PACKAGE=tgz ;; 552 ubuntu) DEFAULT_PACKAGE=deb ;; 553 debian) DEFAULT_PACKAGE=deb ;; 554 freebsd) DEFAULT_PACKAGE=pkg ;; 555 *) DEFAULT_PACKAGE=rpm ;; 556 esac 557 AC_MSG_RESULT([$DEFAULT_PACKAGE]) 558 AC_SUBST(DEFAULT_PACKAGE) 559 560 AC_MSG_CHECKING([default init directory]) 561 case "$VENDOR" in 562 freebsd) initdir=$sysconfdir/rc.d ;; 563 *) initdir=$sysconfdir/init.d;; 564 esac 565 AC_MSG_RESULT([$initdir]) 566 AC_SUBST(initdir) 567 568 AC_MSG_CHECKING([default init script type and shell]) 569 case "$VENDOR" in 570 toss) DEFAULT_INIT_SCRIPT=redhat ;; 571 redhat) DEFAULT_INIT_SCRIPT=redhat ;; 572 fedora) DEFAULT_INIT_SCRIPT=fedora ;; 573 gentoo) DEFAULT_INIT_SCRIPT=openrc ;; 574 alpine) DEFAULT_INIT_SCRIPT=openrc ;; 575 arch) DEFAULT_INIT_SCRIPT=lsb ;; 576 sles) DEFAULT_INIT_SCRIPT=lsb ;; 577 slackware) DEFAULT_INIT_SCRIPT=lsb ;; 578 lunar) DEFAULT_INIT_SCRIPT=lunar ;; 579 ubuntu) DEFAULT_INIT_SCRIPT=lsb ;; 580 debian) DEFAULT_INIT_SCRIPT=lsb ;; 581 freebsd) DEFAULT_INIT_SCRIPT=freebsd;; 582 *) DEFAULT_INIT_SCRIPT=lsb ;; 583 esac 584 585 case "$VENDOR" in 586 gentoo) DEFAULT_INIT_SHELL="/sbin/openrc-run";; 587 alpine) DEFAULT_INIT_SHELL="/sbin/openrc-run";; 588 *) DEFAULT_INIT_SHELL="/bin/sh" ;; 589 esac 590 591 AC_MSG_RESULT([$DEFAULT_INIT_SCRIPT:$DEFAULT_INIT_SHELL]) 592 AC_SUBST(DEFAULT_INIT_SCRIPT) 593 AC_SUBST(DEFAULT_INIT_SHELL) 594 595 AC_MSG_CHECKING([default nfs server init script]) 596 AS_IF([test "$VENDOR" = "debian"], 597 [DEFAULT_INIT_NFS_SERVER="nfs-kernel-server"], 598 [DEFAULT_INIT_NFS_SERVER="nfs"] 599 ) 600 AC_MSG_RESULT([$DEFAULT_INIT_NFS_SERVER]) 601 AC_SUBST(DEFAULT_INIT_NFS_SERVER) 602 603 AC_MSG_CHECKING([default init config directory]) 604 case "$VENDOR" in 605 alpine) initconfdir=/etc/conf.d ;; 606 gentoo) initconfdir=/etc/conf.d ;; 607 toss) initconfdir=/etc/sysconfig ;; 608 redhat) initconfdir=/etc/sysconfig ;; 609 fedora) initconfdir=/etc/sysconfig ;; 610 sles) initconfdir=/etc/sysconfig ;; 611 ubuntu) initconfdir=/etc/default ;; 612 debian) initconfdir=/etc/default ;; 613 freebsd) initconfdir=$sysconfdir/rc.conf.d;; 614 *) initconfdir=/etc/default ;; 615 esac 616 AC_MSG_RESULT([$initconfdir]) 617 AC_SUBST(initconfdir) 618 619 AC_MSG_CHECKING([whether initramfs-tools is available]) 620 if test -d /usr/share/initramfs-tools ; then 621 RPM_DEFINE_INITRAMFS='--define "_initramfs 1"' 622 AC_MSG_RESULT([yes]) 623 else 624 RPM_DEFINE_INITRAMFS='' 625 AC_MSG_RESULT([no]) 626 fi 627 AC_SUBST(RPM_DEFINE_INITRAMFS) 628]) 629 630dnl # 631dnl # Default ZFS package configuration 632dnl # 633AC_DEFUN([ZFS_AC_PACKAGE], [ 634 ZFS_AC_DEFAULT_PACKAGE 635 AS_IF([test x$VENDOR != xfreebsd], [ 636 ZFS_AC_RPM 637 ZFS_AC_DPKG 638 ZFS_AC_ALIEN 639 ]) 640]) 641