-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conditionally link with Boost.Regex library, if it's in C++03 mode.
Boost.Log supports compilers that do not qualify as C++11 compilers for Boost.Regex, even if they are compiling in C++11 mode. In that case, we still need to link with Boost.Regex v4 prebuilt library. For more recent compilers, Boost.Regex v5 is used, and that is a header-only library. This commit removes linking with Boost.Regex when this is detected at configure time. Note that only Boost.Build is updated. CMake doesn't need to be updated since even header-only libraries need to be listed as dependencies. Closes #219.
- Loading branch information
Showing
5 changed files
with
170 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
# log-build-config.jam | ||
# | ||
# Copyright 2023 Andrey Semashev | ||
# | ||
# Distributed under the Boost Software License Version 1.0. (See | ||
# accompanying file LICENSE_1_0.txt or copy at | ||
# http://www.boost.org/LICENSE_1_0.txt) | ||
|
||
import configure ; | ||
import project ; | ||
import path ; | ||
import property ; | ||
import feature ; | ||
|
||
local here = [ modules.binding $(__name__) ] ; | ||
|
||
project.push-current [ project.current ] ; | ||
project.load [ path.join [ path.make $(here:D) ] ../config/message-compiler ] ; | ||
project.load [ path.join [ path.make $(here:D) ] ../config/pthread-mutex-robust ] ; | ||
project.load [ path.join [ path.make $(here:D) ] ../config/native-syslog ] ; | ||
project.load [ path.join [ path.make $(here:D) ] ../config/atomic-int32 ] ; | ||
project.load [ path.join [ path.make $(here:D) ] ../config/regex-header-only ] ; | ||
project.pop-current ; | ||
|
||
rule has-config-flag ( flag : properties * ) | ||
{ | ||
if ( "<define>$(flag)" in $(properties) || "<define>$(flag)=1" in $(properties) ) | ||
{ | ||
return 1 ; | ||
} | ||
else | ||
{ | ||
return ; | ||
} | ||
} | ||
|
||
rule check-regex-header-only ( properties * ) | ||
{ | ||
local result ; | ||
|
||
local has_regex_header_only = [ configure.builds /boost/log/regex-header-only//regex_header_only : $(properties) : "Boost.Regex is header-only" ] ; | ||
if ! $(has_regex_header_only) | ||
{ | ||
result = <library>/boost/regex//boost_regex ; | ||
} | ||
|
||
return $(result) ; | ||
} | ||
|
||
rule check-atomic-int32 ( properties * ) | ||
{ | ||
local result ; | ||
|
||
local has_atomic_int32 = [ configure.builds /boost/log/atomic-int32//atomic_int32 : $(properties) : "native atomic int32 supported" ] ; | ||
if ! $(has_atomic_int32) | ||
{ | ||
result = <define>BOOST_LOG_WITHOUT_IPC ; | ||
} | ||
|
||
return $(result) ; | ||
} | ||
|
||
rule check-pthread-mutex-robust ( properties * ) | ||
{ | ||
local result ; | ||
|
||
local has_pthread_mutex_robust = [ configure.builds /boost/log/pthread-mutex-robust//pthread_mutex_robust : $(properties) : "pthread supports robust mutexes" ] ; | ||
if $(has_pthread_mutex_robust) | ||
{ | ||
result = <define>BOOST_LOG_HAS_PTHREAD_MUTEX_ROBUST ; | ||
} | ||
|
||
return $(result) ; | ||
} | ||
|
||
rule check-native-syslog ( properties * ) | ||
{ | ||
local result ; | ||
|
||
if ! [ has-config-flag BOOST_LOG_WITHOUT_SYSLOG : $(properties) ] | ||
{ | ||
local has_native_syslog = [ configure.builds /boost/log/native-syslog//native_syslog : $(properties) : "native syslog supported" ] ; | ||
if $(has_native_syslog) | ||
{ | ||
result = <define>BOOST_LOG_USE_NATIVE_SYSLOG ; | ||
} | ||
} | ||
|
||
return $(result) ; | ||
} | ||
|
||
rule check-message-compiler ( properties * ) | ||
{ | ||
local result ; | ||
|
||
if <target-os>windows in $(properties) | ||
{ | ||
if ! [ has-config-flag BOOST_LOG_WITHOUT_EVENT_LOG : $(properties) ] | ||
{ | ||
local has_mc = [ configure.builds /boost/log/message-compiler//test-availability : $(properties) : "has message compiler" ] ; | ||
if ! $(has_mc) | ||
{ | ||
result = <define>BOOST_LOG_WITHOUT_EVENT_LOG ; | ||
} | ||
} | ||
else | ||
{ | ||
# This branch is needed to fix building with MinGW | ||
result = <define>BOOST_LOG_WITHOUT_EVENT_LOG ; | ||
} | ||
} | ||
else | ||
{ | ||
result = <define>BOOST_LOG_WITHOUT_EVENT_LOG ; | ||
} | ||
|
||
return $(result) ; | ||
} | ||
|
||
rule select-regex-backend ( properties * ) | ||
{ | ||
local result ; | ||
|
||
# Use Boost.Regex backend by default. It produces smaller executables and also has the best performance for small string matching. | ||
if ! ( | ||
[ log-build-config.has-config-flag BOOST_LOG_WITHOUT_SETTINGS_PARSERS : $(properties) ] || | ||
[ log-build-config.has-config-flag BOOST_LOG_WITHOUT_DEFAULT_FACTORIES : $(properties) ] || | ||
[ log-build-config.has-config-flag BOOST_LOG_USE_STD_REGEX : $(properties) ] || | ||
[ log-build-config.has-config-flag BOOST_LOG_USE_BOOST_XPRESSIVE : $(properties) ] ) | ||
{ | ||
result = <conditional>@log-build-config.check-regex-header-only ; | ||
} | ||
|
||
return $(result) ; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters