]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
meson: systemd option with autodetection
authorTomas Krizek <tomas.krizek@nic.cz>
Thu, 7 Feb 2019 13:02:04 +0000 (14:02 +0100)
committerTomas Krizek <tomas.krizek@nic.cz>
Tue, 12 Mar 2019 09:43:23 +0000 (10:43 +0100)
daemon/meson.build
meson.build

index 134a4bc14345479156506ed3430a7de166970d2c..b6e2cf7cf41940596a0fbde482626f46b532ab2a 100644 (file)
@@ -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'),
   )
index de92d91dad78685110434444f76e721694c13c72..3cf6561eeea1bb519e353ae2cf2dc9bffcd301b1 100644 (file)
@@ -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',