0
0
Fork 0
mirror of https://github.com/netdata/netdata.git synced 2025-04-14 09:38:34 +00:00
netdata_netdata/packaging/cmake/systemd.cmake
Austin S. Hemmelgarn 12306a3e05
Assorted cleanup of CI/packaging related code. ()
* Drop unused Dockerfile.test.

It’s not been used for years, and it doesn’t even work at this point for
it’s intended purpose.

* Remove CodeClimate configuration.

We’re not using it anymore, so there is no point to keeping the
configuration around.

* Remove the build_external directory.

This isn’t used by any of our code AFAICT, and if it _is_ needed, it
should actually be in some sub-directory of `tests` instead of a
top-level directory whose name doesn’t even describe what it does.

* Remove .gitattributes

If there's any objection we can reinstate it.

* Move coverity-scan.sh under packaging/utils

* Move cmake files under packaging/cmake

* Remove devcontainer

* Fix up coverity script to run correctly from new location.

---------

Co-authored-by: vkalintiris <vasilis@netdata.cloud>
2024-02-14 07:01:52 -05:00

37 lines
1.7 KiB
CMake

find_library(SYSTEMD_LIBRARY NAMES systemd)
include(CheckFunctionExists)
set(ENABLE_DSYSTEMD_DBUS NO)
pkg_check_modules(SYSTEMD libsystemd)
if(SYSTEMD_FOUND)
set(CMAKE_REQUIRED_LIBRARIES_BEFORE_SYSTEMD "${CMAKE_REQUIRED_LIBRARIES}")
set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};${SYSTEMD_LIBRARIES}")
check_c_source_compiles("
#include <systemd/sd-journal.h>
int main() {
int x = SD_JOURNAL_OS_ROOT;
return 0;
}" HAVE_SD_JOURNAL_OS_ROOT)
check_symbol_exists(SD_JOURNAL_OS_ROOT "systemd/sd-journal.h" HAVE_SD_JOURNAL_OS_ROOT)
check_symbol_exists(sd_journal_open_files_fd "systemd/sd-journal.h" HAVE_SD_JOURNAL_OPEN_FILES_FD)
check_symbol_exists(sd_journal_restart_fields "systemd/sd-journal.h" HAVE_SD_JOURNAL_RESTART_FIELDS)
check_symbol_exists(sd_journal_get_seqnum "systemd/sd-journal.h" HAVE_SD_JOURNAL_GET_SEQNUM)
check_symbol_exists(sd_bus_default_system "systemd/sd-bus.h" HAVE_SD_BUS_DEFAULT_SYSTEM)
check_symbol_exists(sd_bus_call_method "systemd/sd-bus.h" HAVE_SD_BUS_CALL_METHOD)
check_symbol_exists(sd_bus_message_enter_container "systemd/sd-bus.h" HAVE_SD_BUS_MESSAGE_ENTER_CONTAINER)
check_symbol_exists(sd_bus_message_read "systemd/sd-bus.h" HAVE_SD_BUS_MESSAGE_READ)
check_symbol_exists(sd_bus_message_exit_container "systemd/sd-bus.h" HAVE_SD_BUS_MESSAGE_EXIT_CONTAINER)
set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES_BEFORE_SYSTEMD}")
set(HAVE_SYSTEMD True)
if(HAVE_SD_BUS_DEFAULT_SYSTEM AND HAVE_SD_BUS_CALL_METHOD AND HAVE_SD_BUS_MESSAGE_ENTER_CONTAINER AND HAVE_SD_BUS_MESSAGE_READ AND HAVE_SD_BUS_MESSAGE_EXIT_CONTAINER)
set(ENABLE_SYSTEMD_DBUS YES)
endif()
endif()