[PULL 12/22] meson.build: don't condition iconv detection on library detection

Paolo Bonzini posted 22 patches 5 years, 3 months ago
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Li-Wen Hsu <lwhsu@freebsd.org>, Eduardo Habkost <ehabkost@redhat.com>, Markus Armbruster <armbru@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, Michael Roth <mdroth@linux.vnet.ibm.com>, Cleber Rosa <crosa@redhat.com>, Thomas Huth <thuth@redhat.com>, Ed Maste <emaste@freebsd.org>, Bandan Das <bsd@redhat.com>, "Philippe Mathieu-Daudé" <philmd@redhat.com>, Alexander Bulekov <alxndr@bu.edu>, "Alex Bennée" <alex.bennee@linaro.org>, Stefan Hajnoczi <stefanha@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>, Fam Zheng <fam@euphon.net>, Laurent Vivier <lvivier@redhat.com>
There is a newer version of this series
[PULL 12/22] meson.build: don't condition iconv detection on library detection
Posted by Paolo Bonzini 5 years, 3 months ago
From: Bruce Rogers <brogers@suse.com>

It isn't necessarily the case that use of iconv requires an additional
library. For that reason we shouldn't conditionalize iconv detection on
libiconv.found.

Fixes: 5285e593c33 (configure: Fixes ncursesw detection under msys2/mingw by convert them to meson)

Signed-off-by: Bruce Rogers <brogers@suse.com>
Reviewed-by: Yonggang Luo<l <brogers@suse.com>uoyonggang@gmail.com>
Reviewed-by:Yonggang Luo <luoyonggang@gmail.com>
Message-Id: <20201014221939.196958-1-brogers@suse.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/meson.build b/meson.build
index 0c0f4f9fd8..c1c45e9845 100644
--- a/meson.build
+++ b/meson.build
@@ -459,15 +459,13 @@ if not get_option('iconv').disabled()
   libiconv = cc.find_library('iconv',
                              required: false,
                              static: enable_static)
-  if libiconv.found()
-    if cc.links('''
-      #include <iconv.h>
-      int main(void) {
-        iconv_t conv = iconv_open("WCHAR_T", "UCS-2");
-        return conv != (iconv_t) -1;
-      }''', dependencies: [libiconv])
-      iconv = declare_dependency(dependencies: [libiconv])
-    endif
+  if cc.links('''
+    #include <iconv.h>
+    int main(void) {
+      iconv_t conv = iconv_open("WCHAR_T", "UCS-2");
+      return conv != (iconv_t) -1;
+    }''', dependencies: [libiconv])
+    iconv = declare_dependency(dependencies: [libiconv])
   endif
 endif
 if get_option('iconv').enabled() and not iconv.found()
-- 
2.26.2