]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: add dist-check-includes replacement
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 16 Apr 2017 02:50:56 +0000 (22:50 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 24 Apr 2017 01:47:29 +0000 (21:47 -0400)
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.build
src/systemd/meson.build
tools/meson-check-compilation.sh [new file with mode: 0644]

index b752634c88c0aea02223db1a56e6fae584e8b3af..88f2523f437d5aede9852bccc5dc450338b5e663 100644 (file)
@@ -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.
index c7d7d5096346ac01d584886db8ec3e15749cdd1c..f3b969bb2b1aa29bc826bcf8b53bfefcb18a6564 100644 (file)
@@ -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 (file)
index 0000000..9bbe546
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh -e
+
+"$@" '-' '-c' -o/dev/null </dev/null