@@ -3654,35 +3654,40 @@ if test "$iconv" = "no" ; then
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"
+ curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null)
+ $($pkg_config --cflags ncursesw 2>/dev/null)"
+ curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null)
+ $($pkg_config --libs ncursesw 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"
+ 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>
-#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=:
+ IFS='
+' # turn off variable value expansion except for splitting at newlines
for curses_inc in $curses_inc_list; do
# Make sure we get the wide character prototypes
curses_inc="-DNCURSES_WIDECHAR $curses_inc"
- IFS=:
+ IFS='
+' # turn off variable value expansion except for splitting at newlines
for curses_lib in $curses_lib_list; do
unset IFS
if compile_prog "$curses_inc" "$curses_lib" ; then
@@ -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];