meson: allow installing systemd service without systemd

A vendor may support systemd while not installing it in the build environment.
This would cause systemd to not be detected and the service to not be installed.

Changes the logic to be based off of explicitly listing the option instead of
automatically detected.

Signed-off-by: Aster Boese <asterboese@mailbox.org>
This commit is contained in:
Aster Boese 2026-01-25 20:12:10 -05:00
commit 60fb3ca6ad
No known key found for this signature in database
GPG key ID: EA066F07FD9BC6D4
3 changed files with 3 additions and 4 deletions

View file

@ -1,4 +1,4 @@
option('man', type : 'feature', value : 'auto',
description : 'build manpage with ronn')
option('systemd', type : 'feature', value : 'auto',
option('systemd', type : 'boolean', value : true,
description :'enable systemd support')

View file

@ -1,4 +1,3 @@
systemd = dependency('systemd', required: get_option('systemd'))
if systemd.found()
if get_option('systemd')
subdir('systemd')
endif

View file

@ -1,5 +1,5 @@
unitdir = systemd.get_variable(pkgconfig: 'systemdsystemunitdir')
prefixdir = get_option('prefix')
unitdir = join_paths(prefixdir, get_option('libdir'), 'systemd', 'system')
bindir = join_paths(prefixdir, get_option('bindir'))
unit_conf = configuration_data()