Add optional systemd integration
[tinc] / systemd / meson.build
1 dep_systemd = dependency('systemd', required: opt_systemd)
2 if not dep_systemd.found()
3   subdir_done()
4 endif
5
6 dir_systemd = get_option('systemd_dir')
7 if dir_systemd == ''
8   if meson_version.version_compare('>=0.58')
9     dir_systemd = dep_systemd.get_variable('systemdsystemunitdir', pkgconfig_define: ['prefix', prefix])
10   else
11     dir_systemd = dep_systemd.get_pkgconfig_variable('systemdsystemunitdir', define_variable: ['prefix', prefix])
12   endif
13 endif
14
15 systemd_conf = configuration_data()
16 systemd_conf.set('sysconfdir', dir_sysconf)
17 systemd_conf.set('sbindir', dir_sbin)
18
19 configure_file(input: 'tinc.service.in',
20                output: 'tinc.service',
21                configuration: systemd_conf,
22                install_dir: dir_systemd)
23
24 configure_file(input: 'tinc@.service.in',
25                output: 'tinc@.service',
26                configuration: systemd_conf,
27                install_dir: dir_systemd)
28