diff --git a/configure b/configure index df85c9a84..79d15ac28 100755 --- a/configure +++ b/configure @@ -7,8 +7,7 @@ trap 'echo -e "\n\nConfiguration failed\n\n" >&2' ERR rootdir=$(readlink -f $(dirname $0)) source "$rootdir/scripts/common.sh" -function usage() -{ +function usage() { echo "'configure' configures SPDK to compile on supported platforms." echo "" echo "Usage: ./configure [OPTION]..." @@ -132,7 +131,7 @@ for i in "$@"; do 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 +$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_TYPE=$(cat $rootdir/mk/cc.mk | grep "CC_TYPE=" | cut -d "=" -f 2) @@ -158,7 +157,7 @@ fi #check nasm only on x86 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 # ISA-L, compression & crypto require NASM version 2.14 or newer. CONFIG[ISAL]=n @@ -183,7 +182,7 @@ function check_dir() { for i in "$@"; do case "$i" in - -h|--help) + -h | --help) usage exit 0 ;; @@ -444,6 +443,7 @@ for i in "$@"; do echo "Unrecognized option $i" usage exit 1 + ;; esac done @@ -480,7 +480,7 @@ if [[ "${CONFIG[IDXD]}" = "y" ]]; then cpu_vendor=$(sysctl -a | grep hw.model | cut -c 1-15) else intel="GenuineIntel" - cpu_vendor=$(grep -i 'vendor' /proc/cpuinfo --max-count=1) + cpu_vendor=$(grep -i 'vendor' /proc/cpuinfo --max-count=1) fi if [[ "$cpu_vendor" != *"$intel"* ]]; then echo "ERROR: IDXD cannot be used due to CPU incompatiblity." @@ -497,8 +497,8 @@ if [[ "${CONFIG[ISAL]}" = "y" ]]; then fi if [[ "${CONFIG[ISAL]}" = "n" ]] && [[ "${CONFIG[REDUCE]}" = "y" ]]; then - echo "ERROR Conflicting options: --with-reduce is not compatible with --without-isal." - exit 1 + echo "ERROR Conflicting options: --with-reduce is not compatible with --without-isal." + exit 1 fi if [ -z "${CONFIG[ENV]}" ]; then @@ -565,14 +565,14 @@ if [[ $sys_name != "Linux" ]]; then fi if [ "${CONFIG[RDMA]}" = "y" ]; then - if [[ ! "${CONFIG[RDMA_PROV]}" == "verbs" ]] && [[ ! "${CONFIG[RDMA_PROV]}" == "mlx5_dv" ]]; then - echo "Invalid RDMA provider specified, must be \"verbs\" or \"mlx5_dv\"" - exit 1 - fi + if [[ ! "${CONFIG[RDMA_PROV]}" == "verbs" ]] && [[ ! "${CONFIG[RDMA_PROV]}" == "mlx5_dv" ]]; then + echo "Invalid RDMA provider specified, must be \"verbs\" or \"mlx5_dv\"" + exit 1 + fi if ! echo -e '#include \n#include \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 Please install then re-run this script. exit 1 @@ -580,7 +580,7 @@ if [ "${CONFIG[RDMA]}" = "y" ]; then if echo -e '#include \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" else 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 \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" else CONFIG[RDMA_SET_ACK_TIMEOUT]="n" @@ -610,15 +610,15 @@ than or equal to 4.14 will see significantly reduced performance. fi if [ "${CONFIG[RDMA_PROV]}" == "mlx5_dv" ]; then - if ! echo -e '#include \n' \ - '#include \n' \ - '#include \n' \ - 'int main(void) { return rdma_establish(NULL) || ' \ - '!!IBV_QP_INIT_ATTR_SEND_OPS_FLAGS || !!MLX5_OPCODE_RDMA_WRITE; }\n' \ - | ${BUILD_CMD[@]} -lmlx5 -I${rootdir}/include -c - 2>/dev/null; then - echo "mlx5_dv provider is not supported" - exit 1 - fi + if ! echo -e '#include \n' \ + '#include \n' \ + '#include \n' \ + 'int main(void) { return rdma_establish(NULL) || ' \ + '!!IBV_QP_INIT_ATTR_SEND_OPS_FLAGS || !!MLX5_OPCODE_RDMA_WRITE; }\n' \ + | ${BUILD_CMD[@]} -lmlx5 -I${rootdir}/include -c - 2> /dev/null; then + echo "mlx5_dv provider is not supported" + exit 1 + fi fi echo "Using "${CONFIG[RDMA_PROV]}" RDMA provider" @@ -663,7 +663,7 @@ fi if [[ "${CONFIG[PMDK]}" = "y" ]]; then if ! echo -e '#include \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 Please install then re-run this script. exit 1 @@ -672,7 +672,7 @@ fi if [[ "${CONFIG[REDUCE]}" = "y" ]]; then if ! echo -e '#include \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 Please install then re-run this script. exit 1 @@ -681,7 +681,7 @@ fi if [[ "${CONFIG[NVME_CUSE]}" = "y" ]]; then if ! echo -e '#define FUSE_USE_VERSION 31\n#include \n#include \n#include \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 Please install then re-run this script. exit 1 @@ -691,7 +691,7 @@ fi if [[ "${CONFIG[RBD]}" = "y" ]]; then if ! echo -e '#include \n#include \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 Please install then re-run this script. exit 1 @@ -705,7 +705,7 @@ if [[ "${CONFIG[ISCSI_INITIATOR]}" = "y" ]]; then '#error\n' \ '#endif\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 'LIBISCSI_API_VERSION >= 20150621.' echo Please install then re-run this script. @@ -715,7 +715,7 @@ fi if [[ "${CONFIG[ASAN]}" = "y" ]]; then 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 Please install then re-run this script. exit 1 @@ -724,18 +724,18 @@ fi if [[ "${CONFIG[UBSAN]}" = "y" ]]; then 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 Please install then re-run this script. echo If installed, please check that the GCC version is at least 6.4 \ - and synchronize CC accordingly. + and synchronize CC accordingly. exit 1 fi fi if [[ "${CONFIG[TSAN]}" = "y" ]]; then 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 Please install then re-run this script. exit 1 @@ -780,7 +780,7 @@ if [[ "${CONFIG[FUSE]}" = "y" ]]; then fi 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 Please install then re-run this script. exit 1 @@ -820,7 +820,7 @@ echo "done." # Create .sh with build config for easy sourcing|lookup during the tests. for conf in "${!CONFIG[@]}"; do echo "CONFIG_$conf=${CONFIG[$conf]}" -done >"$rootdir/test/common/build_config.sh" +done > "$rootdir/test/common/build_config.sh" if [[ $sys_name == "FreeBSD" ]]; then echo "Type 'gmake' to build."