[gimp/wip/Jehan/meson-windows-official: 7/14] meson: fix libmng test.




commit c9a34b88a66af78dd3f79335331d4fce7c574f00
Author: Jehan <jehan girinstud io>
Date:   Thu Mar 31 14:42:29 2022 +0200

    meson: fix libmng test.
    
    The main problem was that file-mng would fail to build on Windows 32-bit
    even though the lib was detected. Actually this is because there are
    several possible calling conventions and this can be handled by defining
    the proper macro. This macro is well defined in the pkg-config file, but
    our build was not using it.
    
    So let's change the test to use pkg-config first. If this fails, we
    fallback to more basic method of finding the library. Additionally we
    augment this fallback test with a function check (as we do already in
    autotools) so that our configure test is reliable: we verify that the
    lib is there **and** that symbols are visible. Otherwise we'd end up
    with a successful configure test followed by a broken build (as until
    now in meson).
    
    See the nice explanation here and in next messages:
    https://github.com/msys2/MINGW-packages/issues/11136#issuecomment-1083711452

 meson.build | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/meson.build b/meson.build
index dd74ad6a59..0227e9524e 100644
--- a/meson.build
+++ b/meson.build
@@ -658,7 +658,14 @@ libpng_minver = '1.6.25'
 libpng = dependency('libpng', version: '>='+libpng_minver)
 MIMEtypes += [ 'image/png', 'image/x-icon']
 
-libmng = cc.find_library('mng', required: get_option('mng'))
+libmng = dependency('libmng', required: get_option('mng'))
+
+if not libmng.found()
+  libmng = cc.find_library('mng', required: get_option('mng'))
+  if libmng.found() and not cc.has_function('mng_create', dependencies: libmng)
+    libmng = no_dep
+  endif
+endif
 
 libaa = cc.find_library('aa', required: get_option('aa'))
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]