$NetBSD$

--- configure.orig	2003-06-30 12:22:32.000000000 +0000
+++ configure
@@ -6631,9 +6631,10 @@ EOF
   *-*-netbsd*)
     # no_shadows_password_checking=yes ?
     #          ^  (see above comment)
+    cat >> confdefs.h <<\EOF
+#define SSH_UTMP_UTMPX 1
+EOF
 
-    # At least NetBSD 1.6 has a nonfunctional utmpx.
-    no_utmpx=yes
     ;;
   *)
     ;;
@@ -8339,6 +8340,50 @@ else
   echo "$ac_t""no" 1>&6
 fi
 
+echo $ac_n "checking for loginx in -lutil""... $ac_c" 1>&6
+echo "configure:8345: checking for loginx in -lutil" >&5
+ac_lib_var=`echo util'_'loginx | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lutil  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8353 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char loginx();
+
+int main() {
+loginx()
+; return 0; }
+EOF
+if { (eval echo configure:8364: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_LIBUTIL_LOGINX 1
+EOF
+
+			  LIBS="$LIBS -lutil"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
 
 if test -z "$no_vhangup"; then
   for ac_func in vhangup
@@ -8678,8 +8723,44 @@ EOF
 fi
 echo "$ac_t""$ac_cv_have_proto_logout" 1>&6
 
+echo $ac_n "checking whether there is a prototype for logoutx""... $ac_c" 1>&6
+echo "configure:8728: checking whether there is a prototype for logoutx" >&5
+if eval "test \"`echo '$''{'ac_cv_have_proto_logoutx'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+   cat > conftest.$ac_ext <<EOF
+#line 8733 "configure"
+#include "confdefs.h"
+                               $session_wtmp_includes
+/* If someone has a prototype like this for anything, then... well. */
+void * logoutx(void *, int *, char *, int, char, void *[6][8][10][3][4], ...);
+
+int main() {
+                               ; 
+; return 0; }
+EOF
+if { (eval echo configure:8743: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_have_proto_logoutx=no
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_have_proto_logoutx=yes
+fi
+rm -f conftest*
+fi
+
+if test "$ac_cv_have_proto_logoutx" = "yes"; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_PROTO_LOGOUTX 1
+EOF
+
+fi
+echo "$ac_t""$ac_cv_have_proto_logoutx" 1>&6
+
 echo $ac_n "checking whether there is a prototype for logwtmp""... $ac_c" 1>&6
-echo "configure:8683: checking whether there is a prototype for logwtmp" >&5
+echo "configure:8764: checking whether there is a prototype for logwtmp" >&5
 if eval "test \"`echo '$''{'ac_cv_have_proto_logwtmp'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -8714,6 +8795,42 @@ EOF
 fi
 echo "$ac_t""$ac_cv_have_proto_logwtmp" 1>&6
 
+echo $ac_n "checking whether there is a prototype for logwtmpx""... $ac_c" 1>&6
+echo "configure:8800: checking whether there is a prototype for logwtmpx" >&5
+if eval "test \"`echo '$''{'ac_cv_have_proto_logwtmpx'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+   cat > conftest.$ac_ext <<EOF
+#line 8805 "configure"
+#include "confdefs.h"
+                               $session_wtmp_includes
+/* If someone has a prototype like this for anything, then... well. */
+void * logwtmpx(void *, int *, char *, int, char, void *[6][8][10][3][4], ...);
+
+int main() {
+                               ; 
+; return 0; }
+EOF
+if { (eval echo configure:8815: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_have_proto_logwtmpx=no
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_have_proto_logwtmpx=yes
+fi
+rm -f conftest*
+fi
+
+if test "$ac_cv_have_proto_logwtmpx" = "yes"; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_PROTO_LOGWTMPX 1
+EOF
+
+fi
+echo "$ac_t""$ac_cv_have_proto_logwtmpx" 1>&6
+
 for ac_func in initgroups
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
