[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: <ncursesw/curses.h> and addnwstr
From: |
Florian Weimer |
Subject: |
Re: <ncursesw/curses.h> and addnwstr |
Date: |
Tue, 25 Apr 2023 17:13:55 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) |
* Thomas Dickey:
> On Fri, Mar 17, 2023 at 07:15:26PM +0100, Florian Weimer wrote:
>> ocaml-curses has a configure check like this
>>
>> AC_MSG_CHECKING(for wide character support in ncurses library)
>> AC_TRY_LINK(
>> [#include <wchar.h>
>> #include CURSES_HEADER
>> ],
>> [wchar_t wch = 0;
> ^^^^^^ this is declared via wchar.h, but the wide-character curses.h
> would include that, making the #include redundant.
In theory, the header could use a private type like __wchar_t, I guess.
>> addnwstr(&wch, 1);],
>> [AC_MSG_RESULT(yes)
>> AC_DEFINE(HAVE_WIDE_CURSES, 1, [Defined if ncurses library includes
>> wide character support])
>> BOOL_WIDE_CURSES="true"],
>> [AC_MSG_RESULT(no)])
>>
>> CURSES_HEADER in our builds is <ncursesw/curses.h>. But curiously, that
>> does not declare define, only <curses.h> does. The symbol is defined in
> ^^ not sure what you're indicating here
I meant to write addnwstr.
> But the wide-character features also (even for X/Open Curses) have
> to have a symbol defined to declare them. There's a section in
> the ncurses manpage mentioning that:
>
> • Alternatively, you can enable the feature by defining
> NCURSES_WIDECHAR with the caveat that some other header file
> than curses.h may require a specific value for _XOPEN_SOURCE
> (or a system-specific symbol).
>
> (actually, NetBSD doesn't require a symbol, but that's in the 60% which
> it hasn't implemented yet :-)
Ahh, so I changed it to this:
AC_TRY_LINK(
[#include <wchar.h>
#define NCURSES_WIDECHAR 1
#include CURSES_HEADER
],
[wchar_t wch = 0;
addnwstr (&wch)],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_WIDE_CURSES, 1, [Defined if ncurses library includes wide
character support])
BOOL_WIDE_CURSES="true"],
[AC_MSG_RESULT(no)])
Just addding “#define NCURSES_WIDECHAR 1” (the 1 is significant). That
seems to work—I now get a declaration of addnwstr.
Thanks,
Florian
- Re: <ncursesw/curses.h> and addnwstr,
Florian Weimer <=