diff mbox series

meson.build: don't condition iconv detection on library detection

Message ID 20201014221939.196958-1-brogers@suse.com
State New
Headers show
Series meson.build: don't condition iconv detection on library detection | expand

Commit Message

Bruce Rogers Oct. 14, 2020, 10:19 p.m. UTC
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>
---
 meson.build | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

Comments

罗勇刚(Yonggang Luo) Oct. 15, 2020, 4:33 a.m. UTC | #1
On Thu, Oct 15, 2020 at 6:19 AM Bruce Rogers <brogers@suse.com> wrote:
>
> 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>
> ---
>  meson.build | 16 +++++++---------
>  1 file changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/meson.build b/meson.build
> index 1a4a482492..84c8ec9541 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -431,15 +431,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.28.0
>
Reviewed-by: Yonggang Luo<l <brogers@suse.com>uoyonggang@gmail.com>

--
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo
<div dir="ltr"><br><br>On Thu, Oct 15, 2020 at 6:19 AM Bruce Rogers &lt;<a href="mailto:brogers@suse.com">brogers@suse.com</a>&gt; wrote:<br>&gt;<br>&gt; It isn&#39;t necessarily the case that use of iconv requires an additional<br>&gt; library. For that reason we shouldn&#39;t conditionalize iconv detection on<br>&gt; libiconv.found.<br>&gt;<br>&gt; Fixes: 5285e593c33 (configure: Fixes ncursesw detection under msys2/mingw by convert them to meson)<br>&gt;<br>&gt; Signed-off-by: Bruce Rogers &lt;<a href="mailto:brogers@suse.com">brogers@suse.com</a>&gt;<br>&gt; ---<br>&gt;  meson.build | 16 +++++++---------<br>&gt;  1 file changed, 7 insertions(+), 9 deletions(-)<br>&gt;<br>&gt; diff --git a/meson.build b/meson.build<br>&gt; index 1a4a482492..84c8ec9541 100644<br>&gt; --- a/meson.build<br>&gt; +++ b/meson.build<br>&gt; @@ -431,15 +431,13 @@ if not get_option(&#39;iconv&#39;).disabled()<br>&gt;    libiconv = cc.find_library(&#39;iconv&#39;,<br>&gt;                               required: false,<br>&gt;                               static: enable_static)<br>&gt; -  if libiconv.found()<br>&gt; -    if cc.links(&#39;&#39;&#39;<br>&gt; -      #include &lt;iconv.h&gt;<br>&gt; -      int main(void) {<br>&gt; -        iconv_t conv = iconv_open(&quot;WCHAR_T&quot;, &quot;UCS-2&quot;);<br>&gt; -        return conv != (iconv_t) -1;<br>&gt; -      }&#39;&#39;&#39;, dependencies: [libiconv])<br>&gt; -      iconv = declare_dependency(dependencies: [libiconv])<br>&gt; -    endif<br>&gt; +  if cc.links(&#39;&#39;&#39;<br>&gt; +    #include &lt;iconv.h&gt;<br>&gt; +    int main(void) {<br>&gt; +      iconv_t conv = iconv_open(&quot;WCHAR_T&quot;, &quot;UCS-2&quot;);<br>&gt; +      return conv != (iconv_t) -1;<br>&gt; +    }&#39;&#39;&#39;, dependencies: [libiconv])<br>&gt; +    iconv = declare_dependency(dependencies: [libiconv])<br>&gt;    endif<br>&gt;  endif<br>&gt;  if get_option(&#39;iconv&#39;).enabled() and not iconv.found()<br>&gt; --<br>&gt; 2.28.0<br>&gt;<br>Reviewed-by: Yonggang Luo&lt;<a href="mailto:brogers@suse.com" target="_blank">l</a><a href="mailto:uoyonggang@gmail.com">uoyonggang@gmail.com</a>&gt;<br><br>--<br>         此致<br>礼<br>罗勇刚<br>Yours<br>    sincerely,<br>Yonggang Luo</div>
Philippe Mathieu-Daudé Oct. 15, 2020, 6:51 a.m. UTC | #2
On 10/15/20 6:33 AM, 罗勇刚(Yonggang Luo) wrote:
> 
> 
> On Thu, Oct 15, 2020 at 6:19 AM Bruce Rogers <brogers@suse.com 
> <mailto:brogers@suse.com>> wrote:
>  >
>  > 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 <mailto:brogers@suse.com>>
>  > ---
>  >  meson.build | 16 +++++++---------
>  >  1 file changed, 7 insertions(+), 9 deletions(-)
>  >
>  > diff --git a/meson.build b/meson.build
>  > index 1a4a482492..84c8ec9541 100644
>  > --- a/meson.build
>  > +++ b/meson.build
>  > @@ -431,15 +431,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.28.0
>  >
> Reviewed-by: Yonggang Luo<l 
> <mailto:brogers@suse.com>uoyonggang@gmail.com <mailto:uoyonggang@gmail.com>>

Something is certainly wrong here =)
I suppose you meant:

Reviewed-by:Yonggang Luo <luoyonggang@gmail.com>

> 
> --
>           此致
> 礼
> 罗勇刚
> Yours
>      sincerely,
> Yonggang Luo
Paolo Bonzini Oct. 15, 2020, 5:12 p.m. UTC | #3
On 15/10/20 00:19, Bruce Rogers wrote:
> 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>
> ---
>  meson.build | 16 +++++++---------
>  1 file changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/meson.build b/meson.build
> index 1a4a482492..84c8ec9541 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -431,15 +431,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()
> 

Queued, thanks.

Paolo
diff mbox series

Patch

diff --git a/meson.build b/meson.build
index 1a4a482492..84c8ec9541 100644
--- a/meson.build
+++ b/meson.build
@@ -431,15 +431,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()