meson: port ncpmc iconv solution
Properly deals with iconv, unlike the current solution. have_iconv fails when libiconv CFLAGS are passed to the compiler. Tested under OpenWrt with its CONFIG_BUILD_NLS, which adds libiconv include flags. Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
956c5faebb
commit
cc557c4d60
1
NEWS
1
NEWS
|
@ -1,6 +1,7 @@
|
||||||
ver 0.23.9 (not yet released)
|
ver 0.23.9 (not yet released)
|
||||||
* output
|
* output
|
||||||
- pipewire: set app icon
|
- pipewire: set app icon
|
||||||
|
* improve iconv detection
|
||||||
|
|
||||||
ver 0.23.8 (2022/07/09)
|
ver 0.23.8 (2022/07/09)
|
||||||
* storage
|
* storage
|
||||||
|
|
|
@ -18,17 +18,25 @@ if icu_dep.found()
|
||||||
'Util.cxx',
|
'Util.cxx',
|
||||||
'Init.cxx',
|
'Init.cxx',
|
||||||
]
|
]
|
||||||
elif not get_option('iconv').disabled()
|
else
|
||||||
# an installed iconv library will make the builtin iconv() unavailable,
|
if meson.version().version_compare('>= 0.60')
|
||||||
# so search for the library first and pass it as (possible) dependency
|
iconv_dep = dependency('iconv', required: get_option('iconv'))
|
||||||
iconv_dep = compiler.find_library('libiconv', required: false)
|
conf.set('HAVE_ICONV', iconv_dep.found())
|
||||||
have_iconv = compiler.has_function('iconv',
|
elif not get_option('iconv').disabled()
|
||||||
dependencies: iconv_dep,
|
iconv_open_snippet = '''#include <iconv.h>
|
||||||
prefix : '#include <iconv.h>')
|
int main() {
|
||||||
if not have_iconv and get_option('iconv').enabled()
|
iconv_open("","");
|
||||||
error('iconv() not available')
|
}'''
|
||||||
|
have_iconv = compiler.links(iconv_open_snippet, name: 'iconv_open')
|
||||||
|
if not have_iconv
|
||||||
|
iconv_dep = compiler.find_library('iconv', required: false)
|
||||||
|
have_iconv = compiler.links(iconv_open_snippet, dependencies: iconv_dep, name: 'iconv_open')
|
||||||
|
endif
|
||||||
|
if not have_iconv and get_option('iconv').enabled()
|
||||||
|
error('iconv() not available')
|
||||||
|
endif
|
||||||
|
conf.set('HAVE_ICONV', have_iconv)
|
||||||
endif
|
endif
|
||||||
conf.set('HAVE_ICONV', have_iconv)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
icu = static_library(
|
icu = static_library(
|
||||||
|
|
Loading…
Reference in New Issue