On (28/07/15 11:58), Petr Cech wrote:
From fcf895ad8df932403dfc554a34ff0d8ceac72785 Mon Sep 17 00:00:00
2001
From: Petr Cech <pcech(a)redhat.com>
Date: Mon, 27 Jul 2015 12:52:49 -0400
Subject: [PATCH] BUILD: Repair dependecies on deprecated libraries
From systemd version 209 up, there are no modules -login
and -journal. M4 macro can switch the libraries due to
systemd version.
Resolves:
https://fedorahosted.org/sssd/ticket/2733
---
contrib/ci/deps.sh | 2 +-
src/external/systemd.m4 | 24 +++++++++++++++++-------
2 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/contrib/ci/deps.sh b/contrib/ci/deps.sh
index 74401f8328cdcc6f80afa9f7408ef9e9ce890df7..22b7276ebdb8e3ba5e1e34334adbe310cbff8bad
100644
--- a/contrib/ci/deps.sh
+++ b/contrib/ci/deps.sh
@@ -92,7 +92,7 @@ if [[ "$DISTRO_BRANCH" == -debian-* ]]; then
libselinux1-dev
libsemanage1-dev
libsmbclient-dev
- libsystemd-journal-dev
+ libsystemd-dev
libtalloc-dev
libtdb-dev
libtevent-dev
diff --git a/src/external/systemd.m4 b/src/external/systemd.m4
index dbced0d66aa19e064f998648675a5a9c080eaab8..ddc79e465fd53618c5f90341a96461b92c8528b1
100644
--- a/src/external/systemd.m4
+++ b/src/external/systemd.m4
@@ -1,23 +1,33 @@
+dnl There are no module libsystemd-journal and libsystem-login
+dnl up systemd version 209
I think better comment would be to say that
libsystemd-journal and
libsystem-login ... are deprecated and "libsystemd" should be used
instead of them.
http://lists.freedesktop.org/archives/systemd-devel/2014-February/017146....
+PKG_CHECK_EXISTS(systemd >= 209, [HAVE_SYSTEMD_NEW=yes],
[HAVE_SYSTEMD_NEW=no])
+
dnl A macro to check presence of systemd on the system
AC_DEFUN([AM_CHECK_SYSTEMD],
[
PKG_CHECK_EXISTS(systemd,
[ HAVE_SYSTEMD=1, AC_SUBST(HAVE_SYSTEMD) ],
- [AC_MSG_ERROR([Could not detect systemd presence])]
- )
+ [AC_MSG_ERROR([Could not detect systemd presence])])
])
+AS_IF(test x$HAVE_SYSTEMD_NEW = xyes, login_lib_name=libsystemd,
^^^^^^^^^^^^^^^^
I know I recommended that name to you but development in systemd
is quite rapid. So in future we might need another variable
HAVE_SYSTEMD_NEWER.
So it migth be better to test an availability of library libsystemd.
It was introduced in systemd 209 and is not available on rhel 7.{0,1}
Something like
PKG_CHECK_EXISTS([libsystemd],
[HAVE_LIBSYSTEMD=yes],
[HAVE_LIBSYSTEMD=no])
instead of 1st line in file.
+ login_lib_name=libsystemd-login)
+
the square brackets are user on other places with macro AS_IF
src/external/intgcheck.m4:AS_IF([test -n "$PYTEST"], [HAVE_PYTEST=yes],
[HAVE_PYTEST=no])
src/external/ldap.m4:AS_IF([test -n "$SLAPD"], [HAVE_SLAPD=yes],
[HAVE_SLAPD=no])
src/external/libcmocka.m4: AS_IF([test x"$cmocka_required_headers" !=
x"no"],
src/external/libcmocka.m4- [PKG_CHECK_MODULES([CMOCKA], [cmocka],
[have_cmocka="yes"])]
AM_COND_IF([HAVE_SYSTEMD],
- [PKG_CHECK_MODULES([SYSTEMD_LOGIN], [libsystemd-login],
- [AC_DEFINE_UNQUOTED(HAVE_SYSTEMD_LOGIN, 1, [Build with libsystemdlogin
support])],
+ [PKG_CHECK_MODULES([SYSTEMD_LOGIN],
+ [$login_lib_name],
+ [AC_DEFINE_UNQUOTED(HAVE_SYSTEMD_LOGIN, 1,
+ [Build with libsystemdlogin support])],
[AC_MSG_NOTICE([Build without libsystemd-login support])])])
I would add at least 4 spaces here instead of 1.
So it will be clear that the code belongs to PKG_CHECK_MODULES
and not to the AM_COND_IF
dnl A macro to check presence of journald on the system
AC_DEFUN([AM_CHECK_JOURNALD],
[
- PKG_CHECK_MODULES(JOURNALD,
- libsystemd-journal,
- [AC_DEFINE_UNQUOTED([WITH_JOURNALD], 1, [journald is
available])])
+ AS_IF(test x$HAVE_SYSTEMD_NEW = xyes, journal_lib_name=libsystemd,
+ journal_lib_name=libsystemd-journal)
We do not have the same indentation
in autotools code. We do not have a rules
or coding style. So its safe to use the same indentation as code around.
+ PKG_CHECK_MODULES(JOURNALD, [$journal_lib_name],
+ [AC_DEFINE_UNQUOTED([WITH_JOURNALD], 1,
+ [journald is available])])
dnl Some older versions of pkg-config might not set these automatically
dnl while setting CFLAGS and LIBS manually twice doesn't hurt.
AC_SUBST([JOURNALD_CFLAGS])
--
2.4.3
LS