configure: Further fixes to Clang support.

* Actually locate the clang executable, and allow user overrides
 * Properly preserve arguments in get_build_tool_path
 * Fix get_build_tool_path for commands with dashes (e.g. "clang-5.0")
This commit is contained in:
Augustin Cavalier 2017-12-01 14:23:57 -05:00
parent be622abddb
commit 6570684235
2 changed files with 31 additions and 12 deletions

View File

@ -34,6 +34,10 @@ rule ArchitectureSetup architecture
}
}
if $(HAIKU_CC_IS_CLANG_$(architecture)) = 1 {
gccBaseFlags += -fno-builtin-vfork ;
}
# disable array bounds warnings on gcc 4.6 or newer since they trigger
# too many false positives. Coverity does a better job of this kind of
# analysis anyways.
@ -132,6 +136,10 @@ rule ArchitectureSetup architecture
HAIKU_WERROR_FLAGS_$(architecture) += -Wno-unused-but-set-variable ;
}
if $(HAIKU_CC_IS_CLANG_$(architecture)) = 1 {
gccBaseFlags += -Wno-address-of-packed-member -Wno-unused-private-field ;
}
# debug flags
local debugFlags = -ggdb ;

35
configure vendored
View File

@ -106,15 +106,15 @@ options:
environment variables:
CC The host compiler. Defaults to "gcc".
HAIKU_AR_x86_gcc2 The static library archiver for x86_gcc2.
HAIKU_AR_<arch> The static library archiver for <arch>.
Defaults to "ar".
HAIKU_CC_x86_gcc2 The x86_gcc2 compiler. Defaults to "gcc".
HAIKU_LD_x86_gcc2 The x86_gcc2 linker. Defaults to "ld".
HAIKU_OBJCOPY_x86_gcc2 The x86_gcc2 objcopy to be used. Defaults to
HAIKU_CC_<arch> The compiler for <arch>. Defaults to "gcc".
HAIKU_LD_<arch> The <arch> linker. Defaults to "ld".
HAIKU_OBJCOPY_<arch> The <arch> objcopy to be used. Defaults to
"objcopy".
HAIKU_RANLIB_x86_gcc2 The static library indexer for x86_gcc2. Defaults
HAIKU_RANLIB_<arch> The static library indexer for <arch>. Defaults
to "ranlib".
HAIKU_STRIP_x86_gcc2 The x86_gcc2 strip command. Defaults to "strip".
HAIKU_STRIP_<arch> The <arch> strip command. Defaults to "strip".
HAIKU_NASM The nasm assembler (x86 and x86_64 only).
HAIKU_CPPFLAGS_<arch> The preprocessor flags for target architecture
<arch>. Defaults to "".
@ -224,7 +224,7 @@ real_path()
#
standard_gcc_settings()
{
local gcc=$1
local gcc="$1"
if which greadlink > /dev/null 2>&1; then
readlink="greadlink -e"
@ -353,8 +353,8 @@ set_default_value()
get_build_tool_path()
{
local var="HAIKU_$1"
local varval=`get_variable $var`
local cmd=$2
local varval="`get_variable $var`"
local cmd="$2"
if [ ! -z "$varval" ]; then
# this variable is already set (probably by user) so grab its contents
@ -364,7 +364,7 @@ get_build_tool_path()
local path=${cmd%% *}
if [ -f "$path" ]; then
# get absolute path
# get absolute path from relative path
local oldPwd="`pwd`"
cd "`dirname "$path"`"
path="`pwd`/`basename "$path"`"
@ -376,7 +376,14 @@ get_build_tool_path()
}
fi
eval "$var=\"$path ${cmd#${2%% *}}\""
if test "${cmd#* }" != "$cmd"; then
# $cmd contains arguments, so preserve them (and only them)
cmd=${cmd#* }
else
# $cmd does not contain arguments, so unset it
cmd=
fi
eval "$var=\"$path $cmd\""
}
is_in_list()
@ -618,6 +625,10 @@ while [ $# -gt 0 ] ; do
exit 1
;;
esac
get_build_tool_path clang clang
if [ -n "crossToolsPrefix_$targetArch" ]; then
set_variable crossToolsPrefix_$targetArch llvm-
fi
targetArchs="$targetArchs $targetArch"
HAIKU_PACKAGING_ARCHS=
shift 2
@ -796,7 +807,7 @@ else
# prepare gcc settings and get the actual target architecture
if [ $useClang = 1 ]; then
gcc="clang -target ${targetMachine} -no-integrated-as"
gcc="$HAIKU_clang -target ${targetMachine} -no-integrated-as"
elif [ -z "${crossToolsPrefix}" ]; then
gcc=`get_variable HAIKU_CC_$targetArch`
else