summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2015-04-07 16:30:30 +0200
committerAndreas Schneider <asn@cryptomilk.org>2015-04-08 15:06:26 +0200
commit5ee27b4ead57c15db7168d80f6fdf821663c44fc (patch)
tree9c7fdf83cec7501795fb3d4328a1b6b2cf70dad7 /lib
parent0858b11ff735b535bfeded346c87a0c245d902c7 (diff)
downloadsamba-5ee27b4ead57c15db7168d80f6fdf821663c44fc.tar.gz
waf: Fix systemd detection
https://bugzilla.samba.org/show_bug.cgi?id=11200 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Wed Apr 8 15:06:26 CEST 2015 on sn-devel-104
Diffstat (limited to 'lib')
-rw-r--r--lib/util/become_daemon.c12
-rw-r--r--lib/util/debug.c6
-rwxr-xr-xlib/util/wscript_build4
-rw-r--r--lib/util/wscript_configure41
4 files changed, 29 insertions, 34 deletions
diff --git a/lib/util/become_daemon.c b/lib/util/become_daemon.c
index 78bebfc8309..46229719078 100644
--- a/lib/util/become_daemon.c
+++ b/lib/util/become_daemon.c
@@ -24,7 +24,7 @@
#include "includes.h"
#include "system/filesys.h"
#include "system/locale.h"
-#if HAVE_SYSTEMD
+#if HAVE_LIBSYSTEMD_DAEMON
#include <systemd/sd-daemon.h>
#endif
#include "lib/util/close_low_fd.h"
@@ -69,9 +69,9 @@ _PUBLIC_ void become_daemon(bool do_fork, bool no_process_group, bool log_stdout
if (do_fork) {
newpid = fork();
if (newpid) {
-#if HAVE_SYSTEMD
+#if HAVE_LIBSYSTEMD_DAEMON
sd_notifyf(0, "READY=0\nSTATUS=Starting process...\nMAINPID=%lu", (unsigned long) newpid);
-#endif /* HAVE_SYSTEMD */
+#endif /* HAVE_LIBSYSTEMD_DAEMON */
_exit(0);
}
}
@@ -98,7 +98,7 @@ _PUBLIC_ void become_daemon(bool do_fork, bool no_process_group, bool log_stdout
_PUBLIC_ void exit_daemon(const char *msg, int error)
{
-#ifdef HAVE_SYSTEMD
+#ifdef HAVE_LIBSYSTEMD_DAEMON
if (msg == NULL) {
msg = strerror(error);
}
@@ -117,7 +117,7 @@ _PUBLIC_ void daemon_ready(const char *name)
if (name == NULL) {
name = "Samba";
}
-#ifdef HAVE_SYSTEMD
+#ifdef HAVE_LIBSYSTEMD_DAEMON
sd_notifyf(0, "READY=1\nSTATUS=%s: ready to serve connections...", name);
#endif
DEBUG(0, ("STATUS=daemon '%s' finished starting up and ready to serve "
@@ -129,7 +129,7 @@ _PUBLIC_ void daemon_status(const char *name, const char *msg)
if (name == NULL) {
name = "Samba";
}
-#ifdef HAVE_SYSTEMD
+#ifdef HAVE_LIBSYSTEMD_DAEMON
sd_notifyf(0, "\nSTATUS=%s: %s", name, msg);
#endif
DEBUG(0, ("STATUS=daemon '%s' : %s", name, msg));
diff --git a/lib/util/debug.c b/lib/util/debug.c
index 91b02b45085..81d0cf6a848 100644
--- a/lib/util/debug.c
+++ b/lib/util/debug.c
@@ -102,7 +102,7 @@ static struct {
.fd = 2 /* stderr by default */
};
-#if defined(WITH_SYSLOG) || defined(HAVE_SYSTEMD_JOURNAL)
+#if defined(WITH_SYSLOG) || defined(HAVE_LIBSYSTEMD_JOURNAL)
static int debug_level_to_priority(int level)
{
/*
@@ -174,7 +174,7 @@ static void debug_syslog_log(int msg_level,
}
#endif /* WITH_SYSLOG */
-#ifdef HAVE_SYSTEMD_JOURNAL
+#ifdef HAVE_LIBSYSTEMD_JOURNAL
#include <systemd/sd-journal.h>
static void debug_systemd_log(int msg_level,
const char *msg, const char *msg_no_nl)
@@ -246,7 +246,7 @@ static struct debug_backend {
},
#endif
-#ifdef HAVE_SYSTEMD_JOURNAL
+#ifdef HAVE_LIBSYSTEMD_JOURNAL
{
.name = "systemd",
.log = debug_systemd_log,
diff --git a/lib/util/wscript_build b/lib/util/wscript_build
index 50d53ed63f1..92f25455b82 100755
--- a/lib/util/wscript_build
+++ b/lib/util/wscript_build
@@ -41,7 +41,7 @@ if bld.CONFIG_SET('HAVE_GPFS'):
bld.SAMBA_LIBRARY('samba-debug',
source='debug.c',
deps='replace time-basic close-low-fd talloc socket-blocking' + samba_debug_add_deps,
- public_deps='systemd-journal lttng-ust',
+ public_deps='systemd systemd-journal lttng-ust',
local_include=False,
private_library=True)
@@ -73,7 +73,7 @@ if not bld.env.SAMBA_UTIL_CORE_ONLY:
tevent_debug.c util_process.c memcache.c''',
deps='samba-util-core DYNCONFIG close-low-fd tini tiniparser',
- public_deps='talloc tevent execinfo pthread LIBCRYPTO charset util_setid systemd-daemon',
+ public_deps='talloc tevent execinfo pthread LIBCRYPTO charset util_setid systemd systemd-daemon',
public_headers='debug.h attr.h byteorder.h data_blob.h memory.h safe_string.h time.h talloc_stack.h xfile.h dlinklist.h samba_util.h string_wrappers.h idtree.h idtree_random.h blocking.h signal.h substitute.h fault.h',
header_path= [ ('dlinklist.h samba_util.h', '.'), ('*', 'util') ],
local_include=False,
diff --git a/lib/util/wscript_configure b/lib/util/wscript_configure
index ddd48824121..e52ba4a7623 100644
--- a/lib/util/wscript_configure
+++ b/lib/util/wscript_configure
@@ -100,33 +100,28 @@ conf.CHECK_CODE('struct statvfs buf; buf.f_flags = 0',
local_include=False,
execute=False)
+#
+# systemd removed the libsystemd-daemon and libsystemd-journal libraries. In newer
+# versions it is only libsystemd. As waf pkg-config handling does not provide
+# targets which could be used as a dependency based on the package name we need
+# to look for them on our own. This enabled one of the library targets based on
+# which version we detect.
+#
+conf.SET_TARGET_TYPE('systemd-daemon', 'EMPTY')
+conf.SET_TARGET_TYPE('systemd-journal', 'EMPTY')
+conf.SET_TARGET_TYPE('systemd', 'EMPTY')
+
if Options.options.enable_systemd != False:
- conf.CHECK_CFG(package='libsystemd-daemon', args='--cflags --libs',
- msg='Checking for libsystemd-daemon', uselib_store="SYSTEMD-DAEMON")
- conf.CHECK_HEADERS('systemd/sd-daemon.h', lib='systemd-daemon')
- conf.CHECK_LIB('systemd-daemon', shlib=True)
-
-if (conf.CONFIG_SET('HAVE_SYSTEMD_SD_DAEMON_H') and
- conf.CONFIG_SET('HAVE_LIBSYSTEMD_DAEMON')):
- conf.DEFINE('HAVE_SYSTEMD', '1')
- conf.env['ENABLE_SYSTEMD'] = True
-else:
- conf.SET_TARGET_TYPE('systemd-daemon', 'EMPTY')
- conf.undefine('HAVE_SYSTEMD')
+ conf.check_cfg(package='libsystemd-daemon', args='--cflags --libs',
+ msg='Checking for libsystemd-daemon')
+ if not conf.CHECK_LIB('systemd-daemon', shlib=True):
+ conf.CHECK_LIB('systemd', shlib=True)
if Options.options.enable_systemd != False:
conf.check_cfg(package='libsystemd-journal', args='--cflags --libs',
- msg='Checking for libsystemd-journal',
- uselib_store="SYSTEMD-JOURNAL")
- conf.CHECK_HEADERS('systemd/sd-journal.h', lib='systemd-journal')
- conf.CHECK_LIB('systemd-journal', shlib=True)
-
-if (conf.CONFIG_SET('HAVE_SYSTEMD_SD_JOURNAL_H') and
- conf.CONFIG_SET('HAVE_LIBSYSTEMD_JOURNAL')):
- conf.DEFINE('HAVE_SYSTEMD_JOURNAL', '1')
-else:
- conf.SET_TARGET_TYPE('systemd-journal', 'EMPTY')
- conf.undefine('HAVE_SYSTEMD_JOURNAL')
+ msg='Checking for libsystemd-journal')
+ if not conf.CHECK_LIB('systemd-journal', shlib=True):
+ conf.CHECK_LIB('systemd', shlib=True)
if Options.options.enable_lttng != False:
conf.check_cfg(package='lttng-ust', args='--cflags --libs',