[PATCHv3] build: Fix systemd-daemon compile/linker flags

Jussi Kukkonen jussi.kukkonen at intel.com
Thu Nov 19 06:04:30 PST 2015


* Dont add systemd to REQUIRED_LIBS (this lead to build failure when
  libsystemd is available but libsystemd-daemon is not)
* Only use systemd compile and linker flags where needed (libxtrans)
* Try libsystemd (>= 210) first so it's used instead of the
  libsystemd-daemon wrapper that might also exist

Signed-off-by: Jussi Kukkonen <jussi.kukkonen at intel.com>
---

Let's try once more. Tried to address Peters comments by limiting
systemd flag use to libos.la. Also fixed the issue Emil pointed out
by checking only for libsystemd versions that actually provide the
required api.

Note that the actual systemd-daemon api use is not in xserver, but
in the xtrans "library" (at least that's the only one I could find).


 configure.ac   | 5 ++---
 os/Makefile.am | 4 ++--
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 14a5bb8..997b5e5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -836,9 +836,9 @@ AC_ARG_WITH([systemd-daemon],
 	AS_HELP_STRING([--with-systemd-daemon],
 		[support systemd socket activation (default: auto)]),
 	[WITH_SYSTEMD_DAEMON=$withval], [WITH_SYSTEMD_DAEMON=auto])
-PKG_CHECK_MODULES([SYSTEMD_DAEMON], [libsystemd-daemon],
+PKG_CHECK_MODULES([SYSTEMD_DAEMON], [libsystemd >= 210],
                   [HAVE_SYSTEMD_DAEMON=yes],
-                  [PKG_CHECK_MODULES([SYSTEMD_DAEMON], [libsystemd],
+                  [PKG_CHECK_MODULES([SYSTEMD_DAEMON], [libsystemd-daemon],
                                      [HAVE_SYSTEMD_DAEMON=yes], [HAVE_SYSTEMD_DAEMON=no])])
 if test "x$WITH_SYSTEMD_DAEMON" = xauto; then
 	WITH_SYSTEMD_DAEMON="$HAVE_SYSTEMD_DAEMON"
@@ -848,7 +848,6 @@ if test "x$WITH_SYSTEMD_DAEMON" = xyes; then
 		AC_MSG_ERROR([systemd support requested but no library has been found])
 	fi
 	AC_DEFINE(HAVE_SYSTEMD_DAEMON, 1, [Define to 1 if libsystemd-daemon is available])
-	REQUIRED_LIBS="$REQUIRED_LIBS libsystemd-daemon"
 fi
 AM_CONDITIONAL([HAVE_SYSTEMD_DAEMON], [test "x$HAVE_SYSTEMD_DAEMON" = "xyes"])
 
diff --git a/os/Makefile.am b/os/Makefile.am
index a1bbb4d..c1e2cb5 100644
--- a/os/Makefile.am
+++ b/os/Makefile.am
@@ -1,6 +1,6 @@
 noinst_LTLIBRARIES = libos.la
 
-AM_CFLAGS = $(DIX_CFLAGS) $(SHA1_CFLAGS)
+AM_CFLAGS = $(DIX_CFLAGS) $(SHA1_CFLAGS) $(SYSTEMD_DAEMON_CFLAGS)
 
 SECURERPC_SRCS = rpcauth.c
 XDMCP_SRCS = xdmcp.c
@@ -25,7 +25,7 @@ libos_la_SOURCES = 	\
 	xstrans.c	\
 	xprintf.c	\
 	$(XORG_SRCS)
-libos_la_LIBADD = @SHA1_LIBS@ $(DLOPEN_LIBS) $(LTLIBOBJS)
+libos_la_LIBADD = @SHA1_LIBS@ $(DLOPEN_LIBS) $(SYSTEMD_DAEMON_LIBS) $(LTLIBOBJS)
 
 if SECURE_RPC
 libos_la_SOURCES += $(SECURERPC_SRCS)
-- 
2.6.2



More information about the xorg-devel mailing list