chiark / gitweb /
Fix service file to match installed elogind binary location
[elogind.git] / Makefile.am
index 7facc7610600c1c5d8ad875a88b5947ab74fcbb8..525847b9aa9d29250dac304ccf2ef97e9c128a0b 100644 (file)
@@ -38,9 +38,9 @@ SUBDIRS = . po
 # Keep the test-suite.log
 .PRECIOUS: $(TEST_SUITE_LOG) Makefile
 
-LIBELOGIND_CURRENT=14
-LIBELOGIND_REVISION=0
-LIBELOGIND_AGE=14
+LIBELOGIND_CURRENT=19
+LIBELOGIND_REVISION=4
+LIBELOGIND_AGE=19
 
 # Dirs of external packages
 dbuspolicydir=@dbuspolicydir@
@@ -50,6 +50,8 @@ pamconfdir=@pamconfdir@
 pkgconfigdatadir=$(datadir)/pkgconfig
 pkgconfiglibdir=$(libdir)/pkgconfig
 polkitpolicydir=$(datadir)/polkit-1/actions
+polkitrulesdir=$(datadir)/polkit-1/rules.d
+polkitpkladir=$(localstatedir)/lib/polkit-1/localauthority/10-vendor.d
 bashcompletiondir=@bashcompletiondir@
 zshcompletiondir=@zshcompletiondir@
 
@@ -58,26 +60,26 @@ PKTTYAGENT=$(bindir)/pkttyagent
 
 # Our own, non-special dirs
 pkgsysconfdir=$(sysconfdir)/elogind
-pkgincludedir=$(includedir)/elogind
+pkgincludedir=$(includedir)/elogind/systemd
 udevrulesdir=@udevrulesdir@
 udevbindir=@udevbindir@
 udevlibexecdir=$(udevbindir)
 udevhomedir=$(udevlibexecdir)
-systemshutdowndir=$(rootlibexecdir)/system-shutdown
-systemsleepdir=$(rootlibexecdir)/system-sleep
 factory_pamdir = $(datadir)/factory/etc/pam.d
 
 # And these are the special ones for /
+
 rootprefix=@rootprefix@
 rootbindir=$(rootprefix)/bin
-rootlibexecdir=$(rootprefix)/lib/elogind
+rootlibdir=@rootlibdir@
+rootlibexecdir=@rootlibexecdir@
+systemshutdowndir=$(rootlibexecdir)/system-shutdown
+systemsleepdir=$(rootlibexecdir)/system-sleep
 
 EXTRA_DIST =
 BUILT_SOURCES =
 INSTALL_EXEC_HOOKS =
 UNINSTALL_EXEC_HOOKS =
-INSTALL_DATA_HOOKS =
-UNINSTALL_DATA_HOOKS =
 DISTCLEAN_LOCAL_HOOKS =
 CLEAN_LOCAL_HOOKS =
 pkginclude_HEADERS =
@@ -87,18 +89,28 @@ noinst_DATA =
 pkgconfiglib_DATA =
 polkitpolicy_in_files =
 polkitpolicy_files =
+polkitrules_files =
+polkitpkla_files =
 dist_udevrules_DATA =
 nodist_udevrules_DATA =
 dist_pkgsysconf_DATA =
+nodist_pkgsysconf_DATA =
 dist_dbuspolicy_DATA =
 dist_dbussystemservice_DATA =
 check_PROGRAMS =
 check_DATA =
+dist_rootlibexec_DATA =
+rootlib_LTLIBRARIES =
 tests=
 manual_tests =
+TEST_DATA_FILES =
 if ENABLE_TESTS
-noinst_PROGRAMS = $(manual_tests) $(tests)
+noinst_PROGRAMS = $(manual_tests) $(tests) $(unsafe_tests)
 TESTS = $(tests)
+if ENABLE_UNSAFE_TESTS
+TESTS += \
+       $(unsafe_tests)
+endif
 else
 noinst_PROGRAMS =
 TESTS =
@@ -121,14 +133,16 @@ CLEANFILES = $(BUILT_SOURCES) \
        $(m4_files:.m4=)
 
 .PHONY: $(INSTALL_EXEC_HOOKS) $(UNINSTALL_EXEC_HOOKS) \
-       $(INSTALL_DATA_HOOKS) $(UNINSTALL_DATA_HOOKS) \
        $(DISTCLEAN_LOCAL_HOOKS) $(CLEAN_LOCAL_HOOKS)
 
 AM_CPPFLAGS = \
        -include $(top_builddir)/config.h \
        -DPKGSYSCONFDIR=\"$(pkgsysconfdir)\" \
-       -DSYSTEMD_CGROUP_CONTROLLER=\"$(CGROUP_CONTROLLER)\" \
-       -DELOGIND_CGROUP_AGENT_PATH=\"$(rootlibexecdir)/elogind-cgroups-agent\" \
+       -DSYSTEMD_CGROUP_CONTROLLER=\"_$(CGROUP_CONTROLLER)\" \
+       -DSYSTEMD_CGROUP_CONTROLLER_LEGACY=\"name=$(CGROUP_CONTROLLER)\" \
+       -DSYSTEMD_CGROUP_CONTROLLER_HYBRID=\"name=$(CGROUP_CONTROLLER)\" \
+       -DSYSTEMD_CGROUP_AGENT_PATH=\"$(rootlibexecdir)/elogind-cgroups-agent\" \
+       -DSYSTEMD_BINARY_PATH=\"$(rootlibexecdir)/elogind\" \
        -DUDEVLIBEXECDIR=\"$(udevlibexecdir)\" \
        -DPOLKIT_AGENT_BINARY_PATH=\"$(PKTTYAGENT)\" \
        -DSYSTEM_SLEEP_PATH=\"$(systemsleepdir)\" \
@@ -151,22 +165,17 @@ AM_CPPFLAGS = \
        -I $(top_srcdir)/src/libelogind/sd-bus \
        -I $(top_srcdir)/src/libelogind/sd-event \
        -I $(top_srcdir)/src/libelogind/sd-login \
+       -I $(top_srcdir)/src/libelogind/sd-id128 \
+       -I $(top_srcdir)/src/update-utmp \
+       -I $(top_srcdir)/src/sleep \
+       -DABS_SRC_DIR=\"$(abs_top_srcdir)\" \
+       -DABS_BUILD_DIR=\"$(abs_top_builddir)\" \
        $(OUR_CPPFLAGS)
 
 AM_CFLAGS = $(OUR_CFLAGS)
 AM_LDFLAGS = $(OUR_LDFLAGS)
 
 # ------------------------------------------------------------------------------
