configure: switch to arrays when generating CONFIG.local

This patch is preparation for including build configuration in fedora
devel package.

Change-Id: I174e2a9392a2be2efa9d8032cb8c4d8360208781
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/427909
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Pawel Wodkowski 2018-10-03 16:58:36 +02:00 committed by Jim Harris
parent 461cfcecc6
commit 577df16ab9
3 changed files with 95 additions and 159 deletions

4
CONFIG
View File

@ -63,11 +63,11 @@ CONFIG_TESTS?=y
# Directory that contains the desired SPDK environment library. # Directory that contains the desired SPDK environment library.
# By default, this is implemented using DPDK. # By default, this is implemented using DPDK.
CONFIG_ENV?=$(SPDK_ROOT_DIR)/lib/env_dpdk CONFIG_ENV?=
# This directory should contain 'include' and 'lib' directories for your DPDK # This directory should contain 'include' and 'lib' directories for your DPDK
# installation. # installation.
CONFIG_DPDK_DIR?=$(SPDK_ROOT_DIR)/dpdk/build CONFIG_DPDK_DIR?=
# Build SPDK FIO plugin. Requires CONFIG_FIO_SOURCE_DIR set to a valid # Build SPDK FIO plugin. Requires CONFIG_FIO_SOURCE_DIR set to a valid
# fio source code directory. # fio source code directory.

View File

@ -14,6 +14,8 @@ cd $rootdir
date -u date -u
git describe --tags git describe --tags
./configure $config_params
# Print some test system info out for the log # Print some test system info out for the log
echo "** START ** Info for Hostname: $HOSTNAME" echo "** START ** Info for Hostname: $HOSTNAME"
uname -a uname -a

246
configure vendored
View File

