[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: <ncursesw/curses.h> and addnwstr
From: |
Thomas Dickey |
Subject: |
Re: <ncursesw/curses.h> and addnwstr |
Date: |
Fri, 17 Mar 2023 19:02:39 -0400 |
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.
> 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
> libncursesw.so.6.2, though, which is why this issue is not apparent with
> current compilers which still support implicit function declarations.
>
> How should we resolve this? Is there a better function for ocaml-curses
> to probe? What about portability beyond ncurses?
I'd check if cchar_t is declared, to first get the proper header.
That should only be declared in the wide-character headers (because
it's only used for the wide-character functions of X/Open Curses).
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 :-)
--
Thomas E. Dickey <dickey@invisible-island.net>
https://invisible-island.net
signature.asc
Description: PGP signature