meson: improve iconv detection

This commit is contained in:
Ryan Lucia 2021-02-22 12:25:36 -05:00
parent c6f4ea45aa
commit 2abb098bd1
2 changed files with 10 additions and 4 deletions

View file

@ -77,10 +77,13 @@ cxx = meson.get_compiler('cpp')
cc = meson.get_compiler('c')
deps += cc.find_library('m', required: false)
deps += cc.find_library('dl', required: false)
if not cxx.check_header('iconv.h')
iconv_dep = cc.find_library('iconv', required: false)
if not (iconv_dep.found() or cc.has_function('iconv_open'))
iconv_sp = subproject('iconv') # this really needs to be replaced with a proper port
deps += iconv_sp.get_variable('libiconv_dep')
iconv_dep = iconv_sp.get_variable('libiconv_dep')
endif
deps += iconv_dep
deps += dependency('libass', version: '>=0.9.7',
fallback: ['libass', 'libass_dep'])

View file

@ -61,9 +61,12 @@ else
locale_args += '-DBOOST_LOCALE_NO_WINAPI_BACKEND=1'
endif
if not cpp.check_header('iconv.h')
locale_deps += dependency('iconv')
cxx = meson.get_compiler('cpp')
iconv_dep = cxx.find_library('iconv', required: false)
if not (iconv_dep.found() or cxx.has_function('iconv_open'))
iconv_dep = dependency('iconv')
endif
locale_deps += iconv_dep
locale_args += '-DBOOST_LOCALE_WITH_ICONV=1'
locale_deps += icu_deps