blob: c2ceae4a4758caaa457fa88c4ff8252627735233 [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001From e6783c99f051c6d8252db5f388d805cef0e16357 Mon Sep 17 00:00:00 2001
2From: Joshua Watt <JPEWhacker@gmail.com>
3Date: Thu, 20 Feb 2020 15:20:45 -0600
4Subject: [PATCH] build: Fix strndup detection on MinGW
5
6GCC and meson conspire together to incorrectly detect that strndup()
7exists on MinGW as __builtin_strndup, when no such function exists. As a
8work around, meson will skip looking for __builtin functions if an
9'#include' is in the prefix, so add '#include <string.h>' when looking
10for strndup().
11
12See: https://github.com/mesonbuild/meson/issues/3672
13
14Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
15Upstream-Status: Submitted [https://gitlab.freedesktop.org/wayland/wayland/merge_requests/63]
16---
17 meson.build | 2 +-
18 1 file changed, 1 insertion(+), 1 deletion(-)
19
Andrew Geissler82c905d2020-04-13 13:39:40 -050020--- a/meson.build
21+++ b/meson.build
22@@ -36,11 +36,11 @@ have_funcs = [
23 'posix_fallocate',
24 'prctl',
25 'memfd_create',
26- 'strndup',
27 ]
28 foreach f: have_funcs
29 config_h.set('HAVE_' + f.underscorify().to_upper(), cc.has_function(f))
30 endforeach
Andrew Geisslerc182c622020-05-15 14:13:32 -050031+config_h.set('HAVE_STRNDUP', cc.has_function('strndup') and cc.has_header_symbol('string.h', 'strndup'))
Andrew Geissler82c905d2020-04-13 13:39:40 -050032
33 if get_option('libraries')
34 ffi_dep = dependency('libffi')