-define move-to-rootlibdir
-       if test "$(libdir)" != "$(rootlibdir)"; then \
-               $(MKDIR_P) $(DESTDIR)$(rootlibdir) && \
-               so_img_name=$$(readlink $(DESTDIR)$(libdir)/$$libname) && \
-               rm -f $(DESTDIR)$(libdir)/$$libname && \
-               $(LN_S) --relative -f $(DESTDIR)$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/$$libname && \
-               mv $(DESTDIR)$(libdir)/$$libname.* $(DESTDIR)$(rootlibdir); \
-       fi
-endef
-
 install-touch-usr-hook:
        touch -c $(DESTDIR)/$(prefix)
 
@@ -197,7 +206,7 @@ AM_V_RM_0 = @echo "  RM      " $@;
 
 # ------------------------------------------------------------------------------
 rootbin_PROGRAMS =
-pkglibexec_PROGRAMS =
+rootlibexec_PROGRAMS =
 
 dist_doc_DATA = \
        README \
@@ -249,9 +258,11 @@ man/index.html: man/elogind.index.html
        $(AM_V_LN)$(LN_S) -f elogind.index.html $@
 
 if HAVE_PYTHON
+if ENABLE_MANPAGES
 noinst_DATA += \
        man/index.html
 endif
+endif
 
 CLEANFILES += \
        man/index.html
@@ -297,8 +308,6 @@ noinst_LTLIBRARIES += \
 
 libbasic_la_SOURCES = \
        src/basic/missing.h \
-       src/basic/musl_missing.h \
-       src/basic/musl_missing.c \
        src/basic/capability-util.c \
        src/basic/capability-util.h \
        src/basic/conf-files.c \
@@ -343,6 +352,8 @@ libbasic_la_SOURCES = \
        src/basic/escape.h \
        src/basic/path-util.c \
        src/basic/path-util.h \
+       src/basic/parse-printf-format.c \
+       src/basic/parse-printf-format.h \
        src/basic/time-util.c \
        src/basic/time-util.h \
        src/basic/locale-util.c \
@@ -364,10 +375,14 @@ libbasic_la_SOURCES = \
        src/basic/prioq.h \
        src/basic/strv.c \
        src/basic/strv.h \
+       src/basic/env-util.c \
+       src/basic/env-util.h \
        src/basic/log.c \
        src/basic/log.h \
        src/basic/bus-label.c \
        src/basic/bus-label.h \
+       src/basic/exec-util.c \
+       src/basic/exec-util.h \
        src/basic/virt.c \
        src/basic/virt.h \
        src/basic/smack-util.c \
@@ -413,8 +428,9 @@ libbasic_la_SOURCES = \
        src/basic/copy.h \
        src/basic/alloc-util.h \
        src/basic/alloc-util.c \
-       src/basic/parse-printf-format.c \
-       src/basic/parse-printf-format.h
+       src/basic/format-util.h \
+       src/basic/khash.h \
+       src/basic/khash.c
 
 nodist_libbasic_la_SOURCES = \
        src/basic/errno-from-name.h \
@@ -440,16 +456,26 @@ noinst_LTLIBRARIES += \
        libshared.la
 
 libshared_la_SOURCES = \
+       src/shared/udev-util.h \
+       src/shared/udev-util.c \
+       src/shared/bus-util.c \
+       src/shared/bus-util.h \
+       src/shared/clean-ipc.c \
+       src/shared/clean-ipc.h \
        src/shared/conf-parser.c \
        src/shared/conf-parser.h \
+       src/shared/musl_missing.h \
+       src/shared/musl_missing.c \
        src/shared/pager.c \
        src/shared/pager.h \
+       src/shared/sleep-config.c \
+       src/shared/sleep-config.h \
        src/shared/spawn-polkit-agent.c \
        src/shared/spawn-polkit-agent.h \
-       src/shared/clean-ipc.c \
-       src/shared/clean-ipc.h \
-       src/shared/bus-util.c \
-       src/shared/bus-util.h
+       src/shared/tests.h \
+       src/shared/tests.c \
+       src/shared/nsflags.h \
+       src/shared/nsflags.c
 
 if HAVE_ACL
 libshared_la_SOURCES += \
@@ -463,9 +489,41 @@ libshared_la_CFLAGS = \
 
 libshared_la_LIBADD = \
        libelogind-internal.la \
+       libbasic.la \
        $(UDEV_LIBS) \
        $(ACL_LIBS)
 
+noinst_LTLIBRARIES += \
+       libelogind-shared.la
+
+libelogind_shared_la_SOURCES = \
+       $(libbasic_la_SOURCES) \
+       $(libshared_la_SOURCES) \
+       $(libelogind_internal_la_SOURCES)
+
+libelogind_shared_la_CFLAGS = \
+       $(AM_CFLAGS) \
+       $(libbasic_la_CFLAGS) \
+       $(libshared_la_CFLAGS) \
+       $(libelogind_internal_la_CFLAGS) \
+       $(libelogind_journal_internal_la_CFLAGS) \
+       $(libudev_internal_la_CFLAGS) \
+       $(ACL_CFLAGS) \
+       $(SECCOMP_CFLAGS) \
+       -fvisibility=default
+
+# We can't use libshared_la_LIBADD here because it would
+# pull in libelogind*-internal.la
+libelogind_shared_la_LIBADD = \
+       $(libbasic_la_LIBADD) \
+       $(libelogind_internal_la_LIBADD) \
+       $(UDEV_LIBS) \
+       $(ACL_LIBS) \
+       $(SECCOMP_LIBS)
+
+libelogind_shared_la_LDFLAGS = \
+       $(AM_LDFLAGS)
+ # -----------------------------------------------------------------------------
 gperf_txt_sources = \
        src/basic/errno-list.txt
 
