aboutsummaryrefslogtreecommitdiffstats
path: root/meson.build
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-09-02 17:29:20 -0400
committerDavid Robillard <d@drobilla.net>2023-09-22 23:54:50 -0400
commit6c632697fe1ea1255311bb3a0e56574766d182c7 (patch)
treef48047b2df31b1e038e4a5f21fd49021952c80d7 /meson.build
parent7c164613bf0e5d4a548830267b44a7241ac41c5e (diff)
downloadserd-6c632697fe1ea1255311bb3a0e56574766d182c7.tar.gz
serd-6c632697fe1ea1255311bb3a0e56574766d182c7.tar.bz2
serd-6c632697fe1ea1255311bb3a0e56574766d182c7.zip
Clean up meson formatting
Formatted automatically with muon, with some manual changes to make things format more nicely.
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build52
1 files changed, 27 insertions, 25 deletions
diff --git a/meson.build b/meson.build
index a9fa5643..f50c8f52 100644
--- a/meson.build
+++ b/meson.build
@@ -70,28 +70,30 @@ else
# Only use the features detected by the build system
platform_c_args += ['-DSERD_NO_DEFAULT_CONFIG'] + system_c_args
- # Define HAVE_SOMETHING symbols for all detected features
+ # Feature checks have a header to include and code for the body of main()
template = '#include <@0@>\nint main(void) { @1@; }'
- if cc.links(
- template.format('stdio.h', 'return fileno(stdin);'),
- args: system_c_args,
- name: 'fileno')
- platform_c_args += ['-DHAVE_FILENO']
- endif
- if cc.links(
- template.format('fcntl.h',
- 'posix_fadvise(0, 0, 4096, POSIX_FADV_SEQUENTIAL)'),
- args: system_c_args,
- name: 'posix_fadvise')
- platform_c_args += ['-DHAVE_POSIX_FADVISE']
- endif
- if cc.links(
- template.format('stdlib.h',
- 'void* mem=NULL; posix_memalign(&mem, 8U, 8U);'),
- args: system_c_args,
- name: 'posix_memalign')
- platform_c_args += ['-DHAVE_POSIX_MEMALIGN']
- endif
+ feature_tests = {
+ 'fileno': [
+ 'stdio.h',
+ 'return fileno(stdin);',
+ ],
+ 'posix_fadvise': [
+ 'fcntl.h',
+ 'posix_fadvise(0, 0, 4096, POSIX_FADV_SEQUENTIAL);',
+ ],
+ 'posix_memalign': [
+ 'stdlib.h',
+ 'void* mem=NULL; posix_memalign(&mem, 8U, 8U);',
+ ],
+ }
+
+ # Define HAVE_SOMETHING symbols for all detected features
+ foreach name, args : feature_tests
+ code = template.format(args[0], args[1])
+ if cc.links(code, args: system_c_args, name: name)
+ platform_c_args += ['-DHAVE_' + name.to_upper()]
+ endif
+ endforeach
endif
###########
@@ -199,9 +201,9 @@ if not meson.is_subproject()
summary(
{
- 'Install prefix': get_option('prefix'),
- 'Headers': get_option('prefix') / get_option('includedir'),
- 'Libraries': get_option('prefix') / get_option('libdir'),
+ 'Install prefix': get_option('prefix'),
+ 'Headers': get_option('prefix') / get_option('includedir'),
+ 'Libraries': get_option('prefix') / get_option('libdir'),
},
section: 'Directories',
)
@@ -221,7 +223,6 @@ endif
###########
ttl_metadata_files = files(
- 'serd.ttl',
'test/extra/abbreviate/manifest.ttl',
'test/extra/bad/manifest.ttl',
'test/extra/big/manifest.ttl',
@@ -232,6 +233,7 @@ ttl_metadata_files = files(
'test/extra/pretty/manifest.ttl',
'test/extra/qualify/manifest.ttl',
'test/extra/root/manifest.ttl',
+ 'serd.ttl',
)
subdir('scripts')