From ff3dcfb6feb17fcaad7faef12940b0837f89567f Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Tue, 24 Oct 2006 23:46:48 +0000 Subject: [PATCH] (merge from head) Add detection of gcc compiler flavor so that we can correctly tag generated libraries to not conflict with each other. [SVN r35734] --- v2/tools/gcc.jam | 47 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/v2/tools/gcc.jam b/v2/tools/gcc.jam index f72b33723..779a8eeec 100644 --- a/v2/tools/gcc.jam +++ b/v2/tools/gcc.jam @@ -20,6 +20,7 @@ import common ; import errors ; import property-set ; import pch ; +import regex ; if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] { @@ -56,10 +57,45 @@ import rc ; # using gcc : 3.4 : : foo bar sun ; rule init ( version ? : command * : options * ) { - local condition = [ common.check-init-parameters gcc : version $(version) ] ; - + # Information about the gcc command... + # The command. local command = [ common.get-invocation-command gcc : g++ : $(command) ] ; + # The root directory of the tool install. + local root = [ feature.get-values : $(options) ] ; + # The bin directory where to find the command to execute. + local bin ; + # The flavor of compiler. + local flavor = [ feature.get-values : $(options) ] ; + # AUtodetect the root and bin dir if not given. + if $(command) + { + bin ?= [ common.get-absolute-tool-path $(command[-1]) ] ; + root ?= $(bin:D) ; + } + # Autodetect the version and flavor if not given. + if $(bin) + { + local command-info = [ MATCH "^[^ ]+[ ]+[^ ]+[ ]+([^ ]+)[^(]*[(]?([^)]*)" + : [ SHELL "$(bin)/gcc --version" ] ] ; + version ?= $(command-info[1]) ; + flavor ?= [ regex.replace $(command-info[2]:L) "[ .-:]" "_" ] ; + } + local condition ; + if $(flavor) + { + condition = [ common.check-init-parameters gcc + : version $(version) + : flavor $(flavor) + ] ; + } + else + { + condition = [ common.check-init-parameters gcc + : version $(version) + ] ; + } + common.handle-options gcc : $(condition) : $(command) : $(options) ; local linker = [ feature.get-values : $(options) ] ; @@ -76,13 +112,6 @@ rule init ( version ? : command * : options * ) } init-link-flags gcc $(linker) $(condition) ; - local root = [ feature.get-values : $(options) ] ; - local bin ; - if $(command) - { - bin ?= [ common.get-absolute-tool-path $(command[-1]) ] ; - root ?= $(bin:D) ; - } # If gcc is installed in non-standard location, we'd need to # add LD_LIBRARY_PATH when running programs created with it