configure: Fix Bash style syntax to be compliant with shfmt

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I7858a32bb3186df89844407cfc55c8c76b1dddd4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6024
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
This commit is contained in:
Michal Berger 2021-01-21 12:54:00 +01:00 committed by Tomasz Zawadzki
parent 238251a10b
commit 5ccabc8f27

70
configure vendored
View File

@ -7,8 +7,7 @@ trap 'echo -e "\n\nConfiguration failed\n\n" >&2' ERR
rootdir=$(readlink -f $(dirname $0)) rootdir=$(readlink -f $(dirname $0))
source "$rootdir/scripts/common.sh" source "$rootdir/scripts/common.sh"
function usage() function usage() {
{
echo "'configure' configures SPDK to compile on supported platforms." echo "'configure' configures SPDK to compile on supported platforms."
echo "" echo ""
echo "Usage: ./configure [OPTION]..." echo "Usage: ./configure [OPTION]..."
@ -132,7 +131,7 @@ for i in "$@"; do
done done
# Detect the compiler toolchain # 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 $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=" | sed s/DEFAULT_CC=//) CC=$(cat $rootdir/mk/cc.mk | grep "DEFAULT_CC=" | sed s/DEFAULT_CC=//)
CC_TYPE=$(cat $rootdir/mk/cc.mk | grep "CC_TYPE=" | cut -d "=" -f 2) CC_TYPE=$(cat $rootdir/mk/cc.mk | grep "CC_TYPE=" | cut -d "=" -f 2)
@ -158,7 +157,7 @@ fi
#check nasm only on x86 #check nasm only on x86
if [[ $arch == x86_64* ]]; then if [[ $arch == x86_64* ]]; then
ver=$(nasm -v 2>/dev/null | awk '{print $3}') ver=$(nasm -v 2> /dev/null | awk '{print $3}')
if lt "$ver" 2.14; then if lt "$ver" 2.14; then
# ISA-L, compression & crypto require NASM version 2.14 or newer. # ISA-L, compression & crypto require NASM version 2.14 or newer.
CONFIG[ISAL]=n CONFIG[ISAL]=n
@ -183,7 +182,7 @@ function check_dir() {
for i in "$@"; do for i in "$@"; do
case "$i" in case "$i" in
-h|--help) -h | --help)
usage usage
exit 0 exit 0
;; ;;
@ -444,6 +443,7 @@ for i in "$@"; do
echo "Unrecognized option $i" echo "Unrecognized option $i"
usage usage
exit 1 exit 1
;;
esac esac
done done
@ -480,7 +480,7 @@ if [[ "${CONFIG[IDXD]}" = "y" ]]; then
cpu_vendor=$(sysctl -a | grep hw.model | cut -c 1-15) cpu_vendor=$(sysctl -a | grep hw.model | cut -c 1-15)
else else
intel="GenuineIntel" intel="GenuineIntel"
cpu_vendor=$(grep -i 'vendor' /proc/cpuinfo --max-count=1) cpu_vendor=$(grep -i 'vendor' /proc/cpuinfo --max-count=1)
fi fi
if [[ "$cpu_vendor" != *"$intel"* ]]; then if [[ "$cpu_vendor" != *"$intel"* ]]; then
echo "ERROR: IDXD cannot be used due to CPU incompatiblity." echo "ERROR: IDXD cannot be used due to CPU incompatiblity."
@ -497,8 +497,8 @@ if [[ "${CONFIG[ISAL]}" = "y" ]]; then
fi fi
if [[ "${CONFIG[ISAL]}" = "n" ]] && [[ "${CONFIG[REDUCE]}" = "y" ]]; then if [[ "${CONFIG[ISAL]}" = "n" ]] && [[ "${CONFIG[REDUCE]}" = "y" ]]; then
echo "ERROR Conflicting options: --with-reduce is not compatible with --without-isal." echo "ERROR Conflicting options: --with-reduce is not compatible with --without-isal."
exit 1 exit 1
fi fi
if [ -z "${CONFIG[ENV]}" ]; then if [ -z "${CONFIG[ENV]}" ]; then
@ -565,14 +565,14 @@ if [[ $sys_name != "Linux" ]]; then
fi fi
if [ "${CONFIG[RDMA]}" = "y" ]; then if [ "${CONFIG[RDMA]}" = "y" ]; then
if [[ ! "${CONFIG[RDMA_PROV]}" == "verbs" ]] && [[ ! "${CONFIG[RDMA_PROV]}" == "mlx5_dv" ]]; then if [[ ! "${CONFIG[RDMA_PROV]}" == "verbs" ]] && [[ ! "${CONFIG[RDMA_PROV]}" == "mlx5_dv" ]]; then
echo "Invalid RDMA provider specified, must be \"verbs\" or \"mlx5_dv\"" echo "Invalid RDMA provider specified, must be \"verbs\" or \"mlx5_dv\""
exit 1 exit 1
fi fi
if ! echo -e '#include <infiniband/verbs.h>\n#include <rdma/rdma_verbs.h>\n' \ if ! echo -e '#include <infiniband/verbs.h>\n#include <rdma/rdma_verbs.h>\n' \
'int main(void) { return 0; }\n' \ 'int main(void) { return 0; }\n' \
| ${BUILD_CMD[@]} -libverbs -lrdmacm - 2>/dev/null; then | ${BUILD_CMD[@]} -libverbs -lrdmacm - 2> /dev/null; then
echo --with-rdma requires libverbs and librdmacm. echo --with-rdma requires libverbs and librdmacm.
echo Please install then re-run this script. echo Please install then re-run this script.
exit 1 exit 1
@ -580,7 +580,7 @@ if [ "${CONFIG[RDMA]}" = "y" ]; then
if echo -e '#include <infiniband/verbs.h>\n' \ if echo -e '#include <infiniband/verbs.h>\n' \
'int main(void) { return !!IBV_WR_SEND_WITH_INV; }\n' \ 'int main(void) { return !!IBV_WR_SEND_WITH_INV; }\n' \
| ${BUILD_CMD[@]} -c - 2>/dev/null; then | ${BUILD_CMD[@]} -c - 2> /dev/null; 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"
@ -602,7 +602,7 @@ than or equal to 4.14 will see significantly reduced performance.
if echo -e '#include <rdma/rdma_cma.h>\n' \ if echo -e '#include <rdma/rdma_cma.h>\n' \
'int main(void) { return !!RDMA_OPTION_ID_ACK_TIMEOUT; }\n' \ 'int main(void) { return !!RDMA_OPTION_ID_ACK_TIMEOUT; }\n' \
| ${BUILD_CMD[@]} -c - 2>/dev/null; then | ${BUILD_CMD[@]} -c - 2> /dev/null; then
CONFIG[RDMA_SET_ACK_TIMEOUT]="y" CONFIG[RDMA_SET_ACK_TIMEOUT]="y"
else else
CONFIG[RDMA_SET_ACK_TIMEOUT]="n" CONFIG[RDMA_SET_ACK_TIMEOUT]="n"
@ -610,15 +610,15 @@ than or equal to 4.14 will see significantly reduced performance.
fi fi
if [ "${CONFIG[RDMA_PROV]}" == "mlx5_dv" ]; then if [ "${CONFIG[RDMA_PROV]}" == "mlx5_dv" ]; then
if ! echo -e '#include <spdk/stdinc.h>\n' \ if ! echo -e '#include <spdk/stdinc.h>\n' \
'#include <infiniband/mlx5dv.h>\n' \ '#include <infiniband/mlx5dv.h>\n' \
'#include <rdma/rdma_cma.h>\n' \ '#include <rdma/rdma_cma.h>\n' \
'int main(void) { return rdma_establish(NULL) || ' \ 'int main(void) { return rdma_establish(NULL) || ' \
'!!IBV_QP_INIT_ATTR_SEND_OPS_FLAGS || !!MLX5_OPCODE_RDMA_WRITE; }\n' \ '!!IBV_QP_INIT_ATTR_SEND_OPS_FLAGS || !!MLX5_OPCODE_RDMA_WRITE; }\n' \
| ${BUILD_CMD[@]} -lmlx5 -I${rootdir}/include -c - 2>/dev/null; then | ${BUILD_CMD[@]} -lmlx5 -I${rootdir}/include -c - 2> /dev/null; then
echo "mlx5_dv provider is not supported" echo "mlx5_dv provider is not supported"
exit 1 exit 1
fi fi
fi fi
echo "Using "${CONFIG[RDMA_PROV]}" RDMA provider" echo "Using "${CONFIG[RDMA_PROV]}" RDMA provider"
@ -663,7 +663,7 @@ fi
if [[ "${CONFIG[PMDK]}" = "y" ]]; then if [[ "${CONFIG[PMDK]}" = "y" ]]; then
if ! echo -e '#include <libpmemblk.h>\nint main(void) { return 0; }\n' \ if ! echo -e '#include <libpmemblk.h>\nint main(void) { return 0; }\n' \
| ${BUILD_CMD[@]} -lpmemblk - 2>/dev/null; then | ${BUILD_CMD[@]} -lpmemblk - 2> /dev/null; then
echo --with-pmdk requires libpmemblk. echo --with-pmdk requires libpmemblk.
echo Please install then re-run this script. echo Please install then re-run this script.
exit 1 exit 1
@ -672,7 +672,7 @@ fi
if [[ "${CONFIG[REDUCE]}" = "y" ]]; then if [[ "${CONFIG[REDUCE]}" = "y" ]]; then
if ! echo -e '#include <libpmem.h>\nint main(void) { return 0; }\n' \ if ! echo -e '#include <libpmem.h>\nint main(void) { return 0; }\n' \
| ${BUILD_CMD[@]} -lpmem - 2>/dev/null; then | ${BUILD_CMD[@]} -lpmem - 2> /dev/null; then
echo --with-reduce requires libpmem. echo --with-reduce requires libpmem.
echo Please install then re-run this script. echo Please install then re-run this script.
exit 1 exit 1
@ -681,7 +681,7 @@ fi
if [[ "${CONFIG[NVME_CUSE]}" = "y" ]]; then 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' \ 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 | ${BUILD_CMD[@]} -lfuse3 -D_FILE_OFFSET_BITS=64 - 2> /dev/null; then
echo --with-cuse requires libfuse3. echo --with-cuse requires libfuse3.
echo Please install then re-run this script. echo Please install then re-run this script.
exit 1 exit 1
@ -691,7 +691,7 @@ fi
if [[ "${CONFIG[RBD]}" = "y" ]]; then if [[ "${CONFIG[RBD]}" = "y" ]]; then
if ! echo -e '#include <rbd/librbd.h>\n#include <rados/librados.h>\n' \ if ! echo -e '#include <rbd/librbd.h>\n#include <rados/librados.h>\n' \
'int main(void) { return 0; }\n' \ 'int main(void) { return 0; }\n' \
| ${BUILD_CMD[@]} -lrados -lrbd - 2>/dev/null; then | ${BUILD_CMD[@]} -lrados -lrbd - 2> /dev/null; then
echo --with-rbd requires librados and librbd. echo --with-rbd requires librados and librbd.
echo Please install then re-run this script. echo Please install then re-run this script.
exit 1 exit 1
@ -705,7 +705,7 @@ if [[ "${CONFIG[ISCSI_INITIATOR]}" = "y" ]]; then
'#error\n' \ '#error\n' \
'#endif\n' \ '#endif\n' \
'int main(void) { return 0; }\n' \ 'int main(void) { return 0; }\n' \
| ${BUILD_CMD[@]} -L/usr/lib64/iscsi -liscsi - 2>/dev/null; then | ${BUILD_CMD[@]} -L/usr/lib64/iscsi -liscsi - 2> /dev/null; then
echo --with-iscsi-initiator requires libiscsi with echo --with-iscsi-initiator requires libiscsi with
echo 'LIBISCSI_API_VERSION >= 20150621.' echo 'LIBISCSI_API_VERSION >= 20150621.'
echo Please install then re-run this script. echo Please install then re-run this script.
@ -715,7 +715,7 @@ fi
if [[ "${CONFIG[ASAN]}" = "y" ]]; then if [[ "${CONFIG[ASAN]}" = "y" ]]; then
if ! echo -e 'int main(void) { return 0; }\n' \ if ! echo -e 'int main(void) { return 0; }\n' \
| ${BUILD_CMD[@]} -fsanitize=address - 2>/dev/null; then | ${BUILD_CMD[@]} -fsanitize=address - 2> /dev/null; then
echo --enable-asan requires libasan. echo --enable-asan requires libasan.
echo Please install then re-run this script. echo Please install then re-run this script.
exit 1 exit 1
@ -724,18 +724,18 @@ fi
if [[ "${CONFIG[UBSAN]}" = "y" ]]; then if [[ "${CONFIG[UBSAN]}" = "y" ]]; then
if ! echo -e 'int main(void) { return 0; }\n' \ if ! echo -e 'int main(void) { return 0; }\n' \
| ${BUILD_CMD[@]} -fsanitize=undefined - 2>/dev/null; then | ${BUILD_CMD[@]} -fsanitize=undefined - 2> /dev/null; then
echo --enable-ubsan requires libubsan. echo --enable-ubsan requires libubsan.
echo Please install then re-run this script. echo Please install then re-run this script.
echo If installed, please check that the GCC version is at least 6.4 \ echo If installed, please check that the GCC version is at least 6.4 \
and synchronize CC accordingly. and synchronize CC accordingly.
exit 1 exit 1
fi fi
fi fi
if [[ "${CONFIG[TSAN]}" = "y" ]]; then if [[ "${CONFIG[TSAN]}" = "y" ]]; then
if ! echo -e 'int main(void) { return 0; }\n' \ if ! echo -e 'int main(void) { return 0; }\n' \
| ${BUILD_CMD[@]} -fsanitize=thread - 2>/dev/null; then | ${BUILD_CMD[@]} -fsanitize=thread - 2> /dev/null; then
echo --enable-tsan requires libtsan. echo --enable-tsan requires libtsan.
echo Please install then re-run this script. echo Please install then re-run this script.
exit 1 exit 1
@ -780,7 +780,7 @@ if [[ "${CONFIG[FUSE]}" = "y" ]]; then
fi fi
if [ "${CONFIG[CET]}" = "y" ]; then if [ "${CONFIG[CET]}" = "y" ]; then
if ! echo -e 'int main(void) { return 0; }\n' | ${BUILD_CMD[@]} -fcf-protection - 2>/dev/null; then if ! echo -e 'int main(void) { return 0; }\n' | ${BUILD_CMD[@]} -fcf-protection - 2> /dev/null; then
echo --enable-cet requires compiler/linker that supports CET. echo --enable-cet requires compiler/linker that supports CET.
echo Please install then re-run this script. echo Please install then re-run this script.
exit 1 exit 1
@ -820,7 +820,7 @@ echo "done."
# Create .sh with build config for easy sourcing|lookup during the tests. # Create .sh with build config for easy sourcing|lookup during the tests.
for conf in "${!CONFIG[@]}"; do for conf in "${!CONFIG[@]}"; do
echo "CONFIG_$conf=${CONFIG[$conf]}" echo "CONFIG_$conf=${CONFIG[$conf]}"
done >"$rootdir/test/common/build_config.sh" done > "$rootdir/test/common/build_config.sh"
if [[ $sys_name == "FreeBSD" ]]; then if [[ $sys_name == "FreeBSD" ]]; then
echo "Type 'gmake' to build." echo "Type 'gmake' to build."