autoconf-archive-maintainers
[Top][All Lists]
Advanced

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

ax_with_curses wrongly assumes assumes that only -lncursesw can have WID


From: Samuel Bronson
Subject: ax_with_curses wrongly assumes assumes that only -lncursesw can have WIDEC support
Date: Sat, 8 Sep 2012 15:37:26 -0400

The code in ax_with_curses.m4 serial 13 [1] assumes that the ncurses
library name is a reliable indicator of whether or not it has WIDEC
support (and should, therefore, count as "ncursesw" as far as the
program is concerned).

Unfortunately, things are not quite so simple, as this paragraph from
the ncurses FAQ [2] says:

> The ncurses and ncursesw libraries are reasonably source-compatible. That is, 
> an application written for "ncurses" will build with "ncursesw". But it will 
> behave differently in response to your locale settings. (Some distributors, 
> who do not care about the differences, have chosen to merge the names 
> together as "ncurses").

One example of this is OS X 10.5, where we have:

Users-MacBook:tig sam$ pkgutil --only-files --files
com.apple.pkg.BaseSystem|grep curses
usr/lib/libcurses.dylib
usr/lib/libncurses.5.4.dylib
usr/lib/libncurses.5.dylib
usr/lib/libncurses.dylib

And, since the same ncurses header can be shared between WIDEC and
non-WIDEC builds, you can't reliably determine WIDEC support based on
the header contents, either; you actually have to try linking a
program that refers to a WIDEC-only function (making sure to #define
_XOPEN_SOURCE_EXTENDED before incuding the curses header!) with the
library.

So basically, what needs to be done is:

1. Find a curses library and header that work together
2. Check if it's ncurses
3. Check if it has WIDEC support by trying to link against a symbol
like add_wch()
4. Whatever else

I'm also not sure whether or not the assumption that only ncurses
supports wide characters is warranted, given that X/Open Curses has
included it since Issue 4: I expect there is at least one other
implementation -- why would they have added it to the spec if it
hadn't been implemented -- but does anyone use the other one anymore?

(Obviously, if some joker decides to implement the MBCS functionality
but not the wide-character functionality, we won't be able to detect
this.  But then, there are a lot of things we can't detect, like
whether the wide character support does anything useful...)

[1]: 
http://git.savannah.gnu.org/cgit/autoconf-archive.git/tree/m4/ax_with_curses.m4?id=f0b9e6216dc813324bbc5dccd147ab7058b96262
[2]: http://invisible-island.net/ncurses/ncurses.faq.html#how_big_is_it



reply via email to

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