qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kamil Rytarowski <n54@gmx.com>
To: Laszlo Ersek <lersek@redhat.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Chad Joan" <chadjoan@gmail.com>,
	"Rainer Müller" <raimue@codingfarm.de>,
	patches@linaro.org
Subject: Re: [Qemu-devel] [PATCH] configure: Define NCURSES_WIDECHAR if we're using curses
Date: Sat, 3 Jun 2017 11:43:48 +0200	[thread overview]
Message-ID: <53bc1565-7ea2-0e13-65ab-db72e3dd9867@gmx.com> (raw)
In-Reply-To: <31f800cb-846d-e627-9d1f-f898a0948652@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2422 bytes --]

On 02.06.2017 23:58, Laszlo Ersek wrote:
> On 06/02/17 16:35, Peter Maydell wrote:
>> 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.)
>>
>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>> ---
>> Testing from the people with musl libc and OSX-with-ncurses
>> appreciated, as I don't have any systems which have the bug
>> which this patch is attempting to fix...
>>
>>  configure | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/configure b/configure
>> index 0586ec9..6aca5d1 100755
>> --- a/configure
>> +++ b/configure
>> @@ -3053,6 +3053,8 @@ int main(void) {
>>  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
>>
> 
> Given that we're already consciously using non-portable functions, this
> solution looks the least messy to me.
> 

These functions are enough portable to work on NetBSD curses(3).

pkgsrc had an equivalent patch to define NCURSES_WIDECHAR=1 to fix build
on Darwin.

> Acked-by: Laszlo Ersek <lersek@redhat.com>
> 
> Thanks
> Laszlo
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2017-06-03  9:41 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 [this message]
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
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=53bc1565-7ea2-0e13-65ab-db72e3dd9867@gmx.com \
    --to=n54@gmx.com \
    --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).