meson: fix tristate behavior for systemd_notify option

The old logic was broken for the 'auto' case in that HAVE_SYSTEMD_DAEMON
was only defined when systemd_notify was 'true'.
This commit is contained in:
Mike Gilbert 2024-01-12 15:59:25 -05:00
parent cad42fcb08
commit fe55806284
2 changed files with 16 additions and 6 deletions

View file

@ -91,7 +91,7 @@ endif
conf_data.set('HAVE_LIBBSD', libbsd_dep.found() ? '1' : false)
# Note: this symbol is used by libXtrans.
conf_data.set('HAVE_SYSTEMD_DAEMON', build_systemd ? '1' : false)
conf_data.set('HAVE_SYSTEMD_DAEMON', libsystemd_daemon_dep.found() ? '1' : false)
conf_data.set('CONFIG_UDEV', build_udev ? '1' : false)
conf_data.set('CONFIG_UDEV_KMS', build_udev_kms ? '1' : false)
conf_data.set('HAVE_DBUS', build_dbus ? '1' : false)

View file

@ -107,11 +107,21 @@ xfont2_dep = dependency('xfont2', version: '>= 2.0')
dbus_required = get_option('systemd_logind') == 'true'
dbus_dep = dependency('dbus-1', version: '>= 1.0', required: dbus_required)
build_systemd = get_option('systemd_notify') == 'true'
# libsystemd-daemon was moved into libsystemd in version 209
libsystemd_daemon_dep = dependency('libsystemd', version: '>= 209', required: false)
if not libsystemd_daemon_dep.found()
libsystemd_daemon_dep = dependency('libsystemd-daemon', required: false)
systemd_notify = get_option('systemd_notify')
libsystemd_required = systemd_notify == 'true'
libsystemd_wanted = systemd_notify in ['auto','true']
if libsystemd_wanted
# libsystemd-daemon was moved into libsystemd in version 209
libsystemd_daemon_dep = dependency('libsystemd', version: '>= 209', required: false)
if not libsystemd_daemon_dep.found()
libsystemd_daemon_dep = dependency('libsystemd-daemon', required: false)
endif
if libsystemd_required and not libsystemd_daemon_dep.found()
error('libsystemd required but not found')
endif
else
libsystemd_daemon_dep = disabler()
endif
build_hashtable = false