dnl CF_CURSES_MOUSE version: 5 updated: 2011/01/30 18:45:52
dnl ---------------
dnl Test for the existence of SysVr4 mouse support in curses. If we've not got
dnl it, we'll simulate the interface (for xterm, at least).
AC_DEFUN([CF_CURSES_MOUSE],
[
AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
AC_MSG_CHECKING(for curses mouse-support)
AC_CACHE_VAL(cf_cv_curses_mouse,[
AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],[
	int x, y;
#ifdef NCURSES_VERSION
	MEVENT mpos;
	getyx(stdscr, y, x);
	wmouse_trafo(stdscr, &y, &x, TRUE);
	if (wenclose(stdscr, y, x)) {
		getmouse(&mpos);
	}
#else
	getmouse();
	request_mouse_pos();
	wmouse_position(stdscr, &x, &y);
	mouse_on(TRUE);
	mouse_off(FALSE);
	mouse_set(0);
#endif
	],
	[cf_cv_curses_mouse=yes],
	[cf_cv_curses_mouse=no])
])
AC_MSG_RESULT($cf_cv_curses_mouse)
test $cf_cv_curses_mouse = yes && AC_DEFINE(CURSES_HAS_MOUSE)
])dnl
