Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | From e6783c99f051c6d8252db5f388d805cef0e16357 Mon Sep 17 00:00:00 2001 |
| 2 | From: Joshua Watt <JPEWhacker@gmail.com> |
| 3 | Date: Thu, 20 Feb 2020 15:20:45 -0600 |
| 4 | Subject: [PATCH] build: Fix strndup detection on MinGW |
| 5 | |
| 6 | GCC and meson conspire together to incorrectly detect that strndup() |
| 7 | exists on MinGW as __builtin_strndup, when no such function exists. As a |
| 8 | work around, meson will skip looking for __builtin functions if an |
| 9 | '#include' is in the prefix, so add '#include <string.h>' when looking |
| 10 | for strndup(). |
| 11 | |
| 12 | See: https://github.com/mesonbuild/meson/issues/3672 |
| 13 | |
| 14 | Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> |
| 15 | Upstream-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 Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 20 | --- 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 Geissler | c182c62 | 2020-05-15 14:13:32 -0500 | [diff] [blame^] | 31 | +config_h.set('HAVE_STRNDUP', cc.has_function('strndup') and cc.has_header_symbol('string.h', 'strndup')) |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 32 | |
| 33 | if get_option('libraries') |
| 34 | ffi_dep = dependency('libffi') |