summaryrefslogtreecommitdiff
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
parent03b9bd3a9e51b5ea36099d79ae69edc9cab6c6f6 (diff)
meson.build: work around Meson bug detecting strndup() on Windows
Work around Meson bug https://github.com/mesonbuild/meson/issues/3672
-rw-r--r--NEWS1
-rw-r--r--meson.build8
2 files changed, 8 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 35b762de3..44252f4e6 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ ver 0.21.24 (not yet released)
- simple: fix crash when mounting twice
* fix unit test failure
* fix build failure with Android NDK r21
+* work around Meson bug breaking the Windows build with GCC 10
ver 0.21.23 (2020/04/23)
* protocol
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)