qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] configure: Define NCURSES_WIDECHAR if we're usi


From: Stefan Weil
Subject: Re: [Qemu-devel] [PATCH] configure: Define NCURSES_WIDECHAR if we're using curses
Date: Sun, 6 Jun 2021 20:13:02 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.2

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]