diff --git a/build/jam/ArchitectureRules b/build/jam/ArchitectureRules index 91466a4d82..b554ec8495 100644 --- a/build/jam/ArchitectureRules +++ b/build/jam/ArchitectureRules @@ -29,7 +29,7 @@ rule ArchitectureSetup architecture # http://www.freelists.org/post/haiku-development/hrev45320-Yet-another-nonobvious-effect-of-ftreevrp-optimization if $(gccVersion[1]) >= 3 { gccBaseFlags += -fno-strict-aliasing ; - if ! $(CLANG) { + if ! $(HAIKU_CC_IS_CLANG_$(architecture)) { gccBaseFlags += -fno-tree-vrp ; } } @@ -393,7 +393,7 @@ rule KernelArchitectureSetup architecture local g++BaseFlags = $(gccBaseFlags) -fno-exceptions ; - if $(gccVersion[1]) >= 3 { + if $(gccVersion[1]) >= 3 && ! $(HAIKU_CC_IS_CLANG_$(architecture)) { g++BaseFlags += -fno-use-cxa-atexit ; } @@ -498,7 +498,7 @@ rule ArchitectureSetupWarnings architecture rule EnableWerror dirTokens : scope { # Clang gives way more warnings than GCC, so that code won't compile # -Werror when using Clang. - if ! $(CLANG) { + if ! $(HAIKU_CC_IS_CLANG_$(architecture)) { SetConfigVar WARNINGS : HAIKU_TOP $(dirTokens) : treatAsErrors : $(scope) ; } @@ -513,7 +513,7 @@ rule ArchitectureSetupWarnings architecture WARNINGS on $(file) = $(WARNINGS) ; } - if $(CLANG) { + if $(HAIKU_CC_IS_CLANG_$(architecture)) { # We need -integrated-as, as otherwise Clang uses GCC as assembler and # passes -fheinous-gnu-extensions to GCC, which GCC does not understand # then errors out. diff --git a/configure b/configure index 7aaad6bd1f..1b14df0344 100755 --- a/configure +++ b/configure @@ -86,6 +86,8 @@ options: ones the secondary architectures. --update re-runs last configure invocation [must be given as first option!] + --use-clang Build with host Clang instead of GCC cross + compiler --use-gcc-pipe Build with GCC option -pipe. Speeds up the build process, but uses more memory. --use-gcc-graphite Build with GCC Graphite engine for loop @@ -352,6 +354,16 @@ standard_gcc_settings() set_variable HAIKU_CPU_$targetArch $targetCpu get_build_tool_path CC_$targetArch "$gcc" + if [ $useClang = 1 ]; then + # The get_build_tool_path above is needed to get the path to the rest + # of the build tools + local path=`dirname $(get_variable HAIKU_CC_$targetArch)` + set_variable HAIKU_CC_$targetArch \ + "PATH=\\\"$path:\\\$PATH\\\" clang -target $gccMachine" + set_variable HAIKU_CC_IS_CLANG_$targetArch 1 + else + set_variable HAIKU_CC_IS_CLANG_$targetArch 0 + fi set_variable HAIKU_GCC_RAW_VERSION_$targetArch $gccRawVersion set_variable HAIKU_GCC_MACHINE_$targetArch $gccMachine set_variable HAIKU_GCC_LIB_DIR_$targetArch $gccdir @@ -454,6 +466,7 @@ targetArchs= buildCrossTools= buildCrossToolsScript="$sourceDir/build/scripts/build_cross_tools" buildCrossToolsJobs= +useClang=0 useGccGraphiteDefault=0 unknownArchIndex=1 haikuTargetArchs= @@ -623,6 +636,7 @@ while [ $# -gt 0 ] ; do ) haikuTargetArchs="$haikuTargetArchs $targetArch" ;; + --use-clang) useClang=1; shift 1;; --use-gcc-pipe) HAIKU_USE_GCC_PIPE=1; shift 1;; --use-gcc-graphite) useGccGraphiteDefault=1; shift 1;; --use-32bit) HAIKU_HOST_USE_32BIT=1; shift 1;; @@ -907,6 +921,7 @@ for targetArch in $HAIKU_PACKAGING_ARCHS; do HAIKU_BOOT_LIBSUPC++ HAIKU_BOOT_LIBSUPCXX HAIKU_AR HAIKU_AR HAIKU_CC HAIKU_CC + HAIKU_CC_IS_CLANG HAIKU_CC_IS_CLANG HAIKU_LD HAIKU_LD HAIKU_OBJCOPY HAIKU_OBJCOPY HAIKU_RANLIB HAIKU_RANLIB