]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/systemd/meson.build
Merge pull request #11827 from keszybz/pkgconfig-variables
[thirdparty/systemd.git] / src / systemd / meson.build
1 # SPDX-License-Identifier: LGPL-2.1+
2
3 _systemd_headers = '''
4 sd-bus.h
5 sd-bus-protocol.h
6 sd-bus-vtable.h
7 sd-daemon.h
8 sd-device.h
9 sd-event.h
10 sd-hwdb.h
11 sd-id128.h
12 sd-journal.h
13 sd-login.h
14 sd-messages.h
15 '''.split()
16
17 # https://github.com/mesonbuild/meson/issues/1633
18 systemd_headers = files(_systemd_headers)
19
20 _not_installed_headers = '''
21 sd-dhcp6-client.h
22 sd-dhcp6-lease.h
23 sd-dhcp-client.h
24 sd-dhcp-lease.h
25 sd-dhcp-server.h
26 sd-ipv4acd.h
27 sd-ipv4ll.h
28 sd-lldp.h
29 sd-ndisc.h
30 sd-netlink.h
31 sd-network.h
32 sd-path.h
33 sd-radv.h
34 sd-resolve.h
35 sd-utf8.h
36 '''.split()
37
38 install_headers(
39 systemd_headers,
40 '_sd-common.h',
41 subdir : 'systemd')
42
43
44 ############################################################
45
46 opts = [['c'],
47 ['c', '-ansi'],
48 ['c', '-std=iso9899:1990'],
49 ['c', '-std=iso9899:2011']]
50
51 if cc.has_argument('-std=iso9899:2017')
52 opts += [['c', '-std=iso9899:2017']]
53 endif
54
55 if add_languages('cpp', required : false)
56 opts += [['c++'],
57 ['c++', '-std=c++98'],
58 ['c++', '-std=c++11']]
59 if cc.has_argument('-std=c++14')
60 opts += [['c++', '-std=c++14']]
61 endif
62 if cc.has_argument('-std=c++17')
63 opts += [['c++', '-std=c++17']]
64 endif
65 endif
66
67 foreach header : _systemd_headers + _not_installed_headers + ['../libudev/libudev.h']
68 foreach opt : opts
69 name = ''.join(['cc-', header.split('/')[-1], ':'] + opt)
70 if want_tests != 'false'
71 test(name,
72 check_compilation_sh,
73 args : cc.cmd_array() + ['-c', '-x'] + opt +
74 ['-Werror', '-include',
75 join_paths(meson.current_source_dir(), header)])
76 endif
77 endforeach
78 endforeach