2017-03-30 19:06:49 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
function usage()
|
|
|
|
{
|
|
|
|
echo "'configure' configures SPDK to compile on supported platforms."
|
|
|
|
echo ""
|
|
|
|
echo "Usage: ./configure [OPTION]..."
|
|
|
|
echo ""
|
|
|
|
echo "Defaults for the options are specified in brackets."
|
|
|
|
echo ""
|
|
|
|
echo "General:"
|
|
|
|
echo " -h, --help Display this help and exit"
|
2017-11-15 17:36:36 +00:00
|
|
|
echo ""
|
|
|
|
echo " --prefix=path Configure installation prefix (default: /usr/local)"
|
|
|
|
echo ""
|
2017-03-30 19:06:49 +00:00
|
|
|
echo " --enable-debug Configure for debug builds"
|
|
|
|
echo " --enable-werror Treat compiler warnings as errors"
|
|
|
|
echo " --enable-asan Enable address sanitizer"
|
|
|
|
echo " --enable-ubsan Enable undefined behavior sanitizer"
|
|
|
|
echo " --enable-coverage Enable code coverage tracking"
|
2016-03-24 20:27:53 +00:00
|
|
|
echo " --enable-lto Enable link-time optimization"
|
2018-03-06 22:39:04 +00:00
|
|
|
echo " --disable-tests Disable building of tests"
|
2017-03-30 19:06:49 +00:00
|
|
|
echo " --with-env=path Use an alternate environment implementation"
|
|
|
|
echo ""
|
|
|
|
echo "Specifying Dependencies:"
|
|
|
|
echo "--with-DEPENDENCY[=path] Use the given dependency. Optionally, provide the"
|
|
|
|
echo " path."
|
|
|
|
echo "--without-DEPENDENCY Do not link to the given dependency. This may"
|
|
|
|
echo " disable features and components."
|
|
|
|
echo ""
|
|
|
|
echo "Valid dependencies are listed below."
|
2017-05-08 22:07:13 +00:00
|
|
|
echo " dpdk Optional. Uses dpdk submodule in spdk tree if not specified."
|
2017-03-30 19:06:49 +00:00
|
|
|
echo " example: /usr/share/dpdk/x86_64-default-linuxapp-gcc"
|
|
|
|
echo " fio Required to build fio_plugin."
|
|
|
|
echo " example: /usr/src/fio"
|
2018-03-14 00:05:36 +00:00
|
|
|
echo " vhost Required to build vhost target."
|
|
|
|
echo " No path required."
|
2017-10-17 17:04:28 +00:00
|
|
|
echo " virtio Required to build vhost initiator (Virtio) bdev module."
|
|
|
|
echo " No path required."
|
2017-09-29 08:49:51 +00:00
|
|
|
echo " nvml Required to build persistent memory bdev."
|
|
|
|
echo " example: /usr/share/nvml"
|
2018-03-13 14:42:45 +00:00
|
|
|
echo " vpp Required to build VPP net module."
|
|
|
|
echo " example: /vpp_repo/build-root/install-vpp-native/vpp"
|
2017-03-30 19:06:49 +00:00
|
|
|
echo " rbd [disabled]"
|
|
|
|
echo " No path required."
|
|
|
|
echo " rdma [disabled]"
|
|
|
|
echo " No path required."
|
2017-05-30 08:45:46 +00:00
|
|
|
echo " vtune Required to profile I/O under Intel VTune Amplifier XE."
|
|
|
|
echo " example: /opt/intel/vtune_amplifier_xe_version"
|
2017-03-30 19:06:49 +00:00
|
|
|
echo ""
|
|
|
|
}
|
|
|
|
|
2018-03-08 23:02:09 +00:00
|
|
|
function check_dir() {
|
|
|
|
arg="$1"
|
|
|
|
dir="${arg#*=}"
|
|
|
|
if [ ! -d "$dir" ]; then
|
|
|
|
echo "$arg: directory not found"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2017-03-30 19:06:49 +00:00
|
|
|
for i in "$@"; do
|
|
|
|
case "$i" in
|
|
|
|
-h|--help)
|
|
|
|
usage
|
|
|
|
exit 0
|
|
|
|
;;
|
2017-11-15 17:36:36 +00:00
|
|
|
--prefix=*)
|
|
|
|
CONFIG_PREFIX="${i#*=}"
|
|
|
|
;;
|
2017-03-30 19:06:49 +00:00
|
|
|
--enable-debug)
|
|
|
|
CONFIG_DEBUG=y
|
|
|
|
;;
|
|
|
|
--disable-debug)
|
|
|
|
CONFIG_DEBUG=n
|
|
|
|
;;
|
|
|
|
--enable-asan)
|
|
|
|
CONFIG_ASAN=y
|
|
|
|
;;
|
|
|
|
--disable-asan)
|
|
|
|
CONFIG_ASAN=n
|
|
|
|
;;
|
|
|
|
--enable-ubsan)
|
|
|
|
CONFIG_UBSAN=y
|
|
|
|
;;
|
|
|
|
--disable-ubsan)
|
|
|
|
CONFIG_UBSAN=n
|
|
|
|
;;
|
2017-05-24 22:00:54 +00:00
|
|
|
--enable-tsan)
|
|
|
|
CONFIG_TSAN=y
|
|
|
|
;;
|
|
|
|
--disable-tsan)
|
|
|
|
CONFIG_TSAN=n
|
|
|
|
;;
|
2017-03-30 19:06:49 +00:00
|
|
|
--enable-coverage)
|
|
|
|
CONFIG_COVERAGE=y
|
|
|
|
;;
|
|
|
|
--disable-coverage)
|
|
|
|
CONFIG_COVERAGE=n
|
|
|
|
;;
|
2016-03-24 20:27:53 +00:00
|
|
|
--enable-lto)
|
|
|
|
CONFIG_LTO=y
|
|
|
|
;;
|
|
|
|
--disable-lto)
|
|
|
|
CONFIG_LTO=n
|
|
|
|
;;
|
2018-03-06 22:39:04 +00:00
|
|
|
--enable-tests)
|
|
|
|
CONFIG_TESTS=y
|
|
|
|
;;
|
|
|
|
--disable-tests)
|
|
|
|
CONFIG_TESTS=n
|
|
|
|
;;
|
2017-03-30 19:06:49 +00:00
|
|
|
--enable-werror)
|
|
|
|
CONFIG_WERROR=y
|
|
|
|
;;
|
|
|
|
--disable-werror)
|
|
|
|
CONFIG_WERROR=n
|
|
|
|
;;
|
|
|
|
--with-env=*)
|
|
|
|
CONFIG_ENV="${i#*=}"
|
|
|
|
;;
|
|
|
|
--with-rbd)
|
|
|
|
CONFIG_RBD=y
|
|
|
|
;;
|
|
|
|
--without-rbd)
|
|
|
|
CONFIG_RBD=n
|
|
|
|
;;
|
|
|
|
--with-rdma)
|
|
|
|
CONFIG_RDMA=y
|
|
|
|
;;
|
|
|
|
--without-rdma)
|
|
|
|
CONFIG_RDMA=n
|
|
|
|
;;
|
|
|
|
--with-dpdk=*)
|
2018-03-08 23:02:09 +00:00
|
|
|
check_dir "$i"
|
2017-04-12 20:13:57 +00:00
|
|
|
CONFIG_DPDK_DIR=$(readlink -f ${i#*=})
|
2017-03-30 19:06:49 +00:00
|
|
|
;;
|
|
|
|
--without-dpdk)
|
|
|
|
CONFIG_DPDK_DIR=
|
|
|
|
;;
|
2018-03-14 00:05:36 +00:00
|
|
|
--with-vhost)
|
|
|
|
CONFIG_VHOST=y
|
|
|
|
;;
|
|
|
|
--without-vhost)
|
|
|
|
CONFIG_VHOST=n
|
|
|
|
;;
|
2017-10-17 17:04:28 +00:00
|
|
|
--with-virtio)
|
|
|
|
CONFIG_VIRTIO=y
|
|
|
|
;;
|
|
|
|
--without-virtio)
|
|
|
|
CONFIG_VIRTIO=n
|
|
|
|
;;
|
2017-09-29 08:49:51 +00:00
|
|
|
--with-nvml)
|
|
|
|
CONFIG_NVML=y
|
|
|
|
;;
|
|
|
|
--with-nvml=*)
|
|
|
|
CONFIG_NVML=y
|
2018-03-08 23:02:09 +00:00
|
|
|
check_dir "$i"
|
2017-09-29 08:49:51 +00:00
|
|
|
CONFIG_NVML_DIR=$(readlink -f ${i#*=})
|
|
|
|
;;
|
|
|
|
--without-nvml)
|
|
|
|
CONFIG_NVML=n
|
|
|
|
;;
|
2018-03-13 14:42:45 +00:00
|
|
|
--with-vpp)
|
|
|
|
CONFIG_VPP=y
|
|
|
|
;;
|
|
|
|
--with-vpp=*)
|
|
|
|
CONFIG_VPP=y
|
|
|
|
check_dir "$i"
|
|
|
|
CONFIG_VPP_DIR=$(readlink -f ${i#*=})
|
|
|
|
;;
|
|
|
|
--without-vpp)
|
|
|
|
CONFIG_VPP=n
|
|
|
|
;;
|
2017-03-30 19:06:49 +00:00
|
|
|
--with-fio=*)
|
2018-03-08 23:02:09 +00:00
|
|
|
check_dir "$i"
|
2017-03-30 19:06:49 +00:00
|
|
|
FIO_SOURCE_DIR="${i#*=}"
|
|
|
|
CONFIG_FIO_PLUGIN=y
|
|
|
|
;;
|
|
|
|
--without-fio)
|
|
|
|
FIO_SOURCE_DIR=
|
|
|
|
CONFIG_FIO_PLUGIN=n
|
|
|
|
;;
|
2017-05-30 08:45:46 +00:00
|
|
|
--with-vtune=*)
|
2018-03-08 23:02:09 +00:00
|
|
|
check_dir "$i"
|
2017-05-30 08:45:46 +00:00
|
|
|
VTUNE_SOURCE_DIR="${i#*=}"
|
|
|
|
CONFIG_VTUNE=y
|
|
|
|
;;
|
|
|
|
--without-vtune)
|
|
|
|
VTUNE_SOURCE_DIR=
|
|
|
|
CONFIG_VTUNE=n
|
|
|
|
;;
|
2017-03-30 19:06:49 +00:00
|
|
|
--)
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unrecognized option $i"
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -z "$CONFIG_ENV" ]; then
|
|
|
|
if [ -z "$CONFIG_DPDK_DIR" ]; then
|
2017-06-02 00:51:29 +00:00
|
|
|
rootdir=$(readlink -f $(dirname $0))
|
|
|
|
if [ ! -f "$rootdir"/dpdk/config/common_spdk ]; then
|
|
|
|
echo "DPDK not found; please specify --with-dpdk=<path> or run:"
|
|
|
|
echo
|
|
|
|
echo " git submodule update --init"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
CONFIG_DPDK_DIR="$rootdir"/dpdk/build
|
2017-03-30 19:06:49 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$CONFIG_FIO_PLUGIN" = "y" ]; then
|
|
|
|
if [ -z "$FIO_SOURCE_DIR" ]; then
|
|
|
|
echo "When fio is enabled, you must specify the fio directory using --with-fio=path"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2017-05-30 08:45:46 +00:00
|
|
|
if [ "$CONFIG_VTUNE" = "y" ]; then
|
|
|
|
if [ -z "$VTUNE_SOURCE_DIR" ]; then
|
|
|
|
echo "When VTune is enabled, you must specify the VTune directory using --with-vtune=path"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2017-05-24 22:00:54 +00:00
|
|
|
if [ "$CONFIG_ASAN" = "y" -a "$CONFIG_TSAN" = "y" ]; then
|
|
|
|
echo "ERROR: ASAN and TSAN cannot be enabled at the same time."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2017-06-14 00:01:22 +00:00
|
|
|
if [[ "$OSTYPE" == "FreeBSD"* ]]; then
|
2017-07-13 18:01:45 +00:00
|
|
|
# FreeBSD doesn't support all configurations
|
|
|
|
if [[ "$CONFIG_COVERAGE" == "y" ]]; then
|
|
|
|
echo "ERROR: CONFIG_COVERAGE not available on FreeBSD"
|
|
|
|
exit 1
|
|
|
|
fi
|
2017-06-14 00:01:22 +00:00
|
|
|
fi
|
|
|
|
|
2017-04-03 21:01:12 +00:00
|
|
|
echo -n "Creating CONFIG.local..."
|
|
|
|
|
2017-03-30 19:06:49 +00:00
|
|
|
# Write the configuration file
|
|
|
|
rm -f CONFIG.local
|
2017-11-15 17:36:36 +00:00
|
|
|
if [ -n "$CONFIG_PREFIX" ]; then
|
|
|
|
echo "CONFIG_PREFIX?=$CONFIG_PREFIX" >> CONFIG.local
|
|
|
|
fi
|
2017-03-30 19:06:49 +00:00
|
|
|
if [ -n "$CONFIG_DEBUG" ]; then
|
|
|
|
echo "CONFIG_DEBUG?=$CONFIG_DEBUG" >> 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
|
2016-03-24 20:27:53 +00:00
|
|
|
if [ -n "$CONFIG_LTO" ]; then
|
|
|
|
echo "CONFIG_LTO?=$CONFIG_LTO" >> CONFIG.local
|
|
|
|
fi
|
2018-03-06 22:39:04 +00:00
|
|
|
if [ -n "$CONFIG_TESTS" ]; then
|
|
|
|
echo "CONFIG_TESTS?=$CONFIG_TESTS" >> CONFIG.local
|
|
|
|
fi
|
2017-03-30 19:06:49 +00:00
|
|
|
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
|
2017-05-24 22:00:54 +00:00
|
|
|
if [ -n "$CONFIG_TSAN" ]; then
|
|
|
|
echo "CONFIG_TSAN?=$CONFIG_TSAN" >> CONFIG.local
|
|
|
|
fi
|
2017-03-30 19:06:49 +00:00
|
|
|
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
|
2018-03-14 00:05:36 +00:00
|
|
|
if [ -n "$CONFIG_VHOST" ]; then
|
|
|
|
echo "CONFIG_VHOST?=$CONFIG_VHOST" >> CONFIG.local
|
|
|
|
fi
|
2017-10-17 17:04:28 +00:00
|
|
|
if [ -n "$CONFIG_VIRTIO" ]; then
|
|
|
|
echo "CONFIG_VIRTIO?=$CONFIG_VIRTIO" >> CONFIG.local
|
|
|
|
fi
|
2017-09-29 08:49:51 +00:00
|
|
|
if [ -n "$CONFIG_NVML" ]; then
|
|
|
|
echo "CONFIG_NVML?=$CONFIG_NVML" >> CONFIG.local
|
|
|
|
fi
|
|
|
|
if [ -n "$CONFIG_NVML_DIR" ]; then
|
|
|
|
echo "CONFIG_NVML_DIR?=$CONFIG_NVML_DIR" >> CONFIG.local
|
|
|
|
fi
|
2018-03-13 14:42:45 +00:00
|
|
|
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
|
2017-03-30 19:06:49 +00:00
|
|
|
if [ -n "$CONFIG_FIO_PLUGIN" ]; then
|
|
|
|
echo "CONFIG_FIO_PLUGIN?=$CONFIG_FIO_PLUGIN" >> CONFIG.local
|
|
|
|
fi
|
|
|
|
if [ -n "$FIO_SOURCE_DIR" ]; then
|
|
|
|
echo "FIO_SOURCE_DIR?=$FIO_SOURCE_DIR" >> CONFIG.local
|
|
|
|
fi
|
|
|
|
if [ -n "$CONFIG_RDMA" ]; then
|
|
|
|
echo "CONFIG_RDMA?=$CONFIG_RDMA" >> CONFIG.local
|
|
|
|
fi
|
|
|
|
if [ -n "$CONFIG_RBD" ]; then
|
|
|
|
echo "CONFIG_RBD?=$CONFIG_RBD" >> CONFIG.local
|
|
|
|
fi
|
2017-05-30 08:45:46 +00:00
|
|
|
if [ -n "$CONFIG_VTUNE" ]; then
|
|
|
|
echo "CONFIG_VTUNE?=$CONFIG_VTUNE" >> CONFIG.local
|
|
|
|
fi
|
|
|
|
if [ -n "$VTUNE_SOURCE_DIR" ]; then
|
|
|
|
echo "VTUNE_SOURCE_DIR?=$VTUNE_SOURCE_DIR" >> CONFIG.local
|
|
|
|
fi
|
2017-03-30 19:06:49 +00:00
|
|
|
|
2018-01-19 16:03:51 +00:00
|
|
|
python_command=
|
|
|
|
for interpreter in python3 python2 python ; do
|
|
|
|
type $interpreter > /dev/null 2>&1 || continue
|
|
|
|
python_command=$interpreter
|
|
|
|
break
|
|
|
|
done
|
|
|
|
if [[ -z "$python_command" ]] ; then
|
|
|
|
echo "Could not find python interpreter! Bailing out."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-01-27 23:29:16 +00:00
|
|
|
rm -f PYTHON_COMMAND
|
|
|
|
echo $python_command > PYTHON_COMMAND
|
2018-01-19 16:03:51 +00:00
|
|
|
$python_command scripts/genconfig.py > config.h
|
2017-04-12 20:20:56 +00:00
|
|
|
|
2017-04-03 21:01:12 +00:00
|
|
|
echo "done."
|
2017-05-28 19:35:46 +00:00
|
|
|
if [[ "$OSTYPE" == "FreeBSD"* ]]; then
|
2017-07-13 18:01:45 +00:00
|
|
|
echo "Type 'gmake' to build."
|
2017-05-28 19:35:46 +00:00
|
|
|
else
|
2017-07-13 18:01:45 +00:00
|
|
|
echo "Type 'make' to build."
|
2017-05-28 19:35:46 +00:00
|
|
|
fi
|
2017-03-30 19:06:49 +00:00
|
|
|
|
|
|
|
exit 0
|