From nobody Sun May 5 23:20:48 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=1600445629; cv=none; d=zohomail.com; s=zohoarc; b=e8SnntONqSoUvvBt4Y0Zzftu357z3geAu0A7TcYL98jX7ufAVaOv3XkIoziWVkeozEzq0tdS5fH6TjEVpx8TJSOKezuqfLkvYfQOwXKaX6ppSYAUMQ9f44zhdG6jU4eJktgc+g1MDnaiI3KzghniWiwkaC6b9kplmuCDyvJViEE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600445629; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=38P1i5JkQS7ofb/RLUKRo29Ks91Vqq7zgVYwAGpHkHw=; b=GjXge2Hbb+wIe+Qjo/VJtn5qMP541rhFL0O9NOQ4SF2heO01IMlpeV0xeRgNsbGU5e/wZafCpBSO8MtNwiOSAF6kzEW4OxNiVwlNNaA2BMo0b5os75GHjOmL22chd4QdE2wukM36AXweUmjUQSj0V87TZeNRb8sxGVtGuKdGvgM= 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 1600445629060361.6057677348582; Fri, 18 Sep 2020 09:13:49 -0700 (PDT) Received: from localhost ([::1]:60098 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJJ18-0006TV-J4 for importer@patchew.org; Fri, 18 Sep 2020 12:13:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35310) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJIr0-0001OZ-5H; Fri, 18 Sep 2020 12:03:21 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:37146) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kJIqx-00020X-Uy; Fri, 18 Sep 2020 12:03:17 -0400 Received: by mail-pf1-x444.google.com with SMTP id w7so3731508pfi.4; Fri, 18 Sep 2020 09:03:15 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id z22sm16889012pjq.2.2020.09.18.09.03.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 09:03:12 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=38P1i5JkQS7ofb/RLUKRo29Ks91Vqq7zgVYwAGpHkHw=; b=AD0IKkuDUTEYayFd/69tJ/nPVITto6e2Ci0F2xQArsYLkVOpZX1Is6tDJNSzntnPup /pRKpREQxPusYQIn1dwsnJadShLQU3YDQahQu+m+rgcGBN7mwSO4MIkNiR+kj+42IiIM LAJpF9SmTfpcxP+ACkCA7XNC3p4qLYDlWCy2FPh70Pr8MiYIzgkfEiOzDIhqjMUT9HWK TBsePQC+dNhMsPyIvkFy3BBuJbeXuq/PoVfOd5hU/fEEveh5z32gxBqA+LONJHdpRQdj t1wayClZ4udPbTMsLmYBmKg479uZIqHjY+8wERVkPzaqMQPsXqYCTPlul0F3jpC3Btbi lQow== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=38P1i5JkQS7ofb/RLUKRo29Ks91Vqq7zgVYwAGpHkHw=; b=jraMdzCJ9Hhj3s76FeNkiK3uKvu3LvuHIr4QCLQm8fB7zy1nZnLVYaHaaIVrZDc+/J 703QQ11I0E1dsQcE6oGiaOm6HXO6vJzq0vKXhMkfeymhyRyxCVSEjCThDtINPYJJVdGc eDKStAJfwUuSYuYIWOp6vZtZwo2KSzsb4joDs+E9cpoh+oMizz2XP2p/QCBWSH2lwzWz Rez7JxWn0wktOHiU2vy1eWAATI5cVSRMyZ5euVqypQnkFeZaGSq32FOgI2xPZYWyIIu/ ynhBccVxybqaK/lHAZEhgYzNts4+d82PpkpcZksctjhgx3c+wKxdMTzqZ+bYISUyCiDK sR+Q== X-Gm-Message-State: AOAM533ldNx7kbkWrW8Lv3Myv7kdLys2eh2INTQM9P9fj1NiBONb72f9 bN7W3WBoEJleOSC2Tl2gSwabd+0pXoHCfQ== X-Google-Smtp-Source: ABdhPJx8+4qj8ijLvEY1oZRvZngjc7oqp5cpo/BxFwtqxLH4tw8V+nQSx4sfwNnTx1L/ttli88tAPg== X-Received: by 2002:a62:7511:0:b029:142:2501:35da with SMTP id q17-20020a6275110000b0290142250135damr16466544pfc.58.1600444992827; Fri, 18 Sep 2020 09:03:12 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Subject: [PATCH v5 1/4] curses: Fixes compiler error that complain don't have langinfo.h on msys2/mingw Date: Sat, 19 Sep 2020 00:02:47 +0800 Message-Id: <20200918160250.1141-2-luoyonggang@gmail.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20200918160250.1141-1-luoyonggang@gmail.com> References: <20200918160250.1141-1-luoyonggang@gmail.com> 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::444; envelope-from=luoyonggang@gmail.com; helo=mail-pf1-x444.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 , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , Laurent Vivier , Yonggang Luo , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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" 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 | ^~~~~~~~~~~~ compilation terminated. So we using g_get_codeset instead of nl_langinfo(CODESET) Signed-off-by: Yonggang Luo Reviewed-by: Gerd Hoffmann --- ui/curses.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 #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_autofree 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 From nobody Sun May 5 23:20:48 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=1600445348; cv=none; d=zohomail.com; s=zohoarc; b=kvtmtCE5Pkm7vf9GRUWpmtKnwoWngogb0sjwcnyOy3nwr5nsrXMVe3+/wzzofXCrGDkGNqsb0TBSFEXuvlxT8FOkeJGRUBpyIOiGmHMcx5LRu8RMcU5/4iXTftnn0UhHzV+C4aQdFwTdVevI3SPbzvAeBZD6S6MwLeffuukh6jM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600445348; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fONA64XSdMINk4Pb3HJvl02BkTmqUfaoSQk6W/tx2aE=; b=BCuYgnzESoXLz1CSMVf3mUT3nv5dXzgUlNm6USipXmrP5InnNFwVoK4hYmeZswieDbnLFKxDj2IUQ4yn8GkKmMY3pXUwpDGbZ5oeMHpPdOz55N6MA+sOiM659UqRhi6W+cC861REHe6LEkw1vUbs9HrR7YQt11pC+ohRikyIfzM= 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 1600445348543379.16619286426123; Fri, 18 Sep 2020 09:09:08 -0700 (PDT) Received: from localhost ([::1]:43678 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJIwd-0007vI-8C for importer@patchew.org; Fri, 18 Sep 2020 12:09:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35322) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJIr2-0001Og-2O; Fri, 18 Sep 2020 12:03:21 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:45154) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kJIr0-00020t-BZ; Fri, 18 Sep 2020 12:03:19 -0400 Received: by mail-pg1-x542.google.com with SMTP id 67so3712978pgd.12; Fri, 18 Sep 2020 09:03:17 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id z22sm16889012pjq.2.2020.09.18.09.03.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 09:03:15 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=fONA64XSdMINk4Pb3HJvl02BkTmqUfaoSQk6W/tx2aE=; b=q4zQlAPvzmnCy/j+JfpvVec+NkCSjngziD1domsA2YXZ9C2mPSHG9wcbGMRxm5EZ95 6LFlQ2MrD3rqE/Noaw7Zmr1Ffp1aLc4Ii50rNOnV07Bf/E2115OY3jmgdiOn7igwV8V3 mZvbDbvebf/btejF+vqx6Mlvy5RI2NlgoA6DYxWUtIatb1U2vYLhoDWBbjL3r0fBBByY Gl0Iaozkwx7pfhrhxKD01SBQIg3EaKv9iPMKomh50iNpAEHDV9TmFFqOWH/v5KMm+AEI mj5mVMjCwdYJDltvaj5zHb9AcV1uMMq7hCqavf2w6eApCj8Ha4OxhrUrpyxMMALDO6kv 8akA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=fONA64XSdMINk4Pb3HJvl02BkTmqUfaoSQk6W/tx2aE=; b=K2sOTOM9jQ7Je5Gu2OV53PZfyS7KCurM34JmMml07ZxpSscGPDqmC0IqXw+6kv3MsM VBJf8fjZvn2DU0MkK2SVHCoZE9caaJo9KuJDGZocwTKtsSncDkk2dBdlVnRKjXE8jmzP QjWG++3XwdQNaRxl0C+MpMZ9Hl0w7qFKrq7Pa2Z+RtFd3pRoKNIM/bbVjryDgg7GYVFI aN+ypDEKmZkb61SOCaBv2EYQ5bmAHX6CSbuALXFGkruG85ZX62nROL8O3+VbNMrCv4of JFBSJGXEiGsreFNERBjs5SsQy2iyABcB0c0KwPqdI14fPFTLullGMFxL6g7HMJgMj6j0 kJHA== X-Gm-Message-State: AOAM530Ia5HgCOaKhRJtGjggru6ILjQTClFql9P8OznvUhoXT/wrqH2C +WABHXEjzzYuWFHJl200J5LsVvD87J4gOA== X-Google-Smtp-Source: ABdhPJy65ZplwHo5cDKNDYnSxr/Z8n3sQzglvcDGc3rS8cXHlVeRAXYvUN5fSg2GE34W/gz4kdUi/A== X-Received: by 2002:aa7:96eb:0:b029:142:2501:397b with SMTP id i11-20020aa796eb0000b02901422501397bmr16971433pfq.64.1600444996165; Fri, 18 Sep 2020 09:03:16 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Subject: [PATCH v5 2/4] curses: Fixes curses compiling errors. Date: Sat, 19 Sep 2020 00:02:48 +0800 Message-Id: <20200918160250.1141-3-luoyonggang@gmail.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20200918160250.1141-1-luoyonggang@gmail.com> References: <20200918160250.1141-1-luoyonggang@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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::542; envelope-from=luoyonggang@gmail.com; helo=mail-pg1-x542.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: =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , QEMU Trivial , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , Laurent Vivier , Yonggang Luo , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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=3Dmaybe-uninitialized] 256 | curses2foo(_curses2keycode, _curseskey2keycode, chr, maybe_keyc= ode) | ^~~~~~~~~~ ../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 t= his function [-Werror=3Dmaybe-uninitialized] 256 | curses2foo(_curses2keycode, _curseskey2keycode, chr, maybe_keyc= ode) | ^~~~~~~~~~ ../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 Reviewed-by: Gerd Hoffmann Reviewed-by: Daniel P. Berrang=C3=A9 --- 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 in= t _curseskey2foo[], static void curses_refresh(DisplayChangeListener *dcl) { int chr, keysym, keycode, keycode_alt; - enum maybe_keycode maybe_keycode; + enum maybe_keycode maybe_keycode =3D CURSES_KEYCODE; =20 curses_winch_check(); =20 @@ -299,7 +299,7 @@ static void curses_refresh(DisplayChangeListener *dcl) =20 /* alt or esc key */ if (keycode =3D=3D 1) { - enum maybe_keycode next_maybe_keycode; + enum maybe_keycode next_maybe_keycode =3D CURSES_KEYCODE; int nextchr =3D console_getch(&next_maybe_keycode); =20 if (nextchr !=3D -1) { --=20 2.28.0.windows.1 From nobody Sun May 5 23:20:48 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=1600445827; cv=none; d=zohomail.com; s=zohoarc; b=DsBVADmx7NwG7AYI1kf+07hctEMOybu29ztbp01dzDjQ4gesUz8uQCSS88PHDA+eC83owd6vn2PiYORpw5acxncX9XL8xSGWgOujMgngComeXOsDbRv57qqZw/SFckMQ9sDLmVphdWUkupbmzza+m95eD2onjy8aNcSwvtJnOac= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600445827; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ERzHS3mP7/PmR4u4ye15OKBMGVTAoqY1cYC1G2Sq2y0=; b=WPgS8MyvQtJiUOVS53KaR2uZPeXzmiBUWncHhEvc3JK129s/MB3r3cxoK5Tecl/w/C2Apq5ZMcY0Ih4flOZTObAKc3ayxmyVSFY67kIJx8qHGDh0RscD5lyFjDb0HajC/lMsbyHeArm+VT1+gd5LPoT+z+rPuq/IMTfQZwqNfdA= 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 1600445827480527.4921604760802; Fri, 18 Sep 2020 09:17:07 -0700 (PDT) Received: from localhost ([::1]:40798 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJJ4K-0001md-7x for importer@patchew.org; Fri, 18 Sep 2020 12:17:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJIr6-0001Rr-LF; Fri, 18 Sep 2020 12:03:30 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:45811) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kJIr3-00021D-Oj; Fri, 18 Sep 2020 12:03:24 -0400 Received: by mail-pf1-x441.google.com with SMTP id k15so3712125pfc.12; Fri, 18 Sep 2020 09:03:21 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id z22sm16889012pjq.2.2020.09.18.09.03.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 09:03:18 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=ERzHS3mP7/PmR4u4ye15OKBMGVTAoqY1cYC1G2Sq2y0=; b=b+FTvRBQgTJ0tQjSU2OZJXxKyigb/MvODregi0FLvqwU9RfXVCCHAK0c3ctknp42Sq okwnxcJIegJ2QDmvIwsBgOR3hp3veOOPYUohw5nrJpBzpA2sITH29brGA17fAgEALCF4 QAva7WZKs20o6H5r5Ks5zQZytNhNfgEMw7xtWNFTf2tQXKcV6pS47zXRPPrOYrrD9iJs dKdfn8j8an+2Rrm0V+CdBkh7kUvSnUT3jxcEInD2iS8iZEAwu5q9QSvcCXeXea5u9/Iu ZcAne+q8+DW3jFKW2f8+fFqCdAXYzB5Pg7yWC5T55VQJLPbxb+rsEmdCCvD78kksV3Ky jdOg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=ERzHS3mP7/PmR4u4ye15OKBMGVTAoqY1cYC1G2Sq2y0=; b=XHVlqvo9RAkuLLUwzGXZvsvReHiSPv58hUov/YnfSrr7Mz2GYnxCRUywDH/ojxuoAr 43tklguBHQCh1e7Vx/7AF4r3Gq3HEJhHPoTmA+tYervOZstR+s+sJVnXt/7c5nJNIV+g GRxh4xQcby6CjknrNv3pz/iT4bofUc4cJfovna+hs1ERGoA7poY/kAtJqSiOLCidHW6j A/zUiecRZNPbbRgF5QQpZrjuG84JG0/A3wUxqTlnQXAKWlQ4f80QBrmzFyf7jQ0/+1f2 6EltQxuLt2PlIgLX9wU27ej12kecT11xBvpzMoHy0U9EwcwzVUVLzLTxIi56P91Bvfw8 dc1A== X-Gm-Message-State: AOAM533ryYoCqw4+vxwP8qhtt3s/fnm7Chx2ydvkZzUlZXwKXeqx1Urr DY4NRdQU9T2I/PBzbU2qJ6ERLrmLUioihw== X-Google-Smtp-Source: ABdhPJy0qL5bVvNOkUOkE27hvxCExB4iCKxBaYrJKt7pR2gg0mXVseVurRYGZX3TNR/A9lVNU52aYw== X-Received: by 2002:a63:4902:: with SMTP id w2mr27815218pga.311.1600444999334; Fri, 18 Sep 2020 09:03:19 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Subject: [PATCH v5 3/4] win32: Simplify gmtime_r detection not depends on if _POSIX_C_SOURCE are defined on msys2/mingw Date: Sat, 19 Sep 2020 00:02:49 +0800 Message-Id: <20200918160250.1141-4-luoyonggang@gmail.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20200918160250.1141-1-luoyonggang@gmail.com> References: <20200918160250.1141-1-luoyonggang@gmail.com> 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::441; envelope-from=luoyonggang@gmail.com; helo=mail-pf1-x441.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 , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , Laurent Vivier , Yonggang Luo , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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" We remove the CONFIG_LOCALTIME_R detection option in configure, and move th= e check existence of gmtime_r from configure into C header and source directly by u= sing macro `_POSIX_THREAD_SAFE_FUNCTIONS`. Before this patch, the configure script are always assume the compiler does= n't define _POSIX_C_SOURCE macro at all, but that's not true, because thirdparty libra= ry 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 follo= wing 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 redecla= ration of 'gmtime_r' [-Werror=3Dredundant-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, st= ruct 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 redecla= ration of 'localtime_r' [-Werror=3Dredundant-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 redecla= ration of 'gmtime_r' [-Werror=3Dredundant-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, st= ruct 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 redecla= ration of 'localtime_r' [-Werror=3Dredundant-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 --- 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 422b1ef2a3..21c010140c 100755 --- a/configure +++ b/configure @@ -2499,37 +2499,6 @@ if test "$vhost_net" =3D ""; then test "$vhost_kernel" =3D "yes" && vhost_net=3Dyes fi =20 -########################################## -# MinGW / Mingw-w64 localtime_r/gmtime_r check - -if test "$mingw32" =3D "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 - # are not in fact redundant. -cat > $TMPC << EOF -#include -#include -#undef localtime_r -int main(void) { localtime_r(NULL, NULL); return 0; } -EOF - if compile_prog "" "" ; then - localtime_r=3D"yes" - else - localtime_r=3D"no" - fi -fi - ########################################## # pkg-config probe =20 @@ -6943,9 +6912,6 @@ if [ "$bsd" =3D "yes" ] ; then echo "CONFIG_BSD=3Dy" >> $config_host_mak fi =20 -if test "$localtime_r" =3D "yes" ; then - echo "CONFIG_LOCALTIME_R=3Dy" >> $config_host_mak -fi if test "$qom_cast_debug" =3D "yes" ; then echo "CONFIG_QOM_CAST_DEBUG=3Dy" >> $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) =20 /* 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 */ =20 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) } } =20 -#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 */ =20 static int socket_error(void) { --=20 2.28.0.windows.1 From nobody Sun May 5 23:20:48 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=1600445961; cv=none; d=zohomail.com; s=zohoarc; b=mv+bMBP0Uy+yjXJTiYmd6GTmSgqqVub/rfyP/YGY+F/u5LcaeoQVgoxGRJ1v2onkDnwIzoWpFp81TrVrxr6iEs3XGxTQmPa2OIG1GdI34COBK5KYWD0s7NiI3AL7JDjlmcJXBLj5gymU+96+S+LGB4yVWHSfsdcZkN9Gp6Flxyk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600445961; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=PObA7qDGq61ijr7OJQ2hN5JLm532x4zIpGeZLkEIZQA=; b=ld3qQL3YZRtnv24geEdvYEAdkYcrdfid+8beobps7Il9MQNXiEFhrqlP3UgpiLwso9nbv/QYMjgwzOMQNnee7L2kNXrMyT5po567DJrWSsalLiwk5ncPo55KH8kkka7KyBuM8vX9qK9CAz4B3mUm9HZr+fTfIoOgyHyXQ2O4sc0= 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 1600445961749751.3896045651624; Fri, 18 Sep 2020 09:19:21 -0700 (PDT) Received: from localhost ([::1]:45154 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJJ6W-0003cx-C1 for importer@patchew.org; Fri, 18 Sep 2020 12:19:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35390) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJIrA-0001Sl-Ci; Fri, 18 Sep 2020 12:03:32 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]:46540) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kJIr6-00022V-SQ; Fri, 18 Sep 2020 12:03:27 -0400 Received: by mail-pg1-x530.google.com with SMTP id 34so3715979pgo.13; Fri, 18 Sep 2020 09:03:24 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id z22sm16889012pjq.2.2020.09.18.09.03.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 09:03:21 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=PObA7qDGq61ijr7OJQ2hN5JLm532x4zIpGeZLkEIZQA=; b=kX6f/voLwJOw0o2dwrI/hSRiRr0e70gkxbESJRPqMdP72YaiVpEbRuqAkEwILl030R StzMxjQzwPojyBH/KHQG8Onw+0C4mpH4NT0fH/CkceU+BITzwr6HXheV2Ks/hQbrji4B kyUdprsRQJhbjcrQOnsQr3VMI5fFlMd2JwbawlBqIukEGc6auTDCv8Jlt/QBUeb7CcD9 5Chxg7OHzN1GbWfzRMnb7iFYcOBa0n1/teKUn4vgJ/7CjJJ+bmFkVDCBC8T2OKQdU0O3 DKxWzMmdmPIbnHclORYdzFY5xN/ZKAB45wT9KZB9mIownfmk3oylcH/cAcXMLudT8NXr 1slA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=PObA7qDGq61ijr7OJQ2hN5JLm532x4zIpGeZLkEIZQA=; b=BquUohqCkNpLbVVSaKeYRpLWnZgycwkAMekEz1I7BEFmCTuW20HVBAPUkg+YyMKis1 K+kYh6aKCnNt2sGDO692Z2dY6wMjd5nyox7KLGaoRPjJvztb4DEaIvkPydbdDGOSV+Zm u7rkznwPcHEL6FbP5j44X9GZuT1YvMtlmu9/tujJkGZC1mibvwLtKQ68EVjgiecT07hR XI1zca3kLpwZ/33zkfUXXpjD7fI9UuJTysyBcZ8WDqcJUQMxZj9H+uN5WtXE5Y87aUPB 11otRaG+zkcZ/ET+YudmphkyiWWXjKpZLpgWt4k05Lul8Cp19cJKDhQkrlmAQdH9akml Hy+A== X-Gm-Message-State: AOAM533D1/RGCugjGvA/RDb57vZIjUeV9cdJJt+RKGd6AtMAxQVHEudF m+a2dV6NtkZO3ld7r/WGYpmApAo4nFG0Tg== X-Google-Smtp-Source: ABdhPJznQLSEJA67dSUaA/DWNICyBJExQtHOSWK7WtSskwsNl9tws4GTTVLi4TVkAW6xsyaFmuY7pQ== X-Received: by 2002:a63:1226:: with SMTP id h38mr26912298pgl.196.1600445002486; Fri, 18 Sep 2020 09:03:22 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org Subject: [PATCH v5 4/4] configure: Fixes ncursesw detection under msys2/mingw by convert them to meson Date: Sat, 19 Sep 2020 00:02:50 +0800 Message-Id: <20200918160250.1141-5-luoyonggang@gmail.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20200918160250.1141-1-luoyonggang@gmail.com> References: <20200918160250.1141-1-luoyonggang@gmail.com> 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::530; envelope-from=luoyonggang@gmail.com; helo=mail-pg1-x530.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 , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , Laurent Vivier , Yonggang Luo , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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, -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 Signed-off-by: Yonggang Luo Reviewed-by: Gerd Hoffmann --- configure | 121 +++------------------------------------------- meson.build | 80 +++++++++++++++++++++++++----- meson_options.txt | 4 ++ ui/meson.build | 2 +- 4 files changed, 80 insertions(+), 127 deletions(-) diff --git a/configure b/configure index 21c010140c..2ddb034aa5 100755 --- a/configure +++ b/configure @@ -396,7 +396,8 @@ unset target_list_exclude =20 brlapi=3D"" curl=3D"" -curses=3D"" +iconv=3D"auto" +curses=3D"auto" docs=3D"" fdt=3D"" netmap=3D"no" @@ -1285,13 +1286,13 @@ for opt do ;; --disable-safe-stack) safe_stack=3D"no" ;; - --disable-curses) curses=3D"no" + --disable-curses) curses=3D"disabled" ;; - --enable-curses) curses=3D"yes" + --enable-curses) curses=3D"enabled" ;; - --disable-iconv) iconv=3D"no" + --disable-iconv) iconv=3D"disabled" ;; - --enable-iconv) iconv=3D"yes" + --enable-iconv) iconv=3D"enabled" ;; --disable-curl) curl=3D"no" ;; @@ -3581,105 +3582,6 @@ EOF fi fi =20 -########################################## -# iconv probe -if test "$iconv" !=3D "no" ; then - cat > $TMPC << EOF -#include -int main(void) { - iconv_t conv =3D iconv_open("WCHAR_T", "UCS-2"); - return conv !=3D (iconv_t) -1; -} -EOF - iconv_prefix_list=3D"/usr/local:/usr" - iconv_lib_list=3D":-liconv" - IFS=3D: - for iconv_prefix in $iconv_prefix_list; do - IFS=3D: - iconv_cflags=3D"-I$iconv_prefix/include" - iconv_ldflags=3D"-L$iconv_prefix/lib" - for iconv_link in $iconv_lib_list; do - unset IFS - iconv_lib=3D"$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=3Dyes - break - fi - done - if test "$iconv_found" =3D yes ; then - break - fi - done - if test "$iconv_found" =3D "yes" ; then - iconv=3Dyes - else - if test "$iconv" =3D "yes" ; then - feature_not_found "iconv" "Install iconv devel" - fi - iconv=3Dno - fi -fi - -########################################## -# curses probe -if test "$iconv" =3D "no" ; then - # curses will need iconv - curses=3Dno -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" - 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" - fi - curses_found=3Dno - cat > $TMPC << EOF -#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; -} -EOF - IFS=3D: - for curses_inc in $curses_inc_list; do - # Make sure we get the wide character prototypes - curses_inc=3D"-DNCURSES_WIDECHAR $curses_inc" - IFS=3D: - for curses_lib in $curses_lib_list; do - unset IFS - if compile_prog "$curses_inc" "$curses_lib" ; then - curses_found=3Dyes - break - fi - done - if test "$curses_found" =3D yes ; then - break - fi - done - unset IFS - if test "$curses_found" =3D "yes" ; then - curses=3Dyes - else - if test "$curses" =3D "yes" ; then - feature_not_found "curses" "Install ncurses devel" - fi - curses=3Dno - fi -fi - ########################################## # curl probe if test "$curl" !=3D "no" ; then @@ -6527,16 +6429,6 @@ if test "$have_x11" =3D "yes" && test "$need_x11" = =3D "yes"; then echo "X11_CFLAGS=3D$x11_cflags" >> $config_host_mak echo "X11_LIBS=3D$x11_libs" >> $config_host_mak fi -if test "$iconv" =3D "yes" ; then - echo "CONFIG_ICONV=3Dy" >> $config_host_mak - echo "ICONV_CFLAGS=3D$iconv_cflags" >> $config_host_mak - echo "ICONV_LIBS=3D$iconv_lib" >> $config_host_mak -fi -if test "$curses" =3D "yes" ; then - echo "CONFIG_CURSES=3Dy" >> $config_host_mak - echo "CURSES_CFLAGS=3D$curses_inc" >> $config_host_mak - echo "CURSES_LIBS=3D$curses_lib" >> $config_host_mak -fi if test "$pipe2" =3D "yes" ; then echo "CONFIG_PIPE2=3Dy" >> $config_host_mak fi @@ -7816,6 +7708,7 @@ NINJA=3D${ninja:-$PWD/ninjatool} $meson setup \ -Dstrip=3D$(if test "$strip_opt" =3D yes; then echo true; else ech= o false; fi) \ -Db_pie=3D$(if test "$pie" =3D yes; then echo true; else echo fals= e; fi) \ -Db_coverage=3D$(if test "$gcov" =3D yes; then echo true; else ech= o false; fi) \ + -Diconv=3D$iconv -Dcurses=3D$curses \ -Dmalloc=3D$malloc -Dmalloc_trim=3D$malloc_trim \ -Dcocoa=3D$cocoa -Dmpath=3D$mpath -Dsdl=3D$sdl -Dsdl_image=3D$sdl_= image \ -Dvnc=3D$vnc -Dvnc_sasl=3D$vnc_sasl -Dvnc_jpeg=3D$vnc_jpeg -Dvnc_p= ng=3D$vnc_png \ diff --git a/meson.build b/meson.build index ace15dc8c0..3088566ff4 100644 --- a/meson.build +++ b/meson.build @@ -340,6 +340,71 @@ if targetos =3D=3D 'linux' and not get_option('mpath')= .disabled() endif endif =20 +iconv =3D not_found +if not get_option('iconv').disabled() + libiconv =3D cc.find_library('iconv', static: enable_static) + if libiconv.found() + if cc.links(''' + #include + int main(void) { + iconv_t conv =3D iconv_open("WCHAR_T", "UCS-2"); + return conv !=3D (iconv_t) -1; + }''', dependencies: [libiconv]) + iconv =3D declare_dependency(dependencies: [libiconv]) + endif + endif +endif +if get_option('iconv').enabled() and not iconv.found() + error('Cannot detect iconv API') +endif + +curses =3D not_found +if iconv.found() and not get_option('curses').disabled() + curses_libname_list =3D ['ncursesw', 'ncurses', 'cursesw', 'pdcurses'] + foreach curses_libname : curses_libname_list + libcurses =3D dependency(curses_libname, + required: false, + method: 'pkg-config', + static: enable_static) + + if not libcurses.found() + dirs =3D ['/usr/include/ncursesw'] + if targetos =3D=3D 'windows' + dirs =3D [] + endif + libcurses =3D cc.find_library(curses_libname, + required: false, + dirs: dirs, + static: enable_static) + endif + if libcurses.found() + if cc.links(''' + #include + #include + #include + int main(void) { + 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); + return 0; + }''', compile_args: '-DNCURSES_WIDECHAR', dependencies: [libcurs= es]) + curses =3D 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 =3D not_found if 'CONFIG_BRLAPI' in config_host brlapi =3D declare_dependency(link_args: config_host['BRLAPI_LIBS'].spli= t()) @@ -418,16 +483,6 @@ if 'CONFIG_X11' in config_host x11 =3D declare_dependency(compile_args: config_host['X11_CFLAGS'].split= (), link_args: config_host['X11_LIBS'].split()) endif -curses =3D not_found -if 'CONFIG_CURSES' in config_host - curses =3D declare_dependency(compile_args: config_host['CURSES_CFLAGS']= .split(), - link_args: config_host['CURSES_LIBS'].split(= )) -endif -iconv =3D not_found -if 'CONFIG_ICONV' in config_host - iconv =3D declare_dependency(compile_args: config_host['ICONV_CFLAGS'].s= plit(), - link_args: config_host['ICONV_LIBS'].split()) -endif vnc =3D not_found png =3D not_found jpeg =3D not_found @@ -544,6 +599,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()) @@ -1521,8 +1577,8 @@ if config_host.has_key('CONFIG_NETTLE') endif summary_info +=3D {'libtasn1': config_host.has_key('CONFIG_TASN1'= )} summary_info +=3D {'PAM': config_host.has_key('CONFIG_AUTH_P= AM')} -summary_info +=3D {'iconv support': config_host.has_key('CONFIG_ICONV'= )} -summary_info +=3D {'curses support': config_host.has_key('CONFIG_CURSES= ')} +summary_info +=3D {'iconv support': iconv.found()} +summary_info +=3D {'curses support': curses.found()} # TODO: add back version summary_info +=3D {'virgl support': config_host.has_key('CONFIG_VIRGL'= )} summary_info +=3D {'curl support': config_host.has_key('CONFIG_CURL')} diff --git a/meson_options.txt b/meson_options.txt index 46ea1d889a..a5d155a535 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -15,6 +15,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) =20 ui_modules =3D {} =20 -if config_host.has_key('CONFIG_CURSES') +if curses.found() curses_ss =3D ss.source_set() curses_ss.add(when: [curses, iconv], if_true: [files('curses.c'), pixman= ]) ui_modules +=3D {'curses' : curses_ss} --=20 2.28.0.windows.1