diff --git a/meson.build b/meson.build index 0227e9524e..cfa9e368bd 100644 --- a/meson.build +++ b/meson.build @@ -661,8 +661,14 @@ MIMEtypes += [ 'image/png', 'image/x-icon'] 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 = cc.find_library('mng', required: get_option('mng'),) + + mng_test_prefix = '' + if platform_windows + mng_test_prefix = '#define MNG_USE_DLL\n#include ' + endif + if libmng.found() and not cc.has_function('mng_create', dependencies: libmng, + prefix: mng_test_prefix) libmng = no_dep endif endif diff --git a/plug-ins/common/meson.build b/plug-ins/common/meson.build index 98153b260b..8a8f17bc5c 100644 --- a/plug-ins/common/meson.build +++ b/plug-ins/common/meson.build @@ -111,8 +111,13 @@ if libjxl.found() and libjxl_threads.found() endif if libmng.found() + mng_cflags = [] + if platform_windows + mng_cflags = [ '-DMNG_USE_DLL' ] + endif common_plugins_list += { 'name': 'file-mng', - 'deps': [ gtk3, gegl, libmng, libpng, ], + 'deps': [ gtk3, gegl, libmng, libpng, ], + 'cflags': mng_cflags, } endif