diff mbox series

meson: Fixes curses detection on msys2

Message ID 20201116213106.589-1-luoyonggang@gmail.com (mailing list archive)
State New, archived
Headers show
Series meson: Fixes curses detection on msys2 | expand

Commit Message

Yonggang Luo Nov. 16, 2020, 9:31 p.m. UTC
Fixes regression on curses detection in msys2
by commit#925a40df2828d32d3aaaf022282cba81082fb263

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
 meson.build | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

Comments

Paolo Bonzini Nov. 18, 2020, 8:31 a.m. UTC | #1
On 16/11/20 22:31, Yonggang Luo wrote:
> Fixes regression on curses detection in msys2
> by commit#925a40df2828d32d3aaaf022282cba81082fb263
> 
> Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> ---
>   meson.build | 13 +++++++++----
>   1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/meson.build b/meson.build
> index bbff0880f4..8695f7d1c2 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -494,10 +494,15 @@ if have_system and not get_option('curses').disabled()
>         return 0;
>       }'''
>   
> -  curses = dependency((targetos == 'windows' ? 'ncurses' : 'ncursesw'),
> -                      required: false,
> -                      method: 'pkg-config',
> -                      static: enable_static)
> +  curses_dep_list = targetos == 'windows' ? ['ncurses', 'ncursesw'] : ['ncursesw']
> +  foreach curses_dep : curses_dep_list
> +    if not curses.found()
> +      curses = dependency(curses_dep,
> +                          required: false,
> +                          method: 'pkg-config',
> +                          static: enable_static)
> +    endif
> +  endforeach
>     msg = get_option('curses').enabled() ? 'curses library not found' : ''
>     if curses.found()
>       if cc.links(curses_test, dependencies: [curses])
> 

Queued, thanks.

Paolo
diff mbox series

Patch

diff --git a/meson.build b/meson.build
index bbff0880f4..8695f7d1c2 100644
--- a/meson.build
+++ b/meson.build
@@ -494,10 +494,15 @@  if have_system and not get_option('curses').disabled()
       return 0;
     }'''
 
-  curses = dependency((targetos == 'windows' ? 'ncurses' : 'ncursesw'),
-                      required: false,
-                      method: 'pkg-config',
-                      static: enable_static)
+  curses_dep_list = targetos == 'windows' ? ['ncurses', 'ncursesw'] : ['ncursesw']
+  foreach curses_dep : curses_dep_list
+    if not curses.found()
+      curses = dependency(curses_dep,
+                          required: false,
+                          method: 'pkg-config',
+                          static: enable_static)
+    endif
+  endforeach
   msg = get_option('curses').enabled() ? 'curses library not found' : ''
   if curses.found()
     if cc.links(curses_test, dependencies: [curses])