#  (C) Copyright William E. Kempf 2001. Permission to copy, use, modify, sell and
#  distribute this software is granted provided this copyright notice appears
#  in all copies. This software is provided "as is" without express or implied
#  warranty, and with no claim as to its suitability for any purpose.
#
# Boost.Threads build Jamfile
#
# Declares the following targets:
#   1. libboost_thread, a static link library.
#      1a. On Win32 (when PTW32 is not defined), a dynamic link library
#          boost_threadmon, which must be used in conjunction with
#          libboost_thread. Note that this DLL *must* be used through static
#          linking to the import library.  Dynamic loading will cause undefined
#          behavior.
# Additional configuration variables used:
#   1. PTW32 may be used on Win32 platforms to specify that the pthreads-win32
#      library should be used instead of "native" threads. This feature is
#      mostly used for testing and it's generally recommended you use the
#      native threading libraries instead. PTW32 should be set to be a list
#      of two strings, the first specifying the installation path of the
#      pthreads-win32 library and the second specifying which library
#      variant to link against (see the pthreads-win32 documentation).
#      Example: jam -sPTW32="c:\pthreads-win32 pthreadVCE.lib"

# Declare the location of this subproject relative to the root.
subproject libs/thread/build ;

# Include threads.jam for Boost.Threads global build information.
# This greatly simplifies the Jam code needed to configure the build
# for the various Win32 build types.
SEARCH on <module@>threads.jam = $(SUBDIR) ;
include <module@>threads.jam ;

template thread_libs
    ## sources ##
    : <template>thread_base
    ## requirements ##
    :
    ## default build ##
    : debug release <runtime-link>static/dynamic
;

#######################
# Conditionally declare the Boost.Threads dynamic link library boost_threadmon.

if $(NT) && ! $(PTW32)
{
    dll boost_threadmon : <template>thread_libs ../src/threadmon.cpp ;
}

#######################
# Declare the Boost.Threads static link library libboost_thread.

# Base names of the source files for libboost_thread.
CPP_SOURCES = condition mutex recursive_mutex thread tss xtime once exceptions ;

lib boost_thread : <template>thread_libs ../src/$(CPP_SOURCES).cpp ;

#######################
# Stage the generated targets.

#stage bin-stage
#    : <lib>boost_thread $(threadmon)
#    : <tag><runtime-link-static>"s"
#      <tag><debug>"d"
#    : debug release <runtime-link>static/dynamic
#;
