chiark / gitweb /
Prep v236: Apply missing upstream updates to the build system
[elogind.git] / src / systemd / meson.build
1 # SPDX-License-Identifier: LGPL-2.1+
2 #
3 # Copyright 2017 Zbigniew JÄ™drzejewski-Szmek
4 #
5 # elogind is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU Lesser General Public License as published by
7 # the Free Software Foundation; either version 2.1 of the License, or
8 # (at your option) any later version.
9 #
10 # elogind is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
14 #
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with elogind; If not, see <http://www.gnu.org/licenses/>.
17
18 #if 0 /// No systemd-journal in elogind ...
19 # _systemd_headers = '''
20 #         sd-bus.h
21 #         sd-bus-protocol.h
22 #         sd-bus-vtable.h
23 #         sd-daemon.h
24 #         sd-event.h
25 #         sd-id128.h
26 #         sd-journal.h
27 #         sd-login.h
28 #         sd-messages.h
29 # '''.split()
30 #else
31 _systemd_headers = '''
32         sd-bus.h
33         sd-bus-protocol.h
34         sd-bus-vtable.h
35         sd-daemon.h
36         sd-event.h
37         sd-id128.h
38         sd-login.h
39         sd-messages.h
40 '''.split()
41 #endif // 0
42
43 # https://github.com/mesonbuild/meson/issues/1633
44 systemd_headers = files(_systemd_headers)
45
46 #  sd-device.h
47 #  sd-hwdb.h
48 #  sd-dhcp6-client.h
49 #  sd-dhcp6-lease.h
50 #  sd-dhcp-client.h
51 #  sd-dhcp-lease.h
52 #  sd-dhcp-server.h
53 #  sd-ipv4acd.h
54 #  sd-ipv4ll.h
55 #  sd-lldp.h
56 #  sd-ndisc.h
57 #  sd-netlink.h
58 #  sd-network.h
59 #  sd-path.h
60 #  sd-resolve.h
61 #  sd-utf8.h
62
63 install_headers(
64         systemd_headers,
65         '_sd-common.h',
66 #if 0 /// elogind needs them somewhere else
67 #         subdir : 'systemd')
68 #else
69         subdir : 'elogind/systemd')
70
71 meson.add_install_script(meson_symlink_headers,
72                          includedir,
73                          _systemd_headers,
74                          '_sd-common.h')
75 #endif // 0
76
77
78 ############################################################
79
80 opts = [['c'],
81         ['c', '-ansi'],
82         ['c', '-std=iso9899:1990']]
83
84 cxx = find_program('c++', required : false)
85 if cxx.found()
86         opts += [['c++']]
87 endif
88
89 foreach header : _systemd_headers
90         foreach opt : opts
91                 name = ''.join([header, ':'] + opt)
92                 test('cc-' + name,
93                      check_compilation_sh,
94                      args : cc.cmd_array() + ['-c', '-x'] + opt +
95                             ['-Werror', '-include',
96                              join_paths(meson.current_source_dir(), header)])
97         endforeach
98 endforeach