diff --git a/src/engine/build.sh b/src/engine/build.sh index 7cd0cdbd25..9ae0359ad7 100755 --- a/src/engine/build.sh +++ b/src/engine/build.sh @@ -161,6 +161,8 @@ check_toolset () if test_toolset gcc && test_compiler g++$TOOLSET_SUFFIX -x c++ -std=c++11 -D_GNU_SOURCE ; then B2_TOOLSET=gcc$TOOLSET_SUFFIX ; return ${TRUE} ; fi # GCC (gcc) with -pthread arg (for AIX).. if test_toolset gcc && test_compiler g++$TOOLSET_SUFFIX -x c++ -std=c++11 -pthread ; then B2_TOOLSET=gcc$TOOLSET_SUFFIX ; return ${TRUE} ; fi + # Clang (clang) on FreeBSD needs -pthread arg.. + if test_toolset clang && test_uname FreeBSD && test_compiler clang++$TOOLSET_SUFFIX -x c++ -std=c++11 -pthread ; then B2_TOOLSET=clang$TOOLSET_SUFFIX ; return ${TRUE} ; fi # Clang (clang).. if test_toolset clang && test_compiler clang++$TOOLSET_SUFFIX -x c++ -std=c++11 ; then B2_TOOLSET=clang$TOOLSET_SUFFIX ; return ${TRUE} ; fi # Intel macOS (intel-darwin) diff --git a/src/engine/check_cxx11.cpp b/src/engine/check_cxx11.cpp index f413d03875..0946a45002 100644 --- a/src/engine/check_cxx11.cpp +++ b/src/engine/check_cxx11.cpp @@ -1,6 +1,7 @@ -/* Copyright 2020 Rene Rivera +/* Copyright 2020-2023 Rene Rivera * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt) + * (See accompanying file LICENSE.txt or + * https://www.bfgroup.xyz/b2/LICENSE.txt) */ /* @@ -11,23 +12,36 @@ compiler to build the engine with. */ // Some headers we test... -#include #include +#include +#include // Some basic constexpr support? -template struct X { static constexpr int c = C; }; +template +struct X +{ + static constexpr int c = C; +}; int main() { - // Check for basic thread calls. - // [2020-08-19] Mingw-w64 with win32 threading model (as opposed to posix - // threading model) does not really have std::thread etc. Please see comments - // in sysinfo.cpp. - #ifndef _WIN32 - { auto _ = std::thread::hardware_concurrency(); } - #endif +#ifndef _WIN32 + // Check for basic thread calls. + // [2020-08-19] Mingw-w64 with win32 threading model (as opposed to posix + // threading model) does not really have std::thread etc. Please see + // comments in sysinfo.cpp. + { + auto _ = std::thread::hardware_concurrency(); + } + { + std::mutex m; + std::lock_guard l(m); + } +#endif - // [2021-08-07] We check the following C++11 features: brace initialization, - // unique_ptr. Plus the author's ability to memorize some digits. - { const std::unique_ptr pf {new float {3.14159f}}; } + // [2021-08-07] We check the following C++11 features: brace initialization, + // unique_ptr. Plus the author's ability to memorize some digits. + { + const std::unique_ptr pf { new float { 3.14159f } }; + } }