From dc37816d8eeb6aedb6d2af7403e53b54d9d0235f Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Wed, 26 May 2021 03:01:30 +0300 Subject: [PATCH 46/46] Meson: Support standalone libiconv Make iconv work when it's not provided by glibc, but in a separate libiconv library. See osdn #42395 Signed-off-by: Marko Lindqvist --- meson.build | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 86214bc4a8..9de0e2dc97 100644 --- a/meson.build +++ b/meson.build @@ -122,7 +122,6 @@ endforeach priv_functions = [ 'fork', 'vfork', - 'iconv', 'backtrace', 'bind', 'clock_gettime', @@ -263,6 +262,16 @@ int main(void) { struct ip_mreqn req; req.imr_ifindex = 0; return 0; }''') priv_conf_data.set('HAVE_IP_MREQN', 1) endif +if c_compiler.has_function('iconv') + priv_conf_data.set('HAVE_ICONV', 1) + iconv_lib_dep = [] +elif c_compiler.has_header_symbol('iconv.h', 'iconv') + priv_conf_data.set('HAVE_ICONV', 1) + iconv_lib_dep = c_compiler.find_library('iconv') +else + iconv_lib_dep = [] +endif + if c_compiler.compiles('''#include #include int main(void) { iconv_t cd; const char **c; iconv(cd, c, NULL, NULL); return 0; }''') @@ -575,7 +584,7 @@ common_lib = library('freeciv', c_compiler.find_library('z', dirs: cross_lib_path), c_compiler.find_library('libcurl', dirs: cross_lib_path), c_compiler.find_library('libsqlite3', dirs: cross_lib_path), - ws2_dep, jansson_dep, lua_dep, lzma_dep, bcrypt_lib_dep, + ws2_dep, jansson_dep, lua_dep, lzma_dep, bcrypt_lib_dep, iconv_lib_dep, dependency('threads')], install : true ) -- 2.30.2