summaryrefslogtreecommitdiffstats
path: root/modules/dnstap/meson.build
blob: 7bf73b7c89e6ee0defbea6269ccd567727d3ff51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# C module: dnstap
# SPDX-License-Identifier: GPL-3.0-or-later

dnstap_src = files([
  'dnstap.c',
])

## dnstap dependencies
build_dnstap = false
if get_option('dnstap') != 'disabled'
  dnstap_required = get_option('dnstap') == 'enabled'
  message('--- dnstap module dependencies ---')
  libprotobuf_c = dependency('libprotobuf-c', version: '>=1', required: dnstap_required)
  libfstrm = dependency('libfstrm', version: '>=0.2', required: dnstap_required)
  protoc_c = find_program('protoc-c', required: dnstap_required)
  message('----------------------------------')
  if libprotobuf_c.found() and libfstrm.found() and protoc_c.found()
    build_dnstap = true
  endif
endif


if build_dnstap
  c_src_lint += dnstap_src

  # generate protobuf-c sources using protoc-c
  dnstap_pb = custom_target(
    'dnstap_pb',
    command: [
      protoc_c,
      '--c_out=' + meson.current_build_dir(),
      '--proto_path', meson.current_source_dir(),
      meson.current_source_dir() / 'dnstap.proto',
    ],
    input: [ 'dnstap.proto' ],
    output: [
      'dnstap.pb-c.h',
      'dnstap.pb-c.c',
    ],
  )

  # build dnstap module
  dnstap_mod = shared_module(
    'dnstap',
    dnstap_src,
    dependencies: [
      declare_dependency(sources: dnstap_pb),
      libfstrm,
      libprotobuf_c,
    ],
    include_directories: mod_inc_dir,
    name_prefix: '',
    install: true,
    install_dir: modules_dir,
  )
endif