diff --git a/boostcpp.jam b/boostcpp.jam index e2d04cc188..f45d12ef2f 100644 --- a/boostcpp.jam +++ b/boostcpp.jam @@ -22,6 +22,7 @@ import project ; import regex ; import set ; import targets ; +import feature ; import property ; ############################################################################## @@ -595,24 +596,45 @@ rule declare-targets ( all-libraries * : headers * ) declare_top_level_targets $(libraries) : $(headers) ; } +# Returns the properties identifying the toolset. We'll use them +# below to configure checks. These are essentially same as in +# configure.builds, except we don't use address-model and +# architecture - as we're trying to detect them here. +# +rule toolset-properties ( properties * ) +{ + local toolset = [ property.select : $(properties) ] ; + local toolset-version-property = "" ; + return [ property.select $(toolset-version-property) : $(properties) ] ; +} + +feature.feature deduced-address-model : 32 64 : propagated optional composite hidden ; +feature.compose 32 : 32 ; +feature.compose 64 : 64 ; + rule deduce-address-model ( properties * ) { - local result = [ property.select : $(properties) ] ; + local result ; + local filtered = [ toolset-properties $(properties) ] ; + + if [ configure.builds /boost/architecture//32 : $(filtered) : 32-bit ] + { + result = 32 ; + } + else if [ configure.builds /boost/architecture//64 : $(filtered) : 64-bit ] + { + result = 64 ; + } + if $(result) { - return $(result) ; - } - else - { - if [ configure.builds /boost/architecture//32 : $(properties) : 32-bit ] - { - return 32 ; - } - else if [ configure.builds /boost/architecture//64 : $(properties) : 64-bit ] - { - return 64 ; - } + # Normally, returning composite feature here is equivalent to forcing + # consituent properties as well. But we only want to indicate toolset + # deduced default, so also pick whatever address-model is explicitly + # specified, if any. + result = $(result) [ property.select : $(properties) ] ; } + return $(result) ; } rule address-model ( ) @@ -620,40 +642,48 @@ rule address-model ( ) return @boostcpp.deduce-address-model ; } +local deducable-architectures = arm mips1 power sparc x86 combined ; +feature.feature deduced-architecture : $(deducable-architectures) : propagated optional composite hidden ; +for a in $(deducable-architectures) +{ + feature.compose $(a) : $(a) ; +} + rule deduce-architecture ( properties * ) { - local result = [ property.select : $(properties) ] ; + local result ; + local filtered = [ toolset-properties $(properties) ] ; + if [ configure.builds /boost/architecture//arm : $(filtered) : arm ] + { + result = arm ; + } + else if [ configure.builds /boost/architecture//mips1 : $(filtered) : mips1 ] + { + result = mips1 ; + } + else if [ configure.builds /boost/architecture//power : $(filtered) : power ] + { + result = power ; + } + else if [ configure.builds /boost/architecture//sparc : $(filtered) : sparc ] + { + result = sparc ; + } + else if [ configure.builds /boost/architecture//x86 : $(filtered) : x86 ] + { + result = x86 ; + } + else if [ configure.builds /boost/architecture//combined : $(filtered) : combined ] + { + result = combined ; + } + if $(result) { - return $(result) ; - } - else - { - if [ configure.builds /boost/architecture//arm : $(properties) : arm ] - { - return arm ; - } - else if [ configure.builds /boost/architecture//mips1 : $(properties) : mips1 ] - { - return mips1 ; - } - else if [ configure.builds /boost/architecture//power : $(properties) : power ] - { - return power ; - } - else if [ configure.builds /boost/architecture//sparc : $(properties) : sparc ] - { - return sparc ; - } - else if [ configure.builds /boost/architecture//x86 : $(properties) : x86 ] - { - return x86 ; - } - else if [ configure.builds /boost/architecture//combined : $(properties) : combined ] - { - return combined ; - } + # See comment in deduce-address-model. + result = $(result) [ property.select : $(properties) ] ; } + return $(result) ; } rule architecture ( )