qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Weil <sw@weilnetz.de>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	patches@linaro.org, "Laszlo Ersek" <lersek@redhat.com>,
	"Rainer Müller" <raimue@codingfarm.de>,
	"Chad Joan" <chadjoan@gmail.com>
Subject: Re: [Qemu-devel] [PATCH] configure: Define NCURSES_WIDECHAR if we're using curses
Date: Sun, 6 Jun 2021 20:13:02 +0200	[thread overview]
Message-ID: <5b59b9d2-8b9c-e204-098f-b540f8bd1117@weilnetz.de> (raw)
In-Reply-To: <1496414138-7622-1-git-send-email-peter.maydell@linaro.org>

Am 02.06.17 um 16:35 schrieb Peter Maydell:

> We want the wide character functions from the ncurses header.
> Unfortunately it doesn't provide them by default, but only
> if either:
>   * NCURSES_WIDECHAR is defined (for ncurses 20111030 and up)
>   * _XOPEN_SOURCE/_XOPEN_SOURCE_EXTENDED are suitably defined
>
> So far we have been implicitly relying on the latter, because
> for GNU libc when we define _GNU_SOURCE this causes libc
> to define the _XOPEN_SOURCE macros for us. Unfortunately
> this doesn't work on all libcs, because some (like OSX and
> musl libc) do not define _XOPEN_SOURCE when _GNU_SOURCE
> is defined.
>
> We can't fix this by defining _XOPEN_SOURCE ourselves, because
> that also means "and don't provide any functions that aren't in
> that standard", and not all libcs provide any way to override
> that to also get the non-standard functions. In particular
> FreeBSD has no such mechanism, and OSX's _DARWIN_C_SOURCE
> doesn't reenable everything (for instance getpagesize()
> is still not prototyped if _DARWIN_C_SOURCE and _XOPEN_SOURCE
> are both defined).
>
> So we have to define NCURSES_WIDECHAR. (This will only work
> if your ncurses is at least 20111030, as older versions
> don't honour this macro.)


I answer to this very old e-mail because I noticed today that defining 
NCURSES_WIDECHAR does not work with the latest MacOS on M1:

Apple still delivers a curses.h which indicates NCURSES_VERSION "5.7" 
(20081102). It does not know NCURSES_WIDECHAR, but support for curses 
can be enabled with _XOPEN_SOURCE_EXTENDED=1.

I used this patch for git master:

diff --git a/meson.build b/meson.build
index 626cf932c1..513332a76d 100644
--- a/meson.build
+++ b/meson.build
@@ -606,7 +606,7 @@ if have_system and not get_option('curses').disabled()
      endif
    endforeach
    msg = get_option('curses').enabled() ? 'curses library not found' : ''
-  curses_compile_args = ['-DNCURSES_WIDECHAR']
+  curses_compile_args = ['-DNCURSES_WIDECHAR', 
'-D_XOPEN_SOURCE_EXTENDED=1']
    if curses.found()
      if cc.links(curses_test, args: curses_compile_args, dependencies: 
[curses])
        curses = declare_dependency(compile_args: curses_compile_args, 
dependencies: [curses])


Then curses is detected and works when configure is given the right 
PKG_CONFIG_PATH:

PKG_CONFIG_PATH=/opt/homebrew/Library/Homebrew/os/mac/pkgconfig/11 
./configure

Regards

Stefan




  parent reply	other threads:[~2021-06-06 18:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-02 14:35 [Qemu-devel] [PATCH] configure: Define NCURSES_WIDECHAR if we're using curses Peter Maydell
2017-06-02 21:58 ` Laszlo Ersek
2017-06-03  9:43   ` Kamil Rytarowski
2017-06-03 16:08     ` Laszlo Ersek
2017-06-03 10:13 ` Rainer Müller
2017-06-03 10:17   ` Kamil Rytarowski
2017-06-26 13:31 ` Peter Maydell
2021-06-06 18:13 ` Stefan Weil [this message]
2021-06-07 12:57   ` Laszlo Ersek
2021-06-07 13:05     ` Daniel P. Berrangé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5b59b9d2-8b9c-e204-098f-b540f8bd1117@weilnetz.de \
    --to=sw@weilnetz.de \
    --cc=chadjoan@gmail.com \
    --cc=lersek@redhat.com \
    --cc=patches@linaro.org \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=raimue@codingfarm.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).