Re: [PATCH weston] configure.ac: fixup systemd/systemd-login detection

2018-03-15 Thread Michael Tretter
On Wed, 14 Mar 2018 14:06:59 +, Emil Velikov wrote:
> From: Emil Velikov 
> 
> Current systemd/systemd-login integration requires dbus. Although that
> is far from clear the way current checks are handled.
> 
> Be explicit and clear, effectively fixing cases where the systemd
> auto detection will trip when dbus is explicitly disabled.
> 
> Using git show -w will make things easier to read ;-)
> 
> Cc: Michael Tretter 
> Reported-by: Michael Tretter 
> Signed-off-by: Emil Velikov 
> ---
> Michael, can you give this a try instead?
> ---
>  configure.ac | 29 +
>  1 file changed, 17 insertions(+), 12 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index dd344d6a..89b89d3c 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -524,7 +524,11 @@ AC_ARG_ENABLE(systemd-login,
>AS_HELP_STRING([--enable-systemd-login],
>   [Enable logind support]),,
>enable_systemd_login=auto)
> -if test x$enable_systemd_login != xno -a x$have_dbus != xno; then
> +if test x$enable_systemd_login != xno; then
> +  if test x$enable_systemd_login = xyes -a x$enable_dbus = xno; then
> +AC_MSG_ERROR([systemd-login support explicitly requested, but dbus not 
> available])
> +  fi

These checks allow to configure systemd login support without dbus by
setting enable_systemd_login=auto and enable_dbus=no. In this case,
systemd login support should be disabled without error.

Having a separate message for dbus is good, but not sure if the
conditions are actually clearer.

> +
>PKG_CHECK_MODULES(SYSTEMD_LOGIN,
>  [libsystemd >= 209],
>  [have_systemd_login_209=yes;have_systemd_login=yes],
> @@ -537,20 +541,21 @@ if test x$enable_systemd_login != xno -a x$have_dbus != 
> xno; then
>[have_systemd_login=yes],
>[have_systemd_login=no])
>  ])
> -else
> -  have_systemd_login=no
> -fi
>  
> -if test "x$have_systemd_login" = "xno" -a "x$enable_systemd_login" = "xyes"; 
> then
> -  AC_MSG_ERROR([systemd-login support explicitly enabled, but can't find 
> libsystemd>=209, libsystemd-login or dbus])
> -fi
> +  if test "x$have_systemd_login" = "xno" -a "x$enable_systemd_login" = 
> "xyes"; then
> +AC_MSG_ERROR([systemd-login support explicitly requested, but can't find 
> libsystemd>=209 or libsystemd-login])
> +  fi
>  
> -AS_IF([test "x$have_systemd_login" = "xyes"],
> -  [AC_DEFINE([HAVE_SYSTEMD_LOGIN], [1], [Have systemd-login])])
> -AM_CONDITIONAL(HAVE_SYSTEMD_LOGIN, test "x$have_systemd_login" = "xyes")
> +  if test "x$have_systemd_login" = "xyes"; then
> +AC_DEFINE([HAVE_SYSTEMD_LOGIN], [1], [Have systemd-login])]
> +  else
> +have_systemd_login=no
> +  fi

The else branch is not needed, because it is only taken if
have_systemd_login already is no.

Michael

>  
> -AS_IF([test "x$have_systemd_login_209" = "xyes"],
> -  [AC_DEFINE([HAVE_SYSTEMD_LOGIN_209], [1], [Have systemd-login >= 
> 209])])
> +  AS_IF([test "x$have_systemd_login_209" = "xyes"],
> +[AC_DEFINE([HAVE_SYSTEMD_LOGIN_209], [1], [Have systemd-login >= 
> 209])])
> +fi
> +AM_CONDITIONAL(HAVE_SYSTEMD_LOGIN, test "x$have_systemd_login" = "xyes")
>  
>  
>  # Note that other features might want libxml2, or this feature might use
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston] configure.ac: fixup systemd/systemd-login detection

2018-03-14 Thread Emil Velikov
From: Emil Velikov 

Current systemd/systemd-login integration requires dbus. Although that
is far from clear the way current checks are handled.

Be explicit and clear, effectively fixing cases where the systemd
auto detection will trip when dbus is explicitly disabled.

Using git show -w will make things easier to read ;-)

Cc: Michael Tretter 
Reported-by: Michael Tretter 
Signed-off-by: Emil Velikov 
---
Michael, can you give this a try instead?
---
 configure.ac | 29 +
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/configure.ac b/configure.ac
index dd344d6a..89b89d3c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -524,7 +524,11 @@ AC_ARG_ENABLE(systemd-login,
   AS_HELP_STRING([--enable-systemd-login],
  [Enable logind support]),,
   enable_systemd_login=auto)
-if test x$enable_systemd_login != xno -a x$have_dbus != xno; then
+if test x$enable_systemd_login != xno; then
+  if test x$enable_systemd_login = xyes -a x$enable_dbus = xno; then
+AC_MSG_ERROR([systemd-login support explicitly requested, but dbus not 
available])
+  fi
+
   PKG_CHECK_MODULES(SYSTEMD_LOGIN,
 [libsystemd >= 209],
 [have_systemd_login_209=yes;have_systemd_login=yes],
@@ -537,20 +541,21 @@ if test x$enable_systemd_login != xno -a x$have_dbus != 
xno; then
   [have_systemd_login=yes],
   [have_systemd_login=no])
 ])
-else
-  have_systemd_login=no
-fi
 
-if test "x$have_systemd_login" = "xno" -a "x$enable_systemd_login" = "xyes"; 
then
-  AC_MSG_ERROR([systemd-login support explicitly enabled, but can't find 
libsystemd>=209, libsystemd-login or dbus])
-fi
+  if test "x$have_systemd_login" = "xno" -a "x$enable_systemd_login" = "xyes"; 
then
+AC_MSG_ERROR([systemd-login support explicitly requested, but can't find 
libsystemd>=209 or libsystemd-login])
+  fi
 
-AS_IF([test "x$have_systemd_login" = "xyes"],
-  [AC_DEFINE([HAVE_SYSTEMD_LOGIN], [1], [Have systemd-login])])
-AM_CONDITIONAL(HAVE_SYSTEMD_LOGIN, test "x$have_systemd_login" = "xyes")
+  if test "x$have_systemd_login" = "xyes"; then
+AC_DEFINE([HAVE_SYSTEMD_LOGIN], [1], [Have systemd-login])]
+  else
+have_systemd_login=no
+  fi
 
-AS_IF([test "x$have_systemd_login_209" = "xyes"],
-  [AC_DEFINE([HAVE_SYSTEMD_LOGIN_209], [1], [Have systemd-login >= 209])])
+  AS_IF([test "x$have_systemd_login_209" = "xyes"],
+[AC_DEFINE([HAVE_SYSTEMD_LOGIN_209], [1], [Have systemd-login >= 
209])])
+fi
+AM_CONDITIONAL(HAVE_SYSTEMD_LOGIN, test "x$have_systemd_login" = "xyes")
 
 
 # Note that other features might want libxml2, or this feature might use
-- 
2.16.0

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel