This is more-or-less the same as dist-check-includes. meson doesn't exactly
make it easy to call a compiler with a custom set of options. The tests
are included in the test listing.
meson_make_symlink = meson.source_root() + '/tools/meson-make-symlink.sh'
mkdir_p = 'mkdir -p $DESTDIR/@0@'
+check_compilation_sh = find_program('tools/meson-check-compilation.sh')
# if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
# /usr/sbin, /sbin, and fall back to the default from middle column.
# -*- mode: meson -*-
-systemd_headers = files('''
+_systemd_headers = '''
sd-bus.h
sd-bus-protocol.h
sd-bus-vtable.h
sd-journal.h
sd-login.h
sd-messages.h
-'''.split())
+'''.split()
+
+# https://github.com/mesonbuild/meson/issues/1633
+systemd_headers = files(_systemd_headers)
# sd-device.h
# sd-hwdb.h
systemd_headers,
'_sd-common.h',
subdir : 'systemd')
+
+
+############################################################
+
+opts = [[],
+ ['-ansi'],
+ ['-std=iso9899:1990']]
+
+foreach header : _systemd_headers
+ foreach opt : opts
+ name = ''.join([header] + opt)
+ test('cc-' + name,
+ check_compilation_sh,
+ args : cc.cmd_array() + ['-x', 'c'] + opt +
+ ['-Werror', '-include',
+ join_paths(meson.current_source_dir(), header)])
+ endforeach
+endforeach
--- /dev/null
+#!/bin/sh -e
+
+"$@" '-' '-c' -o/dev/null </dev/null