@@ -9,6 +9,7 @@ require-b2 5.0.1 ;
99import-search /boost/config/checks ;
1010import boost-stacktrace-features ;
1111import config : requires ;
12+ import configure ;
1213import property ;
1314
1415constant boost_dependencies_private :
@@ -63,9 +64,9 @@ explicit WinDbg ;
6364mp-run-simple has_windbg_cached.cpp : : : <library>Dbgeng <library>ole32 : WinDbgCached ;
6465explicit WinDbgCached ;
6566
66- rule build-stacktrace-feature ( name :  props * )
67+ rule build-stacktrace-noop (  props * )
6768{
68-     local enabled = [ property.select <boost.stacktrace.$(name) > : $(props) ] ;
69+     local enabled = [ property.select <boost.stacktrace.noop > : $(props) ] ;
6970    switch $(enabled:G=)
7071    {
7172        case  "on" :  return ;
@@ -79,14 +80,28 @@ lib boost_stacktrace_noop
7980  : # requirements
8081    <warnings>all
8182    <link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
82-     # Enable build when explicitly requested
83-     <conditional>@$(build-stacktrace-feature noop)
83+     <conditional>@build-stacktrace-noop
8484  : # default build
8585  : # usage-requirements
8686    #<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
8787    <define>BOOST_STACKTRACE_NO_LIB=1
8888  ;
8989
90+ rule build-stacktrace-backtrace ( props * )
91+ {
92+     local enabled = [ property.select <boost.stacktrace.backtrace> : $(props) ] ;
93+     switch $(enabled:G=)
94+     {
95+         case  "on" :  return ;
96+         case "off" :  return <build>no ;
97+     }
98+ 
99+     if ! [ configure.builds libbacktrace : $(props) : "boost.stacktrace.backtrace" ]
100+     {
101+         return <build>no ;
102+     }
103+ }
104+ 
90105lib boost_stacktrace_backtrace
91106  : # sources
92107    ../src/backtrace.cpp
@@ -95,8 +110,7 @@ lib boost_stacktrace_backtrace
95110    <target-os>linux:<library>dl
96111    <library>backtrace
97112    <link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
98-     [ check-target-builds libbacktrace : : <build>no ]
99-     <conditional>@$(build-stacktrace-feature backtrace)
113+     <conditional>@build-stacktrace-backtrace
100114  : # default build
101115  : # usage-requirements
102116    #<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
@@ -114,6 +128,12 @@ rule build-stacktrace-addr2line ( props * )
114128
115129    # Disable by default on Windows when not using Cygwin
116130    if <target-os>windows in $(props) && ! ( <target-os>cygwin in $(props) )
131+     {
132+         configure.log-library-search-result "boost.stacktrace.addr2line" : "no" ;
133+         return <build>no ;
134+     }
135+ 
136+     if ! [ configure.builds addr2line : $(props) : "boost.stacktrace.addr2line" ]
117137    {
118138        return <build>no ;
119139    }
@@ -126,53 +146,94 @@ lib boost_stacktrace_addr2line
126146    <warnings>all
127147    <target-os>linux:<library>dl
128148    <link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
129-     [ check-target-builds addr2line : : <build>no ]
130149    <conditional>@build-stacktrace-addr2line
131150  : # default build
132151  : # usage-requirements
133152    #<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
134153    <define>BOOST_STACKTRACE_NO_LIB=1
135154  ;
136155
156+ rule build-stacktrace-basic ( props * )
157+ {
158+     local enabled = [ property.select <boost.stacktrace.basic> : $(props) ] ;
159+     switch $(enabled:G=)
160+     {
161+         case  "on" :  return ;
162+         case "off" :  return <build>no ;
163+     }
164+ 
165+     if [ configure.builds WinDbg : $(props) : "boost.stacktrace.basic" ]
166+     {
167+         return <build>no ;
168+     }
169+ }
170+ 
137171lib boost_stacktrace_basic
138172  : # sources
139173    ../src/basic.cpp
140174  : # requirements
141175    <warnings>all
142176    <target-os>linux:<library>dl
143177    <link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
144-     [ check-target-builds WinDbg : <build>no ]
145-     <conditional>@$(build-stacktrace-feature basic)
178+     <conditional>@build-stacktrace-basic
146179  : # default build
147180  : # usage-requirements
148181    #<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
149182    <define>BOOST_STACKTRACE_NO_LIB=1
150183  ;
151184
185+ rule build-stacktrace-windbg ( props * )
186+ {
187+     local enabled = [ property.select <boost.stacktrace.windbg> : $(props) ] ;
188+     switch $(enabled:G=)
189+     {
190+         case  "on" :  return ;
191+         case "off" :  return <build>no ;
192+     }
193+ 
194+     if ! [ configure.builds WinDbg : $(props) : "boost.stacktrace.windbg" ]
195+     {
196+         return <build>no ;
197+     }
198+ }
199+ 
152200lib boost_stacktrace_windbg
153201  : # sources
154202    ../src/windbg.cpp
155203  : # requirements
156204    <warnings>all
157205    <library>Dbgeng <library>ole32
158206    <link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
159-     [ check-target-builds WinDbg : : <build>no ]
160-     <conditional>@$(build-stacktrace-feature windbg)
207+     <conditional>@build-stacktrace-windbg
161208  : # default build
162209  : # usage-requirements
163210    #<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
164211    <define>BOOST_STACKTRACE_NO_LIB=1
165212  ;
166213
214+ rule build-stacktrace-windbg-cached ( props * )
215+ {
216+     local enabled = [ property.select <boost.stacktrace.windbg_cached> : $(props) ] ;
217+     switch $(enabled:G=)
218+     {
219+         case  "on" :  return ;
220+         case "off" :  return <build>no ;
221+     }
222+ 
223+     if ! [ configure.builds WinDbgCached : $(props) : "boost.stacktrace.windbg_cached" ]
224+     {
225+         return <build>no ;
226+     }
227+ }
228+ 
167229lib boost_stacktrace_windbg_cached
168230  : # sources
169231    ../src/windbg_cached.cpp
170232  : # requirements
171233    <warnings>all
172234    <library>Dbgeng <library>ole32
173235    <link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
174-     [ check-target-builds WinDbgCached : : <build>no ]
175-     <conditional>@$(build-stacktrace-feature windbg-cached)
236+     <conditional>@build-stacktrace-windbg-cached
176237  : # default build
177238  : # usage-requirements
178239    #<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
@@ -191,8 +252,10 @@ rule build-stacktrace-from-exception ( props * )
191252    local arch = [ property.select <architecture> : $(props) ] ;
192253    if $(arch) && ( $(arch:G=) != x86 )
193254    {
255+         configure.log-library-search-result "boost.stacktrace.from_exception" : "no" ;
194256        return <build>no ;
195257    }
258+     configure.log-library-search-result "boost.stacktrace.from_exception" : "yes" ;
196259}
197260
198261lib boost_stacktrace_from_exception
@@ -204,9 +267,6 @@ lib boost_stacktrace_from_exception
204267
205268    # Enable build when explicitly requested, or by default, when on x86
206269    <conditional>@build-stacktrace-from-exception
207- 
208-     # Require usable libbacktrace on other platforms
209-     # [ check-target-builds libbacktrace : : <build>no ]
210270  : # default build
211271  : # usage-requirements
212272    #<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
0 commit comments