@@ -504,6 +562,338 @@ src/basic/errno-to-name.h: src/basic/errno-list.txt
        $(AM_V_at)$(MKDIR_P) $(dir $@)
        $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const errno_names[] = { "} !/EDEADLOCK/ && !/EWOULDBLOCK/ && !/ENOTSUP/ { printf "[%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' <$< >$@
 
+# ------------------------------------------------------------------------------
+
+manual_tests += \
+       test-cgroup
+
+unsafe_tests = \
+       test-ipcrm
+
+tests += \
+       test-log \
+       test-path-util \
+       test-siphash24 \
+       test-utf8 \
+       test-ellipsize \
+       test-util \
+       test-exec-util \
+       test-hexdecoct \
+       test-escape \
+       test-alloc-util \
+       test-proc-cmdline \
+       test-io-util \
+       test-fs-util \
+       test-stat-util \
+       test-fd-util \
+       test-string-util \
+       test-extract-word \
+       test-parse-util \
+       test-user-util \
+       test-process-util \
+       test-strip-tab-ansi \
+       test-prioq \
+       test-hashmap \
+       test-set \
+       test-list \
+       test-unaligned \
+       test-conf-files \
+       test-random-util \
+       test-conf-parser \
+       test-locale-util \
+       test-copy \
+       test-verbs \
+       test-signal-util \
+       test-selinux \
+       test-sizeof
+
+TEST_DATA_FILES += \
+       test/bus-policy/hello.conf \
+       test/bus-policy/methods.conf \
+       test/bus-policy/ownerships.conf \
+       test/bus-policy/signals.conf \
+       test/bus-policy/check-own-rules.conf \
+       test/bus-policy/many-rules.conf \
+       test/bus-policy/test.conf
+
+
+EXTRA_DIST += \
+       src/test/test-helper.h
+
+test_utf8_SOURCES = \
+       src/test/test-utf8.c
+
+test_utf8_LDADD = \
+       libelogind-shared.la
+
+test_locale_util_SOURCES = \
+       src/test/test-locale-util.c
+
+test_locale_util_LDADD = \
+       libelogind-shared.la
+
+test_copy_SOURCES = \
+       src/test/test-copy.c
+
+# Link statically to ensure file is large
+test_copy_LDADD = \
+       libshared.la
+
+test_random_util_SOURCES = \
+       src/test/test-random-util.c
+
+test_random_util_LDADD = \
+       libelogind-shared.la
+
+test_util_SOURCES = \
+       src/test/test-util.c
+
+test_util_LDADD = \
+       libelogind-shared.la
+
+test_exec_util_SOURCES = \
+       src/test/test-exec-util.c
+
+test_exec_util_LDADD = \
+       libelogind-shared.la
+
+test_hexdecoct_SOURCES = \
+       src/test/test-hexdecoct.c
+
+test_hexdecoct_LDADD = \
+       libelogind-shared.la
+
+test_alloc_util_SOURCES = \
+       src/test/test-alloc-util.c
+
+test_alloc_util_LDADD = \
+       libelogind-shared.la
+
+test_io_util_SOURCES = \
+       src/test/test-io-util.c
+
+test_io_util_LDADD = \
+       libelogind-shared.la
+
+test_fs_util_SOURCES = \
+       src/test/test-fs-util.c
+
+test_fs_util_LDADD = \
+       libelogind-shared.la
+
+test_proc_cmdline_SOURCES = \
+       src/test/test-proc-cmdline.c
+
+test_proc_cmdline_LDADD = \
+       libelogind-shared.la
+
+test_fd_util_SOURCES = \
+       src/test/test-fd-util.c
+
+test_fd_util_LDADD = \
+       libelogind-shared.la
+
+test_stat_util_SOURCES = \
+       src/test/test-stat-util.c
+
+test_stat_util_LDADD = \
+       libelogind-shared.la
+
+test_escape_SOURCES = \
+       src/test/test-escape.c
+
+test_escape_LDADD = \
+       libelogind-shared.la
+
+test_string_util_SOURCES = \
+       src/test/test-string-util.c
+
+test_string_util_LDADD = \
+       libelogind-shared.la
+
+test_extract_word_SOURCES = \
+       src/test/test-extract-word.c
+
+test_extract_word_LDADD = \
+       libelogind-shared.la
+
+test_parse_util_SOURCES = \
+       src/test/test-parse-util.c
+
+test_parse_util_LDADD = \
+       libelogind-shared.la
+
+test_user_util_SOURCES = \
+       src/test/test-user-util.c
+
+test_user_util_LDADD = \
+       libelogind-shared.la
+
+test_process_util_SOURCES = \
+       src/test/test-process-util.c
+
+test_process_util_LDADD = \
+       libelogind-shared.la
+
+test_verbs_SOURCES = \
+       src/test/test-verbs.c
+
+test_verbs_LDADD = \
+       libelogind-shared.la
+
+test_signal_util_SOURCES = \
+       src/test/test-signal-util.c
+
+test_signal_util_LDADD = \
+       libelogind-shared.la
+
+test_selinux_SOURCES = \
+       src/test/test-selinux.c
+
+test_selinux_LDADD = \
+       libelogind-shared.la
+
+test_sizeof_SOURCES = \
+       src/test/test-sizeof.c
+
+BUILT_SOURCES += \
+       src/test/test-hashmap-ordered.c
+
+src/test/test-hashmap-ordered.c: src/test/test-hashmap-plain.c
+       $(AM_V_at)$(MKDIR_P) $(dir $@)
+       $(AM_V_GEN)$(AWK) 'BEGIN { print "/* GENERATED FILE */\n#define ORDERED" } \
+                          { if (!match($$0, "^#include"))          \
+                                gsub(/hashmap/, "ordered_hashmap"); \
+                            gsub(/HASHMAP/, "ORDERED_HASHMAP");     \
+                            gsub(/Hashmap/, "OrderedHashmap");      \
+                            print }' <$< >$@
+
+nodist_test_hashmap_SOURCES = \
+       src/test/test-hashmap-ordered.c
+
+test_hashmap_SOURCES = \
+       src/test/test-hashmap.c \
+       src/test/test-hashmap-plain.c
+
+test_hashmap_LDADD = \
+       libelogind-shared.la
+
+test_set_SOURCES = \
+       src/test/test-set.c
+
+test_set_LDADD = \
+       libelogind-shared.la
+
+test_list_SOURCES = \
+       src/test/test-list.c
+
+test_list_LDADD = \
+       libelogind-shared.la
+
+test_unaligned_LDADD = \
+       libelogind-shared.la
+
+test_unaligned_SOURCES = \
+       src/test/test-unaligned.c
+
+test_prioq_SOURCES = \
+       src/test/test-prioq.c
+
+test_prioq_LDADD = \
+       libelogind-shared.la
+
+test_log_SOURCES = \
+       src/test/test-log.c
+
+test_log_LDADD = \
+       libelogind-shared.la
+
+test_ipcrm_SOURCES = \
+       src/test/test-ipcrm.c
+
+test_ipcrm_LDADD = \
+       libelogind-shared.la
+
+test_ellipsize_SOURCES = \
+       src/test/test-ellipsize.c
+
+test_ellipsize_LDADD = \
+       libelogind-shared.la
+
+test_strip_tab_ansi_SOURCES = \
+       src/test/test-strip-tab-ansi.c
+
+test_strip_tab_ansi_LDADD = \
+       libelogind-shared.la
+
+test_cgroup_SOURCES = \
+       src/test/test-cgroup.c
+
+test_cgroup_LDADD = \
+       libelogind-shared.la
+
+test_path_util_SOURCES = \
+       src/test/test-path-util.c
+
+test_path_util_LDADD = \
+       libelogind-shared.la
+
+test_siphash24_SOURCES = \
+       src/test/test-siphash24.c
+
+test_siphash24_LDADD = \
+       libelogind-shared.la
+
+test_conf_files_SOURCES = \
+       src/test/test-conf-files.c
+
+test_conf_files_LDADD = \
+       libelogind-shared.la
+
+test_conf_parser_SOURCES = \
+       src/test/test-conf-parser.c
+
+test_conf_parser_LDADD = \
+       libelogind-shared.la
+
+# ------------------------------------------------------------------------------
+## .PHONY so it always rebuilds it
+.PHONY: coverage lcov-run lcov-report coverage-sync
+
+# run lcov from scratch, always
+coverage: all
+       $(MAKE) lcov-run
+       $(MAKE) lcov-report
+
+coverage_dir = coverage
+coverage_opts = --base-directory $(srcdir) --directory $(builddir) --rc 'geninfo_adjust_src_path=$(abspath $(srcdir))=>$(abspath $(builddir))'
+
+if ENABLE_COVERAGE
+# reset run coverage tests
+lcov-run:
+       @rm -rf $(coverage_dir)
+       lcov $(coverage_opts) --zerocounters
+       -$(MAKE) check
+
+# generate report based on current coverage data
+lcov-report:
+       $(MKDIR_P) $(coverage_dir)
+       lcov $(coverage_opts) --compat-libtool --capture --no-external \
+               | sed 's|$(abspath $(builddir))|$(abspath $(srcdir))|' > $(coverage_dir)/.lcov.info
+       lcov --remove $(coverage_dir)/.lcov.info --output-file $(coverage_dir)/.lcov-clean.info 'test-*'
+       genhtml -t "systemd test coverage" -o $(coverage_dir) $(coverage_dir)/.lcov-clean.info
+       @echo "Coverage report generated in $(abs_builddir)/$(coverage_dir)/index.html"
+
+# lcov doesn't work properly with vpath builds, make sure that bad
+# output is not uploaded by mistake.
+coverage-sync: coverage
+       test "$(builddir)" = "$(srcdir)"
+       rsync -rlv --delete --omit-dir-times coverage/ $(www_target)/coverage
+
+else
+lcov-run lcov-report:
+       echo "Need to reconfigure with --enable-coverage"
+endif
 
 # ------------------------------------------------------------------------------
 
@@ -514,14 +904,14 @@ dist_factory_pam_DATA = \
 endif
 
 # ------------------------------------------------------------------------------
-pkglibexec_PROGRAMS += \
+rootlibexec_PROGRAMS += \
        elogind-cgroups-agent
 
 elogind_cgroups_agent_SOURCES = \
        src/cgroups-agent/cgroups-agent.c
 
 elogind_cgroups_agent_LDADD = \
-       libshared.la
+       libelogind-shared.la
 
 # ------------------------------------------------------------------------------
 libelogind_internal_la_SOURCES = \
@@ -574,29 +964,19 @@ libelogind_internal_la_SOURCES = \
        src/libelogind/sd-bus/bus-protocol.h \
        src/libelogind/sd-event/sd-event.c \
        src/libelogind/sd-id128/sd-id128.c \
+       src/libelogind/sd-id128/id128-util.h \
+       src/libelogind/sd-id128/id128-util.c \
        src/libelogind/sd-daemon/sd-daemon.c \
        src/libelogind/sd-login/sd-login.c
 
-libelogind_internal_la_LIBADD = \
-       libbasic.la \
-       -lresolv
-
 noinst_LTLIBRARIES += \
        libelogind-internal.la
 
 EXTRA_DIST += \
        src/libelogind/libelogind.pc.in \
-       src/libelogind/sd-bus/DIFFERENCES \
        src/libelogind/sd-bus/GVARIANT-SERIALIZATION
 
-libelogind_la_SOURCES = \
-       $(libelogind_internal_la_SOURCES)
-
-nodist_libelogind_la_SOURCES = \
-       $(nodist_libelogind_internal_la_SOURCES)
-
-libelogind_la_CFLAGS = \
-       $(libelogind_internal_la_CFLAGS)
+libelogind_la_SOURCES =
 
 libelogind_la_LDFLAGS = \
        $(AM_LDFLAGS) \
@@ -604,29 +984,111 @@ libelogind_la_LDFLAGS = \
        -Wl,--version-script=$(top_srcdir)/src/libelogind/libelogind.sym
 
 libelogind_la_LIBADD = \
-       $(libelogind_internal_la_LIBADD)
-
-libelogind-install-hook:
-       libname=libelogind.so && $(move-to-rootlibdir)
-
-libelogind-uninstall-hook:
-       rm -f $(DESTDIR)$(rootlibdir)/libelogind.so*
-
-INSTALL_EXEC_HOOKS += libelogind-install-hook
-UNINSTALL_EXEC_HOOKS += libelogind-uninstall-hook
+       libelogind-internal.la \
+       libbasic.la
 
 pkgconfiglib_DATA += \
        src/libelogind/libelogind.pc
 
 pkginclude_HEADERS += \
-       src/systemd/sd-login.h \
-       src/systemd/sd-messages.h \
-       src/systemd/sd-id128.h \
-       src/systemd/_sd-common.h
+       src/systemd/sd-bus.h          \
+       src/systemd/sd-bus-protocol.h \
+       src/systemd/sd-bus-vtable.h   \
+       src/systemd/_sd-common.h      \
+       src/systemd/sd-daemon.h       \
+       src/systemd/sd-event.h        \
+       src/systemd/sd-id128.h        \
+       src/systemd/sd-login.h        \
+       src/systemd/sd-messages.h
+
+header-install-hook:
+       $(MKDIR_P) $(DESTDIR)/$(pkgincludedir)
+       cd $(DESTDIR)/$(includedir)/elogind && \
+               for hdr in $(notdir $(pkginclude_HEADERS)) ; do \
+                       rm -f $$hdr ; \
+                       $(LN_S) systemd/$$hdr $$hdr ; \
+               done
+
+header-uninstall-hook:
+       m -f $(DESTDIR)/$(includedir)/elogind/*.h
+
+INSTALL_EXEC_HOOKS += header-install-hook
+UNINSTALL_EXEC_HOOKS += header-uninstall-hook
+
+rootlib_LTLIBRARIES += \
+       libelogind.la
+
+tests += \
+       test-bus-signature \
+       test-bus-server \
+       test-bus-match \
+       test-bus-introspect \
+       test-bus-vtable \
+       test-bus-error \
+       test-event
 
+test_bus_signature_SOURCES = \
+       src/libelogind/sd-bus/test-bus-signature.c
 
-lib_LTLIBRARIES += \
-       libelogind.la
+test_bus_signature_LDADD = \
+       libelogind-shared.la
+
+test_bus_server_SOURCES = \
+       src/libelogind/sd-bus/test-bus-server.c
+
+test_bus_server_LDADD = \
+       libelogind-shared.la
+
+test_bus_vtable_SOURCES = \
+       src/libelogind/sd-bus/test-bus-vtable.c
+
+test_bus_vtable_LDADD = \
+       libelogind-shared.la
+
+test_bus_error_SOURCES = \
+       src/libelogind/sd-bus/test-bus-error.c
+
+# Link statically because this test uses BUS_ERROR_MAP_ELF_REGISTER
+test_bus_error_LDADD = \
+       libshared.la
+
+test_bus_match_SOURCES = \
+       src/libelogind/sd-bus/test-bus-match.c
+
+test_bus_match_LDADD = \
+       libelogind-shared.la
+
+test_bus_introspect_SOURCES = \
+       src/libelogind/sd-bus/test-bus-introspect.c
+
+test_bus_introspect_LDADD = \
+       libelogind-shared.la
+
+test_event_SOURCES = \
+       src/libelogind/sd-event/test-event.c
+
+test_event_LDADD = \
+       libelogind-shared.la
+
+# ------------------------------------------------------------------------------
+test_id128_SOURCES = \
+       src/test/test-id128.c
+
+test_id128_LDADD = \
+       libelogind-shared.la
+
+tests += \
+       test-id128
+
+# ------------------------------------------------------------------------------
+test_hash_SOURCES = \
+       src/test/test-hash.c
+
+test_hash_LDADD = \
+       libelogind-shared.la
+
+tests += \
+       test-hash
 
 # ------------------------------------------------------------------------------
 elogind_SOURCES = \
@@ -640,6 +1102,14 @@ elogind_LDADD = \
        libelogind-core.la
 
 libelogind_core_la_SOURCES = \
+       src/core/cgroup.h \
+       src/core/cgroup.c \
+       src/core/mount-setup.h \
+       src/core/mount-setup.c \
+        src/login/elogind.c \
+        src/login/elogind.h \
+       src/login/elogind-dbus.c \
+       src/login/elogind-dbus.h \
        src/login/logind-core.c \
        src/login/logind-device.c \
        src/login/logind-device.h \
@@ -653,8 +1123,6 @@ libelogind_core_la_SOURCES = \
        src/login/logind-session.h \
        src/login/logind-session-device.c \
        src/login/logind-session-device.h \
-       src/login/logind-sleep.c \
-       src/login/logind-sleep.h \
        src/login/logind-user.c \
        src/login/logind-user.h \
        src/login/logind-inhibit.c \
@@ -663,14 +1131,19 @@ libelogind_core_la_SOURCES = \
        src/login/logind-session-dbus.c \
        src/login/logind-seat-dbus.c \
        src/login/logind-user-dbus.c \
+       src/login/logind-utmp.c \
        src/login/logind-acl.h \
-       src/core/cgroup.h \
-       src/core/cgroup.c \
-       src/core/mount-setup.h \
-       src/core/mount-setup.c
+       src/sleep/sleep.c \
+       src/sleep/sleep.h
+
+if HAVE_UTMP
+libelogind_core_la_SOURCES += \
+       src/shared/utmp-wtmp.c \
+       src/update-utmp/update-utmp.c
+endif
 
 libelogind_core_la_LIBADD = \
-       libshared.la
+       libelogind-shared.la
 
 if HAVE_ACL
 libelogind_core_la_SOURCES += \
@@ -680,16 +1153,18 @@ endif
 noinst_LTLIBRARIES += \
        libelogind-core.la
 
-pkglibexec_PROGRAMS += \
+rootlibexec_PROGRAMS += \
        elogind
 
 loginctl_SOURCES = \
+       src/login/eloginctl.c \
+       src/login/eloginctl.h \
        src/login/loginctl.c \
        src/login/sysfs-show.h \
        src/login/sysfs-show.c
 
 loginctl_LDADD = \
-       libshared.la
+       libelogind-shared.la
 
 rootbin_PROGRAMS += \
        loginctl
@@ -705,7 +1180,7 @@ elogind_inhibit_SOURCES = \
        src/login/inhibit.c
 
 elogind_inhibit_LDADD = \
-       libshared.la
+       libelogind-shared.la
 
 rootbin_PROGRAMS += \
        elogind-inhibit
@@ -714,19 +1189,19 @@ test_login_SOURCES = \
        src/libelogind/sd-login/test-login.c
 
 test_login_LDADD = \
-       libshared.la
+       libelogind-shared.la
 
 test_login_shared_SOURCES = \
        src/login/test-login-shared.c
 
 test_login_shared_LDADD = \
-       libshared.la
+       libelogind-shared.la
 
 test_inhibit_SOURCES = \
        src/login/test-inhibit.c
 
 test_inhibit_LDADD = \
-       libshared.la
+       libelogind-shared.la
 
 test_login_tables_SOURCES = \
        src/login/test-login-tables.c
@@ -735,10 +1210,10 @@ test_login_tables_LDADD = \
        libelogind-core.la
 
 manual_tests += \
-       test-login \
        test-inhibit
 
 tests += \
+       test-login \
        test-login-tables \
        test-login-shared
 
@@ -766,8 +1241,10 @@ pam_elogind_la_LIBADD = \
 pamlib_LTLIBRARIES = \
        pam_elogind.la
 
+if ENABLE_PAM_CONFIG
 dist_pamconf_DATA = \
        src/login/elogind-user
+endif
 
 EXTRA_DIST += \
        src/login/elogind-user.m4
@@ -779,15 +1256,14 @@ dist_dbussystemservice_DATA += \
 dist_dbuspolicy_DATA += \
        src/login/org.freedesktop.login1.conf
 
-dist_pkgsysconf_DATA += \
+nodist_pkgsysconf_DATA += \
        src/login/logind.conf
 
 polkitpolicy_files += \
        src/login/org.freedesktop.login1.policy
 
 dist_udevrules_DATA += \
-       src/login/70-uaccess.rules \
-       src/login/70-power-switch.rules
+       src/login/70-uaccess.rules
 
 nodist_udevrules_DATA += \
        src/login/71-seat.rules \
@@ -801,10 +1277,13 @@ gperf_gperf_sources = \
 
 EXTRA_DIST += \
        src/login/71-seat.rules.in \
-       src/login/73-seat-late.rules.in
+       src/login/73-seat-late.rules.in \
+       src/login/logind.conf.in \
+       src/login/org.freedesktop.login1.service.in
 
 # ------------------------------------------------------------------------------
 substitutions = \
+       '|rootlibdir=$(rootlibdir)|' \
        '|rootlibexecdir=$(rootlibexecdir)|' \
        '|rootbindir=$(rootbindir)|' \
        '|bindir=$(bindir)|' \
@@ -818,19 +1297,19 @@ substitutions = \
        '|exec_prefix=$(exec_prefix)|' \
        '|libdir=$(libdir)|' \
        '|includedir=$(includedir)|' \
-       '|VERSION=$(VERSION)|' \
        '|rootprefix=$(rootprefix)|' \
        '|udevlibexecdir=$(udevlibexecdir)|' \
        '|KILL=$(KILL)|' \
        '|MKDIR_P=$(MKDIR_P)|' \
+       '|KILL_USER_PROCESSES=$(KILL_USER_PROCESSES)|' \
        '|systemuidmax=$(SYSTEM_UID_MAX)|' \
-       '|systemgidmax=$(SYSTEM_GID_MAX)|' \
-       '|TTY_GID=$(TTY_GID)|'
+       '|systemgidmax=$(SYSTEM_GID_MAX)|'
 
 SED_PROCESS = \
        $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
        $(SED) $(subst '|,-e 's|@,$(subst =,\@|,$(subst |',|g',$(substitutions)))) \
-               < $< > $@
+                -e '/^\#\# /d' \
+                < $< > $@
 
 man/%: man/%.in
        $(SED_PROCESS)
@@ -850,6 +1329,9 @@ shell-completion/%: shell-completion/%.in
 %.conf: %.conf.in
        $(SED_PROCESS)
 
+%.login1.service: %.login1.service.in
+       $(SED_PROCESS)
+
 %.sh: %.sh.in
        $(SED_PROCESS)
        $(AM_V_GEN)chmod +x $@
@@ -882,6 +1364,10 @@ units/user/%: units/user/%.m4
 if ENABLE_POLKIT
 nodist_polkitpolicy_DATA = \
        $(polkitpolicy_files)
+polkitrules_DATA = $(polkitrules_files)
+if ENABLE_POLKIT_PKLA
+polkitpkla_DATA = $(polkitpkla_files)
+endif
 endif
 
 EXTRA_DIST += \
@@ -905,7 +1391,7 @@ XSLTPROC_FLAGS = \
        --stringparam funcsynopsis.style ansi \
        --stringparam man.authors.section.enabled 0 \
        --stringparam man.copyright.section.enabled 0 \
-       --stringparam elogind.version $(VERSION) \
+       --stringparam elogind.version $(PACKAGE_VERSION) \
        --path '$(builddir)/man:$(srcdir)/man'
 
 XSLTPROC_PROCESS_MAN = \
@@ -944,9 +1430,7 @@ EXTRA_DIST += \
 
 install-exec-hook: $(INSTALL_EXEC_HOOKS)
 
-uninstall-hook: $(UNINSTALL_DATA_HOOKS) $(UNINSTALL_EXEC_HOOKS)
-
-install-data-hook: $(INSTALL_DATA_HOOKS)
+uninstall-hook: $(UNINSTALL_EXEC_HOOKS)
 
 distclean-local: $(DISTCLEAN_LOCAL_HOOKS)
 
@@ -973,7 +1457,6 @@ DISTCHECK_CONFIGURE_FLAGS += \
 endif
 
 .PHONY: dist-check-help
-
 dist-check-help: $(rootbin_PROGRAMS)
        for i in $(abspath $^); do                                             \
             if $$i  --help | grep -v 'default:' | grep -E -q '.{80}.' ; then   \
@@ -982,42 +1465,59 @@ dist-check-help: $(rootbin_PROGRAMS)
                exit 1;                                                        \
             fi; done
 
+include_compilers = "$(CC)" "$(CC) -ansi" "$(CC) -std=iso9899:1990"
+public_headers = $(filter-out src/systemd/_sd-common.h, $(pkginclude_HEADERS) $(include_HEADERS))
+.PHONY: dist-check-includes
+dist-check-includes: $(public_headers)
+       @res=0;                                                                 \
+       for i in $(abspath $^); do                                              \
+           for cc in $(include_compilers); do                                  \
+               echo "$$cc -o/dev/null -c -x c -include "$$i" - </dev/null";    \
+               $$cc -o/dev/null -c -x c -include "$$i" - </dev/null || res=1;  \
+           done;                                                               \
+       done; exit $$res
+
 dist:
 
 .PHONY: git-tag
 git-tag:
-       git tag -s "v$(VERSION)" -m "elogind $(VERSION)"
+       git tag -s "v$(PACKAGE_VERSION)" -m "elogind $(PACKAGE_VERSION)"
 
 .PHONY: git-tar
 git-tar:
-       $(AM_V_at)git archive --format=tar --prefix=elogind-$(VERSION)-raw/ HEAD | \
+       $(AM_V_at)git archive --format=tar --prefix=elogind-$(PACKAGE_VERSION)-raw/ HEAD | \
                (cd /var/tmp/ && tar xf -)
-       $(AM_V_GEN)(cd /var/tmp && rm -rf elogind-$(VERSION) && $(MKDIR_P) elogind-$(VERSION) && \
-        for f in `find elogind-$(VERSION)-raw/ -type f | cut -d '/' -f 2-` ; do \
-               $(MKDIR_P) elogind-$(VERSION)/`dirname $$f` ;            \
-               $(AWK) 'BEGIN                    { i=0;e=0      }        \
-                       /^#if\s+0.*elogind.*$$/  { i=1;next     }        \
-                       /^#else\s*$$/            {                       \
-                           { if ( i==1 ) e=1; else print }{next}        \
-                       }                                                \
-                       /^#endif\s*\/\/\s*0\s*$$/ {                      \
-                           { if ( i==1 ) { i=0;e=0 } else print }{next} \
-                       }                                                \
-                       /^\s*\/\/\/.*elogind.*$$/{ next         }        \
-                       /^\s*\/\/\s*#include.+$$/{ next         }        \
-                       { if ( (i==0) || (e==1) ) print         }'       \
-                         elogind-$(VERSION)-raw/$$f                     \
-                       > elogind-$(VERSION)/$$f ;                       \
-                       chmod `stat -c '%a' elogind-$(VERSION)-raw/$$f`  \
-                                           elogind-$(VERSION)/$$f ;     \
-        done ; \
-        for l in `find elogind-$(VERSION)-raw/ -type l | cut -d '/' -f 2-` ; do \
-               $(MKDIR_P) elogind-$(VERSION)/`dirname $$l` ; \
-               cp -P elogind-$(VERSION)-raw/$$l elogind-$(VERSION)/$$l ; \
-        done ; \
-        tar czf elogind-$(VERSION).tar.gz elogind-$(VERSION) ; \
-        rm -rf elogind-$(VERSION) elogind-$(VERSION)-raw) ; \
-       $(AM_V_at)mv /var/tmp/elogind-$(VERSION).tar.gz ./
+       $(AM_V_GEN)(cd /var/tmp &&                                              \
+               rm -rf elogind-$(PACKAGE_VERSION) &&                            \
+               $(MKDIR_P) elogind-$(PACKAGE_VERSION) &&                        \
+        for f in `find elogind-$(PACKAGE_VERSION)-raw/ -type f |               \
+                       cut -d '/' -f 2-` ; do                                  \
+               $(MKDIR_P) elogind-$(PACKAGE_VERSION)/`dirname $$f` ;           \
+               $(AWK) 'BEGIN                    { i=0;e=0      }               \
+                       /^#if\s+0.*elogind.*$$/  { i=1;next     }               \
+                       /^#else\s*$$/            {                              \
+                           { if ( i==1 ) e=1; else print }{next}               \
+                       }                                                       \
+                       /^#endif\s*\/\/\s*0\s*$$/ {                             \
+                           { if ( i==1 ) { i=0;e=0 } else print }{next}        \
+                       }                                                       \
+                       /^\s*\/\/\/.*elogind.*$$/{ next         }               \
+                       /^\s*\/\/\s*#include.+$$/{ next         }               \
+                       { if ( (i==0) || (e==1) ) print         }'              \
+                         elogind-$(PACKAGE_VERSION)-raw/$$f                    \
+                       > elogind-$(PACKAGE_VERSION)/$$f ;                      \
+                       chmod `stat -c '%a' elogind-$(PACKAGE_VERSION)-raw/$$f` \
+                                           elogind-$(PACKAGE_VERSION)/$$f ;    \
+        done ;                                                                 \
+        for l in `find elogind-$(PACKAGE_VERSION)-raw/ -type l |               \
+                       cut -d '/' -f 2-` ; do                                  \
+               $(MKDIR_P) elogind-$(PACKAGE_VERSION)/`dirname $$l` ;           \
+               cp -P elogind-$(PACKAGE_VERSION)-raw/$$l                        \
+                       elogind-$(PACKAGE_VERSION)/$$l ;                        \
+        done ;                                                                 \
+        tar czf elogind-$(PACKAGE_VERSION).tar.gz elogind-$(PACKAGE_VERSION) ; \
+        rm -rf elogind-$(PACKAGE_VERSION) elogind-$(PACKAGE_VERSION)-raw) ;    \
+       $(AM_V_at)mv /var/tmp/elogind-$(PACKAGE_VERSION).tar.gz ./
 
 .PHONY: install-tree
 install-tree: all
@@ -1026,21 +1526,21 @@ install-tree: all
        tree $(abs_srcdir)/install-tree
 
 # Let's run all tests of the test suite, but under valgrind. Let's
-# exclude the one perl script we have in there
+# exclude perl/python/shell scripts we have in there
 .PHONY: valgrind-tests
 valgrind-tests: $(TESTS)
-       $(AM_V_GEN)for f in $(filter-out %.pl, $^); do \
-               if file $$f | grep -q shell; then \
+       $(AM_V_GEN)for f in $(filter-out %.pl %.py, $^); do \
+               if $(LIBTOOL) --mode=execute file $$f | grep -q shell; then \
                echo -e "$${x}Skipping non-binary $$f"; else \
                echo -e "$${x}Running $$f"; \
-               libtool --mode=execute valgrind -q --leak-check=full --max-stackframe=5242880 --error-exitcode=55 $(builddir)/$$f ; fi; \
+               $(AM_TESTS_ENVIRONMENT) $(LIBTOOL) --mode=execute valgrind -q --leak-check=full --max-stackframe=5242880 --error-exitcode=55 $(builddir)/$$f ; fi; \
                x="\n\n"; \
        done
 
 exported-%: %
        $(AM_V_GEN)$(NM) -g --defined-only $(builddir)/.libs/$(<:.la=.so) 2>&1 /dev/null | grep " T " | cut -d" " -f3 > $@
 
-exported: $(addprefix exported-, $(lib_LTLIBRARIES))
+exported: $(addprefix exported-, $(rootlib_LTLIBRARIES))
        $(AM_V_GEN)cat $^ > $@
 
 .PHONY: check-api-docs
@@ -1108,16 +1608,49 @@ BUILT_SOURCES += \
 tests += \
        test-libelogind-sym
 
-.PHONY: cppcheck
+.PHONY: install-tests
+install-tests: $(tests) $(TEST_DATA_FILES)
+       for f in $(tests); do \
+           if [ -x $(top_builddir)/.libs/$$f ]; then \
+               install -D -m 755 $(top_builddir)/.libs/$$f $(DESTDIR)/$(testsdir)/$$f; \
+           else \
+               install -D -m 755 $(top_builddir)/$$f $(DESTDIR)/$(testsdir)/$$f; \
+           fi; \
+       done
+       for f in $(TEST_DATA_FILES); do \
+           install -D -m 644 $(top_srcdir)/$$f $(DESTDIR)/$(testsdir)/testdata/$${f#test/}; \
+       done
+
+.PHONY: cccc cppcheck
+cccc: all
+       cccc --outdir=$(top_builddir)/cccc \
+       `find $(top_srcdir)/src/ -name '*.h' -or -name '*.c'`
+
 cppcheck:
-       cppcheck --enable=all -q $(top_srcdir)
+       cppcheck --enable=all -q \
+       -I $(top_srcdir)/src \
+       -I $(top_builddir)/src/basic \
+       -I $(top_srcdir)/src/basic \
+       -I $(top_srcdir)/src/core \
+       -I $(top_srcdir)/src/shared \
+       -I $(top_builddir)/src/shared \
+       -I $(top_srcdir)/src/login \
+       -I $(top_srcdir)/src/systemd \
+       -I $(top_srcdir)/src/libelogind/sd-bus \
+       -I $(top_srcdir)/src/libelogind/sd-event \
+       -I $(top_srcdir)/src/libelogind/sd-login \
+       -I $(top_srcdir)/src/libelogind/sd-id128 \
+       -I $(top_srcdir)/src/update-utmp \
+       -I $(top_srcdir)/src/sleep \
+       --force \
+       $(top_srcdir)
 
 # Used to extract compile flags for YCM.
 print-%:
        @echo $($*)
 
 git-contrib:
-       @git shortlog -s `git describe --abbrev=0`.. | cut -c8- | awk '{ print $$0 "," }' | sort -u
+       @git shortlog -s `git describe --abbrev=0`.. | cut -c8- | sed 's/ / /g' | awk '{ print $$0 "," }' | sort -u
 
 EXTRA_DIST += \
         tools/gdb-sd_dump_hashmaps.py