$NetBSD: patch-aj,v 1.5 2008/04/04 21:09:16 tonnerre Exp $

Detect getutent correctly on NetBSD with utmpx.
Include curses header when testing tgetent in order to prevent
crash on 64-bit architectures.

--- configure.in.orig	2003-06-03 07:58:24.000000000 -0400
+++ configure.in	2004-06-16 16:11:55.000000000 -0400
@@ -664,6 +664,8 @@
 AC_MSG_ERROR(!!! no tgetent - no screen))))))
 
 AC_TRY_RUN([
+#include <curses.h>
+
 main()
 {
  exit(strcmp(tgoto("%p1%d", 0, 1), "1") ? 0 : 1);
@@ -815,9 +817,15 @@
 AC_TRY_LINK([
 #include <time.h> /* to get time_t on SCO */
 #include <sys/types.h>
-#if defined(SVR4) && !defined(DGUX)
+#include <sys/param.h>
+#if (defined(SVR4) && !defined(DGUX)) \
+ || (defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 106050000))
 #include <utmpx.h>
 #define utmp utmpx
+# ifdef __NetBSD__
+#  define pututline pututxline
+#  define getutent  getutxent
+# endif
 #else
 #include <utmp.h>
 #endif
@@ -1209,6 +1217,7 @@
 AC_TRY_LINK(,[vsprintf(0,0,0);], AC_MSG_RESULT(yes);AC_DEFINE(USEVARARGS), AC_MSG_RESULT(no))
 
 AC_HEADER_DIRENT
+AC_CHECK_HEADERS(sys/stropts.h)
 
 AC_MSG_CHECKING(for setenv)
 AC_TRY_LINK(,[setenv((char *)0,(char *)0);unsetenv((char *)0);], AC_MSG_RESULT(yes);AC_DEFINE(USESETENV),
