From d4dacd96aaf6153aee441b6f951fb2b6c4abfa94 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Wed, 22 Feb 2023 00:45:57 +0200
Subject: [PATCH 34/34] Meson: Allow build without iconv implementation also
 when header found

Iconv is not a hard requirement, but build success when it's
not present. Inconsistently the build failed when it had already
found iconv header, but the implementation was not found.

See osdn #47469

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 meson.build | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index 811d8278af..8b6125791d 100644
--- a/meson.build
+++ b/meson.build
@@ -545,8 +545,11 @@ if c_compiler.has_function('iconv', args: header_arg)
   priv_conf_data.set('HAVE_ICONV', 1)
   iconv_lib_dep = []
 elif c_compiler.has_header_symbol('iconv.h', 'iconv', args: header_arg)
-  priv_conf_data.set('HAVE_ICONV', 1)
-  iconv_lib_dep = c_compiler.find_library('iconv', dirs: cross_lib_path)
+  iconv_lib_dep = c_compiler.find_library('iconv', dirs: cross_lib_path,
+                                          required: false)
+  if iconv_lib_dep.found()
+    priv_conf_data.set('HAVE_ICONV', 1)
+  endif
 else
   iconv_lib_dep = []
 endif
-- 
2.39.1