From 84162fb87c4fa7a129de6dd306aa223d0ef8b142 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Tue, 15 Aug 2006 18:46:13 +0000 Subject: [PATCH] Add host-os and target-os features. [SVN r34889] --- src/tools/builtin.jam | 51 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/src/tools/builtin.jam b/src/tools/builtin.jam index 4e1bba72e..74e81e5d7 100644 --- a/src/tools/builtin.jam +++ b/src/tools/builtin.jam @@ -25,9 +25,60 @@ import project ; # This feature is used to determine which OS we're on. # In future, this may become and +# The future is now... local os = [ modules.peek : OS ] ; feature os : $(os) : propagated link-incompatible ; +# Translates from bjam current OS to the os tags used +# in host-os and target-os. I.e. it returns the +# running host-os. +local rule default-host-os ( ) +{ + local host-os ; + local os-list = [ feature.values host-os ] ; + if [ os.name ] in $(os-list:U) + { + host-os = [ os.name ] ; + } + else + { + switch [ os.name ] + { + case NT : host-os = windows ; + case AS400 : host-os = unix ; + case MINGW : host-os = windows ; + case BSDI : host-os = bsd ; + case COHERENT : host-os = unix ; + case DRAGONFLYBSD : host-os = bsd ; + case IRIX : host-os = sgi ; + case MACOSX : host-os = darwin ; + case KFREEBSD : host-os = freebsd ; + case * : host-os = unix ; + } + } + return $(host-os:L) ; +} + +# The two OS features define a known set of abstract OS +# names. The host-os is the OS under which bjam is running. +# Even though this should really be a fixed property we need +# to list all the values to prevent unkown value errors. +# Both set the default value to the current OS to account for +# the default use case of building on the target OS. +feature host-os + : amiga aix bsd cygwin darwin dos emx freebsd hpux + linux netbsd openbsd osf qnx qnxnto sgi solaris sun sunos + svr4 sysv ultrix unixware vms windows + : optional ; + feature.set-default host-os : [ default-host-os ] ; +feature target-os + : amiga aix bsd cygwin darwin dos emx freebsd hpux + linux netbsd openbsd osf qnx qnxnto sgi solaris sun sunos + svr4 sysv ultrix unixware vms windows + : propagated link-incompatible ; + feature.set-default target-os : [ default-host-os ] ; + + feature toolset : : implicit propagated symmetric ; feature stdlib : native : propagated composite ;