summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2020-05-26 20:50:16 +0200
committerMax Kellermann <max@musicpd.org>2020-05-26 20:50:56 +0200
commitf7b6431b6f02e9d479427dd2054cb97273e414e7 (patch)
treea4fb4381535f8f24f810e7570db960a19b9e5c8c /meson.build
parent03b9bd3a9e51b5ea36099d79ae69edc9cab6c6f6 (diff)
meson.build: work around Meson bug detecting strndup() on Windows
Work around Meson bug https://github.com/mesonbuild/meson/issues/3672
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build8
1 files changed, 7 insertions, 1 deletions
diff --git a/meson.build b/meson.build
index 7c5dcac9f..ab28340a6 100644
--- a/meson.build
+++ b/meson.build
@@ -142,7 +142,13 @@ conf.set('HAVE_GETPWNAM_R', compiler.has_function('getpwnam_r'))
conf.set('HAVE_GETPWUID_R', compiler.has_function('getpwuid_r'))
conf.set('HAVE_INITGROUPS', compiler.has_function('initgroups'))
conf.set('HAVE_FNMATCH', compiler.has_function('fnmatch'))
-conf.set('HAVE_STRNDUP', compiler.has_function('strndup', prefix: '#define _GNU_SOURCE\n#include <string.h>'))
+
+# Explicitly exclude Windows in this check because
+# https://github.com/mesonbuild/meson/issues/3672 (reported in 2018,
+# still not fixed in 2020) causes Meson to believe it exists, because
+# __builtin_strndup() exists (but strndup() still cannot be used).
+conf.set('HAVE_STRNDUP', not is_windows and compiler.has_function('strndup', prefix: '#define _GNU_SOURCE\n#include <string.h>'))
+
conf.set('HAVE_STRCASESTR', compiler.has_function('strcasestr'))
conf.set('HAVE_PRCTL', is_linux)