diff --git a/meson.build b/meson.build index b2515076..ab488832 100644 --- a/meson.build +++ b/meson.build @@ -134,8 +134,9 @@ if fftw_dep.found() endif # We can simplify this when requiring meson>=0.60.0 -magick_dep = dependency('MagickCore', required: false) +magick_dep = dependency(get_option('magick-package'), required: false) if not magick_dep.found() + # very old versions called it "ImageMagick" magick_dep = dependency('ImageMagick', required: get_option('magick')) endif if not get_option('magick').disabled() and magick_dep.found() @@ -146,7 +147,9 @@ if not get_option('magick').disabled() and magick_dep.found() endif if magick_dep.version().version_compare('>=7.0') cfg_var.set('HAVE_MAGICK7', '1') - elif magick_dep.version().version_compare('>=6.0') + else + # come here for imagemagick6, and graphicsmagick1.x, which also uses + # the im6 API cfg_var.set('HAVE_MAGICK6', '1') if cc.has_member('struct _ImageInfo', 'number_scenes', prefix : '#include ', dependencies: magick_dep) cfg_var.set('HAVE_NUMBER_SCENES', '1') @@ -167,8 +170,6 @@ if not get_option('magick').disabled() and magick_dep.found() if cc.compiles('#include \nint main() {(void)GetImageMagick(NULL, 0, NULL);}', name: 'GetImageMagick takes three arguments', dependencies: magick_dep) cfg_var.set('HAVE_GETIMAGEMAGICK3', '1') endif - else - error('Unsupported libmagick version') endif if 'load' in get_option('magick-features') diff --git a/meson_options.txt b/meson_options.txt index 42c5a045..6174e0be 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -19,6 +19,7 @@ option('jpeg-xl', type : 'feature', value : 'auto', description: 'Build with lib option('jpeg-xl-module', type : 'boolean', value : false, description: 'Build libjxl as module') option('lcms', type : 'feature', value : 'auto', description: 'Build with lcms2') option('magick', type : 'feature', value : 'auto', description: 'Build with libMagic') +option('magick-package', type : 'string', value : 'MagickCore', description: 'ImageMagick package to build with') option('magick-features', type : 'array', choices : ['load', 'save'], value : ['load', 'save'], description: 'Enable libMagic load or save capabilities') option('magick-module', type : 'boolean', value : false, description: 'Build libMagic as module') option('matio', type : 'feature', value : 'auto', description: 'Build with matio')