[PATCH v2] meson: fix ncurses detection on macOS

Chris Hofstaedtler posted 1 patch 4 years, 10 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20201230221727.60579-1-chris@hofstaedtler.name
meson.build | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
[PATCH v2] meson: fix ncurses detection on macOS
Posted by Chris Hofstaedtler 4 years, 10 months ago
Without this, meson fails with "curses package not usable" when using ncurses
6.2. Apparently the wide functions (addwstr, etc) are hidden behind the extra
define, and meson does not define it at that detection stage.

Regression from b01a4fd3bd7d6f2 ("configure: Define NCURSES_WIDECHAR if we're
using curses"). The meson conversion has seen many iterations of the curses
check, so pinpointing the exact commit breaking this is not so easy.

Signed-off-by: Chris Hofstaedtler <chris@hofstaedtler.name>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Samuel Thibault <samuel.thibault@gnu.org>
Cc: Yonggang Luo <luoyonggang@gmail.com>
---
 meson.build | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/meson.build b/meson.build
index 372576f82c..fd74728674 100644
--- a/meson.build
+++ b/meson.build
@@ -500,16 +500,16 @@ if have_system and not get_option('curses').disabled()
     endif
   endforeach
   msg = get_option('curses').enabled() ? 'curses library not found' : ''
+  curses_compile_args = ['-DNCURSES_WIDECHAR']
   if curses.found()
-    if cc.links(curses_test, dependencies: [curses])
-      curses = declare_dependency(compile_args: '-DNCURSES_WIDECHAR', dependencies: [curses])
+    if cc.links(curses_test, args: curses_compile_args, dependencies: [curses])
+      curses = declare_dependency(compile_args: curses_compile_args, dependencies: [curses])
     else
       msg = 'curses package not usable'
       curses = not_found
     endif
   endif
   if not curses.found()
-    curses_compile_args = ['-DNCURSES_WIDECHAR']
     has_curses_h = cc.has_header('curses.h', args: curses_compile_args)
     if targetos != 'windows' and not has_curses_h
       message('Trying with /usr/include/ncursesw')
-- 
2.29.2


Re: [PATCH v2] meson: fix ncurses detection on macOS
Posted by Samuel Thibault 4 years, 10 months ago
Chris Hofstaedtler, le mer. 30 déc. 2020 23:17:27 +0100, a ecrit:
> Without this, meson fails with "curses package not usable" when using ncurses
> 6.2. Apparently the wide functions (addwstr, etc) are hidden behind the extra
> define, and meson does not define it at that detection stage.
> 
> Regression from b01a4fd3bd7d6f2 ("configure: Define NCURSES_WIDECHAR if we're
> using curses"). The meson conversion has seen many iterations of the curses
> check, so pinpointing the exact commit breaking this is not so easy.
> 
> Signed-off-by: Chris Hofstaedtler <chris@hofstaedtler.name>
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Cc: Samuel Thibault <samuel.thibault@gnu.org>
> Cc: Yonggang Luo <luoyonggang@gmail.com>

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

> ---
>  meson.build | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/meson.build b/meson.build
> index 372576f82c..fd74728674 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -500,16 +500,16 @@ if have_system and not get_option('curses').disabled()
>      endif
>    endforeach
>    msg = get_option('curses').enabled() ? 'curses library not found' : ''
> +  curses_compile_args = ['-DNCURSES_WIDECHAR']
>    if curses.found()
> -    if cc.links(curses_test, dependencies: [curses])
> -      curses = declare_dependency(compile_args: '-DNCURSES_WIDECHAR', dependencies: [curses])
> +    if cc.links(curses_test, args: curses_compile_args, dependencies: [curses])
> +      curses = declare_dependency(compile_args: curses_compile_args, dependencies: [curses])
>      else
>        msg = 'curses package not usable'
>        curses = not_found
>      endif
>    endif
>    if not curses.found()
> -    curses_compile_args = ['-DNCURSES_WIDECHAR']
>      has_curses_h = cc.has_header('curses.h', args: curses_compile_args)
>      if targetos != 'windows' and not has_curses_h
>        message('Trying with /usr/include/ncursesw')
> -- 
> 2.29.2
> 

Re: [PATCH v2] meson: fix ncurses detection on macOS
Posted by Philippe Mathieu-Daudé 4 years, 10 months ago
On 12/30/20 11:17 PM, Chris Hofstaedtler wrote:
> Without this, meson fails with "curses package not usable" when using ncurses
> 6.2. Apparently the wide functions (addwstr, etc) are hidden behind the extra
> define, and meson does not define it at that detection stage.
> 
> Regression from b01a4fd3bd7d6f2 ("configure: Define NCURSES_WIDECHAR if we're
> using curses"). The meson conversion has seen many iterations of the curses
> check, so pinpointing the exact commit breaking this is not so easy.
> 
> Signed-off-by: Chris Hofstaedtler <chris@hofstaedtler.name>
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Cc: Samuel Thibault <samuel.thibault@gnu.org>
> Cc: Yonggang Luo <luoyonggang@gmail.com>
> ---
>  meson.build | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Suggested-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>


Re: [PATCH v2] meson: fix ncurses detection on macOS
Posted by 罗勇刚 (Yonggang Luo) 4 years, 10 months ago
On Wed, Dec 30, 2020 at 2:17 PM Chris Hofstaedtler <chris@hofstaedtler.name>
wrote:
>
> Without this, meson fails with "curses package not usable" when using
ncurses
> 6.2. Apparently the wide functions (addwstr, etc) are hidden behind the
extra
> define, and meson does not define it at that detection stage.
>
> Regression from b01a4fd3bd7d6f2 ("configure: Define NCURSES_WIDECHAR if
we're
> using curses"). The meson conversion has seen many iterations of the
curses
> check, so pinpointing the exact commit breaking this is not so easy.
>
> Signed-off-by: Chris Hofstaedtler <chris@hofstaedtler.name>
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Cc: Samuel Thibault <samuel.thibault@gnu.org>
> Cc: Yonggang Luo <luoyonggang@gmail.com>
> ---
>  meson.build | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/meson.build b/meson.build
> index 372576f82c..fd74728674 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -500,16 +500,16 @@ if have_system and not
get_option('curses').disabled()
>      endif
>    endforeach
>    msg = get_option('curses').enabled() ? 'curses library not found' : ''
> +  curses_compile_args = ['-DNCURSES_WIDECHAR']
>    if curses.found()
> -    if cc.links(curses_test, dependencies: [curses])
> -      curses = declare_dependency(compile_args: '-DNCURSES_WIDECHAR',
dependencies: [curses])
> +    if cc.links(curses_test, args: curses_compile_args, dependencies:
[curses])
> +      curses = declare_dependency(compile_args: curses_compile_args,
dependencies: [curses])
>      else
>        msg = 'curses package not usable'
>        curses = not_found
>      endif
>    endif
>    if not curses.found()
> -    curses_compile_args = ['-DNCURSES_WIDECHAR']
>      has_curses_h = cc.has_header('curses.h', args: curses_compile_args)
>      if targetos != 'windows' and not has_curses_h
>        message('Trying with /usr/include/ncursesw')
> --
> 2.29.2
>

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

--
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo