chiark / gitweb /
c3f82dc50ca2e8af31c3265d7440b4e7f3fc81b8
[elogind.git] / src / systemd / meson.build
1 # SPDX-License-Identifier: LGPL-2.1+
2 #
3 # Copyright 2017 Zbigniew JÄ™drzejewski-Szmek
4
5 #if 0 /// No systemd-journal in elogind ...
6 # _systemd_headers = '''
7 #         sd-bus.h
8 #         sd-bus-protocol.h
9 #         sd-bus-vtable.h
10 #         sd-daemon.h
11 #         sd-event.h
12 #         sd-id128.h
13 #         sd-journal.h
14 #         sd-login.h
15 #         sd-messages.h
16 # '''.split()
17 #else
18 _systemd_headers = '''
19         sd-bus.h
20         sd-bus-protocol.h
21         sd-bus-vtable.h
22         sd-daemon.h
23         sd-event.h
24         sd-id128.h
25         sd-login.h
26         sd-messages.h
27 '''.split()
28 #endif // 0
29
30 # https://github.com/mesonbuild/meson/issues/1633
31 systemd_headers = files(_systemd_headers)
32
33 #  sd-device.h
34 #  sd-hwdb.h
35 #  sd-dhcp6-client.h
36 #  sd-dhcp6-lease.h
37 #  sd-dhcp-client.h
38 #  sd-dhcp-lease.h
39 #  sd-dhcp-server.h
40 #  sd-ipv4acd.h
41 #  sd-ipv4ll.h
42 #  sd-lldp.h
43 #  sd-ndisc.h
44 #  sd-netlink.h
45 #  sd-network.h
46 #  sd-path.h
47 #  sd-resolve.h
48 #  sd-utf8.h
49
50 install_headers(
51         systemd_headers,
52         '_sd-common.h',
53 #if 0 /// elogind needs them somewhere else
54 #         subdir : 'systemd')
55 #else
56         subdir : 'elogind/systemd')
57
58 meson.add_install_script(meson_symlink_headers,
59                          includedir,
60                          _systemd_headers,
61                          '_sd-common.h')
62 #endif // 0
63
64
65 ############################################################
66
67 opts = [['c'],
68         ['c', '-ansi'],
69         ['c', '-std=iso9899:1990']]
70
71 cxx = find_program('c++', required : false)
72 if cxx.found()
73         opts += [['c++']]
74 endif
75
76 foreach header : _systemd_headers
77         foreach opt : opts
78                 name = ''.join([header, ':'] + opt)
79                 test('cc-' + name,
80                      check_compilation_sh,
81                      args : cc.cmd_array() + ['-c', '-x'] + opt +
82                             ['-Werror', '-include',
83                              join_paths(meson.current_source_dir(), header)])
84         endforeach
85 endforeach