]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/systemd/meson.build
pkgconfig: define variables relative to ${prefix}/${rootprefix}/${sysconfdir}
[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 cxx = find_program('c++', required : false)
56 if cxx.found()
57 opts += [['c++'],
58 ['c++', '-std=c++98'],
59 ['c++', '-std=c++11']]
60 if cc.has_argument('-std=c++14')
61 opts += [['c++', '-std=c++14']]
62 endif
63 if cc.has_argument('-std=c++17')
64 opts += [['c++', '-std=c++17']]
65 endif
66 endif
67
68 foreach header : _systemd_headers + _not_installed_headers + ['../libudev/libudev.h']
69 foreach opt : opts
70 name = ''.join(['cc-', header.split('/')[-1], ':'] + opt)
71 if want_tests != 'false'
72 test(name,
73 check_compilation_sh,
74 args : cc.cmd_array() + ['-c', '-x'] + opt +
75 ['-Werror', '-include',
76 join_paths(meson.current_source_dir(), header)])
77 endif
78 endforeach
79 endforeach