Add iconv detection for meson build

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/394
This commit is contained in:
Akira TAGOH 2023-11-20 16:45:18 +09:00
parent a264a2c0ca
commit c53079fcc1
2 changed files with 49 additions and 33 deletions

View File

@ -1,6 +1,6 @@
project('fontconfig', 'c', project('fontconfig', 'c',
version: '2.14.2', version: '2.14.2',
meson_version : '>= 0.57.0', meson_version : '>= 0.60.0',
default_options: [ 'buildtype=debugoptimized'], default_options: [ 'buildtype=debugoptimized'],
) )
@ -209,6 +209,20 @@ if cc.links(files('meson-cc-tests/solaris-atomic-operations.c'), name: 'Solaris
endif endif
# Check iconv support
iconv_dep = []
found_iconv = 0
if host_machine.system() != 'windows'
iconv_dep = dependency('iconv', required: get_option('iconv'))
found_iconv = iconv_dep.found().to_int()
else
if get_option('iconv').enabled()
warning('-Diconv was set but this is not functional on Windows.')
endif
endif
conf.set('USE_ICONV', found_iconv)
deps += [iconv_dep]
prefix = get_option('prefix') prefix = get_option('prefix')
fonts_conf = configuration_data() fonts_conf = configuration_data()
@ -445,6 +459,7 @@ summary({
'NLS': not get_option('nls').disabled(), 'NLS': not get_option('nls').disabled(),
'Tests': not get_option('tests').disabled(), 'Tests': not get_option('tests').disabled(),
'Tools': not get_option('tools').disabled(), 'Tools': not get_option('tools').disabled(),
'iconv': found_iconv == 1,
}, section: 'General', bool_yn: true, list_sep: ', ') }, section: 'General', bool_yn: true, list_sep: ', ')
summary({ summary({
'Hinting': preferred_hinting, 'Hinting': preferred_hinting,

View File

@ -13,6 +13,7 @@ option('tools', type : 'feature', value : 'auto', yield : true,
description: 'Build command-line tools (fc-list, fc-query, etc.)') description: 'Build command-line tools (fc-list, fc-query, etc.)')
option('cache-build', type : 'feature', value : 'enabled', option('cache-build', type : 'feature', value : 'enabled',
description: 'Run fc-cache on install') description: 'Run fc-cache on install')
option('iconv', type: 'feature', value: 'disabled')
# Defaults # Defaults
option('default-hinting', type: 'combo', choices: ['none', 'slight', 'medium', 'full'], value: 'slight', option('default-hinting', type: 'combo', choices: ['none', 'slight', 'medium', 'full'], value: 'slight',