diff options
-rw-r--r-- | configure.ac | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/configure.ac b/configure.ac index 1d7c401..911f9c7 100644 --- a/configure.ac +++ b/configure.ac @@ -936,18 +936,32 @@ dnl --------------------------------------------------------------------------- AC_ARG_WITH(systemd, AS_HELP_STRING([--with-systemd], - [Add systemd support]),, - with_systemd=auto) + [Add systemd support]), + [with_systemd=$withval], [with_systemd=auto]) + +PKG_CHECK_MODULES(SYSTEMD, + [libsystemd-login libsystemd-daemon], + [have_systemd=yes], [have_systemd=no]) + +if test "x$with_systemd" = "xauto" ; then + if test x$have_systemd = xno ; then + use_systemd=no + else + use_systemd=yes + fi +else + use_systemd=$with_systemd +fi -use_systemd=no -if test "x$with_systemd" != "xno" ; then - use_systemd=yes - AC_DEFINE(WITH_SYSTEMD, 1, [systemd support]) +if test "x$use_systemd" = "xyes"; then + if test "x$have_systemd" = "xno"; then + AC_MSG_ERROR([Systemd support explicitly required, but systemd not found]) + fi - PKG_CHECK_MODULES(SYSTEMD, libsystemd-login libsystemd-daemon) + AC_DEFINE(WITH_SYSTEMD, 1, [systemd support]) fi -AM_CONDITIONAL(WITH_SYSTEMD, test x$use_systemd = xyes) -AC_SUBST(WITH_SYSTEMD) +AC_SUBST(SYSTEMD_CFLAGS) +AC_SUBST(SYSTEMD_LIBS) dnl --------------------------------------------------------------------------- dnl libmatekbd |