[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 6/7] meson.build: Support ncurses on MacOS and OpenBSD
From: |
Paolo Bonzini |
Subject: |
[PULL 6/7] meson.build: Support ncurses on MacOS and OpenBSD |
Date: |
Fri, 19 Nov 2021 15:45:38 +0100 |
From: Stefan Weil <sw@weilnetz.de>
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>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Tested-by: Brad Smith <brad@comstyle.com>
Message-Id: <20211117205355.1392292-1-sw@weilnetz.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
meson.build | 5 ++++-
ui/curses.c | 4 ++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index 582f356209..fbdd415376 100644
--- a/meson.build
+++ b/meson.build
@@ -679,6 +679,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>
@@ -702,7 +705,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.33.1
- [PULL 0/7] Misc bugfixes for 2021-11-19, Paolo Bonzini, 2021/11/19
- [PULL 1/7] meson: fix botched compile check conversions, Paolo Bonzini, 2021/11/19
- [PULL 4/7] qtest/am53c974-test: add test for reset before transfer, Paolo Bonzini, 2021/11/19
- [PULL 6/7] meson.build: Support ncurses on MacOS and OpenBSD,
Paolo Bonzini <=
- [PULL 5/7] docs: Spell QEMU all caps, Paolo Bonzini, 2021/11/19
- [PULL 2/7] nvmm: Fix support for stable version, Paolo Bonzini, 2021/11/19
- [PULL 3/7] esp: ensure that async_len is reset to 0 during esp_hard_reset(), Paolo Bonzini, 2021/11/19
- [PULL 7/7] chardev/wctable: don't free the instance in wctablet_chr_finalize, Paolo Bonzini, 2021/11/19
- Re: [PULL 0/7] Misc bugfixes for 2021-11-19, Richard Henderson, 2021/11/19