dnl CF_WIDEC_CURSES version: 6 updated: 2020/03/19 20:23:48
dnl ---------------
dnl Check for curses implementations that can handle wide-characters
AC_DEFUN([CF_WIDEC_CURSES],
[
AC_CACHE_CHECK(if curses supports wide characters,cf_cv_widec_curses,[
AC_TRY_LINK([
#include <stdlib.h>
#include <${cf_cv_ncurses_header:-curses.h}>],[
    wchar_t temp[2];
    wchar_t wch = 'A';
    temp[0] = wch;
    waddnwstr(stdscr, temp, 1);
],
[cf_cv_widec_curses=yes],
[cf_cv_widec_curses=no])
])

if test "$cf_cv_widec_curses" = yes ; then
	AC_DEFINE(WIDEC_CURSES,1,[Define to 1 if curses supports wide characters])

	# This is needed on Tru64 5.0 to declare mbstate_t
	AC_CACHE_CHECK(if we must include wchar.h to declare mbstate_t,cf_cv_widec_mbstate,[
	AC_TRY_COMPILE([
#include <stdlib.h>
#include <${cf_cv_ncurses_header:-curses.h}>],
[mbstate_t state; (void)state],
[cf_cv_widec_mbstate=no],
[AC_TRY_COMPILE([
#include <stdlib.h>
#include <wchar.h>
#include <${cf_cv_ncurses_header:-curses.h}>],
[mbstate_t state; (void)state],
[cf_cv_widec_mbstate=yes],
[cf_cv_widec_mbstate=unknown])])])

if test "$cf_cv_widec_mbstate" = yes ; then
	AC_DEFINE(NEED_WCHAR_H,1,[Define to 1 if we must include wchar.h])
fi

if test "$cf_cv_widec_mbstate" != unknown ; then
	AC_DEFINE(HAVE_MBSTATE_T,1,[Define to 1 if we have mbstate_t type])
fi

fi
])dnl
