summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--meson.build1
-rw-r--r--src/systemd/meson.build25
-rw-r--r--tools/meson-check-compilation.sh3
3 files changed, 27 insertions, 2 deletions
diff --git a/meson.build b/meson.build
index b752634c88..88f2523f43 100644
--- a/meson.build
+++ b/meson.build
@@ -409,6 +409,7 @@ etags = find_program('etags', required : false)
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.
diff --git a/src/systemd/meson.build b/src/systemd/meson.build
index c7d7d50963..f3b969bb2b 100644
--- a/src/systemd/meson.build
+++ b/src/systemd/meson.build
@@ -1,6 +1,6 @@
# -*- mode: meson -*-
-systemd_headers = files('''
+_systemd_headers = '''
sd-bus.h
sd-bus-protocol.h
sd-bus-vtable.h
@@ -10,7 +10,10 @@ systemd_headers = files('''
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
@@ -33,3 +36,21 @@ install_headers(
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
diff --git a/tools/meson-check-compilation.sh b/tools/meson-check-compilation.sh
new file mode 100644
index 0000000000..9bbe54669b
--- /dev/null
+++ b/tools/meson-check-compilation.sh
@@ -0,0 +1,3 @@
+#!/bin/sh -e
+
+"$@" '-' '-c' -o/dev/null </dev/null