GNOME Bugzilla – Bug 795876
meson: Fix checks for posix_memalign and stpcpy
Last modified: 2018-05-21 15:43:21 UTC
The 'no-builtin' checks were just plain wrong. For accurate detection of functions, use has_function with a header in the prefix. This also allows cross-files to override the result by setting `has_function_stpcpy = false`, etc in [extra properties]
Created attachment 371769 [details] [review] meson: Fix checks for posix_memalign and stpcpy
Does this work correctly on MSYS2 and MinGW, as per bug #794555 and bug #793729?
I have tested this on MinGW-w64 from MSYS, but not the same from MSYS2. I added this has_function feature for more accurate function detection because of MSYS2 and MSYS2 shipping broken toolchains, so it should work. I'll test it tomorrow just to be sure. I forgot to mention that the existing check is wrong on Android, will add that to the commit message too.
(In reply to Nirbheek Chauhan from comment #3) > I'll test it tomorrow just to be sure. Did you get round to this?
(In reply to Philip Withnall from comment #4) > (In reply to Nirbheek Chauhan from comment #3) > > I'll test it tomorrow just to be sure. > > Did you get round to this? It looks like MSYS2 MinGW-w64 fixed its toolchain and `posix_memalign` and `stpcpy` are no longer detected even in the case without #include in prefix. However, this is still needed for Android and for MSYS MinGW-w64.
Created attachment 371838 [details] [review] meson: Fix checks for posix_memalign and stpcpy The 'no-builtin' checks were just plain wrong. For accurate detection of functions, use has_function with a header in the prefix. This fixes posix_memalign detection on Android and on MinGW32, MSYS-MinGW-w64, and old versions of MSYS2-MinGW-w64. Using the header in the `prefix:` is generally a good idea because of how macOS does targetting of specific macOS releases at compile time. This also allows cross-files to override the result by setting `has_function_stpcpy = false`, etc in [extra properties]
(In reply to Nirbheek Chauhan from comment #5) > (In reply to Philip Withnall from comment #4) > > (In reply to Nirbheek Chauhan from comment #3) > > > I'll test it tomorrow just to be sure. > > > > Did you get round to this? > > It looks like MSYS2 MinGW-w64 fixed its toolchain and `posix_memalign` and > `stpcpy` are no longer detected even in the case without #include in prefix. > > However, this is still needed for Android and for MSYS MinGW-w64. MSYS2 still isn't fixed I think, but I added a meson patch in MSYS2 to force it some time ago: https://github.com/Alexpux/MINGW-packages/blob/master/mingw-w64-meson/force-func-detect.patch I can confirm that passing the prefix makes things work either way and I'm going to remove the msys2 patch.
(In reply to Christoph Reiter (lazka) from comment #7) > I can confirm that passing the prefix makes things work either way and I'm > going to remove the msys2 patch. I've proposed to remove the patch here: https://github.com/Alexpux/MINGW-packages/pull/3717
Review of attachment 371838 [details] [review]: OK.
Comment on attachment 371838 [details] [review] meson: Fix checks for posix_memalign and stpcpy git bz timed out, pushed manually.