dnl CF_WITH_GPM version: 10 updated: 2017/04/29 18:32:18
dnl -----------
dnl
dnl The option parameter (if neither yes/no) is assumed to be the name of
dnl the gpm library, e.g., for dynamic loading.
AC_DEFUN([CF_WITH_GPM],
[
AC_MSG_CHECKING(if you want to link with the GPM mouse library)
AC_ARG_WITH(gpm,
	[  --with-gpm              use Alessandro Rubini's GPM library],
	[with_gpm=$withval],
	[with_gpm=maybe])
AC_MSG_RESULT($with_gpm)

if test "$with_gpm" != no ; then
	AC_CHECK_HEADER(gpm.h,[
		AC_DEFINE(HAVE_GPM_H,1,[Define to 1 if we have gpm.h header])
		if test "$with_gpm" != yes && test "$with_gpm" != maybe ; then
			CF_VERBOSE(assuming we really have GPM library)
			AC_DEFINE(HAVE_LIBGPM,1,[Define to 1 if we have the gpm library])
			with_gpm=yes
		else
			AC_CHECK_LIB(gpm,Gpm_Open,[with_gpm=yes],[
				if test "$with_gpm" = maybe; then
					AC_MSG_WARN(Cannot link with GPM library)
					with_gpm=no
				else
					AC_MSG_ERROR(Cannot link with GPM library)
				fi
			])
		fi
	],[
		test "$with_gpm" != maybe && AC_MSG_WARN(Cannot find GPM header)
		with_gpm=no
	])
fi
])
