Commit 3882a5a2 authored by aeolio's avatar aeolio

src/lib/icu: fix iconv() detection when libiconv is installed

parent ac060889
...@@ -12,17 +12,23 @@ if is_windows ...@@ -12,17 +12,23 @@ if is_windows
icu_sources += 'Win32.cxx' icu_sources += 'Win32.cxx'
endif endif
iconv_dep = []
if icu_dep.found() if icu_dep.found()
icu_sources += [ icu_sources += [
'Util.cxx', 'Util.cxx',
'Init.cxx', 'Init.cxx',
] ]
elif not get_option('iconv').disabled() elif not get_option('iconv').disabled()
have_iconv = compiler.has_function('iconv', prefix : '#include <iconv.h>') # an installed iconv library will make the builtin iconf() unavailable,
conf.set('HAVE_ICONV', have_iconv) # so search for the library first and pass it as (possible) dependency
iconv_dep = compiler.find_library('libiconv', required: false)
have_iconv = compiler.has_function('iconv',
dependencies: iconv_dep,
prefix : '#include <iconv.h>')
if not have_iconv and get_option('iconv').enabled() if not have_iconv and get_option('iconv').enabled()
error('iconv() not available') error('iconv() not available')
endif endif
conf.set('HAVE_ICONV', have_iconv)
endif endif
icu = static_library( icu = static_library(
...@@ -31,6 +37,7 @@ icu = static_library( ...@@ -31,6 +37,7 @@ icu = static_library(
include_directories: inc, include_directories: inc,
dependencies: [ dependencies: [
icu_dep, icu_dep,
iconv_dep,
fmt_dep, fmt_dep,
], ],
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment