diff --git a/src/tools/clang-linux.jam b/src/tools/clang-linux.jam index 8f9fec1cc..2e781a832 100644 --- a/src/tools/clang-linux.jam +++ b/src/tools/clang-linux.jam @@ -62,6 +62,31 @@ rule init ( version ? : command * : options * ) { common.handle-options clang-linux : $(condition) : $(command) : $(options) ; clang.init-cxxstd-flags clang-linux : $(condition) : $(version) ; + # Support for gcc root as the backend, this is mainly useful for clang/gcc on Windows + # since on Linux gcc will be the default compiler already located on the PATH. + # On Windows it is possible to have multiple versions of mingw(-64)/gcc installed + # in different paths. The option can be given so that the gcc backend + # can be found at runtime, while the $(command) can be a script that sets the + # PATH for both the clang directory and the backende gcc directory + # before calling clang++ when compiling/linking. + + local root = [ feature.get-values : $(options) ] ; + + if $(root) + { + # On multilib 64-bit boxes, there are both 32-bit and 64-bit libraries + # and all must be added to LD_LIBRARY_PATH. The linker will pick the + # right onces. Note that we do not provide a clean way to build a 32-bit + # binary using a 64-bit compiler, but user can always pass -m32 + # manually. + local lib_path = $(root)/bin $(root)/lib $(root)/lib32 $(root)/lib64 ; + if $(.debug-configuration) + { + ECHO "notice:" using gcc libraries with clang"::" $(condition) "::" $(lib_path) ; + } + toolset.flags clang-linux.link RUN_PATH $(condition) : $(lib_path) ; + } + # - Ranlib. local ranlib = [ feature.get-values : $(options) ] ; toolset.flags clang-linux.archive .RANLIB $(condition) : $(ranlib[1]) ;