From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-07-02 01:51:47
Mark Elston wrote:
> Let me try this again.
Oh, I'm sorry for missing your previous email. Was rather busy yesterday :-(
> I have been trying to diagnose this by tracking down where these
> values are set into the feature. The only place I can find is these
> lines from builtin.jam:
> local os = [ modules.peek : OS ] ;
> feature os : $(os) : propagated link-incompatible ;
> I can see from this why NT is the only allowed value and I get the
> error I show below. However, I cannot see why the same Jamfile works
> on Linux since it contains the <os>NT:... conditional property. It
> looks like <os> is not a free feature but *may* only have the value
> of the current OS.
Yes, that's the case.
> I also have not been able to track down what happens in the first
> line above. The peek rule from modules.jam is:
> rule peek ( module-name ? : variables + )
> module $(<)
> return $($(>)) ;
This code returns the value that 'variables' have in 'module-name'. The
[ modules.peek : OS ]
passes the empty module name, so values from the global module are returned.
> >From the assignment to the 'os' variable above it looks like the peek
> is looking at the global OS variable, i.e. in no particular module.
> Is that right? Where is this variable set? I have not been able to find
> it in the jam files or in the jam_src directory.
I believe it's set somewhere in jam_src: specifically in jam.h. For example,
setting for NT is a line 93.
> So I guess I have two questions:
> 1. Can I legitimately use conditional properties based on the <os> feature
> in my Jamfiles?
I think we need a small tweak here. The <toolset> feature can be used in
condition without declaraing all the toolsets. I'll just disable validation
for <os> as well, just like it's done for <toolset>. It's
'property.expand-subfeatures-in-conditions', if you're interested.
And just to clarify the history. First we did not validate conditions at all,
so <os>FOOBAR:<variant>release was OK even if FOOBAR was never known. Due to
some other improvement in conditinal properties handling, we started
validating conditions. This even caught some typos!
But unfortunately, this problem <toolset>borland:<cxxflags>fooo -- it was now
required that you have "using borland". So I've made <toolset> special --
it's not validated when in condtion. I've just made <os> similiarly special.
If you have build/property.jam revision 1.48, it should work.
> 2. Just out of curiosity, what is the OS variable and how is it set?
It's Jam variable which describes the platform Jam was built for. It's defined
in "jam.h" and set in jam.c, line 359. Look for
var_defines( othersyms );
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk