cmake: s/HAVE_MSGHDR/WITH_SYSTEMD/

as FreeBSD also has msghdr but it does not have systemd, or
flags like MFD_ALLOW_SEALING, O_TMPFILE or F_SEAL_GROW. so
use WITH_SYSTEMD for enabling journald backend of logging system.

also move the option of "WITH_SYSTEMD" up so that the src/CMakeLists.txt
is able to see the variable of WITH_SYSTEMD defined by it.

Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2021-04-08 16:43:33 +08:00
parent dd2e31a336
commit 8c44876be4
7 changed files with 11 additions and 12 deletions

View File

@ -682,6 +682,8 @@ add_custom_target(check
COMMAND ${CMAKE_CTEST_COMMAND}
DEPENDS tests)
option(WITH_SYSTEMD "build with systemd support" ON)
add_subdirectory(src)
add_subdirectory(qa)
@ -691,7 +693,6 @@ if(WITH_MANPAGE)
add_subdirectory(man)
endif(WITH_MANPAGE)
option(WITH_SYSTEMD "install systemd target and service files" ON)
if(WITH_SYSTEMD)
add_subdirectory(systemd)
endif()

View File

@ -65,8 +65,6 @@ CHECK_TYPE_SIZE(__s8 __S8)
CHECK_TYPE_SIZE(__s16 __S16)
CHECK_TYPE_SIZE(__s32 __S32)
CHECK_TYPE_SIZE(__s64 __S64)
set(CMAKE_EXTRA_INCLUDE_FILES "sys/types.h" "sys/socket.h")
CHECK_TYPE_SIZE("struct msghdr" MSGHDR)
unset(CMAKE_EXTRA_INCLUDE_FILES)
include(CheckSymbolExists)

View File

@ -100,7 +100,7 @@ set(common_srcs
util.cc
version.cc)
if(HAVE_MSGHDR)
if(WITH_SYSTEMD)
list(APPEND common_srcs
Journald.cc)
endif()

View File

@ -13,7 +13,7 @@ struct LogEntry;
namespace ceph::logging {
#ifdef HAVE_MSGHDR
#ifdef WITH_SYSTEMD
namespace detail {
@ -86,7 +86,7 @@ class JournaldClusterLogger {
std::unique_ptr<detail::LogEntryEncoder> m_log_entry_encoder;
};
#else // HAVE_MSGHDR
#else // WITH_SYSTEMD
class JournaldLogger {
public:
@ -103,7 +103,7 @@ public:
}
};
#endif // HAVE_MSGHDR
#endif // WITH_SYSTEMD
} // ceph::logging

View File

@ -63,9 +63,6 @@
/* Define to 1 if the system has the type `__u8'. */
#cmakedefine HAVE___U8 1
/* Define to 1 if the system has the type `msghdr` */
#cmakedefine HAVE_MSGHDR 1
/* Define if you have res_nquery */
#cmakedefine HAVE_RES_NQUERY
@ -133,6 +130,9 @@
/* define if cephfs enabled */
#cmakedefine WITH_CEPHFS
/* define if systemed is enabled */
#cmakedefine WITH_SYSTEMD
/*define if GSSAPI/KRB5 enabled */
#cmakedefine HAVE_GSSAPI

View File

@ -153,7 +153,7 @@ if(NOT WIN32)
target_link_libraries(ceph_bench_log rt)
endif()
if(HAVE_MSGHDR)
if(WITH_SYSTEMD)
add_executable(ceph_bench_journald_logger
bench_journald_logger.cc)
target_link_libraries(ceph_bench_journald_logger ceph-common)

View File

@ -361,7 +361,7 @@ target_link_libraries(unittest_blocked_completion Boost::system GTest::GTest)
add_executable(unittest_allocate_unique test_allocate_unique.cc)
add_ceph_unittest(unittest_allocate_unique)
if(HAVE_MSGHDR)
if(WITH_SYSTEMD)
add_executable(unittest_journald_logger test_journald_logger.cc)
target_link_libraries(unittest_journald_logger ceph-common)
add_ceph_unittest(unittest_journald_logger)