configure: Fix & enhance --use-clang.

Now you set the arch along with the argument, and specify the binutils
manually (and thus build without a complete crosstools environment.)
This commit is contained in:
Augustin Cavalier 2017-11-23 17:29:15 +01:00
parent 4d87bc24d4
commit d73993ff20

42
configure vendored
View File

@ -84,8 +84,8 @@ options:
ones the secondary architectures. ones the secondary architectures.
--update re-runs last configure invocation [must be given --update re-runs last configure invocation [must be given
as first option!] as first option!]
--use-clang Build with host Clang instead of GCC cross --use-clang <arch> Build with host Clang instead of GCC cross
compiler compiler, targeting <arch>
--use-gcc-pipe Build with GCC option -pipe. Speeds up the build --use-gcc-pipe Build with GCC option -pipe. Speeds up the build
process, but uses more memory. process, but uses more memory.
--use-gcc-graphite Build with GCC Graphite engine for loop --use-gcc-graphite Build with GCC Graphite engine for loop
@ -354,7 +354,13 @@ get_build_tool_path()
{ {
local var="HAIKU_$1" local var="HAIKU_$1"
local cmd=$2 local cmd=$2
local path=${2%% *}
if [ ! -z "${!var}" ]; then
# this variable is already set (probably by user) so grab its contents
cmd=${!var}
fi
local path=${cmd%% *}
if [ -f "$path" ]; then if [ -f "$path" ]; then
# get absolute path # get absolute path
@ -364,7 +370,7 @@ get_build_tool_path()
cd $oldPwd cd $oldPwd
else else
which "$path" > /dev/null 2>&1 || { which "$path" > /dev/null 2>&1 || {
echo "Build tool \"$path\" not found." >&2 echo "Build tool \"$path\" not found (maybe specify it in $var?)" >&2
exit 1 exit 1
} }
fi fi
@ -599,7 +605,22 @@ while [ $# -gt 0 ] ; do
) )
haikuTargetArchs="$haikuTargetArchs $targetArch" haikuTargetArchs="$haikuTargetArchs $targetArch"
;; ;;
--use-clang) useClang=1; shift 1;; --use-clang)
assertparam "$1" $#
targetArch=$2
useClang=1
case "$targetArch" in
x86) targetMachine=i586-pc-haiku;;
x86_64) targetMachine=x86_64-unknown-haiku;;
*)
echo "Unsupported target architecture: $2" >&2
exit 1
;;
esac
targetArchs="$targetArchs $targetArch"
HAIKU_PACKAGING_ARCHS=
shift 2
;;
--use-gcc-pipe) HAIKU_USE_GCC_PIPE=1; shift 1;; --use-gcc-pipe) HAIKU_USE_GCC_PIPE=1; shift 1;;
--use-gcc-graphite) useGccGraphiteDefault=1; shift 1;; --use-gcc-graphite) useGccGraphiteDefault=1; shift 1;;
--use-32bit) HAIKU_HOST_USE_32BIT=1; shift 1;; --use-32bit) HAIKU_HOST_USE_32BIT=1; shift 1;;
@ -774,15 +795,12 @@ else
# prepare gcc settings and get the actual target architecture # prepare gcc settings and get the actual target architecture
if [ $useClang = 1 ]; then if [ $useClang = 1 ]; then
target=${crossToolsPrefix##*/} gcc="clang -target ${targetMachine} -no-integrated-as"
target=${target%-} elif [ -z "${crossToolsPrefix}" ]; then
gcc="clang -target ${target} -no-integrated-as" gcc=`get_variable HAIKU_CC_$targetArch`
else else
gcc="${crossToolsPrefix}gcc" gcc="${crossToolsPrefix}gcc"
fi fi
if [ -z "${crossToolsPrefix}" ]; then
gcc=`get_variable HAIKU_CC_$targetArch`
fi
standard_gcc_settings "$gcc" standard_gcc_settings "$gcc"
targetArch=$standard_gcc_settings_targetArch targetArch=$standard_gcc_settings_targetArch
@ -930,3 +948,5 @@ HAIKU_OUTPUT_DIR = ${outputDir} ;
include [ FDirName \$(HAIKU_TOP) Jamfile ] ; include [ FDirName \$(HAIKU_TOP) Jamfile ] ;
EOF EOF
echo "Configured successfully!"