#include <lua.h>
#include <uv.h>
-#ifdef HAS_SYSTEMD
+#if SYSTEMD_VERSION > 0
#include <systemd/sd-daemon.h>
#endif
#include <libknot/error.h>
memcpy(&engine->ipc_set, ipc_set, sizeof(*ipc_set));
/* Notify supervisor. */
-#ifdef HAS_SYSTEMD
+#if SYSTEMD_VERSION > 0
sd_notify(0, "READY=1");
#endif
/* Run event loop */
return EXIT_SUCCESS;
}
-#ifdef HAS_SYSTEMD
+#if SYSTEMD_VERSION >= 227
static void free_sd_socket_names(char **socket_names, int count)
{
for (int i = 0; i < count; i++) {
ret = bind_sockets(&args.addrs_tls, true, &args.fds);
if (ret) goto cleanup_args;
-#ifdef HAS_SYSTEMD
+#if SYSTEMD_VERSION >= 227
/* Accept passed sockets from systemd supervisor. */
char **socket_names = NULL;
int sd_nsocks = sd_listen_fds_with_names(0, &socket_names);
## Systemd
message('--- systemd socket activation ---')
-libsystemd = dependency('libsystemd', version: '>=227', required: false)
+libsystemd = dependency('libsystemd', required: false)
systemd_files = get_option('systemd_files')
-if systemd_files == 'enabled' and not libsystemd.found()
+if systemd_files == 'enabled' and (
+ not libsystemd.found() or libsystemd.version().version_compare('<227'))
error('systemd_files=enabled requires libsystemd >= 227')
endif
message('---------------------------')
libzscanner.get_pkgconfig_variable('soname'))
conf_data.set_quoted('libknot_SONAME',
libknot.get_pkgconfig_variable('soname'))
-conf_data.set('HAS_SYSTEMD', libsystemd.found())
+conf_data.set('SYSTEMD_VERSION',
+ libsystemd.found() ? libsystemd.version().to_int() : -1)
conf_data.set('NOVERBOSELOG', not verbose_log)
kresconfig = configure_file(