xserver: Fix configure.ac check for libsystemd/-daemon

The configure script looks for the libsystemd-daemon pkg-config
module.  If the configure script finds it, the script will add
libsystemd-daemon to a list of modules which are used to consolidate
CFLAGS and LIBS.

The check for libsystemd-daemon was altered to fallback to libsystemd
if libsystemd-daemon was not found (libsystemd-daemon was brought into
libsystemd).  Unfortunately, the configure script still adds
"libsystemd-daemon" to the list of modules to consolidate, instead of
"libsystemd".  With this patch, we set a variable depending on which
pkg-config module is found and add that to the module list instead.

Changes since v1:
- Rearranged logic so that we do a versioned check for libsystemd
  first, then look for libsystemd-daemon.
- Cleaned up the check a bit, only performing the module checks if we
  don't have --with-systemd-daemon=no, in a similar style to
  --with-dtrace.
- Changed the variable name to LIBSYSTEMD_DAEMON as per feedback.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Bob Ham <bob.ham@collabora.com>
This commit is contained in:
Bob Ham 2015-12-04 12:30:47 +00:00 committed by Adam Jackson
parent 530d3e5ca0
commit 7c0ba32ddd

View File

@ -832,23 +832,26 @@ REQUIRED_MODULES="$FIXESPROTO $DAMAGEPROTO $XCMISCPROTO $XTRANS $BIGREQSPROTO $S
dnl systemd socket activation dnl systemd socket activation
dnl activate the code in libxtrans that grabs systemd's socket fds dnl activate the code in libxtrans that grabs systemd's socket fds
dnl libsystemd-daemon was moved into libsystemd in version 209
LIBSYSTEMD="libsystemd >= 209"
AC_ARG_WITH([systemd-daemon], AC_ARG_WITH([systemd-daemon],
AS_HELP_STRING([--with-systemd-daemon], AS_HELP_STRING([--with-systemd-daemon],
[support systemd socket activation (default: auto)]), [support systemd socket activation (default: auto)]),
[WITH_SYSTEMD_DAEMON=$withval], [WITH_SYSTEMD_DAEMON=auto]) [WITH_SYSTEMD_DAEMON=$withval], [WITH_SYSTEMD_DAEMON=auto])
PKG_CHECK_MODULES([SYSTEMD_DAEMON], [libsystemd-daemon], if test "x$WITH_SYSTEMD_DAEMON" = "xyes" -o "x$WITH_SYSTEMD_DAEMON" = "xauto" ; then
[HAVE_SYSTEMD_DAEMON=yes], PKG_CHECK_MODULES([SYSTEMD_DAEMON], [$LIBSYSTEMD],
[PKG_CHECK_MODULES([SYSTEMD_DAEMON], [libsystemd], [HAVE_SYSTEMD_DAEMON=yes;
[HAVE_SYSTEMD_DAEMON=yes], [HAVE_SYSTEMD_DAEMON=no])]) LIBSYSTEMD_DAEMON="$LIBSYSTEMD"],
if test "x$WITH_SYSTEMD_DAEMON" = xauto; then [PKG_CHECK_MODULES([SYSTEMD_DAEMON], [libsystemd-daemon],
WITH_SYSTEMD_DAEMON="$HAVE_SYSTEMD_DAEMON" [HAVE_SYSTEMD_DAEMON=yes;
fi LIBSYSTEMD_DAEMON=libsystemd-daemon],
if test "x$WITH_SYSTEMD_DAEMON" = xyes; then [HAVE_SYSTEMD_DAEMON=no])])
if test "x$HAVE_SYSTEMD_DAEMON" = xno; then if test "x$HAVE_SYSTEMD_DAEMON" = xyes; then
AC_DEFINE(HAVE_SYSTEMD_DAEMON, 1, [Define to 1 if libsystemd-daemon is available])
REQUIRED_LIBS="$REQUIRED_LIBS $LIBSYSTEMD_DAEMON"
elif test "x$WITH_SYSTEMD_DAEMON" = xyes; then
AC_MSG_ERROR([systemd support requested but no library has been found]) AC_MSG_ERROR([systemd support requested but no library has been found])
fi fi
AC_DEFINE(HAVE_SYSTEMD_DAEMON, 1, [Define to 1 if libsystemd-daemon is available])
REQUIRED_LIBS="$REQUIRED_LIBS libsystemd-daemon"
fi fi
AM_CONDITIONAL([HAVE_SYSTEMD_DAEMON], [test "x$HAVE_SYSTEMD_DAEMON" = "xyes"]) AM_CONDITIONAL([HAVE_SYSTEMD_DAEMON], [test "x$HAVE_SYSTEMD_DAEMON" = "xyes"])