From 7ddcfe7c00d1ca6269000dc48c6bb12100fc1737 Mon Sep 17 00:00:00 2001 From: Georgy Yakovlev <168902+gyakovlev@users.noreply.github.com> Date: Fri, 28 Aug 2020 09:43:44 -0700 Subject: [PATCH] config/zfs-build.m4: add --with-vendor flag This will allow an override of auto-detection of distribution, which is based on checking presence of /etc/*-release files. Build systems makes a lot of file location assumptions based on detected distribution. Some distributions (like gentoo) may prefer explicitly setting --with-vendor=gentoo to avoid auto-detection. Since auto-detection checks all files in order, current script may misdetect even on gentoo system if /etc/redhat-release file is present Default behavior is unchanged and default is --with-vendor=check Reviewed-by: Ryan Moeller Reviewed-by: Brian Behlendorf Signed-off-by: Georgy Yakovlev Closes #10835 --- config/zfs-build.m4 | 64 ++++++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 27 deletions(-) diff --git a/config/zfs-build.m4 b/config/zfs-build.m4 index 54b61de090..2f0aca8305 100644 --- a/config/zfs-build.m4 +++ b/config/zfs-build.m4 @@ -418,33 +418,43 @@ dnl # package type for 'make pkg': (rpm | deb | tgz) dnl # AC_DEFUN([ZFS_AC_DEFAULT_PACKAGE], [ AC_MSG_CHECKING([os distribution]) - if test -f /etc/toss-release ; then - VENDOR=toss ; - elif test -f /etc/fedora-release ; then - VENDOR=fedora ; - elif test -f /etc/redhat-release ; then - VENDOR=redhat ; - elif test -f /etc/gentoo-release ; then - VENDOR=gentoo ; - elif test -f /etc/arch-release ; then - VENDOR=arch ; - elif test -f /etc/SuSE-release ; then - VENDOR=sles ; - elif test -f /etc/slackware-version ; then - VENDOR=slackware ; - elif test -f /etc/lunar.release ; then - VENDOR=lunar ; - elif test -f /etc/lsb-release ; then - VENDOR=ubuntu ; - elif test -f /etc/debian_version ; then - VENDOR=debian ; - elif test -f /etc/alpine-release ; then - VENDOR=alpine ; - elif test -f /bin/freebsd-version ; then - VENDOR=freebsd ; - else - VENDOR= ; - fi + AC_ARG_WITH([vendor], + [AS_HELP_STRING([--with-vendor], + [Distribution vendor @<:@default=check@:>@])], + [with_vendor=$withval], + [with_vendor=check]) + AS_IF([test "x$with_vendor" = "xcheck"],[ + if test -f /etc/toss-release ; then + VENDOR=toss ; + elif test -f /etc/fedora-release ; then + VENDOR=fedora ; + elif test -f /etc/redhat-release ; then + VENDOR=redhat ; + elif test -f /etc/gentoo-release ; then + VENDOR=gentoo ; + elif test -f /etc/arch-release ; then + VENDOR=arch ; + elif test -f /etc/SuSE-release ; then + VENDOR=sles ; + elif test -f /etc/slackware-version ; then + VENDOR=slackware ; + elif test -f /etc/lunar.release ; then + VENDOR=lunar ; + elif test -f /etc/lsb-release ; then + VENDOR=ubuntu ; + elif test -f /etc/debian_version ; then + VENDOR=debian ; + elif test -f /etc/alpine-release ; then + VENDOR=alpine ; + elif test -f /bin/freebsd-version ; then + VENDOR=freebsd ; + else + VENDOR= ; + fi], + [ test "x${with_vendor}" != x],[ + VENDOR="$with_vendor" ], + [ VENDOR= ; ] + ) AC_MSG_RESULT([$VENDOR]) AC_SUBST(VENDOR)