From eb94788550af905c0e0fd4fed4530cb7bcf516c9 Mon Sep 17 00:00:00 2001 From: NicJA Date: Mon, 15 Apr 2019 19:32:55 +0000 Subject: [PATCH] force CC/CXX to the passed in compiler to use. make sure to detect the correct lld version to use for llvm. git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@56258 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- configure | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++----- configure.in | 15 ++++++++++----- 2 files changed, 62 insertions(+), 10 deletions(-) diff --git a/configure b/configure index 5335eb2247..048cad4312 100755 --- a/configure +++ b/configure @@ -854,6 +854,7 @@ aros_host_autoheader aros_host_autoconf aros_host_aclocal aros_host_ld +base_lld_name MMAKE AWK CPP @@ -2897,6 +2898,7 @@ if test "$use_c_compiler" = ""; then host_c_compilers="$default_c_compilers" else host_c_compilers="$use_c_compiler" + CC=$use_c_compiler fi default_cxx_compilers="g++ clang++ c++" @@ -2912,6 +2914,7 @@ if test "$use_cxx_compiler" = ""; then host_cxx_compilers="$default_cxx_compilers" else host_cxx_compilers="$use_cxx_compiler" + CXX=$use_cxx_compiler fi @@ -4305,13 +4308,15 @@ if test "$IS_SUN_COMPILER" -ne "0"; then fi IS_LLVM_COMPILER=`echo $HOST_COMPILER_VERSION | grep -i -c -E 'LLVM|clang'` if test "$IS_LLVM_COMPILER" -ne "0"; then - HOST_TOOLCHAIN_PREFIX=llvm- if test "$CC_BASE" != "gcc"; then + HOST_TOOLCHAIN_PREFIX=llvm- HOST_TOOLCHAIN_SUFFIX="`echo $CC_BASE | sed -e \"s|clang||g\"`" + HOST_TOOLCHAIN_FAMILY=llvm + else + IS_GNU_COMPILER=1 fi - HOST_TOOLCHAIN_FAMILY=llvm fi -IS_GNU_COMPILER=`echo $HOST_COMPILER_VERSION | grep -i -c -E 'gcc'` +IS_GNU_COMPILER?=`echo $HOST_COMPILER_VERSION | grep -i -c -E 'gcc'` if test "$IS_GNU_COMPILER" -ne "0"; then HOST_TOOLCHAIN_PREFIX= HOST_TOOLCHAIN_SUFFIX= @@ -4421,9 +4426,51 @@ aros_build_host=$host aros_host_cpp="$CPP" aros_host_cc="$CC" aros_host_cxx="$CXX" -base_ld_name="${HOST_TOOLCHAIN_PREFIX}ld${HOST_TOOLCHAIN_SUFFIX}" +base_ld_name=${HOST_TOOLCHAIN_PREFIX}ld${HOST_TOOLCHAIN_SUFFIX} if test "$HOST_TOOLCHAIN_FAMILY" = "llvm"; then - base_ld_name="ld.lld${HOST_TOOLCHAIN_SUFFIX}" + for ac_prog in $base_ld_name ld.lld${HOST_TOOLCHAIN_SUFFIX} ld64.lld${HOST_TOOLCHAIN_SUFFIX} ld-link${HOST_TOOLCHAIN_SUFFIX}.exe ld${HOST_TOOLCHAIN_SUFFIX} +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_base_lld_name+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$base_lld_name"; then + ac_cv_prog_base_lld_name="$base_lld_name" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_base_lld_name="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +base_lld_name=$ac_cv_prog_base_lld_name +if test -n "$base_lld_name"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $base_lld_name" >&5 +$as_echo "$base_lld_name" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$base_lld_name" && break +done + + base_ld_name=$base_lld_name fi if test "$base_ld_name" = ""; then diff --git a/configure.in b/configure.in index 7d665c4223..f152cbcb72 100644 --- a/configure.in +++ b/configure.in @@ -97,6 +97,7 @@ if test "$use_c_compiler" = ""; then host_c_compilers="$default_c_compilers" else host_c_compilers="$use_c_compiler" + CC=$use_c_compiler fi default_cxx_compilers="g++ clang++ c++" @@ -105,6 +106,7 @@ if test "$use_cxx_compiler" = ""; then host_cxx_compilers="$default_cxx_compilers" else host_cxx_compilers="$use_cxx_compiler" + CXX=$use_cxx_compiler fi @@ -140,13 +142,15 @@ if test "$IS_SUN_COMPILER" -ne "0"; then fi IS_LLVM_COMPILER=`echo $HOST_COMPILER_VERSION | grep -i -c -E 'LLVM|clang'` if test "$IS_LLVM_COMPILER" -ne "0"; then - HOST_TOOLCHAIN_PREFIX=llvm- if test "$CC_BASE" != "gcc"; then + HOST_TOOLCHAIN_PREFIX=llvm- HOST_TOOLCHAIN_SUFFIX="`echo $CC_BASE | sed -e \"s|clang||g\"`" + HOST_TOOLCHAIN_FAMILY=llvm + else + IS_GNU_COMPILER=1 fi - HOST_TOOLCHAIN_FAMILY=llvm fi -IS_GNU_COMPILER=`echo $HOST_COMPILER_VERSION | grep -i -c -E 'gcc'` +IS_GNU_COMPILER?=`echo $HOST_COMPILER_VERSION | grep -i -c -E 'gcc'` if test "$IS_GNU_COMPILER" -ne "0"; then HOST_TOOLCHAIN_PREFIX= HOST_TOOLCHAIN_SUFFIX= @@ -169,9 +173,10 @@ aros_build_host=$host aros_host_cpp="$CPP" aros_host_cc="$CC" aros_host_cxx="$CXX" -base_ld_name=["${HOST_TOOLCHAIN_PREFIX}ld${HOST_TOOLCHAIN_SUFFIX}"] +base_ld_name=${HOST_TOOLCHAIN_PREFIX}ld${HOST_TOOLCHAIN_SUFFIX} if test "$HOST_TOOLCHAIN_FAMILY" = "llvm"; then - base_ld_name=["ld.lld${HOST_TOOLCHAIN_SUFFIX}"] + AC_CHECK_PROGS(base_lld_name,[$base_ld_name ld.lld${HOST_TOOLCHAIN_SUFFIX} ld64.lld${HOST_TOOLCHAIN_SUFFIX} ld-link${HOST_TOOLCHAIN_SUFFIX}.exe ld${HOST_TOOLCHAIN_SUFFIX}]) + base_ld_name=$base_lld_name fi AROS_TOOL_CCPATH(aros_host_ld,ld,$base_ld_name) AROS_REQUIRED(ld,$aros_host_ld) -- 2.11.4.GIT