summaryrefslogtreecommitdiff
path: root/src/systemd/meson.build
blob: 5a8760deb527ba4a5e6b989f2829fdc4c41c6a95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# SPDX-License-Identifier: LGPL-2.1-or-later

_systemd_headers = [
        'sd-bus.h',
        'sd-bus-protocol.h',
        'sd-bus-vtable.h',
        'sd-daemon.h',
        'sd-device.h',
        'sd-event.h',
        'sd-gpt.h',
        'sd-hwdb.h',
        'sd-id128.h',
        'sd-journal.h',
        'sd-login.h',
        'sd-messages.h',
        'sd-path.h',
]

# https://github.com/mesonbuild/meson/issues/1633
systemd_headers = files(_systemd_headers)

_not_installed_headers = [
        'sd-dhcp6-client.h',
        'sd-dhcp6-lease.h',
        'sd-dhcp-client.h',
        'sd-dhcp-lease.h',
        'sd-dhcp-option.h',
        'sd-dhcp6-option.h',
        'sd-dhcp-server.h',
        'sd-ipv4acd.h',
        'sd-ipv4ll.h',
        'sd-lldp-rx.h',
        'sd-lldp-tx.h',
        'sd-lldp.h',
        'sd-ndisc.h',
        'sd-netlink.h',
        'sd-network.h',
        'sd-radv.h',
        'sd-resolve.h',
]

install_headers(
        systemd_headers,
        '_sd-common.h',
        subdir : 'systemd')

############################################################

if want_tests == 'false'
        subdir_done()
endif

opts = [['c'],
        ['c', '-ansi'],
        ['c', '-std=iso9899:1990'],
        ['c', '-std=iso9899:2011']]

if cc.has_argument('-std=iso9899:2017')
        opts += [['c', '-std=iso9899:2017']]
endif

if cc.has_argument('-std=c2x')
        opts += [['c', '-std=c2x']]
endif

if cxx_cmd != ''
        opts += [['c++'],
                 ['c++', '-std=c++98'],
                 ['c++', '-std=c++11']]
        if cxx.has_argument('-std=c++14')
                opts += [['c++', '-std=c++14']]
        endif
        if cxx.has_argument('-std=c++17')
                opts += [['c++', '-std=c++17']]
        endif
        if cxx.has_argument('-std=c++20')
                opts += [['c++', '-std=c++20']]
        endif
        if cxx.has_argument('-std=c++23')
                opts += [['c++', '-std=c++23']]
        endif
endif

foreach header : _systemd_headers + _not_installed_headers + [libudev_h_path]
        foreach opt : opts
                std_name = opt.length() == 2 ? '_'.join(opt[1].split(':')) : ''
                test('cc-' + header.split('/')[-1] + '_' + opt[0] + std_name,
                     env,
                     suite : 'headers',
                     args : [cc.cmd_array(),
                             '-c',
                             '-x', opt,
                             '-Wall',
                             '-Wextra',
                             '-Werror',
                             '-pedantic',
                             '-Wno-long-long',
                             '-Wno-variadic-macros',
                             '-include', meson.current_source_dir() / header,
                             '-o/dev/null',
                             '/dev/null'])
        endforeach
endforeach