Skip to content

Commit c0874b6

Browse files
committed
mingw: allow users to override pthread lib name with PTW32_LIB_NAME
1 parent 1eb8efb commit c0874b6

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

build/Jamfile.v2

+25-11
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
# You need to provide the include path and lib path in the variables
1717
# PTW32_INCLUDE and PTW32_LIB respectively. You can specify these
1818
# paths in site-config.jam, user-config.jam or in the environment.
19+
# Additionally, you can provide PTW32_LIB_NAME to overwrite the name hardcoded
20+
# by Boost.Thread.
1921
# A new feature is provided to request a specific API:
2022
# <threadapi>win32 and <threadapi>pthread.
2123
#
@@ -165,12 +167,16 @@ rule win32_pthread_paths ( properties * )
165167
local result ;
166168
local PTW32_INCLUDE ;
167169
local PTW32_LIB ;
168-
PTW32_INCLUDE = [ modules.peek : PTW32_INCLUDE ] ;
169-
PTW32_LIB = [ modules.peek : PTW32_LIB ] ;
170-
PTW32_INCLUDE ?= [ modules.peek user-config : PTW32_INCLUDE ] ;
171-
PTW32_LIB ?= [ modules.peek user-config : PTW32_LIB ] ;
172-
PTW32_INCLUDE ?= [ modules.peek site-config : PTW32_INCLUDE ] ;
173-
PTW32_LIB ?= [ modules.peek site-config : PTW32_LIB ] ;
170+
local PTW32_LIB_NAME ;
171+
PTW32_INCLUDE = [ modules.peek : PTW32_INCLUDE ] ;
172+
PTW32_LIB = [ modules.peek : PTW32_LIB ] ;
173+
PTW32_LIB_NAME = [ modules.peek : PTW32_LIB_NAME ] ;
174+
PTW32_INCLUDE ?= [ modules.peek user-config : PTW32_INCLUDE ] ;
175+
PTW32_LIB ?= [ modules.peek user-config : PTW32_LIB ] ;
176+
PTW32_LIB_NAME ?= [ modules.peek user-config : PTW32_LIB_NAME ] ;
177+
PTW32_INCLUDE ?= [ modules.peek site-config : PTW32_INCLUDE ] ;
178+
PTW32_LIB ?= [ modules.peek site-config : PTW32_LIB ] ;
179+
PTW32_LIB_NAME ?= [ modules.peek site-config : PTW32_LIB_NAME ] ;
174180

175181
if ! ( $(PTW32_INCLUDE) && $(PTW32_LIB) )
176182
{
@@ -192,16 +198,23 @@ rule win32_pthread_paths ( properties * )
192198
{
193199
local include_path = [ path.make $(PTW32_INCLUDE) ] ;
194200
local lib_path = [ path.make $(PTW32_LIB) ] ;
195-
local libname = pthread ;
201+
local libname = $(PTW32_LIB_NAME) ;
196202
if <toolset>msvc in $(properties)
197203
{
198-
libname = $(libname)VC2.lib ;
204+
if ! $(libname)
205+
{
206+
libname = libpthreadVC2.lib ;
207+
}
208+
lib_path = [ path.glob $(lib_path) : $(libname) ] ;
199209
}
200210
if <toolset>gcc in $(properties)
201211
{
202-
libname = lib$(libname)GC2.a ;
212+
if ! $(libname)
213+
{
214+
libname = libpthreadGC2.a ;
215+
}
216+
lib_path = [ path.glob $(lib_path) : $(libname) ] ;
203217
}
204-
lib_path = [ path.glob $(lib_path) : $(libname) ] ;
205218
if ! $(lib_path)
206219
{
207220
if ! $(.notified)
@@ -210,6 +223,7 @@ rule win32_pthread_paths ( properties * )
210223
echo "Trying to build Boost.Thread with pthread support." ;
211224
echo "But the library" $(libname) "could not be found in path" ;
212225
echo $(PTW32_LIB) ;
226+
echo "You can force the library name by setting PTW32_LIB_NAME " ;
213227
echo "************************************************************" ;
214228
.notified = true ;
215229
}
@@ -316,4 +330,4 @@ lib boost_thread
316330
<conditional>@usage-requirements
317331
;
318332

319-
boost-install boost_thread ;
333+
boost-install boost_thread ;

0 commit comments

Comments
 (0)