@ -66,6 +66,14 @@ function usage()
echo "" echo ""
} }
# Load default values
# Convert config to sourcable configuration file
sed -r 's/CONFIG_([[:alnum:]_]+)\?=(.*)/CONFIG[\1]=\2/g' CONFIG > CONFIG.sh
declare -A CONFIG
source CONFIG.sh
rm CONFIG.sh
function check_dir() { function check_dir() {
arg="$1" arg="$1"
dir="${arg#*=}" dir="${arg#*=}"
@ -82,70 +90,70 @@ for i in "$@"; do
exit 0 exit 0
;; ;;
--prefix=*) --prefix=*)
CONFIG_PREFIX="${i#*=}" CONFIG[PREFIX]="${i#*=}"
;; ;;
--enable-debug) --enable-debug)
CONFIG_DEBUG=y CONFIG[DEBUG]=y
;; ;;
--disable-debug) --disable-debug)
CONFIG_DEBUG=n CONFIG[DEBUG]=n
;; ;;
--enable-log-bt) --enable-log-bt)
CONFIG_LOG_BACKTRACE=y CONFIG[LOG_BACKTRACE]=y
;; ;;
--disable-log-bt) --disable-log-bt)
CONFIG_LOG_BACKTRACE=n CONFIG[LOG_BACKTRACE]=n
;; ;;
--enable-asan) --enable-asan)
CONFIG_ASAN=y CONFIG[ASAN]=y
;; ;;
--disable-asan) --disable-asan)
CONFIG_ASAN=n CONFIG[ASAN]=n
;; ;;
--enable-ubsan) --enable-ubsan)
CONFIG_UBSAN=y CONFIG[UBSAN]=y
;; ;;
--disable-ubsan) --disable-ubsan)
CONFIG_UBSAN=n CONFIG[UBSAN]=n
;; ;;
--enable-tsan) --enable-tsan)
CONFIG_TSAN=y CONFIG[TSAN]=y
;; ;;
--disable-tsan) --disable-tsan)
CONFIG_TSAN=n CONFIG[TSAN]=n
;; ;;
--enable-coverage) --enable-coverage)
CONFIG_COVERAGE=y CONFIG[COVERAGE]=y
;; ;;
--disable-coverage) --disable-coverage)
CONFIG_COVERAGE=n CONFIG[COVERAGE]=n
;; ;;
--enable-lto) --enable-lto)
CONFIG_LTO=y CONFIG[LTO]=y
;; ;;
--disable-lto) --disable-lto)
CONFIG_LTO=n CONFIG[LTO]=n
;; ;;
--enable-tests) --enable-tests)
CONFIG_TESTS=y CONFIG[TESTS]=y
;; ;;
--disable-tests) --disable-tests)
CONFIG_TESTS=n CONFIG[TESTS]=n
;; ;;
--enable-werror) --enable-werror)
CONFIG_WERROR=y CONFIG[WERROR]=y
;; ;;
--disable-werror) --disable-werror)
CONFIG_WERROR=n CONFIG[WERROR]=n
;; ;;
--with-env=*) --with-env=*)
CONFIG_ENV="${i#*=}" CONFIG[ENV]="${i#*=}"
;; ;;
--with-rbd) --with-rbd)
CONFIG_RBD=y CONFIG[RBD]=y
;; ;;
--without-rbd) --without-rbd)
CONFIG_RBD=n CONFIG[RBD]=n
;; ;;
--with-raid) --with-raid)
echo "--with-raid option ignored and is now deprecated. RAID module is always enabled." echo "--with-raid option ignored and is now deprecated. RAID module is always enabled."
@ -154,87 +162,88 @@ for i in "$@"; do
echo "--without-raid option ignored and is now deprecated. RAID module is always enabled." echo "--without-raid option ignored and is now deprecated. RAID module is always enabled."
;; ;;
--with-rdma) --with-rdma)
CONFIG_RDMA=y CONFIG[RDMA]=y
;; ;;
--without-rdma) --without-rdma)
CONFIG_RDMA=n CONFIG[RDMA]=n
;; ;;
--with-shared) --with-shared)
CONFIG_SHARED=y CONFIG[SHARED]=y
;; ;;
--without-shared) --without-shared)
CONFIG_SHARED=n CONFIG[SHARED]=n
;; ;;
--with-iscsi-initiator) --with-iscsi-initiator)
CONFIG_ISCSI_INITIATOR=y CONFIG[ISCSI_INITIATOR]=y
;; ;;
--without-iscsi-initiator) --without-iscsi-initiator)
CONFIG_ISCSI_INITIATOR=n CONFIG[ISCSI_INITIATOR]=n
;; ;;
--with-dpdk=*) --with-dpdk=*)
check_dir "$i" check_dir "$i"
CONFIG_DPDK_DIR=$(readlink -f ${i#*=}) CONFIG[DPDK_DIR]=$(readlink -f ${i#*=})
;; ;;
--without-dpdk) --without-dpdk)
CONFIG_DPDK_DIR= CONFIG[DPDK_DIR]=
;; ;;
--with-crypto) --with-crypto)
CONFIG_CRYPTO=y CONFIG[CRYPTO]=y
;; ;;
--without-crypto) --without-crypto)
CONFIG_CRYPTO=n CONFIG[CRYPTO]=n
;; ;;
--with-vhost) --with-vhost)
CONFIG_VHOST=y CONFIG[VHOST]=y
;; ;;
--without-vhost) --without-vhost)
CONFIG_VHOST=n CONFIG[VHOST]=n
;; ;;
--with-virtio) --with-virtio)
CONFIG_VIRTIO=y CONFIG[VIRTIO]=y
;; ;;
--without-virtio) --without-virtio)
CONFIG_VIRTIO=n CONFIG[VIRTIO]=n
;; ;;
--with-pmdk) --with-pmdk)
CONFIG_PMDK=y CONFIG[PMDK]=y
CONFIG[PMDK_DIR]=""
;; ;;
--with-pmdk=*) --with-pmdk=*)
CONFIG_PMDK=y CONFIG[PMDK]=y
check_dir "$i" check_dir "$i"
CONFIG_PMDK_DIR=$(readlink -f ${i#*=}) CONFIG[PMDK_DIR]=$(readlink -f ${i#*=})
;; ;;
--without-pmdk) --without-pmdk)
CONFIG_PMDK=n CONFIG[PMDK]=n
;; ;;
--with-vpp) --with-vpp)
CONFIG_VPP=y CONFIG[VPP]=y
;; ;;
--with-vpp=*) --with-vpp=*)
CONFIG_VPP=y CONFIG[VPP]=y
check_dir "$i" check_dir "$i"
CONFIG_VPP_DIR=$(readlink -f ${i#*=}) CONFIG[VPP_DIR]=$(readlink -f ${i#*=})
;; ;;
--without-vpp) --without-vpp)
CONFIG_VPP=n CONFIG[VPP]=n
;; ;;
--with-fio=*) --with-fio=*)
check_dir "$i" check_dir "$i"
CONFIG_FIO_SOURCE_DIR="${i#*=}" CONFIG[FIO_SOURCE_DIR]="${i#*=}"
CONFIG_FIO_PLUGIN=y CONFIG[FIO_PLUGIN]=y
;; ;;
--without-fio) --without-fio)
CONFIG_FIO_SOURCE_DIR= CONFIG[FIO_SOURCE_DIR]=
CONFIG_FIO_PLUGIN=n CONFIG[FIO_PLUGIN]=n
;; ;;
--with-vtune=*) --with-vtune=*)
check_dir "$i" check_dir "$i"
CONFIG_VTUNE_DIR="${i#*=}" CONFIG[VTUNE_DIR]="${i#*=}"
CONFIG_VTUNE=y CONFIG[VTUNE]=y
;; ;;
--without-vtune) --without-vtune)
CONFIG_VTUNE_DIR= CONFIG[VTUNE_DIR]=
CONFIG_VTUNE=n CONFIG[VTUNE]=n
;; ;;
--) --)
break break
@ -246,58 +255,64 @@ for i in "$@"; do
esac esac
done done
if [ -z "$CONFIG_ENV" ]; then if [ -z "${CONFIG[ENV]}" ]; then
if [ -z "$CONFIG_DPDK_DIR" ]; then
rootdir=$(readlink -f $(dirname $0)) rootdir=$(readlink -f $(dirname $0))
CONFIG[ENV]=$rootdir/lib/env_dpdk
echo "Using default SPDK env in ${CONFIG[ENV]}"
if [ -z "${CONFIG[DPDK_DIR]}" ]; then
if [ ! -f "$rootdir"/dpdk/config/common_spdk ]; then if [ ! -f "$rootdir"/dpdk/config/common_spdk ]; then
echo "DPDK not found; please specify --with-dpdk=<path> or run:" echo "DPDK not found; please specify --with-dpdk=<path> or run:"
echo echo
echo " git submodule update --init" echo " git submodule update --init"
exit 1 exit 1
else
CONFIG[DPDK_DIR]="${rootdir}/dpdk/build"
echo "Using default DPDK in ${CONFIG[DPDK_DIR]}"
fi fi
CONFIG_DPDK_DIR="$rootdir"/dpdk/build
fi fi
else else
if [ "$CONFIG_VHOST" = "y" ]; then if [ "${CONFIG[VHOST]}" = "y" ]; then
echo "Vhost is only supported when using the default DPDK environment. Disabling it." echo "Vhost is only supported when using the default DPDK environment. Disabling it."
fi fi
# Always disable vhost, but only print the error message if the user explicitly turned it on. # Always disable vhost, but only print the error message if the user explicitly turned it on.
CONFIG_VHOST="n" CONFIG[VHOST]="n"
if [ "$CONFIG_VIRTIO" = "y" ]; then if [ "${CONFIG[VIRTIO]}" = "y" ]; then
echo "Virtio is only supported when using the default DPDK environment. Disabling it." echo "Virtio is only supported when using the default DPDK environment. Disabling it."
fi fi
# Always disable virtio, but only print the error message if the user explicitly turned it on. # Always disable virtio, but only print the error message if the user explicitly turned it on.
CONFIG_VIRTIO="n" CONFIG[VIRTIO]="n"
fi fi
if [ "$CONFIG_FIO_PLUGIN" = "y" ]; then if [ "${CONFIG[FIO_PLUGIN]}" = "y" ]; then
if [ -z "$CONFIG_FIO_SOURCE_DIR" ]; then if [ -z "${CONFIG[FIO_SOURCE_DIR]}" ]; then
echo "When fio is enabled, you must specify the fio directory using --with-fio=path" echo "When fio is enabled, you must specify the fio directory using --with-fio=path"
exit 1 exit 1
fi fi
else
CONFIG[FIO_SOURCE_DIR]=
fi fi
if [ "$CONFIG_VTUNE" = "y" ]; then if [ "${CONFIG[VTUNE]}" = "y" ]; then
if [ -z "$CONFIG_VTUNE_DIR" ]; then if [ -z "${CONFIG[VTUNE_DIR]}" ]; then
echo "When VTune is enabled, you must specify the VTune directory using --with-vtune=path" echo "When VTune is enabled, you must specify the VTune directory using --with-vtune=path"
exit 1 exit 1
fi fi
fi fi
if [ "$CONFIG_ASAN" = "y" -a "$CONFIG_TSAN" = "y" ]; then if [ "${CONFIG[ASAN]}" = "y" -a "${CONFIG[TSAN]}" = "y" ]; then
echo "ERROR: ASAN and TSAN cannot be enabled at the same time." echo "ERROR: ASAN and TSAN cannot be enabled at the same time."
exit 1 exit 1
fi fi
if [[ "$OSTYPE" == "freebsd"* ]]; then if [[ "$OSTYPE" == "freebsd"* ]]; then
# FreeBSD doesn't support all configurations # FreeBSD doesn't support all configurations
if [[ "$CONFIG_COVERAGE" == "y" ]]; then if [[ "${CONFIG[COVERAGE]}" == "y" ]]; then
echo "ERROR: CONFIG_COVERAGE not available on FreeBSD" echo "ERROR: CONFIG_COVERAGE not available on FreeBSD"
exit 1 exit 1
fi fi
fi fi
if [ "$CONFIG_RDMA" = "y" ]; then if [ "${CONFIG[RDMA]}" = "y" ]; then
if [ "$OSTYPE" != "FreeBSD"* ]; then if [ "$OSTYPE" != "FreeBSD"* ]; then
ibv_lib_file="$(readlink -f /usr/lib64/libibverbs.so)" || true ibv_lib_file="$(readlink -f /usr/lib64/libibverbs.so)" || true
if [ -z $ibv_lib_file ]; then if [ -z $ibv_lib_file ]; then
@ -307,9 +322,9 @@ if [ "$CONFIG_RDMA" = "y" ]; then
ibv_maj_ver=`echo $ibv_ver_str | cut -d. -f3` ibv_maj_ver=`echo $ibv_ver_str | cut -d. -f3`
ibv_min_ver=`echo $ibv_ver_str | cut -d. -f4` ibv_min_ver=`echo $ibv_ver_str | cut -d. -f4`
if [[ "$ibv_maj_var" > 1 || ("$ibv_maj_ver" -eq 1 && "$ibv_min_ver" -ge 1) ]]; then if [[ "$ibv_maj_var" > 1 || ("$ibv_maj_ver" -eq 1 && "$ibv_min_ver" -ge 1) ]]; then
CONFIG_RDMA_SEND_WITH_INVAL="y" CONFIG[RDMA_SEND_WITH_INVAL]="y"
else else
CONFIG_RDMA_SEND_WITH_INVAL="n" CONFIG[RDMA_SEND_WITH_INVAL]="n"
echo " echo "
******************************************************************************* *******************************************************************************
WARNING: The Infiniband Verbs opcode Send With Invalidate is either not WARNING: The Infiniband Verbs opcode Send With Invalidate is either not
@ -328,7 +343,7 @@ than or equal to 4.14 will see significantly reduced performance.
fi fi
fi fi
if [[ "$CONFIG_CRYPTO" = "y" ]]; then if [[ "${CONFIG[CRYPTO]}" = "y" ]]; then
echo NOTE: Crypto is currently marked as experimental. Do not use in production. echo NOTE: Crypto is currently marked as experimental. Do not use in production.
set +e set +e
nasm_ver=$(nasm -v | sed 's/[^0-9]*//g' | awk '{print substr ($0, 0, 5)}') nasm_ver=$(nasm -v | sed 's/[^0-9]*//g' | awk '{print substr ($0, 0, 5)}')
@ -348,93 +363,12 @@ if [[ "$CONFIG_CRYPTO" = "y" ]]; then
fi fi
echo -n "Creating CONFIG.local..." echo -n "Creating CONFIG.local..."
cp -f CONFIG CONFIG.local
# Write the configuration file for key in ${!CONFIG[@]}; do
rm -f CONFIG.local sed -i.bak -r "s#^\s*CONFIG_${key}\?=.*#CONFIG_${key}\?=${CONFIG[$key]}#g" CONFIG.local
if [ -n "$CONFIG_PREFIX" ]; then done
echo "CONFIG_PREFIX?=$CONFIG_PREFIX" >> CONFIG.local # On FreeBSD sed -i 'SUFFIX' - SUFFIX is mandatory. So no way but to delete the backed file.
fi rm -f CONFIG.local.bak
if [ -n "$CONFIG_DEBUG" ]; then
echo "CONFIG_DEBUG?=$CONFIG_DEBUG" >> CONFIG.local
fi
if [ -n "$CONFIG_LOG_BACKTRACE" ]; then
echo "CONFIG_LOG_BACKTRACE?=$CONFIG_LOG_BACKTRACE" >> CONFIG.local
fi
if [ -n "$CONFIG_WERROR" ]; then
echo "CONFIG_WERROR?=$CONFIG_WERROR" >> CONFIG.local
fi
if [ -n "$CONFIG_COVERAGE" ]; then
echo "CONFIG_COVERAGE?=$CONFIG_COVERAGE" >> CONFIG.local
fi
if [ -n "$CONFIG_LTO" ]; then
echo "CONFIG_LTO?=$CONFIG_LTO" >> CONFIG.local
fi
if [ -n "$CONFIG_TESTS" ]; then
echo "CONFIG_TESTS?=$CONFIG_TESTS" >> CONFIG.local
fi
if [ -n "$CONFIG_ASAN" ]; then
echo "CONFIG_ASAN?=$CONFIG_ASAN" >> CONFIG.local
fi
if [ -n "$CONFIG_UBSAN" ]; then
echo "CONFIG_UBSAN?=$CONFIG_UBSAN" >> CONFIG.local
fi
if [ -n "$CONFIG_TSAN" ]; then
echo "CONFIG_TSAN?=$CONFIG_TSAN" >> CONFIG.local
fi
if [ -n "$CONFIG_ENV" ]; then
echo "CONFIG_ENV?=$CONFIG_ENV" >> CONFIG.local
fi
if [ -n "$CONFIG_DPDK_DIR" ]; then
echo "CONFIG_DPDK_DIR?=$CONFIG_DPDK_DIR" >> CONFIG.local
fi
if [ -n "$CONFIG_CRYPTO" ]; then
echo "CONFIG_CRYPTO?=$CONFIG_CRYPTO" >> CONFIG.local
fi
if [ -n "$CONFIG_VHOST" ]; then
echo "CONFIG_VHOST?=$CONFIG_VHOST" >> CONFIG.local
fi
if [ -n "$CONFIG_VIRTIO" ]; then
echo "CONFIG_VIRTIO?=$CONFIG_VIRTIO" >> CONFIG.local
fi
if [ -n "$CONFIG_PMDK" ]; then
echo "CONFIG_PMDK?=$CONFIG_PMDK" >> CONFIG.local
fi
if [ -n "$CONFIG_PMDK_DIR" ]; then
echo "CONFIG_PMDK_DIR?=$CONFIG_PMDK_DIR" >> CONFIG.local
fi
if [ -n "$CONFIG_VPP" ]; then
echo "CONFIG_VPP?=$CONFIG_VPP" >> CONFIG.local
fi
if [ -n "$CONFIG_VPP_DIR" ]; then
echo "CONFIG_VPP_DIR?=$CONFIG_VPP_DIR" >> CONFIG.local
fi
if [ -n "$CONFIG_FIO_PLUGIN" ]; then
echo "CONFIG_FIO_PLUGIN?=$CONFIG_FIO_PLUGIN" >> CONFIG.local
fi
if [ -n "$CONFIG_FIO_SOURCE_DIR" ]; then
echo "CONFIG_FIO_SOURCE_DIR?=$CONFIG_FIO_SOURCE_DIR" >> CONFIG.local
fi
if [ -n "$CONFIG_RDMA" ]; then
echo "CONFIG_RDMA?=$CONFIG_RDMA" >> CONFIG.local
fi
if [ -n "$CONFIG_RDMA_SEND_WITH_INVAL" ]; then
echo "CONFIG_RDMA_SEND_WITH_INVAL?=$CONFIG_RDMA_SEND_WITH_INVAL" >> CONFIG.local
fi
if [ -n "$CONFIG_SHARED" ]; then
echo "CONFIG_SHARED?=$CONFIG_SHARED" >> CONFIG.local
fi
if [ -n "$CONFIG_ISCSI_INITIATOR" ]; then
echo "CONFIG_ISCSI_INITIATOR?=$CONFIG_ISCSI_INITIATOR" >> CONFIG.local
fi
if [ -n "$CONFIG_RBD" ]; then
echo "CONFIG_RBD?=$CONFIG_RBD" >> CONFIG.local
fi
if [ -n "$CONFIG_VTUNE" ]; then
echo "CONFIG_VTUNE?=$CONFIG_VTUNE" >> CONFIG.local
fi
if [ -n "$CONFIG_VTUNE_DIR" ]; then
echo "CONFIG_VTUNE_DIR?=$CONFIG_VTUNE_DIR" >> CONFIG.local
fi
# Environment variables # Environment variables
if [ -n "$CFLAGS" ]; then if [ -n "$CFLAGS" ]; then