* [PATCH v9 1/5] configure: fixes indent of $meson setup
2020-10-12 23:43 [PATCH v9 0/5] Fixes curses on msys2/mingw Yonggang Luo
@ 2020-10-12 23:43 ` Yonggang Luo
2020-10-13 8:35 ` Philippe Mathieu-Daudé
2020-10-12 23:43 ` [PATCH v9 2/5] curses: Fixes compiler error that complain don't have langinfo.h on msys2/mingw Yonggang Luo
` (3 subsequent siblings)
4 siblings, 1 reply; 9+ messages in thread
From: Yonggang Luo @ 2020-10-12 23:43 UTC (permalink / raw)
To: qemu-devel, Daniel P . Berrangé
Cc: QEMU Trivial, Alex Bennée, Richard Henderson, Laurent Vivier,
Yonggang Luo, Gerd Hoffmann, Paolo Bonzini,
Philippe Mathieu-Daudé
convert these line from tab to space
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
configure | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/configure b/configure
index b553288c5e..1b63488521 100755
--- a/configure
+++ b/configure
@@ -7211,13 +7211,13 @@ NINJA=${ninja:-$PWD/ninjatool} $meson setup \
-Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \
-Db_staticpic=$(if test "$pie" = yes; then echo true; else echo false; fi) \
-Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \
- -Dmalloc=$malloc -Dmalloc_trim=$malloc_trim -Dsparse=$sparse \
- -Dkvm=$kvm -Dhax=$hax -Dwhpx=$whpx -Dhvf=$hvf \
- -Dxen=$xen -Dxen_pci_passthrough=$xen_pci_passthrough -Dtcg=$tcg \
- -Dcocoa=$cocoa -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \
- -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \
- -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f \
- -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt \
+ -Dmalloc=$malloc -Dmalloc_trim=$malloc_trim -Dsparse=$sparse \
+ -Dkvm=$kvm -Dhax=$hax -Dwhpx=$whpx -Dhvf=$hvf \
+ -Dxen=$xen -Dxen_pci_passthrough=$xen_pci_passthrough -Dtcg=$tcg \
+ -Dcocoa=$cocoa -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \
+ -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \
+ -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f \
+ -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt \
$cross_arg \
"$PWD" "$source_path"
--
2.28.0.windows.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v9 1/5] configure: fixes indent of $meson setup
2020-10-12 23:43 ` [PATCH v9 1/5] configure: fixes indent of $meson setup Yonggang Luo
@ 2020-10-13 8:35 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-13 8:35 UTC (permalink / raw)
To: Yonggang Luo, qemu-devel, Daniel P . Berrangé
Cc: QEMU Trivial, Richard Henderson, Laurent Vivier, Gerd Hoffmann,
Paolo Bonzini, Alex Bennée
On 10/13/20 1:43 AM, Yonggang Luo wrote:
> convert these line from tab to space
>
> Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
> configure | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/configure b/configure
> index b553288c5e..1b63488521 100755
> --- a/configure
> +++ b/configure
> @@ -7211,13 +7211,13 @@ NINJA=${ninja:-$PWD/ninjatool} $meson setup \
> -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \
> -Db_staticpic=$(if test "$pie" = yes; then echo true; else echo false; fi) \
> -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \
> - -Dmalloc=$malloc -Dmalloc_trim=$malloc_trim -Dsparse=$sparse \
> - -Dkvm=$kvm -Dhax=$hax -Dwhpx=$whpx -Dhvf=$hvf \
> - -Dxen=$xen -Dxen_pci_passthrough=$xen_pci_passthrough -Dtcg=$tcg \
> - -Dcocoa=$cocoa -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \
> - -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \
> - -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f \
> - -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt \
> + -Dmalloc=$malloc -Dmalloc_trim=$malloc_trim -Dsparse=$sparse \
> + -Dkvm=$kvm -Dhax=$hax -Dwhpx=$whpx -Dhvf=$hvf \
> + -Dxen=$xen -Dxen_pci_passthrough=$xen_pci_passthrough -Dtcg=$tcg \
> + -Dcocoa=$cocoa -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \
> + -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \
> + -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f \
> + -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt \
> $cross_arg \
> "$PWD" "$source_path"
>
>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v9 2/5] curses: Fixes compiler error that complain don't have langinfo.h on msys2/mingw
2020-10-12 23:43 [PATCH v9 0/5] Fixes curses on msys2/mingw Yonggang Luo
2020-10-12 23:43 ` [PATCH v9 1/5] configure: fixes indent of $meson setup Yonggang Luo
@ 2020-10-12 23:43 ` Yonggang Luo
2020-10-13 8:35 ` Philippe Mathieu-Daudé
2020-10-12 23:43 ` [PATCH v9 3/5] curses: Fixes curses compiling errors Yonggang Luo
` (2 subsequent siblings)
4 siblings, 1 reply; 9+ messages in thread
From: Yonggang Luo @ 2020-10-12 23:43 UTC (permalink / raw)
To: qemu-devel, Daniel P . Berrangé
Cc: QEMU Trivial, Alex Bennée, Richard Henderson, Laurent Vivier,
Yonggang Luo, Gerd Hoffmann, Paolo Bonzini,
Philippe Mathieu-Daudé
msys2/mingw lacks the POSIX-required langinfo.h.
gcc test.c -DNCURSES_WIDECHAR -I/mingw64/include/ncursesw -pipe -lncursesw -lgnurx -ltre -lintl -liconv
test.c:4:10: fatal error: langinfo.h: No such file or directory
4 | #include <langinfo.h>
| ^~~~~~~~~~~~
compilation terminated.
So we using g_get_codeset instead of nl_langinfo(CODESET)
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
configure | 5 +----
ui/curses.c | 10 +++++-----
2 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/configure b/configure
index 1b63488521..71a574f718 100755
--- a/configure
+++ b/configure
@@ -3530,17 +3530,14 @@ if test "$curses" != "no" ; then
#include <locale.h>
#include <curses.h>
#include <wchar.h>
-#include <langinfo.h>
int main(void) {
- const char *codeset;
wchar_t wch = L'w';
setlocale(LC_ALL, "");
resize_term(0, 0);
addwstr(L"wide chars\n");
addnwstr(&wch, 1);
add_wch(WACS_DEGREE);
- codeset = nl_langinfo(CODESET);
- return codeset != 0;
+ return 0;
}
EOF
IFS=:
diff --git a/ui/curses.c b/ui/curses.c
index a59b23a9cf..12bc682cf9 100644
--- a/ui/curses.c
+++ b/ui/curses.c
@@ -30,7 +30,6 @@
#endif
#include <locale.h>
#include <wchar.h>
-#include <langinfo.h>
#include <iconv.h>
#include "qapi/error.h"
@@ -526,6 +525,7 @@ static void font_setup(void)
iconv_t nativecharset_to_ucs2;
iconv_t font_conv;
int i;
+ g_autofree gchar *local_codeset = g_get_codeset();
/*
* Control characters are normally non-printable, but VGA does have
@@ -566,14 +566,14 @@ static void font_setup(void)
0x25bc
};
- ucs2_to_nativecharset = iconv_open(nl_langinfo(CODESET), "UCS-2");
+ ucs2_to_nativecharset = iconv_open(local_codeset, "UCS-2");
if (ucs2_to_nativecharset == (iconv_t) -1) {
fprintf(stderr, "Could not convert font glyphs from UCS-2: '%s'\n",
strerror(errno));
exit(1);
}
- nativecharset_to_ucs2 = iconv_open("UCS-2", nl_langinfo(CODESET));
+ nativecharset_to_ucs2 = iconv_open("UCS-2", local_codeset);
if (nativecharset_to_ucs2 == (iconv_t) -1) {
iconv_close(ucs2_to_nativecharset);
fprintf(stderr, "Could not convert font glyphs to UCS-2: '%s'\n",
@@ -581,7 +581,7 @@ static void font_setup(void)
exit(1);
}
- font_conv = iconv_open(nl_langinfo(CODESET), font_charset);
+ font_conv = iconv_open(local_codeset, font_charset);
if (font_conv == (iconv_t) -1) {
iconv_close(ucs2_to_nativecharset);
iconv_close(nativecharset_to_ucs2);
@@ -602,7 +602,7 @@ static void font_setup(void)
/* DEL */
convert_ucs(0x7F, 0x2302, ucs2_to_nativecharset);
- if (strcmp(nl_langinfo(CODESET), "UTF-8")) {
+ if (strcmp(local_codeset, "UTF-8")) {
/* Non-Unicode capable, use termcap equivalents for those available */
for (i = 0; i <= 0xFF; i++) {
wchar_t wch[CCHARW_MAX];
--
2.28.0.windows.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v9 2/5] curses: Fixes compiler error that complain don't have langinfo.h on msys2/mingw
2020-10-12 23:43 ` [PATCH v9 2/5] curses: Fixes compiler error that complain don't have langinfo.h on msys2/mingw Yonggang Luo
@ 2020-10-13 8:35 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-13 8:35 UTC (permalink / raw)
To: Yonggang Luo, qemu-devel, Daniel P . Berrangé
Cc: QEMU Trivial, Richard Henderson, Laurent Vivier, Gerd Hoffmann,
Paolo Bonzini, Alex Bennée
On 10/13/20 1:43 AM, Yonggang Luo wrote:
> msys2/mingw lacks the POSIX-required langinfo.h.
>
> gcc test.c -DNCURSES_WIDECHAR -I/mingw64/include/ncursesw -pipe -lncursesw -lgnurx -ltre -lintl -liconv
> test.c:4:10: fatal error: langinfo.h: No such file or directory
> 4 | #include <langinfo.h>
> | ^~~~~~~~~~~~
> compilation terminated.
>
> So we using g_get_codeset instead of nl_langinfo(CODESET)
>
> Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
> configure | 5 +----
> ui/curses.c | 10 +++++-----
> 2 files changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/configure b/configure
> index 1b63488521..71a574f718 100755
> --- a/configure
> +++ b/configure
> @@ -3530,17 +3530,14 @@ if test "$curses" != "no" ; then
> #include <locale.h>
> #include <curses.h>
> #include <wchar.h>
> -#include <langinfo.h>
> int main(void) {
> - const char *codeset;
> wchar_t wch = L'w';
> setlocale(LC_ALL, "");
> resize_term(0, 0);
> addwstr(L"wide chars\n");
> addnwstr(&wch, 1);
> add_wch(WACS_DEGREE);
> - codeset = nl_langinfo(CODESET);
> - return codeset != 0;
> + return 0;
> }
> EOF
> IFS=:
> diff --git a/ui/curses.c b/ui/curses.c
> index a59b23a9cf..12bc682cf9 100644
> --- a/ui/curses.c
> +++ b/ui/curses.c
> @@ -30,7 +30,6 @@
> #endif
> #include <locale.h>
> #include <wchar.h>
> -#include <langinfo.h>
> #include <iconv.h>
>
> #include "qapi/error.h"
> @@ -526,6 +525,7 @@ static void font_setup(void)
> iconv_t nativecharset_to_ucs2;
> iconv_t font_conv;
> int i;
> + g_autofree gchar *local_codeset = g_get_codeset();
>
> /*
> * Control characters are normally non-printable, but VGA does have
> @@ -566,14 +566,14 @@ static void font_setup(void)
> 0x25bc
> };
>
> - ucs2_to_nativecharset = iconv_open(nl_langinfo(CODESET), "UCS-2");
> + ucs2_to_nativecharset = iconv_open(local_codeset, "UCS-2");
> if (ucs2_to_nativecharset == (iconv_t) -1) {
> fprintf(stderr, "Could not convert font glyphs from UCS-2: '%s'\n",
> strerror(errno));
> exit(1);
> }
>
> - nativecharset_to_ucs2 = iconv_open("UCS-2", nl_langinfo(CODESET));
> + nativecharset_to_ucs2 = iconv_open("UCS-2", local_codeset);
> if (nativecharset_to_ucs2 == (iconv_t) -1) {
> iconv_close(ucs2_to_nativecharset);
> fprintf(stderr, "Could not convert font glyphs to UCS-2: '%s'\n",
> @@ -581,7 +581,7 @@ static void font_setup(void)
> exit(1);
> }
>
> - font_conv = iconv_open(nl_langinfo(CODESET), font_charset);
> + font_conv = iconv_open(local_codeset, font_charset);
> if (font_conv == (iconv_t) -1) {
> iconv_close(ucs2_to_nativecharset);
> iconv_close(nativecharset_to_ucs2);
> @@ -602,7 +602,7 @@ static void font_setup(void)
> /* DEL */
> convert_ucs(0x7F, 0x2302, ucs2_to_nativecharset);
>
> - if (strcmp(nl_langinfo(CODESET), "UTF-8")) {
> + if (strcmp(local_codeset, "UTF-8")) {
> /* Non-Unicode capable, use termcap equivalents for those available */
> for (i = 0; i <= 0xFF; i++) {
> wchar_t wch[CCHARW_MAX];
>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v9 3/5] curses: Fixes curses compiling errors.
2020-10-12 23:43 [PATCH v9 0/5] Fixes curses on msys2/mingw Yonggang Luo
2020-10-12 23:43 ` [PATCH v9 1/5] configure: fixes indent of $meson setup Yonggang Luo
2020-10-12 23:43 ` [PATCH v9 2/5] curses: Fixes compiler error that complain don't have langinfo.h on msys2/mingw Yonggang Luo
@ 2020-10-12 23:43 ` Yonggang Luo
2020-10-12 23:43 ` [PATCH v9 4/5] win32: Simplify gmtime_r detection not depends on if _POSIX_C_SOURCE are defined on msys2/mingw Yonggang Luo
2020-10-12 23:43 ` [PATCH v9 5/5] configure: Fixes ncursesw detection under msys2/mingw by convert them to meson Yonggang Luo
4 siblings, 0 replies; 9+ messages in thread
From: Yonggang Luo @ 2020-10-12 23:43 UTC (permalink / raw)
To: qemu-devel, Daniel P . Berrangé
Cc: QEMU Trivial, Alex Bennée, Richard Henderson, Laurent Vivier,
Yonggang Luo, Gerd Hoffmann, Paolo Bonzini,
Philippe Mathieu-Daudé
This is the compiling error:
../ui/curses.c: In function 'curses_refresh':
../ui/curses.c:256:5: error: 'next_maybe_keycode' may be used uninitialized in this function [-Werror=maybe-uninitialized]
256 | curses2foo(_curses2keycode, _curseskey2keycode, chr, maybe_keycode)
| ^~~~~~~~~~
../ui/curses.c:302:32: note: 'next_maybe_keycode' was declared here
302 | enum maybe_keycode next_maybe_keycode;
| ^~~~~~~~~~~~~~~~~~
../ui/curses.c:256:5: error: 'maybe_keycode' may be used uninitialized in this function [-Werror=maybe-uninitialized]
256 | curses2foo(_curses2keycode, _curseskey2keycode, chr, maybe_keycode)
| ^~~~~~~~~~
../ui/curses.c:265:24: note: 'maybe_keycode' was declared here
265 | enum maybe_keycode maybe_keycode;
| ^~~~~~~~~~~~~
cc1.exe: all warnings being treated as errors
gcc version 10.2.0 (Rev1, Built by MSYS2 project)
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
ui/curses.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ui/curses.c b/ui/curses.c
index 12bc682cf9..e4f9588c3e 100644
--- a/ui/curses.c
+++ b/ui/curses.c
@@ -262,7 +262,7 @@ static int curses2foo(const int _curses2foo[], const int _curseskey2foo[],
static void curses_refresh(DisplayChangeListener *dcl)
{
int chr, keysym, keycode, keycode_alt;
- enum maybe_keycode maybe_keycode;
+ enum maybe_keycode maybe_keycode = CURSES_KEYCODE;
curses_winch_check();
@@ -299,7 +299,7 @@ static void curses_refresh(DisplayChangeListener *dcl)
/* alt or esc key */
if (keycode == 1) {
- enum maybe_keycode next_maybe_keycode;
+ enum maybe_keycode next_maybe_keycode = CURSES_KEYCODE;
int nextchr = console_getch(&next_maybe_keycode);
if (nextchr != -1) {
--
2.28.0.windows.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v9 4/5] win32: Simplify gmtime_r detection not depends on if _POSIX_C_SOURCE are defined on msys2/mingw
2020-10-12 23:43 [PATCH v9 0/5] Fixes curses on msys2/mingw Yonggang Luo
` (2 preceding siblings ...)
2020-10-12 23:43 ` [PATCH v9 3/5] curses: Fixes curses compiling errors Yonggang Luo
@ 2020-10-12 23:43 ` Yonggang Luo
2020-10-13 8:37 ` Philippe Mathieu-Daudé
2020-10-12 23:43 ` [PATCH v9 5/5] configure: Fixes ncursesw detection under msys2/mingw by convert them to meson Yonggang Luo
4 siblings, 1 reply; 9+ messages in thread
From: Yonggang Luo @ 2020-10-12 23:43 UTC (permalink / raw)
To: qemu-devel, Daniel P . Berrangé
Cc: QEMU Trivial, Alex Bennée, Richard Henderson, Laurent Vivier,
Yonggang Luo, Gerd Hoffmann, Paolo Bonzini,
Philippe Mathieu-Daudé
We remove the CONFIG_LOCALTIME_R detection option in configure, and move the check
existence of gmtime_r from configure into C header and source directly by using macro
`_POSIX_THREAD_SAFE_FUNCTIONS`.
Before this patch, the configure script are always assume the compiler doesn't define
_POSIX_C_SOURCE macro at all, but that's not true, because thirdparty library such
as ncursesw may define -D_POSIX_C_SOURCE in it's pkg-config file. And that C Flags will
added -D_POSIX_C_SOURCE into each QEMU_CFLAGS. And that's causing the following compiling error:
n file included from C:/work/xemu/qemu/include/qemu/osdep.h:119,
from ../softmmu/main.c:25:
C:/work/xemu/qemu/include/sysemu/os-win32.h:53:12: error: redundant redeclaration of 'gmtime_r' [-Werror=redundant-decls]
53 | struct tm *gmtime_r(const time_t *timep, struct tm *result);
| ^~~~~~~~
In file included from C:/work/xemu/qemu/include/qemu/osdep.h:94,
from ../softmmu/main.c:25:
C:/CI-Tools/msys64/mingw64/x86_64-w64-mingw32/include/time.h:284:36: note: previous definition of 'gmtime_r' was here
284 | __forceinline struct tm *__CRTDECL gmtime_r(const time_t *_Time, struct tm *_Tm) {
| ^~~~~~~~
In file included from C:/work/xemu/qemu/include/qemu/osdep.h:119,
from ../softmmu/main.c:25:
C:/work/xemu/qemu/include/sysemu/os-win32.h:55:12: error: redundant redeclaration of 'localtime_r' [-Werror=redundant-decls]
55 | struct tm *localtime_r(const time_t *timep, struct tm *result);
| ^~~~~~~~~~~
In file included from C:/work/xemu/qemu/include/qemu/osdep.h:94,
from ../softmmu/main.c:25:
C:/CI-Tools/msys64/mingw64/x86_64-w64-mingw32/include/time.h:281:36: note: previous definition of 'localtime_r' was here
281 | __forceinline struct tm *__CRTDECL localtime_r(const time_t *_Time, struct tm *_Tm) {
| ^~~~~~~~~~~
Compiling C object libcommon.fa.p/hw_gpio_zaurus.c.obj
In file included from C:/work/xemu/qemu/include/qemu/osdep.h:119,
from ../hw/i2c/smbus_slave.c:16:
C:/work/xemu/qemu/include/sysemu/os-win32.h:53:12: error: redundant redeclaration of 'gmtime_r' [-Werror=redundant-decls]
53 | struct tm *gmtime_r(const time_t *timep, struct tm *result);
| ^~~~~~~~
In file included from C:/work/xemu/qemu/include/qemu/osdep.h:94,
from ../hw/i2c/smbus_slave.c:16:
C:/CI-Tools/msys64/mingw64/x86_64-w64-mingw32/include/time.h:284:36: note: previous definition of 'gmtime_r' was here
284 | __forceinline struct tm *__CRTDECL gmtime_r(const time_t *_Time, struct tm *_Tm) {
| ^~~~~~~~
In file included from C:/work/xemu/qemu/include/qemu/osdep.h:119,
from ../hw/i2c/smbus_slave.c:16:
C:/work/xemu/qemu/include/sysemu/os-win32.h:55:12: error: redundant redeclaration of 'localtime_r' [-Werror=redundant-decls]
55 | struct tm *localtime_r(const time_t *timep, struct tm *result);
| ^~~~~~~~~~~
In file included from C:/work/xemu/qemu/include/qemu/osdep.h:94,
from ../hw/i2c/smbus_slave.c:16:
C:/CI-Tools/msys64/mingw64/x86_64-w64-mingw32/include/time.h:281:36: note: previous definition of 'localtime_r' was here
281 | __forceinline struct tm *__CRTDECL localtime_r(const time_t *_Time, struct tm *_Tm) {
| ^~~~~~~~~~~
Compiling C object libcommon.fa.p/hw_dma_xilinx_axidma.c.obj
After this patch, whenever ncursesw or other thirdparty libraries tried to define or not
define _POSIX_C_SOURCE, the source will building properly. Because now, we don't make any
assumption if _POSIX_C_SOURCE are defined. We solely relied on if the macro `_POSIX_THREAD_SAFE_FUNCTIONS`
are defined in msys2/mingw header.
The _POSIX_THREAD_SAFE_FUNCTIONS are defined in mingw header like this:
```
#if defined(_POSIX_C_SOURCE) && !defined(_POSIX_THREAD_SAFE_FUNCTIONS)
#define _POSIX_THREAD_SAFE_FUNCTIONS 200112L
#endif
#ifdef _POSIX_THREAD_SAFE_FUNCTIONS
__forceinline struct tm *__CRTDECL localtime_r(const time_t *_Time, struct tm *_Tm) {
return localtime_s(_Tm, _Time) ? NULL : _Tm;
}
__forceinline struct tm *__CRTDECL gmtime_r(const time_t *_Time, struct tm *_Tm) {
return gmtime_s(_Tm, _Time) ? NULL : _Tm;
}
__forceinline char *__CRTDECL ctime_r(const time_t *_Time, char *_Str) {
return ctime_s(_Str, 0x7fffffff, _Time) ? NULL : _Str;
}
__forceinline char *__CRTDECL asctime_r(const struct tm *_Tm, char * _Str) {
return asctime_s(_Str, 0x7fffffff, _Tm) ? NULL : _Str;
}
#endif
```
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
configure | 34 ----------------------------------
include/sysemu/os-win32.h | 4 ++--
util/oslib-win32.c | 4 ++--
3 files changed, 4 insertions(+), 38 deletions(-)
diff --git a/configure b/configure
index 71a574f718..9a87685517 100755
--- a/configure
+++ b/configure
@@ -2386,37 +2386,6 @@ if test "$vhost_net" = ""; then
test "$vhost_kernel" = "yes" && vhost_net=yes
fi
-##########################################
-# MinGW / Mingw-w64 localtime_r/gmtime_r check
-
-if test "$mingw32" = "yes"; then
- # Some versions of MinGW / Mingw-w64 lack localtime_r
- # and gmtime_r entirely.
- #
- # Some versions of Mingw-w64 define a macro for
- # localtime_r/gmtime_r.
- #
- # Some versions of Mingw-w64 will define functions
- # for localtime_r/gmtime_r, but only if you have
- # _POSIX_THREAD_SAFE_FUNCTIONS defined. For fun
- # though, unistd.h and pthread.h both define
- # that for you.
- #
- # So this #undef localtime_r and #include <unistd.h>
- # are not in fact redundant.
-cat > $TMPC << EOF
-#include <unistd.h>
-#include <time.h>
-#undef localtime_r
-int main(void) { localtime_r(NULL, NULL); return 0; }
-EOF
- if compile_prog "" "" ; then
- localtime_r="yes"
- else
- localtime_r="no"
- fi
-fi
-
##########################################
# pkg-config probe
@@ -6610,9 +6579,6 @@ if [ "$bsd" = "yes" ] ; then
echo "CONFIG_BSD=y" >> $config_host_mak
fi
-if test "$localtime_r" = "yes" ; then
- echo "CONFIG_LOCALTIME_R=y" >> $config_host_mak
-fi
if test "$qom_cast_debug" = "yes" ; then
echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
fi
diff --git a/include/sysemu/os-win32.h b/include/sysemu/os-win32.h
index d8978e28c0..5346d51e89 100644
--- a/include/sysemu/os-win32.h
+++ b/include/sysemu/os-win32.h
@@ -48,12 +48,12 @@
#define siglongjmp(env, val) longjmp(env, val)
/* Missing POSIX functions. Don't use MinGW-w64 macros. */
-#ifndef CONFIG_LOCALTIME_R
+#ifndef _POSIX_THREAD_SAFE_FUNCTIONS
#undef gmtime_r
struct tm *gmtime_r(const time_t *timep, struct tm *result);
#undef localtime_r
struct tm *localtime_r(const time_t *timep, struct tm *result);
-#endif /* CONFIG_LOCALTIME_R */
+#endif /* _POSIX_THREAD_SAFE_FUNCTIONS */
static inline void os_setup_signal_handling(void) {}
static inline void os_daemonize(void) {}
diff --git a/util/oslib-win32.c b/util/oslib-win32.c
index 051afb217b..e99debfb8d 100644
--- a/util/oslib-win32.c
+++ b/util/oslib-win32.c
@@ -106,7 +106,7 @@ void qemu_anon_ram_free(void *ptr, size_t size)
}
}
-#ifndef CONFIG_LOCALTIME_R
+#ifndef _POSIX_THREAD_SAFE_FUNCTIONS
/* FIXME: add proper locking */
struct tm *gmtime_r(const time_t *timep, struct tm *result)
{
@@ -130,7 +130,7 @@ struct tm *localtime_r(const time_t *timep, struct tm *result)
}
return p;
}
-#endif /* CONFIG_LOCALTIME_R */
+#endif /* _POSIX_THREAD_SAFE_FUNCTIONS */
static int socket_error(void)
{
--
2.28.0.windows.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v9 4/5] win32: Simplify gmtime_r detection not depends on if _POSIX_C_SOURCE are defined on msys2/mingw
2020-10-12 23:43 ` [PATCH v9 4/5] win32: Simplify gmtime_r detection not depends on if _POSIX_C_SOURCE are defined on msys2/mingw Yonggang Luo
@ 2020-10-13 8:37 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-13 8:37 UTC (permalink / raw)
To: Yonggang Luo, qemu-devel, Daniel P . Berrangé
Cc: QEMU Trivial, Richard Henderson, Laurent Vivier, Gerd Hoffmann,
Paolo Bonzini, Alex Bennée
On 10/13/20 1:43 AM, Yonggang Luo wrote:
> We remove the CONFIG_LOCALTIME_R detection option in configure, and move the check
> existence of gmtime_r from configure into C header and source directly by using macro
> `_POSIX_THREAD_SAFE_FUNCTIONS`.
> Before this patch, the configure script are always assume the compiler doesn't define
> _POSIX_C_SOURCE macro at all, but that's not true, because thirdparty library such
> as ncursesw may define -D_POSIX_C_SOURCE in it's pkg-config file. And that C Flags will
> added -D_POSIX_C_SOURCE into each QEMU_CFLAGS. And that's causing the following compiling error:
> n file included from C:/work/xemu/qemu/include/qemu/osdep.h:119,
> from ../softmmu/main.c:25:
> C:/work/xemu/qemu/include/sysemu/os-win32.h:53:12: error: redundant redeclaration of 'gmtime_r' [-Werror=redundant-decls]
> 53 | struct tm *gmtime_r(const time_t *timep, struct tm *result);
> | ^~~~~~~~
> In file included from C:/work/xemu/qemu/include/qemu/osdep.h:94,
> from ../softmmu/main.c:25:
> C:/CI-Tools/msys64/mingw64/x86_64-w64-mingw32/include/time.h:284:36: note: previous definition of 'gmtime_r' was here
> 284 | __forceinline struct tm *__CRTDECL gmtime_r(const time_t *_Time, struct tm *_Tm) {
> | ^~~~~~~~
> In file included from C:/work/xemu/qemu/include/qemu/osdep.h:119,
> from ../softmmu/main.c:25:
> C:/work/xemu/qemu/include/sysemu/os-win32.h:55:12: error: redundant redeclaration of 'localtime_r' [-Werror=redundant-decls]
> 55 | struct tm *localtime_r(const time_t *timep, struct tm *result);
> | ^~~~~~~~~~~
> In file included from C:/work/xemu/qemu/include/qemu/osdep.h:94,
> from ../softmmu/main.c:25:
> C:/CI-Tools/msys64/mingw64/x86_64-w64-mingw32/include/time.h:281:36: note: previous definition of 'localtime_r' was here
> 281 | __forceinline struct tm *__CRTDECL localtime_r(const time_t *_Time, struct tm *_Tm) {
> | ^~~~~~~~~~~
^^^ very verbose but OK.
vvv This part is duplicated, can you remove?
> Compiling C object libcommon.fa.p/hw_gpio_zaurus.c.obj
> In file included from C:/work/xemu/qemu/include/qemu/osdep.h:119,
> from ../hw/i2c/smbus_slave.c:16:
> C:/work/xemu/qemu/include/sysemu/os-win32.h:53:12: error: redundant redeclaration of 'gmtime_r' [-Werror=redundant-decls]
> 53 | struct tm *gmtime_r(const time_t *timep, struct tm *result);
> | ^~~~~~~~
> In file included from C:/work/xemu/qemu/include/qemu/osdep.h:94,
> from ../hw/i2c/smbus_slave.c:16:
> C:/CI-Tools/msys64/mingw64/x86_64-w64-mingw32/include/time.h:284:36: note: previous definition of 'gmtime_r' was here
> 284 | __forceinline struct tm *__CRTDECL gmtime_r(const time_t *_Time, struct tm *_Tm) {
> | ^~~~~~~~
> In file included from C:/work/xemu/qemu/include/qemu/osdep.h:119,
> from ../hw/i2c/smbus_slave.c:16:
> C:/work/xemu/qemu/include/sysemu/os-win32.h:55:12: error: redundant redeclaration of 'localtime_r' [-Werror=redundant-decls]
> 55 | struct tm *localtime_r(const time_t *timep, struct tm *result);
> | ^~~~~~~~~~~
> In file included from C:/work/xemu/qemu/include/qemu/osdep.h:94,
> from ../hw/i2c/smbus_slave.c:16:
> C:/CI-Tools/msys64/mingw64/x86_64-w64-mingw32/include/time.h:281:36: note: previous definition of 'localtime_r' was here
> 281 | __forceinline struct tm *__CRTDECL localtime_r(const time_t *_Time, struct tm *_Tm) {
> | ^~~~~~~~~~~
> Compiling C object libcommon.fa.p/hw_dma_xilinx_axidma.c.obj
>
> After this patch, whenever ncursesw or other thirdparty libraries tried to define or not
> define _POSIX_C_SOURCE, the source will building properly. Because now, we don't make any
> assumption if _POSIX_C_SOURCE are defined. We solely relied on if the macro `_POSIX_THREAD_SAFE_FUNCTIONS`
> are defined in msys2/mingw header.
>
> The _POSIX_THREAD_SAFE_FUNCTIONS are defined in mingw header like this:
>
> ```
> #if defined(_POSIX_C_SOURCE) && !defined(_POSIX_THREAD_SAFE_FUNCTIONS)
> #define _POSIX_THREAD_SAFE_FUNCTIONS 200112L
> #endif
>
> #ifdef _POSIX_THREAD_SAFE_FUNCTIONS
> __forceinline struct tm *__CRTDECL localtime_r(const time_t *_Time, struct tm *_Tm) {
> return localtime_s(_Tm, _Time) ? NULL : _Tm;
> }
> __forceinline struct tm *__CRTDECL gmtime_r(const time_t *_Time, struct tm *_Tm) {
> return gmtime_s(_Tm, _Time) ? NULL : _Tm;
> }
> __forceinline char *__CRTDECL ctime_r(const time_t *_Time, char *_Str) {
> return ctime_s(_Str, 0x7fffffff, _Time) ? NULL : _Str;
> }
> __forceinline char *__CRTDECL asctime_r(const struct tm *_Tm, char * _Str) {
> return asctime_s(_Str, 0x7fffffff, _Tm) ? NULL : _Str;
> }
> #endif
> ```
>
> Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
> configure | 34 ----------------------------------
> include/sysemu/os-win32.h | 4 ++--
> util/oslib-win32.c | 4 ++--
> 3 files changed, 4 insertions(+), 38 deletions(-)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v9 5/5] configure: Fixes ncursesw detection under msys2/mingw by convert them to meson
2020-10-12 23:43 [PATCH v9 0/5] Fixes curses on msys2/mingw Yonggang Luo
` (3 preceding siblings ...)
2020-10-12 23:43 ` [PATCH v9 4/5] win32: Simplify gmtime_r detection not depends on if _POSIX_C_SOURCE are defined on msys2/mingw Yonggang Luo
@ 2020-10-12 23:43 ` Yonggang Luo
4 siblings, 0 replies; 9+ messages in thread
From: Yonggang Luo @ 2020-10-12 23:43 UTC (permalink / raw)
To: qemu-devel, Daniel P . Berrangé
Cc: QEMU Trivial, Alex Bennée, Richard Henderson, Laurent Vivier,
Yonggang Luo, Gerd Hoffmann, Paolo Bonzini,
Philippe Mathieu-Daudé
The mingw pkg-config are showing following absolute path and contains : as the separator,
-D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC:/CI-Tools/msys64/mingw64/include/ncursesw:-I/usr/include/ncursesw:
-DNCURSES_WIDECHAR -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC -pipe -lncursesw -lgnurx -ltre -lintl -liconv
-DNCURSES_WIDECHAR -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC -lncursesw
-DNCURSES_WIDECHAR -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC -lcursesw
-DNCURSES_WIDECHAR /CI-Tools/msys64/mingw64/include/ncursesw -pipe -lncursesw -lgnurx -ltre -lintl -liconv
-DNCURSES_WIDECHAR /CI-Tools/msys64/mingw64/include/ncursesw -lncursesw
-DNCURSES_WIDECHAR /CI-Tools/msys64/mingw64/include/ncursesw -lcursesw
-DNCURSES_WIDECHAR -I/usr/include/ncursesw -pipe -lncursesw -lgnurx -ltre -lintl -liconv
-DNCURSES_WIDECHAR -I/usr/include/ncursesw -lncursesw
-DNCURSES_WIDECHAR -I/usr/include/ncursesw -lcursesw
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
---
configure | 118 +++-------------------------------------------
meson.build | 83 +++++++++++++++++++++++++++-----
meson_options.txt | 4 ++
ui/meson.build | 2 +-
4 files changed, 83 insertions(+), 124 deletions(-)
diff --git a/configure b/configure
index 9a87685517..f839c2a557 100755
--- a/configure
+++ b/configure
@@ -295,7 +295,8 @@ unset target_list_exclude
brlapi=""
curl=""
-curses=""
+iconv="auto"
+curses="auto"
docs=""
fdt="auto"
netmap="no"
@@ -1173,13 +1174,13 @@ for opt do
;;
--disable-safe-stack) safe_stack="no"
;;
- --disable-curses) curses="no"
+ --disable-curses) curses="disabled"
;;
- --enable-curses) curses="yes"
+ --enable-curses) curses="enabled"
;;
- --disable-iconv) iconv="no"
+ --disable-iconv) iconv="disabled"
;;
- --enable-iconv) iconv="yes"
+ --enable-iconv) iconv="enabled"
;;
--disable-curl) curl="no"
;;
@@ -3440,102 +3441,6 @@ EOF
fi
fi
-##########################################
-# iconv probe
-if test "$iconv" != "no" ; then
- cat > $TMPC << EOF
-#include <iconv.h>
-int main(void) {
- iconv_t conv = iconv_open("WCHAR_T", "UCS-2");
- return conv != (iconv_t) -1;
-}
-EOF
- iconv_prefix_list="/usr/local:/usr"
- iconv_lib_list=":-liconv"
- IFS=:
- for iconv_prefix in $iconv_prefix_list; do
- IFS=:
- iconv_cflags="-I$iconv_prefix/include"
- iconv_ldflags="-L$iconv_prefix/lib"
- for iconv_link in $iconv_lib_list; do
- unset IFS
- iconv_lib="$iconv_ldflags $iconv_link"
- echo "looking at iconv in '$iconv_cflags' '$iconv_lib'" >> config.log
- if compile_prog "$iconv_cflags" "$iconv_lib" ; then
- iconv_found=yes
- break
- fi
- done
- if test "$iconv_found" = yes ; then
- break
- fi
- done
- if test "$iconv_found" = "yes" ; then
- iconv=yes
- else
- if test "$iconv" = "yes" ; then
- feature_not_found "iconv" "Install iconv devel"
- fi
- iconv=no
- fi
-fi
-
-##########################################
-# curses probe
-if test "$iconv" = "no" ; then
- # curses will need iconv
- curses=no
-fi
-if test "$curses" != "no" ; then
- if test "$mingw32" = "yes" ; then
- curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):"
- curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null):-lpdcurses"
- else
- curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null):-I/usr/include/ncursesw:"
- curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null):-lncursesw:-lcursesw"
- fi
- curses_found=no
- cat > $TMPC << EOF
-#include <locale.h>
-#include <curses.h>
-#include <wchar.h>
-int main(void) {
- wchar_t wch = L'w';
- setlocale(LC_ALL, "");
- resize_term(0, 0);
- addwstr(L"wide chars\n");
- addnwstr(&wch, 1);
- add_wch(WACS_DEGREE);
- return 0;
-}
-EOF
- IFS=:
- for curses_inc in $curses_inc_list; do
- # Make sure we get the wide character prototypes
- curses_inc="-DNCURSES_WIDECHAR $curses_inc"
- IFS=:
- for curses_lib in $curses_lib_list; do
- unset IFS
- if compile_prog "$curses_inc" "$curses_lib" ; then
- curses_found=yes
- break
- fi
- done
- if test "$curses_found" = yes ; then
- break
- fi
- done
- unset IFS
- if test "$curses_found" = "yes" ; then
- curses=yes
- else
- if test "$curses" = "yes" ; then
- feature_not_found "curses" "Install ncurses devel"
- fi
- curses=no
- fi
-fi
-
##########################################
# curl probe
if test "$curl" != "no" ; then
@@ -6200,16 +6105,6 @@ if test "$have_x11" = "yes" && test "$need_x11" = "yes"; then
echo "X11_CFLAGS=$x11_cflags" >> $config_host_mak
echo "X11_LIBS=$x11_libs" >> $config_host_mak
fi
-if test "$iconv" = "yes" ; then
- echo "CONFIG_ICONV=y" >> $config_host_mak
- echo "ICONV_CFLAGS=$iconv_cflags" >> $config_host_mak
- echo "ICONV_LIBS=$iconv_lib" >> $config_host_mak
-fi
-if test "$curses" = "yes" ; then
- echo "CONFIG_CURSES=y" >> $config_host_mak
- echo "CURSES_CFLAGS=$curses_inc" >> $config_host_mak
- echo "CURSES_LIBS=$curses_lib" >> $config_host_mak
-fi
if test "$pipe2" = "yes" ; then
echo "CONFIG_PIPE2=y" >> $config_host_mak
fi
@@ -7181,6 +7076,7 @@ NINJA=${ninja:-$PWD/ninjatool} $meson setup \
-Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \
-Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f \
-Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt \
+ -Diconv=$iconv -Dcurses=$curses \
$cross_arg \
"$PWD" "$source_path"
diff --git a/meson.build b/meson.build
index c23167c61b..8ad600a91a 100644
--- a/meson.build
+++ b/meson.build
@@ -424,6 +424,74 @@ if targetos == 'linux' and have_tools and not get_option('mpath').disabled()
endif
endif
+iconv = not_found
+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
+ endif
+endif
+if get_option('iconv').enabled() and not iconv.found()
+ error('Cannot detect iconv API')
+endif
+
+curses = not_found
+if iconv.found() and not get_option('curses').disabled()
+ curses_libname_list = ['ncursesw', 'ncurses', 'cursesw', 'pdcurses']
+ curses_test = '''
+ #include <locale.h>
+ #include <curses.h>
+ #include <wchar.h>
+ int main(void) {
+ wchar_t wch = L'w';
+ setlocale(LC_ALL, "");
+ resize_term(0, 0);
+ addwstr(L"wide chars\n");
+ addnwstr(&wch, 1);
+ add_wch(WACS_DEGREE);
+ return 0;
+ }'''
+ foreach curses_libname : curses_libname_list
+ libcurses = dependency(curses_libname,
+ required: false,
+ method: 'pkg-config',
+ static: enable_static)
+
+ if not libcurses.found()
+ dirs = ['/usr/include/ncursesw']
+ if targetos == 'windows'
+ dirs = []
+ endif
+ libcurses = cc.find_library(curses_libname,
+ required: false,
+ dirs: dirs,
+ static: enable_static)
+ endif
+ if libcurses.found()
+ if cc.links(curses_test, dependencies: [libcurses])
+ curses = declare_dependency(compile_args: '-DNCURSES_WIDECHAR', dependencies: [libcurses])
+ break
+ endif
+ endif
+ endforeach
+endif
+if get_option('curses').enabled() and not curses.found()
+ if not iconv.found()
+ error('Cannot detect iconv API')
+ else
+ error('Cannot detect curses API')
+ endif
+endif
+
brlapi = not_found
if 'CONFIG_BRLAPI' in config_host
brlapi = declare_dependency(link_args: config_host['BRLAPI_LIBS'].split())
@@ -502,16 +570,6 @@ if 'CONFIG_X11' in config_host
x11 = declare_dependency(compile_args: config_host['X11_CFLAGS'].split(),
link_args: config_host['X11_LIBS'].split())
endif
-curses = not_found
-if 'CONFIG_CURSES' in config_host
- curses = declare_dependency(compile_args: config_host['CURSES_CFLAGS'].split(),
- link_args: config_host['CURSES_LIBS'].split())
-endif
-iconv = not_found
-if 'CONFIG_ICONV' in config_host
- iconv = declare_dependency(compile_args: config_host['ICONV_CFLAGS'].split(),
- link_args: config_host['ICONV_LIBS'].split())
-endif
vnc = not_found
png = not_found
jpeg = not_found
@@ -618,6 +676,7 @@ config_host_data.set('CONFIG_COCOA', cocoa.found())
config_host_data.set('CONFIG_LIBUDEV', libudev.found())
config_host_data.set('CONFIG_MPATH', mpathpersist.found())
config_host_data.set('CONFIG_MPATH_NEW_API', mpathpersist_new_api)
+config_host_data.set('CONFIG_CURSES', curses.found())
config_host_data.set('CONFIG_SDL', sdl.found())
config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
config_host_data.set('CONFIG_VNC', vnc.found())
@@ -1833,8 +1892,8 @@ if config_host.has_key('CONFIG_NETTLE')
endif
summary_info += {'libtasn1': config_host.has_key('CONFIG_TASN1')}
summary_info += {'PAM': config_host.has_key('CONFIG_AUTH_PAM')}
-summary_info += {'iconv support': config_host.has_key('CONFIG_ICONV')}
-summary_info += {'curses support': config_host.has_key('CONFIG_CURSES')}
+summary_info += {'iconv support': iconv.found()}
+summary_info += {'curses support': curses.found()}
# TODO: add back version
summary_info += {'virgl support': config_host.has_key('CONFIG_VIRGL')}
summary_info += {'curl support': config_host.has_key('CONFIG_CURL')}
diff --git a/meson_options.txt b/meson_options.txt
index 1d3c94840a..e6cb1e589b 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -32,6 +32,10 @@ option('cocoa', type : 'feature', value : 'auto',
description: 'Cocoa user interface (macOS only)')
option('mpath', type : 'feature', value : 'auto',
description: 'Multipath persistent reservation passthrough')
+option('iconv', type : 'feature', value : 'auto',
+ description: 'Font glyph conversion support')
+option('curses', type : 'feature', value : 'auto',
+ description: 'curses UI')
option('sdl', type : 'feature', value : 'auto',
description: 'SDL user interface')
option('sdl_image', type : 'feature', value : 'auto',
diff --git a/ui/meson.build b/ui/meson.build
index 8a080c38e3..78ad792ffb 100644
--- a/ui/meson.build
+++ b/ui/meson.build
@@ -39,7 +39,7 @@ specific_ss.add(when: ['CONFIG_SOFTMMU'], if_true: opengl)
ui_modules = {}
-if config_host.has_key('CONFIG_CURSES')
+if curses.found()
curses_ss = ss.source_set()
curses_ss.add(when: [curses, iconv], if_true: [files('curses.c'), pixman])
ui_modules += {'curses' : curses_ss}
--
2.28.0.windows.1
^ permalink raw reply related [flat|nested] 9+ messages in thread