aboutsummaryrefslogtreecommitdiffstats
path: root/meson.build
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-07-15 15:42:52 -0400
committerDavid Robillard <d@drobilla.net>2022-07-16 09:33:02 -0400
commit51326d59fc1054b2a1c33467130cae7e159f0983 (patch)
treedcd1bb1e320f00b3d5a5db6caef2bd8c81c8cf80 /meson.build
parent208f680a7d2fc6b0b2fe11aea416de784235c6bb (diff)
downloadserd-51326d59fc1054b2a1c33467130cae7e159f0983.tar.gz
serd-51326d59fc1054b2a1c33467130cae7e159f0983.tar.bz2
serd-51326d59fc1054b2a1c33467130cae7e159f0983.zip
Define _POSIX_C_SOURCE globally in the build system
Using inconsistent defines like this that affect the standard library implementation can cause issues. So, doing this consistently for the whole library is a better approach, although it unfortunately makes the code more difficult to compile manually.
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build15
1 files changed, 13 insertions, 2 deletions
diff --git a/meson.build b/meson.build
index 6a3ce355..f8d7f439 100644
--- a/meson.build
+++ b/meson.build
@@ -36,6 +36,17 @@ subdir('meson/suppressions')
m_dep = cc.find_library('m', required: false)
+##########################
+# Platform Configuration #
+##########################
+
+platform_args = []
+if host_machine.system() in ['gnu', 'linux']
+ platform_args += [
+ '-D_POSIX_C_SOURCE=200809L',
+ ]
+endif
+
###########
# Library #
###########
@@ -70,7 +81,7 @@ endif
libserd = library(
meson.project_name() + library_suffix,
sources,
- c_args: c_suppressions + extra_c_args + [
+ c_args: c_suppressions + extra_c_args + platform_args + [
'-DSERD_INTERNAL',
'-DSERD_VERSION="@0@"'.format(meson.project_version()),
],
@@ -116,7 +127,7 @@ if not get_option('tools').disabled()
serdi = executable(
'serdi',
files('src/serdi.c'),
- c_args: c_suppressions,
+ c_args: c_suppressions + platform_args,
dependencies: serd_dep,
install: true,
link_args: tool_link_args,