configure: fix LTO and CROSS_PREFIX

Starting with patch 873c874, it was not possible to configure SPDK
with LTO enabled or setting a cross compilation prefix.

detect_cc.sh was moved before the configuration options
were read from command line.
This patch fixes this behavior by reading passed options
before invoking detect_cc.sh.

Next loop that reads all options has empty handling for those,
as otherwise "Unrecognized option" condition would trigger.

Added LTO to NIGHTLY release build tests.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I21802e14c0565cb7f323bcbd805967a3c4781b46
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1714
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Tomasz Zawadzki 2020-04-07 08:05:15 -04:00
parent 29252a483b
commit 4d2e26d888
2 changed files with 20 additions and 10 deletions

View File

@ -35,7 +35,7 @@ fi
timing_enter build_release
./configure $config_params --disable-debug
./configure $config_params --disable-debug --with-lto
$MAKE ${MAKEFLAGS}
$MAKE ${MAKEFLAGS} clean

28
configure vendored
View File

@ -120,6 +120,20 @@ declare -A CONFIG
source $rootdir/CONFIG.sh
rm $rootdir/CONFIG.sh
for i in "$@"; do
case "$i" in
--cross-prefix=*)
CONFIG[CROSS_PREFIX]="${i#*=}"
;;
--enable-lto)
CONFIG[LTO]=y
;;
--disable-lto)
CONFIG[LTO]=n
;;
esac
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
@ -177,15 +191,17 @@ for i in "$@"; do
usage
exit 0
;;
--cross-prefix=*) ;&
--enable-lto) ;&
--disable-lto)
# Options handled before detecting CC.
;;
--prefix=*)
CONFIG[PREFIX]="${i#*=}"
;;
--target-arch=*)
CONFIG[ARCH]="${i#*=}"
;;
--cross-prefix=*)
CONFIG[CROSS_PREFIX]="${i#*=}"
;;
--enable-debug)
CONFIG[DEBUG]=y
;;
@ -222,12 +238,6 @@ for i in "$@"; do
--disable-coverage)
CONFIG[COVERAGE]=n
;;
--enable-lto)
CONFIG[LTO]=y
;;
--disable-lto)
CONFIG[LTO]=n
;;
--enable-pgo-capture)
CONFIG[PGO_CAPTURE]=y
;;