summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2018-04-18 13:54:12 -0700
committerDylan Baker <dylan@pnwbakers.com>2018-05-17 11:06:01 -0700
commit05363d44a0dce99d296510c37f24e38627d127d2 (patch)
tree9d6e50bd7091a5256d5c78fecf74432f52e11d8a
parent9ed71667be484f1918f9a1b8e4d32bbff172a67f (diff)
meson: Don't check for posix_memalign on windows
There's a mingw bug for this, it exports __builtin_posix_memalign but not posix_memalign, so the check will succeed, but compiling will fail.
-rw-r--r--meson.build13
1 files changed, 11 insertions, 2 deletions
diff --git a/meson.build b/meson.build
index c08614e385..43749e9628 100644
--- a/meson.build
+++ b/meson.build
@@ -972,13 +972,22 @@ foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', 'endian.h']
pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify())
endif
endforeach
-
-foreach f : ['strtof', 'mkostemp', 'posix_memalign', 'timespec_get', 'memfd_create']
+foreach f : ['strtof', 'mkostemp', 'timespec_get', 'memfd_create']
if cc.has_function(f)
pre_args += '-DHAVE_@0@'.format(f.to_upper())
endif
endforeach
+# MinGW provides a __builtin_posix_memalign function, but not a posix_memalign.
+# This means that this check will succeed, but then compilation will later
+# fail. MSVC doesn't have this function at all, so only check for it on
+# non-windows platforms.
+if host_machine.system() != 'windows'
+ if cc.has_function('posix_memalign')
+ pre_args += '-DHAVE_POSIX_MEMALIGN'
+ endif
+endif
+
# strtod locale support
if cc.links('''
#define _GNU_SOURCE