From: Tomas Krizek Date: Thu, 7 Feb 2019 13:02:04 +0000 (+0100) Subject: meson: systemd option with autodetection X-Git-Tag: v4.0.0~24^2~170 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2443cfa910a94fc0cabf2bb4444245ad93ccf2d7;p=thirdparty%2Fknot-resolver.git meson: systemd option with autodetection --- diff --git a/daemon/meson.build b/daemon/meson.build index 134a4bc14..b6e2cf7cf 100644 --- a/daemon/meson.build +++ b/daemon/meson.build @@ -31,7 +31,7 @@ luajit_has_setfuncs = run_command( ).returncode() == 0 ? '1' : '0' # daemon CFLAGS -c_args = [ +kresd_c_args += [ '-fPIE', # NOTE this triggers warning, but is needed for compatibility with meson 0.47.0 '-DROOTHINTS="@0@/root.hints"'.format(config.get('etc_dir')), '-DLIBEXT="@0@"'.format(lib_suffix), @@ -43,20 +43,10 @@ c_args = [ # TODO test build on osx if host_machine.system() == 'darwin' # luajit workaround for OS X https://luajit.org/install.html#embed - c_args += ['-pagezero_size', '10000', '-image_base', '100000000'] + kresd_c_args += ['-pagezero_size', '10000', '-image_base', '100000000'] endif -# optional systemd socket activation -message('--- optional kresd dependencies ---') -libsystemd = dependency('libsystemd', version: '>=227', required: false) -if libsystemd.found() - c_args += ['-DHAS_SYSTEMD'] - config.set('man_seealso_systemd', '\\fIkresd.systemd(7)\\fR, ') -endif -message('-----------------------------------') - - subdir('lua') @@ -77,7 +67,7 @@ if get_option('daemon') libsystemd, ], export_dynamic: true, - c_args: c_args, + c_args: kresd_c_args, install: true, install_dir: get_option('sbindir'), ) diff --git a/meson.build b/meson.build index de92d91da..3cf6561ee 100644 --- a/meson.build +++ b/meson.build @@ -29,6 +29,7 @@ message('------------------------------') # Variables libkres_soversion = 9 +kresd_c_args = [] ## Paths prefix = get_option('prefix') @@ -57,16 +58,40 @@ else endif endif +## Systemd +systemd = get_option('systemd') +if systemd != 'disabled' + message('--- systemd integration ---') + libsystemd = dependency('libsystemd', version: '>=227', required: systemd == 'enabled') + if libsystemd.found() + systemd = 'enabled' # with socket activation + else + libsystemd = dependency('libsystemd', required: systemd == 'nosocket') + if libsystemd.found() + systemd = 'nosocket' # without socket activation + else + systemd = 'disabled' # without systemd + endif + endif + if systemd != 'disabled' + kresd_c_args += ['-DHAS_SYSTEMD'] + endif + message('---------------------------') +endif + ## Configuration (for *.in files) config = configuration_data() config.set('keyfile_default', get_option('keyfile_default')) config.set('modules_dir', etc_dir) config.set('etc_dir', etc_dir) -config.set('man_seealso_systemd', '') config.set('version', meson.project_version()) config.set('date', run_command('scripts/get-date.sh', check: true).stdout().strip()) +# TODO use correct systemd man page +config.set('man_seealso_systemd', '') +#config.set('man_seealso_systemd', '\\fIkresd.systemd(7)\\fR, ') +# TODO use var instead add_global_arguments( '-D_GNU_SOURCE', '-Wtype-limits',