From nobody Mon May 20 15:26:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1599449582; cv=none; d=zohomail.com; s=zohoarc; b=XJ0yCR2lo47dPqquk4S1FSxKsy3TCEMlYrtz353pCPLBGFo1pSYUVIEOUU+onXC0wuJPWHsAYJa+Q4XwdmCAXuNPKcu4/S4MKD7m42Z3DdtT0ygOGOqz2XVz6cgHZi+zAT9JphthNGe2ogsgS83PMhH3rCeUKEP0S4usk5Ztb1U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599449582; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=nAx6s0n7EquPuKtbRfQCQcpP1wZJocedy6K5u8E7EDo=; b=m38onepKqKvJ4cxlJpaGbnx/IRnipwSPtdnjRHXMJSnkn/J3TCCU/YdbSbaaUyETrbqRkXHsvea+CwbqDktYdqEESb5Khd4QoQ/WFU4H4ktj+g0HLuSDLB1TpvFR8dwtzpLznejSucOL8jNsoRLgFFfxEjKtmjUYgTqfVwiPzNU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1599449582511529.5027866308363; Sun, 6 Sep 2020 20:33:02 -0700 (PDT) Received: from localhost ([::1]:42292 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kF7ts-0005IR-Bj for importer@patchew.org; Sun, 06 Sep 2020 23:33:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43300) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kF7tF-0004lu-3Q; Sun, 06 Sep 2020 23:32:21 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:37341) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kF7tD-0001w3-A0; Sun, 06 Sep 2020 23:32:20 -0400 Received: by mail-pf1-x443.google.com with SMTP id w7so7908044pfi.4; Sun, 06 Sep 2020 20:32:18 -0700 (PDT) Received: from localhost.localdomain ([222.95.248.6]) by smtp.googlemail.com with ESMTPSA id j18sm10973291pgm.30.2020.09.06.20.32.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Sep 2020 20:32:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nAx6s0n7EquPuKtbRfQCQcpP1wZJocedy6K5u8E7EDo=; b=et8TH88KAEvaQt4beYyr20+X4EvGDTuta0UPlHeG33J0BEG/JRZVxNFuSUJpvSol3I MUM/5OTL/pRfn18RJ6doWKoXz3w6lSaf3iB+eiFFyoUq/yYeq9bATBH5k4W2Z3oBCITd 8flU5B3KEVeOSjxGRIk/xWAd8YnAoueP8JWAWGPua3VFPSmKvDf3ATduhsChbBKyQgya DHA1MsTC0ur4zM6n7GSJU6cXF3OzKkVhZGlEAiMFeak4eFZgrS8QBDYlgSBW2P6n5dkc LhuVFl2hN9nHFvRJNCzzmk4eXqShHCRJekC5EMLST/kmsHvieFswwn/H+lxxZGx/ztqm E0YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nAx6s0n7EquPuKtbRfQCQcpP1wZJocedy6K5u8E7EDo=; b=fs/Fpn05Tjfp3Y07mpRULRsx5Munt9DWYMqGwFLrH9zW6py50axKj9yZMRFZReII7m kwJ3dMGKZ57tl6AlOkgBwjuWPhRrdI/MpZl6dZSY6tdyc6BjlfCbA+jCZGfOdrSAXt73 W5baWmqPqdXN08FN5//6lgm28ddFn/13CjsiO0rCU70m+ifZekeJHFP2jwTQ9VwC406C O+tNddayLF+lSeM/EA9pKh+NnWsTkO7uo35JnJnq+fEcbQJzaWV2R+d1CVSGwdqxD55E O5lzglZIXITN7A58URHwDG7obbB/YmogD6vL56B5alzLfKOlqwfWuIFsj3RsUXtEtk6k n16A== X-Gm-Message-State: AOAM531wStiAUt1FdSlZxZULBMoWoj4zpSuF5XlXKSPla4kODBY4NdsG 42NrXc8ZNurvwrzLyxyPuxAaHD/eOm4edAeh X-Google-Smtp-Source: ABdhPJzuFIypYQbGNaq+jH8XeaaNXD6FKPuGRL7tzl34f18XZUcNZbgJHHkjHVGqkmHBotBbWOiGZQ== X-Received: by 2002:a63:6d0d:: with SMTP id i13mr15673017pgc.372.1599449536980; Sun, 06 Sep 2020 20:32:16 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Subject: [PATCH v2] configure: Fixes ncursesw detection under msys2/mingw and enable curses Date: Mon, 7 Sep 2020 11:32:01 +0800 Message-Id: <20200907033201.1453-1-luoyonggang@gmail.com> X-Mailer: git-send-email 2.28.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::443; envelope-from=luoyonggang@gmail.com; helo=mail-pf1-x443.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: QEMU Trivial , Yonggang Luo , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The mingw pkg-config are showing following absolute path and contains : as = the separator, so we must handling : properly. -D_XOPEN_SOURCE=3D600 -D_POSIX_C_SOURCE=3D199506L -IC:/CI-Tools/msys64/ming= w64/include/ncursesw:-I/usr/include/ncursesw: -DNCURSES_WIDECHAR -D_XOPEN_SOURCE=3D600 -D_POSIX_C_SOURCE=3D199506L -IC -p= ipe -lncursesw -lgnurx -ltre -lintl -liconv -DNCURSES_WIDECHAR -D_XOPEN_SOURCE=3D600 -D_POSIX_C_SOURCE=3D199506L -IC -l= ncursesw -DNCURSES_WIDECHAR -D_XOPEN_SOURCE=3D600 -D_POSIX_C_SOURCE=3D199506L -IC -l= cursesw -DNCURSES_WIDECHAR /CI-Tools/msys64/mingw64/include/ncursesw -pipe -lncurse= sw -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 MINGW doesn't have langinfo.h, only exist in glic and musl 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 | ^~~~~~~~~~~~ compilation terminated. Signed-off-by: Yonggang Luo --- configure | 9 +++------ ui/curses.c | 10 +++++----- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/configure b/configure index f8cbd2898c..2dc25bda69 100755 --- a/configure +++ b/configure @@ -3620,8 +3620,8 @@ if test "$iconv" =3D "no" ; then fi if test "$curses" !=3D "no" ; then if test "$mingw32" =3D "yes" ; then - curses_inc_list=3D"$($pkg_config --cflags ncurses 2>/dev/null):" - curses_lib_list=3D"$($pkg_config --libs ncurses 2>/dev/null):-lpdcurse= s" + curses_inc_list=3D"$($pkg_config --cflags ncursesw 2>/dev/null):-I/${M= SYSTEM,,}/include/ncursesw:" + curses_lib_list=3D"$($pkg_config --libs ncursesw 2>/dev/null):-lncurse= sw" else curses_inc_list=3D"$($pkg_config --cflags ncursesw 2>/dev/null):-I/usr= /include/ncursesw:" curses_lib_list=3D"$($pkg_config --libs ncursesw 2>/dev/null):-lncurse= sw:-lcursesw" @@ -3631,17 +3631,14 @@ if test "$curses" !=3D "no" ; then #include #include #include -#include int main(void) { - const char *codeset; wchar_t wch =3D L'w'; setlocale(LC_ALL, ""); resize_term(0, 0); addwstr(L"wide chars\n"); addnwstr(&wch, 1); add_wch(WACS_DEGREE); - codeset =3D nl_langinfo(CODESET); - return codeset !=3D 0; + return 0; } EOF IFS=3D: diff --git a/ui/curses.c b/ui/curses.c index a59b23a9cf..f13804e942 100644 --- a/ui/curses.c +++ b/ui/curses.c @@ -30,7 +30,6 @@ #endif #include #include -#include #include =20 #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_autoptr(gchar) local_codeset =3D g_get_codeset(); =20 /* * Control characters are normally non-printable, but VGA does have @@ -566,14 +566,14 @@ static void font_setup(void) 0x25bc }; =20 - ucs2_to_nativecharset =3D iconv_open(nl_langinfo(CODESET), "UCS-2"); + ucs2_to_nativecharset =3D iconv_open(local_codeset, "UCS-2"); if (ucs2_to_nativecharset =3D=3D (iconv_t) -1) { fprintf(stderr, "Could not convert font glyphs from UCS-2: '%s'\n", strerror(errno)); exit(1); } =20 - nativecharset_to_ucs2 =3D iconv_open("UCS-2", nl_langinfo(CODESET)); + nativecharset_to_ucs2 =3D iconv_open("UCS-2", local_codeset); if (nativecharset_to_ucs2 =3D=3D (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); } =20 - font_conv =3D iconv_open(nl_langinfo(CODESET), font_charset); + font_conv =3D iconv_open(local_codeset, font_charset); if (font_conv =3D=3D (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); =20 - if (strcmp(nl_langinfo(CODESET), "UTF-8")) { + if (strcmp(local_codeset, "UTF-8")) { /* Non-Unicode capable, use termcap equivalents for those availabl= e */ for (i =3D 0; i <=3D 0xFF; i++) { wchar_t wch[CCHARW_MAX]; --=20 2.28.0.windows.1