[Mesa-dev] [PATCH v3 22/48] meson: Don't check for posix_memalign on windows
Dylan Baker
dylan at pnwbakers.com
Tue Aug 7 00:51:02 UTC 2018
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.
---
meson.build | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/meson.build b/meson.build
index 4dc76732d4a..dfeeab8c11a 100644
--- a/meson.build
+++ b/meson.build
@@ -1014,13 +1014,22 @@ foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', 'endian.h', 'dlfcn.h'
pre_args += '-DHAVE_ at 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_ at 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
--
2.18.0
More information about the mesa-dev
mailing list