summaryrefslogtreecommitdiffstats
path: root/man/meson.build
diff options
context:
space:
mode:
Diffstat (limited to 'man/meson.build')
-rw-r--r--man/meson.build96
1 files changed, 95 insertions, 1 deletions
diff --git a/man/meson.build b/man/meson.build
index 403098a..69ea5c4 100644
--- a/man/meson.build
+++ b/man/meson.build
@@ -59,7 +59,15 @@ foreach tuple : manpages
mandirn = get_option('mandir') / ('man' + section)
- if condition == '' or conf.get(condition) == 1
+ have = true
+ foreach word : condition.split()
+ if conf.get(word) != 1
+ have = false
+ break
+ endif
+ endforeach
+
+ if have
file = files(tuple[0] + '.xml')
source_xml_files += file
if tuple[0].startswith('org.freedesktop.')
@@ -240,3 +248,89 @@ update_man_rules = custom_target(
'@0@/man/*.xml'.format(project_source_root),
'@0@/rules/meson.build'.format(meson.current_source_dir())],
depends : man_page_depends)
+
+############################################################
+
+simple_examples = files(
+ 'event-quick-child.c',
+ 'hwdb-usb-device.c',
+ 'id128-app-specific.c',
+ 'inotify-watch-tmp.c',
+ 'journal-enumerate-fields.c',
+ 'journal-iterate-foreach.c',
+ 'journal-iterate-poll.c',
+ 'journal-iterate-unique.c',
+ 'journal-iterate-wait.c',
+ 'journal-stream-fd.c',
+ 'logcontrol-example.c',
+ 'notify-selfcontained-example.c',
+ 'path-documents.c',
+ 'print-unit-path-call-method.c',
+ 'print-unit-path.c',
+ 'sd-bus-container-append.c',
+ 'sd-bus-container-read.c',
+ 'sd_bus_error-example.c',
+ 'sd_bus_service_reconnect.c',
+ 'send-unit-files-changed.c',
+ 'vtable-example.c',
+)
+
+examples = []
+foreach example : simple_examples
+ examples += [ { 'file' : example } ]
+endforeach
+
+if conf.get('HAVE_GLIB') == 1
+ examples += [
+ {
+ 'file' : files('glib-event-glue.c'),
+ 'opts' : [
+ '-I', libglib.get_variable('includedir') / 'glib-2.0',
+ '-I', libglib.get_variable('libdir') / 'glib-2.0/include',
+ ],
+ },
+ ]
+endif
+
+default_args = [
+ cc.cmd_array(),
+ '-c',
+ '-x', 'c',
+ '-pedantic',
+ '-Wall',
+ '-Werror',
+ '-Wextra',
+ '-Wno-unused-parameter',
+ '-o', '/dev/null',
+ '-I', meson.current_source_dir() / '../src',
+]
+
+std_args_in = [
+ [ '-std=c90', '-Wno-pedantic', '-Wno-variadic-macros', ],
+ [ '-std=c99', ],
+ [ '-std=c11', ],
+ [ '-std=c17', ],
+ [ '-std=c23', ],
+ [ '-std=gnu90', '-Wno-pedantic', '-Wno-variadic-macros', ],
+ [ '-std=gnu99', ],
+ [ '-std=gnu11', ],
+ [ '-std=gnu17', ],
+ [ '-std=gnu23', ],
+]
+
+std_args = []
+foreach std : std_args_in
+ if cc.has_argument(std[0])
+ std_args += [std]
+ endif
+endforeach
+
+foreach item : examples
+ foreach std : std_args
+ file = item.get('file')
+ test('cc-' + fs.stem(file) + '-' + std[0].split('=')[1],
+ env,
+ suite : 'example',
+ args : default_args + std + item.get('opts', []) + [file])
+ endforeach
+endforeach