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 <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
Closes #10835
This commit is contained in:
Georgy Yakovlev 2020-08-28 09:43:44 -07:00 committed by GitHub
parent 2b07c5aa3e
commit 7ddcfe7c00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 37 additions and 27 deletions

View File

@ -418,33 +418,43 @@ dnl # package type for 'make pkg': (rpm | deb | tgz)
dnl # dnl #
AC_DEFUN([ZFS_AC_DEFAULT_PACKAGE], [ AC_DEFUN([ZFS_AC_DEFAULT_PACKAGE], [
AC_MSG_CHECKING([os distribution]) AC_MSG_CHECKING([os distribution])
if test -f /etc/toss-release ; then AC_ARG_WITH([vendor],
VENDOR=toss ; [AS_HELP_STRING([--with-vendor],
elif test -f /etc/fedora-release ; then [Distribution vendor @<:@default=check@:>@])],
VENDOR=fedora ; [with_vendor=$withval],
elif test -f /etc/redhat-release ; then [with_vendor=check])
VENDOR=redhat ; AS_IF([test "x$with_vendor" = "xcheck"],[
elif test -f /etc/gentoo-release ; then if test -f /etc/toss-release ; then
VENDOR=gentoo ; VENDOR=toss ;
elif test -f /etc/arch-release ; then elif test -f /etc/fedora-release ; then
VENDOR=arch ; VENDOR=fedora ;
elif test -f /etc/SuSE-release ; then elif test -f /etc/redhat-release ; then
VENDOR=sles ; VENDOR=redhat ;
elif test -f /etc/slackware-version ; then elif test -f /etc/gentoo-release ; then
VENDOR=slackware ; VENDOR=gentoo ;
elif test -f /etc/lunar.release ; then elif test -f /etc/arch-release ; then
VENDOR=lunar ; VENDOR=arch ;
elif test -f /etc/lsb-release ; then elif test -f /etc/SuSE-release ; then
VENDOR=ubuntu ; VENDOR=sles ;
elif test -f /etc/debian_version ; then elif test -f /etc/slackware-version ; then
VENDOR=debian ; VENDOR=slackware ;
elif test -f /etc/alpine-release ; then elif test -f /etc/lunar.release ; then
VENDOR=alpine ; VENDOR=lunar ;
elif test -f /bin/freebsd-version ; then elif test -f /etc/lsb-release ; then
VENDOR=freebsd ; VENDOR=ubuntu ;
else elif test -f /etc/debian_version ; then
VENDOR= ; VENDOR=debian ;
fi 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_MSG_RESULT([$VENDOR])
AC_SUBST(VENDOR) AC_SUBST(VENDOR)