dnl beta tests for openpty support
AC_MSG_CHECKING(whether we can use openpty)
ac_use_openpty="yes"
AC_ARG_ENABLE(openpty,
 AC_HELP_STRING([--disable-openpty],[disable openpty (UNIX98 terminals) support [default=enabled]]),
 [ac_use_openpty="no"])
if test "$ac_use_openpty" = "yes"; then
	kde_safe_LIBS=$LIBS
	LIBS="$LIBS $LIBUTIL"
	AC_TRY_RUN([
#include <pty.h>

int main(int argc, char* argv) {
	int master_fd, slave_fd;
	int result;

	result = openpty(&master_fd, &slave_fd, 0, 0, 0);

	return 0;
}
], [ac_use_openpty="yes"], [ac_use_openpty="no"])
	LIBS=$kde_safe_LIBS
fi
if test "$ac_use_openpty" = "yes"; then
	AC_DEFINE(HAVE_OPENPTY, 1, [Defines whether we can use the openpty() function])
	AC_MSG_RESULT(yes)
else
	AC_MSG_RESULT(no)
fi

dnl Set preprocessor variable of how to get cwd from a process
AC_MSG_CHECKING(how cwd can be be found by seperate process)
case "$host" in 
  *-*-linux*) cwd_method='proc' ;;
	*) cwd_method='no' ;;
esac
AC_MSG_RESULT($cwd_method)

case "$cwd_method" in
	proc) AC_DEFINE(HAVE_PROC_CWD, 1, [Defines whether /proc/`pid`/cwd exists]) ;;
esac
