-AC_CACHE_CHECK(for ncurses extended functions,cf_cv_ncurses_ext_funcs,[
-AC_TRY_LINK([
-#include <${cf_cv_ncurses_header-curses.h}>],
-[
- (void) assume_default_colors (0, 0);
- (void) curses_version ();
- (void) define_key (0, 0);
- (void) is_term_resized (0, 0);
- (void) key_defined (0);
- (void) keybound (0, 0);
- (void) keyok (0, 0);
- (void) resize_term (0, 0);
- (void) resizeterm (0, 0);
- (void) use_default_colors ();
- (void) use_extended_names (0);
- (void) wresize (0, 0, 0);],
- [cf_cv_ncurses_ext_funcs=yes],
- [cf_cv_ncurses_ext_funcs=no])
-])
-test "$cf_cv_ncurses_ext_funcs" != no && AC_DEFINE(NCURSES_EXT_FUNCS)
+CF_TPUTS_PROTO
+CF_NCURSES_EXT_FUNCS
+
+if test "$cf_enable_widec" = yes
+then
+ # workaround for systems with ncurses before 20111029, due to change of
+ # feature test macro from _XPG5 to _XOPEN_SOURCE
+ if test -n "$cf_cv_ncurses_version" && test "x$cf_cv_ncurses_version" != xno
+ then
+ cf_define_xpg5=no
+ AC_MSG_CHECKING(if _XPG5 should be defined to enable wide-characters)
+
+ AC_TRY_COMPILE([
+#include <${cf_cv_ncurses_header:-curses.h}>],
+ [int x = _XPG5],,
+ [cf_save_cppflags="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS -D_XPG5"
+ AC_TRY_COMPILE([
+#include <${cf_cv_ncurses_header:-curses.h}>],
+ [int x = _XPG5],
+ [cf_define_xpg5=yes])
+ CPPFLAGS="$cf_save_cppflags"])
+ AC_MSG_RESULT($cf_define_xpg5)
+
+ if test "$cf_define_xpg5" = yes
+ then
+ CPPFLAGS="$CPPFLAGS -D_XPG5"
+ fi
+ fi
+
+ AC_CACHE_CHECK(for wide-character functions,cf_cv_widechar_funcs,[
+ AC_TRY_LINK([
+#include <${cf_cv_ncurses_header:-curses.h}>],
+ [
+ static wchar_t src_wchar[2];
+ static cchar_t dst_cchar;
+ setcchar(&dst_cchar, src_wchar, A_NORMAL, 0, (void *) 0);
+ ],
+ [cf_cv_widechar_funcs=yes],
+ [cf_cv_widechar_funcs=no])
+ ])
+ if test "$cf_cv_widechar_funcs" != no ; then
+ AC_DEFINE(USE_WIDEC_SUPPORT,1,[Define to 1 to enable wide-character support in (n)curses])
+ else
+ AC_DEFINE(USE_WIDEC_SUPPORT,0)
+ fi
+else
+ AC_DEFINE(USE_WIDEC_SUPPORT,0)
+fi