detect_cc: Handle empty arguments
When called from scripts, sometimes the arguments passed will be empty. Change-Id: I2f9fa1daa173eecc7b20928cd359284bb6f74ff3 Signed-off-by: Ben Walker <benjamin.walker@intel.com> Reviewed-on: https://review.gerrithub.io/c/444278 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
parent
8bbf0391f6
commit
5a670e8e76
@ -23,10 +23,7 @@ function usage()
|
||||
err " --lto=[y|n] Attempt to configure for LTO"
|
||||
}
|
||||
|
||||
CC=cc
|
||||
CXX=c++
|
||||
LD=ld
|
||||
LTO=n
|
||||
|
||||
|
||||
for i in "$@"; do
|
||||
case "$i" in
|
||||
@ -35,16 +32,24 @@ for i in "$@"; do
|
||||
exit 0
|
||||
;;
|
||||
--cc=*)
|
||||
if [[ -n "${i#*=}" ]]; then
|
||||
CC="${i#*=}"
|
||||
fi
|
||||
;;
|
||||
--cxx=*)
|
||||
if [[ -n "${i#*=}" ]]; then
|
||||
CXX="${i#*=}"
|
||||
fi
|
||||
;;
|
||||
--lto=*)
|
||||
if [[ -n "${i#*=}" ]]; then
|
||||
LTO="${i#*=}"
|
||||
fi
|
||||
;;
|
||||
--ld=*)
|
||||
if [[ -n "${i#*=}" ]]; then
|
||||
LD="${i#*=}"
|
||||
fi
|
||||
;;
|
||||
--)
|
||||
break
|
||||
@ -56,6 +61,11 @@ for i in "$@"; do
|
||||
esac
|
||||
done
|
||||
|
||||
: ${CC=cc}
|
||||
: ${CXX=c++}
|
||||
: ${LD=ld}
|
||||
: ${LTO=n}
|
||||
|
||||
CC_TYPE=$($CC -v 2>&1 | grep -o -E '\w+ version' | head -1 | awk '{ print $1 }')
|
||||
CXX_TYPE=$($CXX -v 2>&1 | grep -o -E '\w+ version' | head -1 | awk '{ print $1 }')
|
||||
if [ "$CC_TYPE" != "$CXX_TYPE" ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user