config: fix fail if explicit dependency not met

This patch modifies default configuration disabling features
with known issues or incompatibilities.

If user tries to explicitly turn on feature which dependences are
not met it exits with error immediately.

	Fixes issue #1193

Change-Id: If7363506ee812c5135f5a3a023ab9e8d26268528
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/971
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Tomasz Kulasek 2020-02-20 17:57:44 +01:00 committed by Tomasz Zawadzki
parent e4c26938a4
commit 873c8748eb

75
configure vendored
View File

@ -116,6 +116,44 @@ declare -A CONFIG
source $rootdir/CONFIG.sh source $rootdir/CONFIG.sh
rm $rootdir/CONFIG.sh rm $rootdir/CONFIG.sh
# Detect the compiler toolchain
$rootdir/scripts/detect_cc.sh --cc="$CC" --cxx="$CXX" --lto="${CONFIG[LTO]}" --ld="$LD" --cross-prefix="${CONFIG[CROSS_PREFIX]}" > $rootdir/mk/cc.mk
CC=$(cat $rootdir/mk/cc.mk | grep "DEFAULT_CC=" | cut -d "=" -f 2)
CC_TYPE=$(cat $rootdir/mk/cc.mk | grep "CC_TYPE=" | cut -d "=" -f 2)
arch=$($CC -dumpmachine)
# Sanitize default configuration. All parameters set by user explicit should fail
# Force no ISA-L if non-x86 or non-aarch64 architecture
if [[ "${CONFIG[ISAL]}" = "y" ]]; then
if [[ $arch != x86_64* ]] && [[ $arch != aarch64* ]]; then
CONFIG[ISAL]=n
echo "Notice: ISA-L not supported for ${arch}. Turning off default feature."
fi
fi
if [[ "$OSTYPE" == "freebsd"* ]]; then
# Vhost, rte_vhost library and virtio are only supported on Linux.
CONFIG[VHOST]="n"
CONFIG[VHOST_INTERNAL_LIB]="n"
CONFIG[VIRTIO]="n"
echo "Notice: Vhost, rte_vhost library and virtio are only supported on Linux. Turning off default feature."
fi
ver=$(nasm -v 2>/dev/null | awk '{print $3}' | sed 's/[^0-9]*//g')
if [[ "${ver:0:1}" -le "2" ]] && [[ "${ver:0:3}" -le "213" ]] && [[ "${ver:0:5}" -lt "21303" ]]; then
# ISA-L, compression & crypto require NASM version 2.13.03 or newer.
CONFIG[ISAL]=n
CONFIG[CRYPTO]=n
CONFIG[IPSEC_MB]=n
CONFIG[REDUCE]=n
HAVE_NASM=n
echo "Notice: ISA-L, compression & crypto require NASM version 2.13.03 or newer. Turning off default ISA-L and crypto features."
else
HAVE_NASM=y
fi
function check_dir() { function check_dir() {
arg="$1" arg="$1"
dir="${arg#*=}" dir="${arg#*=}"
@ -381,14 +419,6 @@ for i in "$@"; do
esac esac
done done
# Detect the compiler toolchain
$rootdir/scripts/detect_cc.sh --cc="$CC" --cxx="$CXX" --lto="${CONFIG[LTO]}" --ld="$LD" --cross-prefix="${CONFIG[CROSS_PREFIX]}" > $rootdir/mk/cc.mk
CC=$(cat $rootdir/mk/cc.mk | grep "DEFAULT_CC=" | cut -d "=" -f 2)
CC_TYPE=$(cat $rootdir/mk/cc.mk | grep "CC_TYPE=" | cut -d "=" -f 2)
arch=$($CC -dumpmachine)
if [[ $arch == x86_64* ]]; then if [[ $arch == x86_64* ]]; then
BUILD_CMD=($CC -o /dev/null -x c $CPPFLAGS $CFLAGS $LDFLAGS -march=native) BUILD_CMD=($CC -o /dev/null -x c $CPPFLAGS $CFLAGS $LDFLAGS -march=native)
else else
@ -398,8 +428,8 @@ fi
# Detect architecture and force no ISA-L if non-x86 or non-aarch64 architecture # Detect architecture and force no ISA-L if non-x86 or non-aarch64 architecture
if [[ "${CONFIG[ISAL]}" = "y" ]]; then if [[ "${CONFIG[ISAL]}" = "y" ]]; then
if [[ $arch != x86_64* ]] && [[ $arch != aarch64* ]]; then if [[ $arch != x86_64* ]] && [[ $arch != aarch64* ]]; then
echo "Notice: ISA-L disabled due to CPU incompatiblity." echo "ERROR: ISA-L cannot be used due to CPU incompatiblity."
CONFIG[ISAL]=n exit 1
fi fi
fi fi
@ -496,16 +526,16 @@ fi
if [[ "$OSTYPE" == "freebsd"* ]]; then if [[ "$OSTYPE" == "freebsd"* ]]; then
if [[ "${CONFIG[VHOST]}" == "y" ]]; then if [[ "${CONFIG[VHOST]}" == "y" ]]; then
echo "Vhost is only supported on Linux. Disabling it." echo "Vhost is only supported on Linux."
CONFIG[VHOST]="n" exit 1
fi fi
if [[ "${CONFIG[VHOST_INTERNAL_LIB]}" == "y" ]]; then if [[ "${CONFIG[VHOST_INTERNAL_LIB]}" == "y" ]]; then
echo "Internal rte_vhost library is only supported on Linux. Disabling it." echo "Internal rte_vhost library is only supported on Linux."
CONFIG[VHOST_INTERNAL_LIB]="n" exit 1
fi fi
if [[ "${CONFIG[VIRTIO]}" == "y" ]]; then if [[ "${CONFIG[VIRTIO]}" == "y" ]]; then
echo "Virtio is only supported on Linux. Disabling it." echo "Virtio is only supported on Linux."
CONFIG[VIRTIO]="n" exit 1
fi fi
fi fi
@ -551,15 +581,10 @@ if [[ "${CONFIG[FC]}" = "y" ]]; then
fi fi
if [[ "${CONFIG[ISAL]}" = "y" ]] || [[ "${CONFIG[CRYPTO]}" = "y" ]]; then if [[ "${CONFIG[ISAL]}" = "y" ]] || [[ "${CONFIG[CRYPTO]}" = "y" ]]; then
ver=$(nasm -v 2>/dev/null | awk '{print $3}' | sed 's/[^0-9]*//g') if [[ "${HAVE_NASM}" = "n" ]]; then
if [[ "${ver:0:1}" -le "2" ]] && [[ "${ver:0:3}" -le "213" ]] && [[ "${ver:0:5}" -lt "21303" ]]; then echo "ERROR: ISA-L, compression & crypto require NASM version 2.13.03 or newer."
echo "Notice: ISA-L, compression & crypto auto-disabled due to nasm dependency." echo "Please install or upgrade them re-run this script."
echo "These features require NASM version 2.13.03 or newer. Please install" exit 1
echo "or upgrade then re-run this script."
CONFIG[ISAL]=n
CONFIG[CRYPTO]=n
CONFIG[IPSEC_MB]=n
CONFIG[REDUCE]=n
else else
if [[ "${CONFIG[CRYPTO]}" = "y" ]]; then if [[ "${CONFIG[CRYPTO]}" = "y" ]]; then
CONFIG[IPSEC_MB]=y CONFIG[IPSEC_MB]=y