2017-03-30 19:06:49 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2018-10-03 14:32:45 +00:00
|
|
|
trap 'echo -e "\n\nConfiguration failed\n\n" >&2' ERR
|
|
|
|
|
2019-08-26 23:02:30 +00:00
|
|
|
rootdir=$(readlink -f $(dirname $0))
|
|
|
|
|
2017-03-30 19:06:49 +00:00
|
|
|
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)"
|
2019-07-23 17:52:47 +00:00
|
|
|
echo " --target-arch=arch Target build architecture. Must be a valid GNU arch. Default: native"
|
2017-11-15 17:36:36 +00:00
|
|
|
echo ""
|
2019-07-09 12:40:41 +00:00
|
|
|
echo " --cross-prefix=prefix Prefix for cross compilation (default: none)"
|
|
|
|
echo " example: aarch64-linux-gnu"
|
|
|
|
echo ""
|
2017-03-30 19:06:49 +00:00
|
|
|
echo " --enable-debug Configure for debug builds"
|
2018-09-10 14:08:25 +00:00
|
|
|
echo " --enable-log-bt Enable support of backtrace printing in SPDK logs (requires libunwind)."
|
2017-03-30 19:06:49 +00:00
|
|
|
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"
|
2019-02-11 18:19:32 +00:00
|
|
|
echo " --enable-pgo-capture Enable generation of profile guided optimization data"
|
|
|
|
echo " --enable-pgo-use Use previously captured profile guided optimization data"
|
2018-03-06 22:39:04 +00:00
|
|
|
echo " --disable-tests Disable building of tests"
|
2017-03-30 19:06:49 +00:00
|
|
|
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."
|
2019-06-27 08:10:02 +00:00
|
|
|
echo " dpdk Build against a custom dpdk version. By default, the dpdk"
|
|
|
|
echo " submodule in spdk tree will be used."
|
2017-03-30 19:06:49 +00:00
|
|
|
echo " example: /usr/share/dpdk/x86_64-default-linuxapp-gcc"
|
2019-02-08 21:37:23 +00:00
|
|
|
echo " env Use an alternate environment implementation instead of DPDK."
|
|
|
|
echo " Implies --without-dpdk."
|
2019-06-27 08:10:02 +00:00
|
|
|
echo " igb-uio-driver Build DPDK's igb-uio driver."
|
|
|
|
echo " Required on some systems to use qat devices. This flag is"
|
|
|
|
echo " effective only with the default dpdk submodule."
|
2019-02-08 21:37:23 +00:00
|
|
|
echo " No path required"
|
2019-06-27 08:10:02 +00:00
|
|
|
echo " crypto Build vbdev crypto module."
|
2019-02-08 21:37:23 +00:00
|
|
|
echo " No path required."
|
2019-06-27 08:10:02 +00:00
|
|
|
echo " fio Build fio_plugin."
|
2017-03-30 19:06:49 +00:00
|
|
|
echo " example: /usr/src/fio"
|
2019-06-27 08:10:02 +00:00
|
|
|
echo " vhost Build vhost target. Enabled by default."
|
2018-03-14 00:05:36 +00:00
|
|
|
echo " No path required."
|
2019-06-27 08:10:02 +00:00
|
|
|
echo " internal-vhost-lib Use the internal copy of rte_vhost. By default, the upstream"
|
|
|
|
echo " rte_vhost from DPDK will be used."
|
2019-02-25 00:57:46 +00:00
|
|
|
echo " No path required."
|
2019-06-27 08:10:02 +00:00
|
|
|
echo " virtio Build vhost initiator and virtio-pci bdev modules."
|
2017-10-17 17:04:28 +00:00
|
|
|
echo " No path required."
|
2019-06-27 08:10:02 +00:00
|
|
|
echo " pmdk Build persistent memory bdev."
|
2018-04-03 23:07:39 +00:00
|
|
|
echo " example: /usr/share/pmdk"
|
2019-06-27 08:10:02 +00:00
|
|
|
echo " reduce Build vbdev compression module."
|
2018-09-21 14:37:54 +00:00
|
|
|
echo " No path required."
|
2019-06-27 08:10:02 +00:00
|
|
|
echo " vpp Build VPP net module."
|
2019-05-09 02:17:00 +00:00
|
|
|
echo " example: /vpp_repo/build-root/rpmbuild/vpp-18.01.1.0/build-root/install-vpp-native/vpp"
|
2019-06-27 08:10:02 +00:00
|
|
|
echo " rbd Build Ceph RBD bdev module."
|
2017-03-30 19:06:49 +00:00
|
|
|
echo " No path required."
|
2019-06-27 08:10:02 +00:00
|
|
|
echo " rdma Build RDMA transport for NVMf target and initiator."
|
2017-03-30 19:06:49 +00:00
|
|
|
echo " No path required."
|
2019-04-22 09:28:02 +00:00
|
|
|
echo " fc Build FC transport for NVMf target."
|
|
|
|
echo " If an argument is provided, it is considered a directory containing"
|
|
|
|
echo " libufc.a and fc_lld.h. Otherwise the regular system paths will"
|
|
|
|
echo " be searched."
|
2019-06-27 08:10:02 +00:00
|
|
|
echo " shared Build spdk shared libraries."
|
2018-08-14 17:56:26 +00:00
|
|
|
echo " No path required."
|
2019-06-27 08:10:02 +00:00
|
|
|
echo " iscsi-initiator Build with iscsi bdev module."
|
2017-12-04 17:07:04 +00:00
|
|
|
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"
|
2019-06-27 08:10:02 +00:00
|
|
|
echo " ocf Build OCF library and bdev module."
|
2018-09-20 16:54:49 +00:00
|
|
|
echo " If argument is directory, interpret it as root of OCF repo"
|
|
|
|
echo " If argument is file, interpret it as compiled OCF lib"
|
2019-02-12 13:27:52 +00:00
|
|
|
echo " If no argument is specified, OCF git submodule is used by default"
|
2018-09-20 16:54:49 +00:00
|
|
|
echo " example: /usr/src/ocf/"
|
2019-06-27 08:10:02 +00:00
|
|
|
echo " isal Build with ISA-L. Enabled by default on x86 architecture."
|
2019-01-21 09:05:59 +00:00
|
|
|
echo " No path required."
|
2019-06-27 08:10:02 +00:00
|
|
|
echo " uring Build I/O uring bdev."
|
|
|
|
echo " If an argument is provided, it is considered a directory containing"
|
|
|
|
echo " liburing.a and io_uring.h. Otherwise the regular system paths will"
|
|
|
|
echo " be searched."
|
2019-10-08 12:28:49 +00:00
|
|
|
echo " fuse Build FUSE components for mounting a blobfs filesystem."
|
|
|
|
echo " No path required."
|
2019-10-24 18:04:33 +00:00
|
|
|
echo " nvme-cuse Build NVMe driver with support for CUSE-based character devices."
|
|
|
|
echo " No path required."
|
2017-03-30 19:06:49 +00:00
|
|
|
echo ""
|
2018-03-28 18:24:48 +00:00
|
|
|
echo "Environment variables:"
|
|
|
|
echo ""
|
2019-07-24 17:15:08 +00:00
|
|
|
echo "CC C compiler"
|
2018-03-28 18:24:48 +00:00
|
|
|
echo "CFLAGS C compiler flags"
|
2019-07-24 17:15:08 +00:00
|
|
|
echo "CXX C++ compiler"
|
2018-03-28 18:24:48 +00:00
|
|
|
echo "CXXFLAGS C++ compiler flags"
|
2019-07-24 17:15:08 +00:00
|
|
|
echo "LD Linker"
|
2018-03-28 18:24:48 +00:00
|
|
|
echo "LDFLAGS Linker flags"
|
|
|
|
echo "DESTDIR Destination for 'make install'"
|
|
|
|
echo ""
|
2017-03-30 19:06:49 +00:00
|
|
|
}
|
|
|
|
|
2018-10-03 14:58:36 +00:00
|
|
|
# Load default values
|
|
|
|
# Convert config to sourcable configuration file
|
2019-08-26 23:02:30 +00:00
|
|
|
sed -r 's/CONFIG_([[:alnum:]_]+)=(.*)/CONFIG[\1]=\2/g' $rootdir/CONFIG > $rootdir/CONFIG.sh
|
2018-10-03 14:58:36 +00:00
|
|
|
declare -A CONFIG
|
2019-08-26 23:02:30 +00:00
|
|
|
source $rootdir/CONFIG.sh
|
|
|
|
rm $rootdir/CONFIG.sh
|
2018-10-03 14:58:36 +00:00
|
|
|
|
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=*)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[PREFIX]="${i#*=}"
|
2017-11-15 17:36:36 +00:00
|
|
|
;;
|
2019-07-23 17:52:47 +00:00
|
|
|
--target-arch=*)
|
|
|
|
CONFIG[ARCH]="${i#*=}"
|
|
|
|
;;
|
2019-07-09 12:40:41 +00:00
|
|
|
--cross-prefix=*)
|
|
|
|
CONFIG[CROSS_PREFIX]="${i#*=}"
|
|
|
|
;;
|
2017-03-30 19:06:49 +00:00
|
|
|
--enable-debug)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[DEBUG]=y
|
2017-03-30 19:06:49 +00:00
|
|
|
;;
|
|
|
|
--disable-debug)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[DEBUG]=n
|
2017-03-30 19:06:49 +00:00
|
|
|
;;
|
2018-09-10 14:08:25 +00:00
|
|
|
--enable-log-bt)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[LOG_BACKTRACE]=y
|
2018-09-10 14:08:25 +00:00
|
|
|
;;
|
|
|
|
--disable-log-bt)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[LOG_BACKTRACE]=n
|
2018-07-18 19:08:17 +00:00
|
|
|
;;
|
2017-03-30 19:06:49 +00:00
|
|
|
--enable-asan)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[ASAN]=y
|
2017-03-30 19:06:49 +00:00
|
|
|
;;
|
|
|
|
--disable-asan)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[ASAN]=n
|
2017-03-30 19:06:49 +00:00
|
|
|
;;
|
|
|
|
--enable-ubsan)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[UBSAN]=y
|
2017-03-30 19:06:49 +00:00
|
|
|
;;
|
|
|
|
--disable-ubsan)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[UBSAN]=n
|
2017-03-30 19:06:49 +00:00
|
|
|
;;
|
2017-05-24 22:00:54 +00:00
|
|
|
--enable-tsan)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[TSAN]=y
|
2017-05-24 22:00:54 +00:00
|
|
|
;;
|
|
|
|
--disable-tsan)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[TSAN]=n
|
2017-05-24 22:00:54 +00:00
|
|
|
;;
|
2017-03-30 19:06:49 +00:00
|
|
|
--enable-coverage)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[COVERAGE]=y
|
2017-03-30 19:06:49 +00:00
|
|
|
;;
|
|
|
|
--disable-coverage)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[COVERAGE]=n
|
2017-03-30 19:06:49 +00:00
|
|
|
;;
|
2016-03-24 20:27:53 +00:00
|
|
|
--enable-lto)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[LTO]=y
|
2016-03-24 20:27:53 +00:00
|
|
|
;;
|
|
|
|
--disable-lto)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[LTO]=n
|
2016-03-24 20:27:53 +00:00
|
|
|
;;
|
2019-02-11 18:19:32 +00:00
|
|
|
--enable-pgo-capture)
|
|
|
|
CONFIG[PGO_CAPTURE]=y
|
|
|
|
;;
|
|
|
|
--disable-pgo-capture)
|
|
|
|
CONFIG[PGO_CAPTURE]=n
|
|
|
|
;;
|
|
|
|
--enable-pgo-use)
|
|
|
|
CONFIG[PGO_USE]=y
|
|
|
|
;;
|
|
|
|
--disable-pgo-use)
|
|
|
|
CONFIG[PGO_USE]=n
|
|
|
|
;;
|
2018-03-06 22:39:04 +00:00
|
|
|
--enable-tests)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[TESTS]=y
|
2018-03-06 22:39:04 +00:00
|
|
|
;;
|
|
|
|
--disable-tests)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[TESTS]=n
|
2018-03-06 22:39:04 +00:00
|
|
|
;;
|
2017-03-30 19:06:49 +00:00
|
|
|
--enable-werror)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[WERROR]=y
|
2017-03-30 19:06:49 +00:00
|
|
|
;;
|
|
|
|
--disable-werror)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[WERROR]=n
|
2017-03-30 19:06:49 +00:00
|
|
|
;;
|
2019-02-08 21:37:23 +00:00
|
|
|
--with-dpdk=*)
|
|
|
|
check_dir "$i"
|
|
|
|
CONFIG[DPDK_DIR]=$(readlink -f ${i#*=})
|
|
|
|
;;
|
|
|
|
--without-dpdk)
|
|
|
|
CONFIG[DPDK_DIR]=
|
|
|
|
;;
|
2017-03-30 19:06:49 +00:00
|
|
|
--with-env=*)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[ENV]="${i#*=}"
|
2017-03-30 19:06:49 +00:00
|
|
|
;;
|
|
|
|
--with-rbd)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[RBD]=y
|
2017-03-30 19:06:49 +00:00
|
|
|
;;
|
|
|
|
--without-rbd)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[RBD]=n
|
2017-03-30 19:06:49 +00:00
|
|
|
;;
|
|
|
|
--with-rdma)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[RDMA]=y
|
2017-03-30 19:06:49 +00:00
|
|
|
;;
|
|
|
|
--without-rdma)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[RDMA]=n
|
2017-03-30 19:06:49 +00:00
|
|
|
;;
|
2019-04-22 09:28:02 +00:00
|
|
|
--with-fc=*)
|
|
|
|
CONFIG[FC]=y
|
|
|
|
CONFIG[FC_PATH]=$(readlink -f ${i#*=})
|
|
|
|
;;
|
|
|
|
--with-fc)
|
|
|
|
CONFIG[FC]=y
|
|
|
|
CONFIG[FC_PATH]=
|
|
|
|
;;
|
|
|
|
--without-fc)
|
|
|
|
CONFIG[FC]=n
|
|
|
|
CONFIG[FC_PATH]=
|
|
|
|
;;
|
2018-08-14 17:56:26 +00:00
|
|
|
--with-shared)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[SHARED]=y
|
2018-08-14 17:56:26 +00:00
|
|
|
;;
|
|
|
|
--without-shared)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[SHARED]=n
|
2018-08-14 17:56:26 +00:00
|
|
|
;;
|
2017-12-04 17:07:04 +00:00
|
|
|
--with-iscsi-initiator)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[ISCSI_INITIATOR]=y
|
2017-12-04 17:07:04 +00:00
|
|
|
;;
|
|
|
|
--without-iscsi-initiator)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[ISCSI_INITIATOR]=n
|
2017-12-04 17:07:04 +00:00
|
|
|
;;
|
2018-03-22 23:24:14 +00:00
|
|
|
--with-crypto)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[CRYPTO]=y
|
2018-03-22 23:24:14 +00:00
|
|
|
;;
|
|
|
|
--without-crypto)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[CRYPTO]=n
|
2018-03-22 23:24:14 +00:00
|
|
|
;;
|
2018-03-14 00:05:36 +00:00
|
|
|
--with-vhost)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[VHOST]=y
|
2018-03-14 00:05:36 +00:00
|
|
|
;;
|
|
|
|
--without-vhost)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[VHOST]=n
|
2018-03-14 00:05:36 +00:00
|
|
|
;;
|
2019-02-25 00:57:46 +00:00
|
|
|
--with-internal-vhost-lib)
|
|
|
|
CONFIG[VHOST_INTERNAL_LIB]=y
|
|
|
|
;;
|
|
|
|
--without-internal-vhost-lib)
|
|
|
|
CONFIG[VHOST_INTERNAL_LIB]=n
|
|
|
|
;;
|
2017-10-17 17:04:28 +00:00
|
|
|
--with-virtio)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[VIRTIO]=y
|
2017-10-17 17:04:28 +00:00
|
|
|
;;
|
|
|
|
--without-virtio)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[VIRTIO]=n
|
2017-10-17 17:04:28 +00:00
|
|
|
;;
|
2018-04-03 23:07:39 +00:00
|
|
|
--with-pmdk)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[PMDK]=y
|
|
|
|
CONFIG[PMDK_DIR]=""
|
2017-09-29 08:49:51 +00:00
|
|
|
;;
|
2018-04-03 23:07:39 +00:00
|
|
|
--with-pmdk=*)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[PMDK]=y
|
2018-03-08 23:02:09 +00:00
|
|
|
check_dir "$i"
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[PMDK_DIR]=$(readlink -f ${i#*=})
|
2017-09-29 08:49:51 +00:00
|
|
|
;;
|
2018-04-03 23:07:39 +00:00
|
|
|
--without-pmdk)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[PMDK]=n
|
2017-09-29 08:49:51 +00:00
|
|
|
;;
|
2018-09-21 14:37:54 +00:00
|
|
|
--with-reduce)
|
|
|
|
CONFIG[REDUCE]=y
|
|
|
|
;;
|
|
|
|
--without-reduce)
|
|
|
|
CONFIG[REDUCE]=n
|
|
|
|
;;
|
2018-03-13 14:42:45 +00:00
|
|
|
--with-vpp)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[VPP]=y
|
2018-03-13 14:42:45 +00:00
|
|
|
;;
|
|
|
|
--with-vpp=*)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[VPP]=y
|
2018-03-13 14:42:45 +00:00
|
|
|
check_dir "$i"
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[VPP_DIR]=$(readlink -f ${i#*=})
|
2018-03-13 14:42:45 +00:00
|
|
|
;;
|
|
|
|
--without-vpp)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[VPP]=n
|
2018-03-13 14:42:45 +00:00
|
|
|
;;
|
2017-03-30 19:06:49 +00:00
|
|
|
--with-fio=*)
|
2018-03-08 23:02:09 +00:00
|
|
|
check_dir "$i"
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[FIO_SOURCE_DIR]="${i#*=}"
|
|
|
|
CONFIG[FIO_PLUGIN]=y
|
2017-03-30 19:06:49 +00:00
|
|
|
;;
|
|
|
|
--without-fio)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[FIO_SOURCE_DIR]=
|
|
|
|
CONFIG[FIO_PLUGIN]=n
|
2017-03-30 19:06:49 +00:00
|
|
|
;;
|
2017-05-30 08:45:46 +00:00
|
|
|
--with-vtune=*)
|
2018-03-08 23:02:09 +00:00
|
|
|
check_dir "$i"
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[VTUNE_DIR]="${i#*=}"
|
|
|
|
CONFIG[VTUNE]=y
|
2017-05-30 08:45:46 +00:00
|
|
|
;;
|
|
|
|
--without-vtune)
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[VTUNE_DIR]=
|
|
|
|
CONFIG[VTUNE]=n
|
2017-05-30 08:45:46 +00:00
|
|
|
;;
|
2018-10-10 17:09:07 +00:00
|
|
|
--with-igb-uio-driver)
|
|
|
|
CONFIG[IGB_UIO_DRIVER]=y
|
|
|
|
;;
|
|
|
|
--without-igb-uio-driver)
|
|
|
|
CONFIG[IGB_UIO_DRIVER]=n
|
|
|
|
;;
|
2019-02-12 13:27:52 +00:00
|
|
|
--with-ocf)
|
|
|
|
CONFIG[OCF]=y
|
|
|
|
CONFIG[OCF_PATH]=$(readlink -f "./ocf")
|
|
|
|
;;
|
2018-09-20 16:54:49 +00:00
|
|
|
--with-ocf=*)
|
|
|
|
CONFIG[OCF]=y
|
|
|
|
CONFIG[OCF_PATH]=$(readlink -f ${i#*=})
|
|
|
|
;;
|
|
|
|
--without-ocf)
|
|
|
|
CONFIG[OCF]=n
|
|
|
|
CONFIG[OCF_PATH]=
|
|
|
|
;;
|
2019-01-21 09:05:59 +00:00
|
|
|
--with-isal)
|
2019-03-06 21:14:53 +00:00
|
|
|
CONFIG[ISAL]=y
|
|
|
|
;;
|
|
|
|
--without-isal)
|
|
|
|
CONFIG[ISAL]=n
|
|
|
|
;;
|
2019-02-14 19:07:42 +00:00
|
|
|
--with-uring=*)
|
|
|
|
CONFIG[URING]=y
|
|
|
|
CONFIG[URING_PATH]=$(readlink -f ${i#*=})
|
|
|
|
;;
|
|
|
|
--with-uring)
|
|
|
|
CONFIG[URING]=y
|
|
|
|
CONFIG[URING_PATH]=
|
|
|
|
;;
|
|
|
|
--without-uring)
|
|
|
|
CONFIG[URING]=n
|
|
|
|
CONFIG[URING_PATH]=
|
|
|
|
;;
|
2019-10-08 12:28:49 +00:00
|
|
|
--with-fuse)
|
|
|
|
CONFIG[FUSE]=y
|
|
|
|
;;
|
|
|
|
--without-fuse)
|
|
|
|
CONFIG[FUSE]=n
|
|
|
|
;;
|
2019-10-24 18:04:33 +00:00
|
|
|
--with-nvme-cuse)
|
|
|
|
CONFIG[NVME_CUSE]=y
|
|
|
|
;;
|
|
|
|
--without-nvme-cuse)
|
|
|
|
CONFIG[NVME_CUSE]=n
|
|
|
|
;;
|
2017-03-30 19:06:49 +00:00
|
|
|
--)
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unrecognized option $i"
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2019-07-24 17:15:08 +00:00
|
|
|
# Detect the compiler toolchain
|
2019-08-26 23:02:30 +00:00
|
|
|
$rootdir/scripts/detect_cc.sh --cc="$CC" --cxx="$CXX" --lto="${CONFIG[LTO]}" --ld="$LD" --cross-prefix="${CONFIG[CROSS_PREFIX]}" > $rootdir/mk/cc.mk
|
2019-07-24 17:15:08 +00:00
|
|
|
|
2019-08-29 16:18:37 +00:00
|
|
|
CC=$(cat $rootdir/mk/cc.mk | grep "DEFAULT_CC=" | cut -d "=" -f 2)
|
2019-08-26 23:02:30 +00:00
|
|
|
CC_TYPE=$(cat $rootdir/mk/cc.mk | grep "CC_TYPE=" | cut -d "=" -f 2)
|
2019-07-24 17:15:08 +00:00
|
|
|
|
2019-09-25 10:30:10 +00:00
|
|
|
arch=$($CC -dumpmachine)
|
|
|
|
|
|
|
|
if [[ $arch == x86_64* ]]; then
|
|
|
|
BUILD_CMD=($CC -o /dev/null -x c $CPPFLAGS $CFLAGS $LDFLAGS -march=native)
|
|
|
|
else
|
|
|
|
BUILD_CMD=($CC -o /dev/null -x c $CPPFLAGS $CFLAGS $LDFLAGS)
|
|
|
|
fi
|
2019-07-24 17:15:08 +00:00
|
|
|
|
2019-07-23 17:59:35 +00:00
|
|
|
# Detect architecture and force no ISA-L if non-x86 archtecture
|
|
|
|
if [[ "${CONFIG[ISAL]}" = "y" ]]; then
|
|
|
|
if [[ $arch != x86_64* ]]; then
|
|
|
|
echo "Notice: ISA-L disabled due to CPU incompatiblity."
|
|
|
|
CONFIG[ISAL]=n
|
|
|
|
fi
|
2019-01-21 09:05:59 +00:00
|
|
|
fi
|
|
|
|
|
2018-10-15 20:46:41 +00:00
|
|
|
if [[ "${CONFIG[ISAL]}" = "n" ]] && [[ "${CONFIG[REDUCE]}" = "y" ]]; then
|
|
|
|
echo "ERROR Conflicting options: --with-reduce is not compatible with --without-isal."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-10-03 14:58:36 +00:00
|
|
|
if [ -z "${CONFIG[ENV]}" ]; then
|
|
|
|
CONFIG[ENV]=$rootdir/lib/env_dpdk
|
|
|
|
echo "Using default SPDK env in ${CONFIG[ENV]}"
|
|
|
|
if [ -z "${CONFIG[DPDK_DIR]}" ]; then
|
2018-10-04 11:24:38 +00:00
|
|
|
if [ ! -f "$rootdir"/dpdk/config/common_base ]; then
|
2017-06-02 00:51:29 +00:00
|
|
|
echo "DPDK not found; please specify --with-dpdk=<path> or run:"
|
|
|
|
echo
|
|
|
|
echo " git submodule update --init"
|
|
|
|
exit 1
|
2018-10-03 14:58:36 +00:00
|
|
|
else
|
|
|
|
CONFIG[DPDK_DIR]="${rootdir}/dpdk/build"
|
|
|
|
echo "Using default DPDK in ${CONFIG[DPDK_DIR]}"
|
2017-06-02 00:51:29 +00:00
|
|
|
fi
|
2019-05-29 09:29:37 +00:00
|
|
|
|
|
|
|
if [[ "${CONFIG[VHOST]}" = "y" ]] && [[ "${CONFIG[VHOST_INTERNAL_LIB]}" = "n" ]]; then
|
|
|
|
# We lookup "common_linux" file to check if DPDK version is >= 19.05.
|
|
|
|
# "common_linux" is available since exactly DPDK 19.05 - it was renamed
|
|
|
|
# from "common_linuxapp".
|
|
|
|
if [ ! -f "$rootdir"/dpdk/config/common_linux ]; then
|
|
|
|
echo "Notice: Using internal, legacy rte_vhost library due to DPDK" \
|
|
|
|
"version < 19.05"
|
|
|
|
CONFIG[VHOST_INTERNAL_LIB]=y
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
if [[ "${CONFIG[VHOST]}" = "y" ]] && [[ "${CONFIG[VHOST_INTERNAL_LIB]}" = "n" ]]; then
|
|
|
|
# DPDK must be already built, so we can simply try to use the new rte_vhost.
|
|
|
|
# It has a number of internal dependencies though, so don't try to link the
|
|
|
|
# program, just compile it
|
|
|
|
if ! echo -e '#include <rte_vhost.h>\n' \
|
|
|
|
'int main(void) { return rte_vhost_extern_callback_register(0, NULL, NULL); }\n' \
|
2019-09-06 23:15:47 +00:00
|
|
|
| ${BUILD_CMD[@]} -c -Wno-deprecated-declarations -Werror \
|
2019-06-12 10:45:57 +00:00
|
|
|
-I"${CONFIG[DPDK_DIR]}/include" - &>/dev/null; then
|
2019-05-29 09:29:37 +00:00
|
|
|
echo "Notice: DPDK's rte_vhost not found or version < 19.05, using internal," \
|
|
|
|
"legacy rte_vhost library."
|
|
|
|
CONFIG[VHOST_INTERNAL_LIB]=y
|
|
|
|
fi
|
|
|
|
fi
|
2017-03-30 19:06:49 +00:00
|
|
|
fi
|
2018-07-19 19:55:44 +00:00
|
|
|
else
|
2019-02-08 21:37:23 +00:00
|
|
|
if [ -n "${CONFIG[DPDK_DIR]}" ]; then
|
|
|
|
echo "--with-env and --with-dpdk are mutually exclusive."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-10-03 14:58:36 +00:00
|
|
|
if [ "${CONFIG[VHOST]}" = "y" ]; then
|
2018-07-19 19:55:44 +00:00
|
|
|
echo "Vhost is only supported when using the default DPDK environment. Disabling it."
|
|
|
|
fi
|
|
|
|
# Always disable vhost, but only print the error message if the user explicitly turned it on.
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[VHOST]="n"
|
|
|
|
if [ "${CONFIG[VIRTIO]}" = "y" ]; then
|
2018-07-19 19:55:44 +00:00
|
|
|
echo "Virtio is only supported when using the default DPDK environment. Disabling it."
|
|
|
|
fi
|
|
|
|
# Always disable virtio, but only print the error message if the user explicitly turned it on.
|
2018-10-03 14:58:36 +00:00
|
|
|
CONFIG[VIRTIO]="n"
|
2017-03-30 19:06:49 +00:00
|
|
|
fi
|
|
|
|
|
2018-10-03 14:58:36 +00:00
|
|
|
if [ "${CONFIG[FIO_PLUGIN]}" = "y" ]; then
|
|
|
|
if [ -z "${CONFIG[FIO_SOURCE_DIR]}" ]; then
|
2017-03-30 19:06:49 +00:00
|
|
|
echo "When fio is enabled, you must specify the fio directory using --with-fio=path"
|
|
|
|
exit 1
|
|
|
|
fi
|
2018-10-03 14:58:36 +00:00
|
|
|
else
|
|
|
|
CONFIG[FIO_SOURCE_DIR]=
|
2017-03-30 19:06:49 +00:00
|
|
|
fi
|
|
|
|
|
2018-10-03 14:58:36 +00:00
|
|
|
if [ "${CONFIG[VTUNE]}" = "y" ]; then
|
|
|
|
if [ -z "${CONFIG[VTUNE_DIR]}" ]; then
|
2017-05-30 08:45:46 +00:00
|
|
|
echo "When VTune is enabled, you must specify the VTune directory using --with-vtune=path"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2018-10-03 14:58:36 +00:00
|
|
|
if [ "${CONFIG[ASAN]}" = "y" -a "${CONFIG[TSAN]}" = "y" ]; then
|
2017-05-24 22:00:54 +00:00
|
|
|
echo "ERROR: ASAN and TSAN cannot be enabled at the same time."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-08-14 17:56:26 +00:00
|
|
|
if [[ "$OSTYPE" == "freebsd"* ]]; then
|
2017-07-13 18:01:45 +00:00
|
|
|
# FreeBSD doesn't support all configurations
|
2018-10-03 14:58:36 +00:00
|
|
|
if [[ "${CONFIG[COVERAGE]}" == "y" ]]; then
|
2017-07-13 18:01:45 +00:00
|
|
|
echo "ERROR: CONFIG_COVERAGE not available on FreeBSD"
|
|
|
|
exit 1
|
|
|
|
fi
|
2017-06-14 00:01:22 +00:00
|
|
|
fi
|
|
|
|
|
2019-07-04 19:51:04 +00:00
|
|
|
if [[ "$OSTYPE" == "freebsd"* ]]; then
|
|
|
|
if [[ "${CONFIG[VHOST]}" == "y" ]]; then
|
|
|
|
echo "Vhost is only supported on Linux. Disabling it."
|
|
|
|
CONFIG[VHOST]="n"
|
|
|
|
fi
|
2019-09-11 08:00:15 +00:00
|
|
|
if [[ "${CONFIG[VHOST_INTERNAL_LIB]}" == "y" ]]; then
|
|
|
|
echo "Internal rte_vhost library is only supported on Linux. Disabling it."
|
|
|
|
CONFIG[VHOST_INTERNAL_LIB]="n"
|
|
|
|
fi
|
2019-07-04 19:51:04 +00:00
|
|
|
if [[ "${CONFIG[VIRTIO]}" == "y" ]]; then
|
|
|
|
echo "Virtio is only supported on Linux. Disabling it."
|
|
|
|
CONFIG[VIRTIO]="n"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2018-10-03 14:58:36 +00:00
|
|
|
if [ "${CONFIG[RDMA]}" = "y" ]; then
|
2019-05-07 16:30:45 +00:00
|
|
|
if ! echo -e '#include <infiniband/verbs.h>\n#include <rdma/rdma_verbs.h>\n' \
|
|
|
|
'int main(void) { return 0; }\n' \
|
2019-09-06 23:15:47 +00:00
|
|
|
| ${BUILD_CMD[@]} -libverbs -lrdmacm - 2>/dev/null; then
|
2019-05-07 16:30:45 +00:00
|
|
|
echo --with-rdma requires libverbs and librdmacm.
|
|
|
|
echo Please install then re-run this script.
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if echo -e '#include <infiniband/verbs.h>\n' \
|
|
|
|
'int main(void) { return !!IBV_WR_SEND_WITH_INV; }\n' \
|
2019-09-06 23:15:47 +00:00
|
|
|
| ${BUILD_CMD[@]} -c - 2>/dev/null; then
|
2019-05-07 17:12:15 +00:00
|
|
|
CONFIG[RDMA_SEND_WITH_INVAL]="y"
|
|
|
|
else
|
|
|
|
CONFIG[RDMA_SEND_WITH_INVAL]="n"
|
|
|
|
echo "
|
2018-08-15 20:09:49 +00:00
|
|
|
*******************************************************************************
|
|
|
|
WARNING: The Infiniband Verbs opcode Send With Invalidate is either not
|
|
|
|
supported or is not functional with the current version of libibverbs installed
|
|
|
|
on this system. Please upgrade to at least version 1.1.
|
|
|
|
|
|
|
|
Beginning with Linux kernel 4.14, the kernel NVMe-oF initiator leverages Send
|
|
|
|
With Invalidate RDMA operations to improve performance. Failing to use the
|
|
|
|
Send With Invalidate operation on the NVMe-oF target side results in full
|
|
|
|
functionality, but greatly reduced performance. The SPDK NVMe-oF target will
|
|
|
|
be unable to leverage that operation using the currently installed version
|
|
|
|
of libibverbs, so Linux kernel NVMe-oF initiators based on kernels greater
|
|
|
|
than or equal to 4.14 will see significantly reduced performance.
|
2018-08-22 16:31:54 +00:00
|
|
|
*******************************************************************************"
|
2018-08-15 20:09:49 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2019-04-22 09:28:02 +00:00
|
|
|
if [[ "${CONFIG[FC]}" = "y" ]]; then
|
|
|
|
if [[ -n "${CONFIG[FC_PATH]}" ]]; then
|
|
|
|
if [ ! -d "${CONFIG[FC_PATH]}" ]; then
|
|
|
|
echo "${CONFIG[FC_PATH]}: directory not found"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2019-01-21 09:05:59 +00:00
|
|
|
if [[ "${CONFIG[ISAL]}" = "y" ]] || [[ "${CONFIG[CRYPTO]}" = "y" ]]; then
|
2019-04-30 05:56:39 +00:00
|
|
|
ver=$(nasm -v | 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
|
2019-01-29 19:08:53 +00:00
|
|
|
echo "Notice: ISA-L, compression & crypto auto-disabled due to nasm dependency."
|
2019-04-25 07:41:00 +00:00
|
|
|
echo "These features require NASM version 2.13.03 or newer. Please install"
|
2019-01-21 09:05:59 +00:00
|
|
|
echo "or upgrade then re-run this script."
|
|
|
|
CONFIG[ISAL]=n
|
|
|
|
CONFIG[CRYPTO]=n
|
|
|
|
CONFIG[IPSEC_MB]=n
|
2018-10-15 20:46:41 +00:00
|
|
|
CONFIG[REDUCE]=n
|
2019-01-21 09:05:59 +00:00
|
|
|
else
|
|
|
|
if [[ "${CONFIG[CRYPTO]}" = "y" ]]; then
|
|
|
|
CONFIG[IPSEC_MB]=y
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "${CONFIG[ISAL]}" = "y" ]]; then
|
2019-01-29 09:38:22 +00:00
|
|
|
if [ ! -f "$rootdir"/isa-l/autogen.sh ]; then
|
2019-01-29 17:44:49 +00:00
|
|
|
echo "ISA-L was not found; To install ISA-L run:"
|
2019-01-21 09:05:59 +00:00
|
|
|
echo " git submodule update --init"
|
2018-08-28 19:55:04 +00:00
|
|
|
exit 1
|
2018-08-18 16:25:41 +00:00
|
|
|
fi
|
2019-01-21 09:05:59 +00:00
|
|
|
|
|
|
|
if [[ "${CONFIG[RBD]}" = "y" ]]; then
|
2018-10-15 20:46:41 +00:00
|
|
|
echo "ISAL and RBD cannot co-exist currently so disabling ISAL and compression."
|
2019-01-21 09:05:59 +00:00
|
|
|
CONFIG[ISAL]=n
|
2018-10-15 20:46:41 +00:00
|
|
|
CONFIG[REDUCE]=n
|
2019-01-21 09:05:59 +00:00
|
|
|
else
|
|
|
|
cd $rootdir/isa-l
|
2019-11-11 13:00:09 +00:00
|
|
|
ISAL_LOG=$rootdir/isa-l/spdk-isal.log
|
2019-01-21 09:05:59 +00:00
|
|
|
echo -n "Configuring ISA-L (logfile: $ISAL_LOG)..."
|
|
|
|
./autogen.sh &> $ISAL_LOG
|
|
|
|
./configure CFLAGS="-fPIC -g -O2" --enable-shared=no >> $ISAL_LOG 2>&1
|
|
|
|
echo "done."
|
|
|
|
cd $rootdir
|
|
|
|
fi
|
2018-08-18 16:25:41 +00:00
|
|
|
fi
|
2018-08-15 20:09:49 +00:00
|
|
|
|
2019-05-07 13:40:08 +00:00
|
|
|
if [[ "${CONFIG[PMDK]}" = "y" ]]; then
|
|
|
|
if ! echo -e '#include <libpmemblk.h>\nint main(void) { return 0; }\n' \
|
2019-09-06 23:15:47 +00:00
|
|
|
| ${BUILD_CMD[@]} -lpmemblk - 2>/dev/null; then
|
2019-05-07 13:40:08 +00:00
|
|
|
echo --with-pmdk requires libpmemblk.
|
|
|
|
echo Please install then re-run this script.
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2018-09-21 14:37:54 +00:00
|
|
|
if [[ "${CONFIG[REDUCE]}" = "y" ]]; then
|
2019-05-07 13:33:48 +00:00
|
|
|
if ! echo -e '#include <libpmem.h>\nint main(void) { return 0; }\n' \
|
2019-09-06 23:15:47 +00:00
|
|
|
| ${BUILD_CMD[@]} -lpmem - 2>/dev/null; then
|
2018-09-21 14:37:54 +00:00
|
|
|
echo --with-reduce requires libpmem.
|
|
|
|
echo Please install then re-run this script.
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2018-09-26 07:57:32 +00:00
|
|
|
if [[ "${CONFIG[VPP]}" = "y" ]]; then
|
|
|
|
if [ ! -z "${CONFIG[VPP_DIR]}" ]; then
|
|
|
|
VPP_CFLAGS="-L${CONFIG[VPP_DIR]}/lib -I${CONFIG[VPP_DIR]}/include"
|
|
|
|
fi
|
|
|
|
if ! echo -e '#include <vnet/session/application_interface.h>\nint main(void) { return 0; }\n' \
|
2019-09-06 23:15:47 +00:00
|
|
|
| ${BUILD_CMD[@]} ${VPP_CFLAGS} -lvppinfra -lsvm -lvlibmemoryclient - 2>/dev/null; then
|
2018-09-26 07:57:32 +00:00
|
|
|
echo --with-vpp requires installed vpp.
|
|
|
|
echo Please install then re-run this script.
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2019-10-24 18:04:33 +00:00
|
|
|
if [[ "${CONFIG[NVME_CUSE]}" = "y" ]]; then
|
|
|
|
if ! echo -e '#define FUSE_USE_VERSION 31\n#include <fuse3/cuse_lowlevel.h>\n#include <fuse3/fuse_lowlevel.h>\n#include <fuse3/fuse_opt.h>\nint main(void) { return 0; }\n' \
|
|
|
|
| ${BUILD_CMD[@]} -lfuse3 -D_FILE_OFFSET_BITS=64 - 2>/dev/null; then
|
|
|
|
echo --with-cuse requires libfuse3.
|
|
|
|
echo Please install then re-run this script.
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2019-05-07 16:42:28 +00:00
|
|
|
if [[ "${CONFIG[RBD]}" = "y" ]]; then
|
|
|
|
if ! echo -e '#include <rbd/librbd.h>\n#include <rados/librados.h>\n' \
|
|
|
|
'int main(void) { return 0; }\n' \
|
2019-09-06 23:15:47 +00:00
|
|
|
| ${BUILD_CMD[@]} -lrados -lrbd - 2>/dev/null; then
|
2019-05-07 16:42:28 +00:00
|
|
|
echo --with-rbd requires librados and librbd.
|
|
|
|
echo Please install then re-run this script.
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2019-05-07 16:55:00 +00:00
|
|
|
if [[ "${CONFIG[ISCSI_INITIATOR]}" = "y" ]]; then
|
|
|
|
# Fedora installs libiscsi to /usr/lib64/iscsi for some reason.
|
|
|
|
if ! echo -e '#include <iscsi/iscsi.h>\n#include <iscsi/scsi-lowlevel.h>\n' \
|
|
|
|
'#if LIBISCSI_API_VERSION < 20150621\n' \
|
|
|
|
'#error\n' \
|
|
|
|
'#endif\n' \
|
|
|
|
'int main(void) { return 0; }\n' \
|
2019-09-06 23:15:47 +00:00
|
|
|
| ${BUILD_CMD[@]} -L/usr/lib64/iscsi -liscsi - 2>/dev/null; then
|
2019-05-07 16:55:00 +00:00
|
|
|
echo --with-iscsi-initiator requires libiscsi with
|
|
|
|
echo 'LIBISCSI_API_VERSION >= 20150621.'
|
|
|
|
echo Please install then re-run this script.
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2019-05-08 15:35:23 +00:00
|
|
|
if [[ "${CONFIG[LOG_BACKTRACE]}" = "y" ]]; then
|
|
|
|
if ! echo -e '#include <libunwind.h>\nint main(void) { return 0; }\n' \
|
2019-09-06 23:15:47 +00:00
|
|
|
| ${BUILD_CMD[@]} -lunwind - 2>/dev/null; then
|
2019-05-08 15:35:23 +00:00
|
|
|
echo --enable-log-bt requires libunwind.
|
|
|
|
echo Please install then re-run this script.
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2019-05-08 15:48:59 +00:00
|
|
|
if [[ "${CONFIG[ASAN]}" = "y" ]]; then
|
|
|
|
if ! echo -e 'int main(void) { return 0; }\n' \
|
2019-09-06 23:15:47 +00:00
|
|
|
| ${BUILD_CMD[@]} -fsanitize=address - 2>/dev/null; then
|
2019-05-08 15:48:59 +00:00
|
|
|
echo --enable-asan requires libasan.
|
|
|
|
echo Please install then re-run this script.
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "${CONFIG[UBSAN]}" = "y" ]]; then
|
|
|
|
if ! echo -e 'int main(void) { return 0; }\n' \
|
2019-09-06 23:15:47 +00:00
|
|
|
| ${BUILD_CMD[@]} -fsanitize=undefined - 2>/dev/null; then
|
2019-05-08 15:48:59 +00:00
|
|
|
echo --enable-ubsan requires libubsan.
|
|
|
|
echo Please install then re-run this script.
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "${CONFIG[TSAN]}" = "y" ]]; then
|
|
|
|
if ! echo -e 'int main(void) { return 0; }\n' \
|
2019-09-06 23:15:47 +00:00
|
|
|
| ${BUILD_CMD[@]} -fsanitize=thread - 2>/dev/null; then
|
2019-05-08 15:48:59 +00:00
|
|
|
echo --enable-tsan requires libtsan.
|
|
|
|
echo Please install then re-run this script.
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2018-09-20 16:54:49 +00:00
|
|
|
if [[ "${CONFIG[OCF]}" = "y" ]]; then
|
|
|
|
# If OCF_PATH is a file, assume it is a library and use it to compile with
|
|
|
|
if [ -f ${CONFIG[OCF_PATH]} ]; then
|
|
|
|
CONFIG[CUSTOMOCF]=y
|
|
|
|
else
|
|
|
|
CONFIG[CUSTOMOCF]=n
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2019-02-11 18:19:32 +00:00
|
|
|
if [[ "${CONFIG[PGO_CAPTURE]}" = "y" && "${CONFIG[PGO_USE]}" = "y" ]]; then
|
|
|
|
echo "ERROR: --enable-pgo-capture and --enable-pgo-use are mutually exclusive."
|
|
|
|
exit 1
|
2019-02-12 19:45:01 +00:00
|
|
|
elif [[ "${CONFIG[PGO_USE]}" = "y" ]]; then
|
|
|
|
if [[ "$CC_TYPE" = "clang" ]]; then
|
|
|
|
# For clang we need to run an extra step on gathered profiling data.
|
|
|
|
echo "Generating suitable profile data"
|
|
|
|
llvm-profdata merge -output=build/pgo/default.profdata build/pgo
|
|
|
|
fi
|
2019-02-11 18:19:32 +00:00
|
|
|
fi
|
|
|
|
|
2019-02-14 19:07:42 +00:00
|
|
|
if [[ "${CONFIG[URING]}" = "y" ]]; then
|
|
|
|
if [[ -n "${CONFIG[URING_PATH]}" ]]; then
|
|
|
|
if [ ! -d "${CONFIG[URING_PATH]}" ]; then
|
|
|
|
echo "${CONFIG[URING_PATH]}: directory not found"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
2019-02-11 18:19:32 +00:00
|
|
|
|
2019-10-08 12:28:49 +00:00
|
|
|
if [[ "${CONFIG[FUSE]}" = "y" ]]; then
|
|
|
|
if [[ ! -d /usr/include/fuse3 ]] && [[ ! -d /usr/local/include/fuse3 ]]; then
|
|
|
|
echo "--with-fuse requires libfuse3."
|
|
|
|
echo "Please install then re-run this script."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2018-10-03 17:58:52 +00:00
|
|
|
# We are now ready to generate final configuration. But first do sanity
|
|
|
|
# check to see if all keys in CONFIG array have its reflection in CONFIG file.
|
2019-08-26 23:02:30 +00:00
|
|
|
if [ $(egrep -c "^\s*CONFIG_[[:alnum:]_]+=" $rootdir/CONFIG) -ne ${#CONFIG[@]} ]; then
|
2018-10-03 17:58:52 +00:00
|
|
|
echo ""
|
|
|
|
echo "BUG: Some configuration options are not present in CONFIG file. Please update this file."
|
|
|
|
echo "Missing options in CONFIG (+) file and in current config (-): "
|
|
|
|
diff -u --label "CONFIG file" --label "CONFIG[@]" \
|
2018-09-21 14:32:36 +00:00
|
|
|
<(sed -r -e '/^\s*$/d; /^\s*#.*/d; s/(CONFIG_[[:alnum:]_]+)=.*/\1/g' CONFIG | sort) \
|
2018-10-03 17:58:52 +00:00
|
|
|
<(printf "CONFIG_%s\n" ${!CONFIG[@]} | sort)
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-09-21 14:32:36 +00:00
|
|
|
echo -n "Creating mk/config.mk..."
|
2019-08-26 23:02:30 +00:00
|
|
|
cp -f $rootdir/CONFIG $rootdir/mk/config.mk
|
2018-10-03 14:58:36 +00:00
|
|
|
for key in ${!CONFIG[@]}; do
|
2019-08-26 23:02:30 +00:00
|
|
|
sed -i.bak -r "s#^\s*CONFIG_${key}=.*#CONFIG_${key}\?=${CONFIG[$key]}#g" $rootdir/mk/config.mk
|
2018-10-03 14:58:36 +00:00
|
|
|
done
|
|
|
|
# On FreeBSD sed -i 'SUFFIX' - SUFFIX is mandatory. So no way but to delete the backed file.
|
2019-08-26 23:02:30 +00:00
|
|
|
rm -f $rootdir/mk/config.mk.bak
|
2019-05-09 06:57:32 +00:00
|
|
|
echo "done."
|
2017-03-30 19:06:49 +00:00
|
|
|
|
2018-03-28 18:24:48 +00:00
|
|
|
# Environment variables
|
2019-05-09 06:57:32 +00:00
|
|
|
echo -n "Creating mk/cc.flags.mk..."
|
2019-08-26 23:02:30 +00:00
|
|
|
rm -f $rootdir/mk/cc.flags.mk
|
|
|
|
[ -n "$CFLAGS" ] && echo "CFLAGS?=$CFLAGS" > $rootdir/mk/cc.flags.mk
|
|
|
|
[ -n "$CXXFLAGS" ] && echo "CXXFLAGS?=$CXXFLAGS" >> $rootdir/mk/cc.flags.mk
|
|
|
|
[ -n "$LDFLAGS" ] && echo "LDFLAGS?=$LDFLAGS" >> $rootdir/mk/cc.flags.mk
|
|
|
|
[ -n "$DESTDIR" ] && echo "DESTDIR?=$DESTDIR" >> $rootdir/mk/cc.flags.mk
|
2017-04-03 21:01:12 +00:00
|
|
|
echo "done."
|
2018-09-21 14:32:36 +00:00
|
|
|
|
2018-08-14 17:56:26 +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
|