]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/systemd/meson.build
core: reduce scope of variants
[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 sd-path.h
16 '''.split()
17
18 # https://github.com/mesonbuild/meson/issues/1633
19 systemd_headers = files(_systemd_headers)
20
21 _not_installed_headers = '''
22 sd-dhcp6-client.h
23 sd-dhcp6-lease.h
24 sd-dhcp-client.h
25 sd-dhcp-lease.h
26 sd-dhcp-option.h
27 sd-dhcp6-option.h
28 sd-dhcp-server.h
29 sd-ipv4acd.h
30 sd-ipv4ll.h
31 sd-lldp.h
32 sd-ndisc.h
33 sd-netlink.h
34 sd-network.h
35 sd-radv.h
36 sd-resolve.h
37 sd-utf8.h
38 '''.split()
39
40 install_headers(
41 systemd_headers,
42 '_sd-common.h',
43 subdir : 'systemd')
44
45
46 ############################################################
47
48 opts = [['c'],
49 ['c', '-ansi'],
50 ['c', '-std=iso9899:1990'],
51 ['c', '-std=iso9899:2011']]
52
53 if cc.has_argument('-std=iso9899:2017')
54 opts += [['c', '-std=iso9899:2017']]
55 endif
56
57 if add_languages('cpp', required : false)
58 opts += [['c++'],
59 ['c++', '-std=c++98'],
60 ['c++', '-std=c++11']]
61 if cc.has_argument('-std=c++14')
62 opts += [['c++', '-std=c++14']]
63 endif
64 if cc.has_argument('-std=c++17')
65 opts += [['c++', '-std=c++17']]
66 endif
67 endif
68
69 foreach header : _systemd_headers + _not_installed_headers + ['../libudev/libudev.h']
70 foreach opt : opts
71 name = ''.join(['cc-', header.split('/')[-1], ':'] + opt)
72 if want_tests != 'false'
73 test(name,
74 check_compilation_sh,
75 args : cc.cmd_array() + ['-c', '-x'] + opt +
76 ['-Werror', '-include',
77 join_paths(meson.current_source_dir(), header)])
78 endif
79 endforeach
80 endforeach