[weston v2] configure.ac: Add support for new versions of systemd

Pekka Paalanen ppaalanen at gmail.com
Fri Mar 13 01:28:25 PDT 2015


On Fri, 13 Mar 2015 00:56:10 +0000
Javier Jardón <jjardon at gnome.org> wrote:

> ... that only provide a unique libsystemd.pc file
> ---
>  configure.ac | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index d9d8d8f..5f2cbc1 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -341,14 +341,21 @@ AC_ARG_ENABLE(resize-optimization,
>  AS_IF([test "x$enable_resize_optimization" = "xyes"],
>        [AC_DEFINE([USE_RESIZE_POOL], [1], [Use resize memory pool as a performance optimization])])
>  
> -PKG_CHECK_MODULES(SYSTEMD_LOGIN, [libsystemd-login >= 198],
> -                  [have_systemd_login=yes], [have_systemd_login=no])
> +PKG_CHECK_MODULES([SYSTEMD_LOGIN],
> +                  [libsystemd >= 198],
> +                  [PKG_CHECK_MODULES([SYSTEMD_LOGIN],
> +                                     [libsystemd-login >= 198],
> +                                     [have_systemd_login=yes], [have_systemd_login=no])])

Hi,

am I reading this right:

if libsystemd >= 198 then
	if libsystemd-login >= 198 then
		have_systemd_login=yes
	else
		have_systend_login=no
	endif
else
	error "libsystemd required to build weston"
endif

And when I try this patch on my system without systemd, it indeed says:

	configure: error: Package requirements (libsystemd >= 198) were
	not met:

	No package 'libsystemd' found

So that's not right. Weston works just fine without systemd, too.

So I think you have to add an explicit test for libsystemd version
which removed the libsystemd-login.pc. Something like this:

if libsystemd >= <version where libsystemd-login.pc removed>
	if libsystemd >= 198
		have_systemd_login=yes
	else
		have_systemd_login=no
	endif
	if libsystemd >= 209
		have_systemd_login_209=yes
	else
		have_systemd_login_209=yes
	endif
else
	if libsystemd-login >= 198
		have_systemd_login=yes
	else
		have_systemd_login=no
	endif
	if libsystemd-login >= 209
		have_systemd_login_209=yes
	else
		have_systemd_login_209=yes
	endif
endif

And make sure that there is no default-error path, because according to
the current tests, weston can deal with logind missing and/or logind-209
missing.

Of course you can collapse the pseudocode I wrote since some version
checks are implied by others, but I think that would be the effective
idea.

Also, nesting a PKG_CHECK_MODULES inside a PKG_CHECK_MODULES invocation
is hard to read. Could you untangle that, please? I think that is the
reason why the >=209 check is not nested in the >=198 check. Maybe
using AS_IF would be ok...


Thanks,
pq

>  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")
>  
> -PKG_CHECK_MODULES(SYSTEMD_LOGIN_209, [libsystemd-login >= 209],
> -                  [have_systemd_login_209=yes], [have_systemd_login_209=no])
> +PKG_CHECK_MODULES([SYSTEMD_LOGIN_209],
> +                  [libsystemd >= 209],
> +                  [have_systemd_login_209=yes],
> +                  [PKG_CHECK_MODULES([SYSTEMD_LOGIN_209],
> +                                     [libsystemd-login >= 209],
> +                                     [have_systemd_login_209=yes], [have_systemd_login_209=no])])
>  AS_IF([test "x$have_systemd_login_209" = "xyes"],
>        [AC_DEFINE([HAVE_SYSTEMD_LOGIN_209], [1], [Have systemd-login >= 209])])
>  



More information about the wayland-devel mailing list