* [PATCH v2 for-6.2] meson.build: Support ncurses on MacOS and OpenBSD
@ 2021-11-17 20:53 Stefan Weil
2021-11-18 10:43 ` Daniel P. Berrangé
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Stefan Weil @ 2021-11-17 20:53 UTC (permalink / raw)
To: qemu-devel, Gerd Hoffmann, Brad Smith
Cc: Stefan Weil, Daniel P . Berrangé
MacOS provides header files for curses 5.7 with support
for wide characters, but requires _XOPEN_SOURCE_EXTENDED=1
to activate that.
By default those old header files are used even if there
is a newer Homebrew installation of ncurses 6.2 available.
Change also the old macro definition of NCURSES_WIDECHAR
and set it to 1 like it is done in newer versions of
curses.h when _XOPEN_SOURCE_EXTENDED=1 is defined.
OpenBSD has the same version of ncurses and needs the same fix.
Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
v2:
- Only define _XOPEN_SOURCE_EXTENDED when curses.h is used.
- Extended to fix OpenBSD, too (untested!)
meson.build | 5 ++++-
ui/curses.c | 4 ++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index e2d38a43e6..16b3f748f4 100644
--- a/meson.build
+++ b/meson.build
@@ -681,6 +681,9 @@ iconv = not_found
curses = not_found
if have_system and not get_option('curses').disabled()
curses_test = '''
+ #if defined(__APPLE__) || defined(__OpenBSD__)
+ #define _XOPEN_SOURCE_EXTENDED 1
+ #endif
#include <locale.h>
#include <curses.h>
#include <wchar.h>
@@ -704,7 +707,7 @@ 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']
+ curses_compile_args = ['-DNCURSES_WIDECHAR=1']
if curses.found()
if cc.links(curses_test, args: curses_compile_args, dependencies: [curses])
curses = declare_dependency(compile_args: curses_compile_args, dependencies: [curses])
diff --git a/ui/curses.c b/ui/curses.c
index e4f9588c3e..861d63244c 100644
--- a/ui/curses.c
+++ b/ui/curses.c
@@ -38,6 +38,10 @@
#include "ui/input.h"
#include "sysemu/sysemu.h"
+#if defined(__APPLE__) || defined(__OpenBSD__)
+#define _XOPEN_SOURCE_EXTENDED 1
+#endif
+
/* KEY_EVENT is defined in wincon.h and in curses.h. Avoid redefinition. */
#undef KEY_EVENT
#include <curses.h>
--
2.30.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 for-6.2] meson.build: Support ncurses on MacOS and OpenBSD
2021-11-17 20:53 [PATCH v2 for-6.2] meson.build: Support ncurses on MacOS and OpenBSD Stefan Weil
@ 2021-11-18 10:43 ` Daniel P. Berrangé
2021-11-19 0:18 ` Brad Smith
2021-11-19 9:18 ` Paolo Bonzini
2 siblings, 0 replies; 4+ messages in thread
From: Daniel P. Berrangé @ 2021-11-18 10:43 UTC (permalink / raw)
To: Stefan Weil; +Cc: Brad Smith, qemu-devel, Gerd Hoffmann
On Wed, Nov 17, 2021 at 09:53:55PM +0100, Stefan Weil wrote:
> MacOS provides header files for curses 5.7 with support
> for wide characters, but requires _XOPEN_SOURCE_EXTENDED=1
> to activate that.
>
> By default those old header files are used even if there
> is a newer Homebrew installation of ncurses 6.2 available.
>
> Change also the old macro definition of NCURSES_WIDECHAR
> and set it to 1 like it is done in newer versions of
> curses.h when _XOPEN_SOURCE_EXTENDED=1 is defined.
>
> OpenBSD has the same version of ncurses and needs the same fix.
>
> Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>
> v2:
> - Only define _XOPEN_SOURCE_EXTENDED when curses.h is used.
> - Extended to fix OpenBSD, too (untested!)
>
> meson.build | 5 ++++-
> ui/curses.c | 4 ++++
> 2 files changed, 8 insertions(+), 1 deletion(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 for-6.2] meson.build: Support ncurses on MacOS and OpenBSD
2021-11-17 20:53 [PATCH v2 for-6.2] meson.build: Support ncurses on MacOS and OpenBSD Stefan Weil
2021-11-18 10:43 ` Daniel P. Berrangé
@ 2021-11-19 0:18 ` Brad Smith
2021-11-19 9:18 ` Paolo Bonzini
2 siblings, 0 replies; 4+ messages in thread
From: Brad Smith @ 2021-11-19 0:18 UTC (permalink / raw)
To: Stefan Weil, qemu-devel, Gerd Hoffmann; +Cc: Daniel P . Berrangé
On 11/17/2021 3:53 PM, Stefan Weil wrote:
> MacOS provides header files for curses 5.7 with support
> for wide characters, but requires _XOPEN_SOURCE_EXTENDED=1
> to activate that.
>
> By default those old header files are used even if there
> is a newer Homebrew installation of ncurses 6.2 available.
>
> Change also the old macro definition of NCURSES_WIDECHAR
> and set it to 1 like it is done in newer versions of
> curses.h when _XOPEN_SOURCE_EXTENDED=1 is defined.
>
> OpenBSD has the same version of ncurses and needs the same fix.
>
> Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>
> v2:
> - Only define _XOPEN_SOURCE_EXTENDED when curses.h is used.
> - Extended to fix OpenBSD, too (untested!)
>
> meson.build | 5 ++++-
> ui/curses.c | 4 ++++
> 2 files changed, 8 insertions(+), 1 deletion(-)
Tested-by: Brad Smith <brad@comstyle.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 for-6.2] meson.build: Support ncurses on MacOS and OpenBSD
2021-11-17 20:53 [PATCH v2 for-6.2] meson.build: Support ncurses on MacOS and OpenBSD Stefan Weil
2021-11-18 10:43 ` Daniel P. Berrangé
2021-11-19 0:18 ` Brad Smith
@ 2021-11-19 9:18 ` Paolo Bonzini
2 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2021-11-19 9:18 UTC (permalink / raw)
To: Stefan Weil, qemu-devel, Gerd Hoffmann, Brad Smith
Cc: Daniel P . Berrangé
On 11/17/21 21:53, Stefan Weil wrote:
> MacOS provides header files for curses 5.7 with support
> for wide characters, but requires _XOPEN_SOURCE_EXTENDED=1
> to activate that.
>
> By default those old header files are used even if there
> is a newer Homebrew installation of ncurses 6.2 available.
>
> Change also the old macro definition of NCURSES_WIDECHAR
> and set it to 1 like it is done in newer versions of
> curses.h when _XOPEN_SOURCE_EXTENDED=1 is defined.
>
> OpenBSD has the same version of ncurses and needs the same fix.
>
> Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
Queued, thanks.
Paolo
> v2:
> - Only define _XOPEN_SOURCE_EXTENDED when curses.h is used.
> - Extended to fix OpenBSD, too (untested!)
>
> meson.build | 5 ++++-
> ui/curses.c | 4 ++++
> 2 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/meson.build b/meson.build
> index e2d38a43e6..16b3f748f4 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -681,6 +681,9 @@ iconv = not_found
> curses = not_found
> if have_system and not get_option('curses').disabled()
> curses_test = '''
> + #if defined(__APPLE__) || defined(__OpenBSD__)
> + #define _XOPEN_SOURCE_EXTENDED 1
> + #endif
> #include <locale.h>
> #include <curses.h>
> #include <wchar.h>
> @@ -704,7 +707,7 @@ 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']
> + curses_compile_args = ['-DNCURSES_WIDECHAR=1']
> if curses.found()
> if cc.links(curses_test, args: curses_compile_args, dependencies: [curses])
> curses = declare_dependency(compile_args: curses_compile_args, dependencies: [curses])
> diff --git a/ui/curses.c b/ui/curses.c
> index e4f9588c3e..861d63244c 100644
> --- a/ui/curses.c
> +++ b/ui/curses.c
> @@ -38,6 +38,10 @@
> #include "ui/input.h"
> #include "sysemu/sysemu.h"
>
> +#if defined(__APPLE__) || defined(__OpenBSD__)
> +#define _XOPEN_SOURCE_EXTENDED 1
> +#endif
> +
> /* KEY_EVENT is defined in wincon.h and in curses.h. Avoid redefinition. */
> #undef KEY_EVENT
> #include <curses.h>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-11-19 9:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-17 20:53 [PATCH v2 for-6.2] meson.build: Support ncurses on MacOS and OpenBSD Stefan Weil
2021-11-18 10:43 ` Daniel P. Berrangé
2021-11-19 0:18 ` Brad Smith
2021-11-19 9:18 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).