Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-05-31 01:02:59


Hi Michael,

> To give you an idea I have listed all the relevent OS detections using at
> present:
>
> borland.jam
> if [ os.name ] = CYGWIN
> if [ os.name ] = NT
> gcc.jam
> if [ os.name ] = NT
> if [ os.on-windows ]
> if [ modules.peek : UNIX ]
> intel.jam
> if [ os.name ] = LINUX
> msvc.jam
> if [ os.name ] in CYGWIN
> testing.jam
> if [ os.name ] = NT
> buitin.jam
> local os = [ modules.peek : OS ] ;
> common.jam
> if [ os.name ] = NT
> if [ modules.peek : NT ]
> symlink.jam
> if [ modules.peek : UNIX ] { os = UNIX ; }
> else { os ?= [ os.name ] ; }
>
> name = [ modules.peek : OS ] ;
> platform = [ modules.peek : OSPLAT ] ;
> version = [ modules.peek : OSVER ] ;
> rule on-windows
> {
> .... code base on NT UNIX and JAMUNAME
> }

Ouch! At least "modules.peek" usage is messy.

> >From this the following points seem to be important.
>
> a) The tool specific files generally use use os.name. The exception is
> gcc.jam which uses both "on-windows" and the builtin "UNIX"

I think at least it's desired to kill module.peek used to check for UNIX.

> b) CYGWIN detection is inconsistent. The tools use os.name=CYGWIN.
> os.jam defines an entirely different mechanism base on JAMUNAME!

I agree that we need some single mechanism, but I'm not sure which one is
correct.

> c) builtin.jam should probably import and use "os.name"

Definitely.

> d) common.jam could use "os.name" consitently

Definitely.

> e) I don't understand symlink.jam at all!

I think I can explain. Most modules, when actions differ from OS to OS, do
this:

if [ os.name ] = NT
{
actions bake-toasts { }
}
else
{
actions bake-toasts { }
}

but symlink.jam does this

local os = ....
link-os .... ;

actions link-UNIX { }
actions link-NT { }

I think that for consistency we'd better use the first method everything,
including symlink.jam

> It would seem correct to localise all the detection code in os.jam. This
> would prevent inconsistencies spreading throughout the code. It may even be
> worth clearing the remaining Platform Identifier Variables
> (MAC,NT,OS2,UNIX,VMS) so dependency on them does not spread.

I agree with the above. We might want rules like:

os.on-nt
os.on-unix
os.on-mac

and so on.

> Does anyone know the correct way to detect for CYGWIN?

I hope somebody else will comment ...

- Volodya

 


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