4e267a7d3d
log4cxx needs boost or C++17 since bump to version 0.12.0 in commit83a0e8dea2
(see2ab3b78b9a
): In file included from /home/buildroot/autobuild/instance-3/output-1/build/log4cxx-0.12.0/src/main/cpp/action.cpp:18:0: /home/buildroot/autobuild/instance-3/output-1/build/log4cxx-0.12.0/src/main/include/log4cxx/rolling/action.h:51:8: error: 'mutex' in namespace 'std' does not name a type std::mutex mutex; ^ Fixes: - http://autobuild.buildroot.org/results/71e/71eb8c4f69a2505242b3224bd79f4a96eb3b68a4/build-end.log Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
190 lines
7.0 KiB
Diff
190 lines
7.0 KiB
Diff
From 249dd85494a430d95fd69d89f42b02fd950cda51 Mon Sep 17 00:00:00 2001
|
|
From: Robert Middleton <rm5248@users.noreply.github.com>
|
|
Date: Thu, 22 Jul 2021 15:27:50 -0700
|
|
Subject: [PATCH] LOGCXX-528 (#66)
|
|
|
|
Fixes for checking that C++11 is available. Fix for older compilers.
|
|
|
|
[Retrieved from:
|
|
https://github.com/apache/logging-log4cxx/commit/249dd85494a430d95fd69d89f42b02fd950cda51]
|
|
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
|
---
|
|
CMakeLists.txt | 10 +++++++++
|
|
src/cmake/boost-fallback/boost-fallback.cmake | 21 ++++++++++---------
|
|
src/main/cpp/hierarchy.cpp | 4 ++--
|
|
src/main/include/CMakeLists.txt | 2 +-
|
|
.../log4cxx/helpers/appenderattachableimpl.h | 1 +
|
|
.../include/log4cxx/helpers/aprinitializer.h | 1 +
|
|
src/main/include/log4cxx/helpers/loglog.h | 1 +
|
|
.../include/log4cxx/helpers/serversocket.h | 1 +
|
|
src/main/include/log4cxx/level.h | 1 +
|
|
src/main/include/log4cxx/rolling/action.h | 1 +
|
|
10 files changed, 30 insertions(+), 13 deletions(-)
|
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index e5b44ef1a..9c6e63902 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -41,6 +41,9 @@ if( NOT "${CMAKE_CXX_STANDARD}")
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
endif()
|
|
|
|
+# Don't allow for compiler-specific extensions
|
|
+set(CMAKE_CXX_EXTENSIONS OFF)
|
|
+
|
|
# Building
|
|
add_subdirectory(src)
|
|
|
|
@@ -185,6 +188,13 @@ if(APACHE_MAINTAINER)
|
|
)
|
|
endif()
|
|
|
|
+#
|
|
+# Check for any fatal configuration errors
|
|
+#
|
|
+if( "${SHARED_MUTEX_IMPL}" STREQUAL "NONE" )
|
|
+ message( FATAL_ERROR "No shared_mutex implementation found. Requires Boost or C++17" )
|
|
+endif()
|
|
+
|
|
#
|
|
# Output configuration information
|
|
# Similar to APR CMake configuration
|
|
diff --git a/src/cmake/boost-fallback/boost-fallback.cmake b/src/cmake/boost-fallback/boost-fallback.cmake
|
|
index a8d7d441b..8285b0b99 100644
|
|
--- a/src/cmake/boost-fallback/boost-fallback.cmake
|
|
+++ b/src/cmake/boost-fallback/boost-fallback.cmake
|
|
@@ -56,16 +56,17 @@ try_compile(STD_ATOMIC_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tests"
|
|
"${CMAKE_CURRENT_LIST_DIR}/test-stdatomic.cpp")
|
|
|
|
find_package(Boost COMPONENTS thread)
|
|
-try_compile(Boost_SHARED_PTR_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tests"
|
|
- "${CMAKE_CURRENT_LIST_DIR}/test-boostsharedptr.cpp")
|
|
-try_compile(Boost_MUTEX_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tests"
|
|
- "${CMAKE_CURRENT_LIST_DIR}/test-boostmutex.cpp")
|
|
-try_compile(Boost_SHARED_MUTEX_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tests"
|
|
- "${CMAKE_CURRENT_LIST_DIR}/test-boostsharedmutex.cpp"
|
|
- LINK_LIBRARIES Threads::Threads
|
|
-)
|
|
-try_compile(Boost_ATOMIC_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tests"
|
|
- "${CMAKE_CURRENT_LIST_DIR}/test-boostatomic.cpp")
|
|
+if( ${Boost_FOUND} )
|
|
+ try_compile(Boost_SHARED_PTR_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tests"
|
|
+ "${CMAKE_CURRENT_LIST_DIR}/test-boostsharedptr.cpp")
|
|
+ try_compile(Boost_MUTEX_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tests"
|
|
+ "${CMAKE_CURRENT_LIST_DIR}/test-boostmutex.cpp")
|
|
+ try_compile(Boost_SHARED_MUTEX_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tests"
|
|
+ "${CMAKE_CURRENT_LIST_DIR}/test-boostsharedmutex.cpp"
|
|
+ LINK_LIBRARIES Threads::Threads Boost::thread)
|
|
+ try_compile(Boost_ATOMIC_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tests"
|
|
+ "${CMAKE_CURRENT_LIST_DIR}/test-boostatomic.cpp")
|
|
+endif( ${Boost_FOUND} )
|
|
|
|
# Link the target with the appropriate boost libraries(if required)
|
|
function(boostfallback_link target)
|
|
diff --git a/src/main/cpp/hierarchy.cpp b/src/main/cpp/hierarchy.cpp
|
|
index 4f5174448..c70d39dbb 100644
|
|
--- a/src/main/cpp/hierarchy.cpp
|
|
+++ b/src/main/cpp/hierarchy.cpp
|
|
@@ -223,7 +223,7 @@ LoggerPtr Hierarchy::getLogger(const LogString& name,
|
|
else
|
|
{
|
|
LoggerPtr logger(factory->makeNewLoggerInstance(pool, name));
|
|
- logger->setHierarchy(weak_from_this());
|
|
+ logger->setHierarchy(shared_from_this());
|
|
loggers->insert(LoggerMap::value_type(name, logger));
|
|
|
|
ProvisionNodeMap::iterator it2 = provisionNodes->find(name);
|
|
@@ -423,6 +423,6 @@ void Hierarchy::configureRoot(){
|
|
// LOGCXX-322 we need to turn the repositroy into a weak_ptr, and we
|
|
// can't use weak_from_this() in the constructor.
|
|
if( !root->getLoggerRepository().lock() ){
|
|
- root->setHierarchy(weak_from_this());
|
|
+ root->setHierarchy(shared_from_this());
|
|
}
|
|
}
|
|
diff --git a/src/main/include/CMakeLists.txt b/src/main/include/CMakeLists.txt
|
|
index 8183660a5..584941c97 100644
|
|
--- a/src/main/include/CMakeLists.txt
|
|
+++ b/src/main/include/CMakeLists.txt
|
|
@@ -133,7 +133,7 @@ if( ${STD_SHARED_MUTEX_FOUND} )
|
|
elseif( ${Boost_SHARED_MUTEX_FOUND} )
|
|
set( SHARED_MUTEX_IMPL "boost::shared_mutex" )
|
|
else()
|
|
- set( SMART_PTR_IMPL "NONE" )
|
|
+ set( SHARED_MUTEX_IMPL "NONE" )
|
|
endif()
|
|
|
|
if( ${STD_ATOMIC_FOUND} )
|
|
diff --git a/src/main/include/log4cxx/helpers/appenderattachableimpl.h b/src/main/include/log4cxx/helpers/appenderattachableimpl.h
|
|
index 40e77d93c..b80b5aade 100644
|
|
--- a/src/main/include/log4cxx/helpers/appenderattachableimpl.h
|
|
+++ b/src/main/include/log4cxx/helpers/appenderattachableimpl.h
|
|
@@ -28,6 +28,7 @@
|
|
#include <log4cxx/helpers/object.h>
|
|
#include <log4cxx/helpers/pool.h>
|
|
#include <log4cxx/log4cxx.h>
|
|
+#include <mutex>
|
|
|
|
namespace log4cxx
|
|
{
|
|
diff --git a/src/main/include/log4cxx/helpers/aprinitializer.h b/src/main/include/log4cxx/helpers/aprinitializer.h
|
|
index 6f3f55070..fccd18e0f 100644
|
|
--- a/src/main/include/log4cxx/helpers/aprinitializer.h
|
|
+++ b/src/main/include/log4cxx/helpers/aprinitializer.h
|
|
@@ -30,6 +30,7 @@ extern "C" {
|
|
}
|
|
|
|
#include <apr_time.h>
|
|
+#include <mutex>
|
|
|
|
namespace log4cxx
|
|
{
|
|
diff --git a/src/main/include/log4cxx/helpers/loglog.h b/src/main/include/log4cxx/helpers/loglog.h
|
|
index d54785ddc..a4c92416a 100644
|
|
--- a/src/main/include/log4cxx/helpers/loglog.h
|
|
+++ b/src/main/include/log4cxx/helpers/loglog.h
|
|
@@ -20,6 +20,7 @@
|
|
|
|
#include <log4cxx/logstring.h>
|
|
#include <exception>
|
|
+#include <mutex>
|
|
|
|
namespace log4cxx
|
|
{
|
|
diff --git a/src/main/include/log4cxx/helpers/serversocket.h b/src/main/include/log4cxx/helpers/serversocket.h
|
|
index e6e6d475e..7da75b969 100644
|
|
--- a/src/main/include/log4cxx/helpers/serversocket.h
|
|
+++ b/src/main/include/log4cxx/helpers/serversocket.h
|
|
@@ -19,6 +19,7 @@
|
|
#define _LOG4CXX_HELPERS_SERVER_SOCKET_H
|
|
|
|
#include <log4cxx/helpers/socket.h>
|
|
+#include <mutex>
|
|
|
|
namespace log4cxx
|
|
{
|
|
diff --git a/src/main/include/log4cxx/level.h b/src/main/include/log4cxx/level.h
|
|
index 4ca4bf28c..7848c902a 100644
|
|
--- a/src/main/include/log4cxx/level.h
|
|
+++ b/src/main/include/log4cxx/level.h
|
|
@@ -22,6 +22,7 @@
|
|
#include <log4cxx/logstring.h>
|
|
#include <limits.h>
|
|
#include <log4cxx/helpers/object.h>
|
|
+#include <mutex>
|
|
|
|
#if defined(_MSC_VER)
|
|
#pragma warning ( push )
|
|
diff --git a/src/main/include/log4cxx/rolling/action.h b/src/main/include/log4cxx/rolling/action.h
|
|
index 0e8d55f36..fc4497813 100644
|
|
--- a/src/main/include/log4cxx/rolling/action.h
|
|
+++ b/src/main/include/log4cxx/rolling/action.h
|
|
@@ -21,6 +21,7 @@
|
|
#include <log4cxx/portability.h>
|
|
#include <log4cxx/helpers/object.h>
|
|
#include <log4cxx/helpers/pool.h>
|
|
+#include <mutex>
|
|
|
|
namespace log4cxx
|
|
{
|