*** empty log message ***
authorroot <root>
Sun, 22 Jan 2006 00:48:13 +0000 (00:48 +0000)
committerroot <root>
Sun, 22 Jan 2006 00:48:13 +0000 (00:48 +0000)
13 files changed:
MANIFEST
aclocal.m4
config.h.in
configure
ptytty.m4 [new file with mode: 0644]
src/fdpass.C
src/fdpass.h
src/logging.C
src/main.C
src/ptytty.C
src/ptytty.h
src/rxvt.h
update_ptytty [new file with mode: 0755]

index ae10a406595b09ab6234ade80db4dad539eff4c2..27cee5ca0dab59678353f454c365ee0d4d9fdec2 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -10,6 +10,7 @@ reconf
 configure
 autogen.sh
 aclocal.m4
+ptytty.m4
 config.guess
 config.h.in
 config.sub
@@ -59,8 +60,6 @@ src/command.C
 src/command.h
 src/encoding.C
 src/encoding.h
-src/fdpass.h
-src/fdpass.C
 src/feature.h
 src/hookinc.h
 src/init.C
@@ -70,15 +69,11 @@ src/iom.h
 src/iom_conf.h
 src/keyboard.C
 src/keyboard.h
-src/logging.C
 src/main.C
 src/misc.C
 src/netdisp.C
 src/netdisp.h
 src/optinc.h
-src/ptytty_conf.h
-src/ptytty.h
-src/ptytty.C
 src/rxvtutil.C
 src/rxvtutil.h
 src/rxvttoolkit.C
@@ -106,6 +101,14 @@ src/version.h
 src/xdefaults.C
 src/xpm.C
 
+src/libptytty.h
+src/ptytty_conf.h
+src/ptytty.h
+src/ptytty.C
+src/logging.C
+src/fdpass.h
+src/fdpass.C
+
 src/gentables
 src/gencompose
 src/genlinedraw
index 93bb03797cd0610f2af59d9fef8f28b1ae82aa19..e30a06c2b905e4b4774cdd61d8e7c5c2865410e3 100644 (file)
@@ -230,3 +230,5 @@ done])
 fi
 ])
 
+m4_include([ptytty.m4])
+
index 608500ea20add50bdde0e5e50acba78ef02e63da..21fa9e2771bf22d6a470bacd849bbd05c523966b 100644 (file)
@@ -1,5 +1,8 @@
 /* config.h.in.  Generated from configure.ac by autoheader.  */
 
+/* clone device filename */
+#undef CLONE_DEVICE
+
 /* Define if you want 8 bit control sequences */
 #undef EIGHT_BIT_CONTROLS
 
 /* Define to 1 if you have the <cwchar> header file. */
 #undef HAVE_CWCHAR
 
+/* Define to 1 if you have /dev/ptym/clone */
+#undef HAVE_DEV_CLONE
+
+/* Define to 1 if you have /dev/ptc */
+#undef HAVE_DEV_PTC
+
+/* Define to 1 if you have /dev/ptmx */
+#undef HAVE_DEV_PTMX
+
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
+/* Define to 1 if you have the `getpt' function. */
+#undef HAVE_GETPT
+
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define to 1 if you have the `isastream' function. */
+#undef HAVE_ISASTREAM
+
+/* Define to 1 if you have the <lastlog.h> header file. */
+#undef HAVE_LASTLOG_H
+
+/* Define to 1 if you have the <libutil.h> header file. */
+#undef HAVE_LIBUTIL_H
+
 /* Define to 1 if you have the `Xft' library (-lXft). */
 #undef HAVE_LIBXFT
 
 /* Define to 1 if you have the `on_exit' function. */
 #undef HAVE_ON_EXIT
 
+/* Define to 1 if you have the `openpty' function. */
+#undef HAVE_OPENPTY
+
+/* Define to 1 if you have the `posix_openpt' function. */
+#undef HAVE_POSIX_OPENPT
+
+/* Define to 1 if you have the <pty.h> header file. */
+#undef HAVE_PTY_H
+
+/* Define to 1 if you have the `revoke' function. */
+#undef HAVE_REVOKE
+
 /* Define if you have sched-h and sched_yield */
 #undef HAVE_SCHED_YIELD
 
 /* Define to 1 if you have the <string.h> header file. */
 #undef HAVE_STRING_H
 
+/* Define if utmp.h or lastlog.h has struct lastlog */
+#undef HAVE_STRUCT_LASTLOG
+
+/* Define if utmpx.h or lastlog.h has struct lastlogx */
+#undef HAVE_STRUCT_LASTLOGX
+
+/* Define if utmp.h has struct utmp */
+#undef HAVE_STRUCT_UTMP
+
+/* Define if utmpx.h has struct utmpx */
+#undef HAVE_STRUCT_UTMPX
+
 /* Define to 1 if you have the <sys/byteorder.h> header file. */
 #undef HAVE_SYS_BYTEORDER_H
 
 /* Define to 1 if you have the <sys/stat.h> header file. */
 #undef HAVE_SYS_STAT_H
 
+/* Define to 1 if you have the <sys/stropts.h> header file. */
+#undef HAVE_SYS_STROPTS_H
+
 /* Define to 1 if you have the <sys/strredir.h> header file. */
 #undef HAVE_SYS_STRREDIR_H
 
 /* Define to 1 if you have the <termios.h> header file. */
 #undef HAVE_TERMIOS_H
 
+/* Define to 1 if you have the `ttyslot' function. */
+#undef HAVE_TTYSLOT
+
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define if sys/socket.h defines the necessary macros/functions for file
+   handle passing */
+#undef HAVE_UNIX_FDPASS
+
 /* Define to 1 if you have the `unsetenv' function. */
 #undef HAVE_UNSETENV
 
+/* Define to 1 if you have the `updwtmp' function. */
+#undef HAVE_UPDWTMP
+
+/* Define to 1 if you have the `updwtmpx' function. */
+#undef HAVE_UPDWTMPX
+
+/* Define to 1 if you have the <util.h> header file. */
+#undef HAVE_UTIL_H
+
+/* Define to 1 if you have the <utmpx.h> header file. */
+#undef HAVE_UTMPX_H
+
+/* Define if struct utmpx contains ut_host */
+#undef HAVE_UTMPX_HOST
+
+/* Define if struct utmpx contains ut_session */
+#undef HAVE_UTMPX_SESSION
+
+/* Define to 1 if you have the <utmp.h> header file. */
+#undef HAVE_UTMP_H
+
+/* Define if struct utmp contains ut_host */
+#undef HAVE_UTMP_HOST
+
+/* Define if struct utmp contains ut_pid */
+#undef HAVE_UTMP_PID
+
 /* Define to 1 if you have the <wchar.h> header file. */
 #undef HAVE_WCHAR_H
 
 /* Define if setlocale (defined to Xsetlocale) works */
 #undef HAVE_XSETLOCALE
 
+/* Define to 1 if you have the `_getpty' function. */
+#undef HAVE__GETPTY
+
 /* Define if you want ISO 14755 extended support */
 #undef ISO_14755
 
+/* Define location of lastlogx */
+#undef LASTLOGX_FILE
+
+/* Define location of lastlog */
+#undef LASTLOG_FILE
+
+/* Define if lastlog is provided via a directory */
+#undef LASTLOG_IS_DIR
+
 /* Define if you want to have lastlog support when utmp/utmpx is enabled */
 #undef LASTLOG_SUPPORT
 
 /* Define if you want to represent unicode characters outside plane 0 */
 #undef UNICODE_3
 
+/* "" */
+#undef UNIX98_PTY
+
 /* Define if you want to have XIM (X Input Method) protocol support - required
    for multibyte characters input */
 #undef USE_XIM
 
+/* Define location of utmpx */
+#undef UTMPX_FILE
+
+/* Define location of utmp */
+#undef UTMP_FILE
+
 /* Define if you want to have utmp/utmpx support */
 #undef UTMP_SUPPORT
 
+/* Define location of wtmpx */
+#undef WTMPX_FILE
+
+/* Define location of wtmp */
+#undef WTMP_FILE
+
 /* Define if you want to have wtmp support when utmp/utmpx is enabled */
 #undef WTMP_SUPPORT
 
index 59eb181323cef5e5da8f7764353cb149389f4f68..63dc302736164a9fbf2b42aadaebeb2528926613 100755 (executable)
--- a/configure
+++ b/configure
 done
 
 
-UTMP_CHECK
+
+
+
+
+for ac_func in \
+       ttyslot \
+       updwtmp \
+       updwtmpx \
+
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"                         || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
+
+
+for ac_header in \
+       utmp.h \
+       utmpx.h \
+       lastlog.h \
+
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"                         || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+if test "${ac_cv_header_utmp_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for utmp.h" >&5
+echo $ECHO_N "checking for utmp.h... $ECHO_C" >&6
+if test "${ac_cv_header_utmp_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_utmp_h" >&5
+echo "${ECHO_T}$ac_cv_header_utmp_h" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking utmp.h usability" >&5
+echo $ECHO_N "checking utmp.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <utmp.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"                         || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking utmp.h presence" >&5
+echo $ECHO_N "checking utmp.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <utmp.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: utmp.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: utmp.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: utmp.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: utmp.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: utmp.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: utmp.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: utmp.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: utmp.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: utmp.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: utmp.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: utmp.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: utmp.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: utmp.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: utmp.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: utmp.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: utmp.h: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for utmp.h" >&5
+echo $ECHO_N "checking for utmp.h... $ECHO_C" >&6
+if test "${ac_cv_header_utmp_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_utmp_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_utmp_h" >&5
+echo "${ECHO_T}$ac_cv_header_utmp_h" >&6
+
+fi
+if test $ac_cv_header_utmp_h = yes; then
+  echo "$as_me:$LINENO: checking for struct utmp" >&5
+echo $ECHO_N "checking for struct utmp... $ECHO_C" >&6
+if test "${struct_utmp+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <utmp.h>
+int
+main ()
+{
+struct utmp ut;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"                         || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  struct_utmp=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+struct_utmp=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $struct_utmp" >&5
+echo "${ECHO_T}$struct_utmp" >&6
+if test x$struct_utmp = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_STRUCT_UTMP 1
+_ACEOF
+
+fi
+
+
+echo "$as_me:$LINENO: checking for ut_host in utmp struct" >&5
+echo $ECHO_N "checking for ut_host in utmp struct... $ECHO_C" >&6
+if test "${struct_utmp_host+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <utmp.h>
+int
+main ()
+{
+struct utmp ut; ut.ut_host;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"                         || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  struct_utmp_host=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+struct_utmp_host=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $struct_utmp_host" >&5
+echo "${ECHO_T}$struct_utmp_host" >&6
+if test x$struct_utmp_host = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_UTMP_HOST 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for ut_pid in utmp struct" >&5
+echo $ECHO_N "checking for ut_pid in utmp struct... $ECHO_C" >&6
+if test "${struct_utmp_pid+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <utmp.h>
+int
+main ()
+{
+struct utmp ut; ut.ut_pid;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"                         || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  struct_utmp_pid=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+struct_utmp_pid=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $struct_utmp_pid" >&5
+echo "${ECHO_T}$struct_utmp_pid" >&6
+if test x$struct_utmp_pid = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_UTMP_PID 1
+_ACEOF
+
+fi
+
+fi
+
+
+
+if test "${ac_cv_header_utmpx_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for utmpx.h" >&5
+echo $ECHO_N "checking for utmpx.h... $ECHO_C" >&6
+if test "${ac_cv_header_utmpx_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_utmpx_h" >&5
+echo "${ECHO_T}$ac_cv_header_utmpx_h" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking utmpx.h usability" >&5
+echo $ECHO_N "checking utmpx.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <utmpx.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"                         || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking utmpx.h presence" >&5
+echo $ECHO_N "checking utmpx.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <utmpx.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: utmpx.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: utmpx.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: utmpx.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: utmpx.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: utmpx.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: utmpx.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: utmpx.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: utmpx.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: utmpx.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: utmpx.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: utmpx.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: utmpx.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: utmpx.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: utmpx.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: utmpx.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: utmpx.h: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for utmpx.h" >&5
+echo $ECHO_N "checking for utmpx.h... $ECHO_C" >&6
+if test "${ac_cv_header_utmpx_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_utmpx_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_utmpx_h" >&5
+echo "${ECHO_T}$ac_cv_header_utmpx_h" >&6
+
+fi
+if test $ac_cv_header_utmpx_h = yes; then
+  echo "$as_me:$LINENO: checking for struct utmpx" >&5
+echo $ECHO_N "checking for struct utmpx... $ECHO_C" >&6
+if test "${struct_utmpx+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <utmpx.h>
+int
+main ()
+{
+struct utmpx ut;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"                         || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  struct_utmpx=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+struct_utmpx=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $struct_utmpx" >&5
+echo "${ECHO_T}$struct_utmpx" >&6
+if test x$struct_utmpx = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_STRUCT_UTMPX 1
+_ACEOF
+
+fi
+
+
+echo "$as_me:$LINENO: checking for host in utmpx struct" >&5
+echo $ECHO_N "checking for host in utmpx struct... $ECHO_C" >&6
+if test "${struct_utmpx_host+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <utmpx.h>
+int
+main ()
+{
+struct utmpx utx; utx.ut_host;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"                         || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  struct_utmpx_host=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+struct_utmpx_host=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $struct_utmpx_host" >&5
+echo "${ECHO_T}$struct_utmpx_host" >&6
+if test x$struct_utmpx_host = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_UTMPX_HOST 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for session in utmpx struct" >&5
+echo $ECHO_N "checking for session in utmpx struct... $ECHO_C" >&6
+if test "${struct_utmpx_session+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <utmpx.h>
+int
+main ()
+{
+struct utmpx utx; utx.ut_session;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"                         || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  struct_utmpx_session=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+struct_utmpx_session=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $struct_utmpx_session" >&5
+echo "${ECHO_T}$struct_utmpx_session" >&6
+if test x$struct_utmpx_session = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_UTMPX_SESSION 1
+_ACEOF
+
+fi
+
+fi
+
+
+echo "$as_me:$LINENO: checking for struct lastlog" >&5
+echo $ECHO_N "checking for struct lastlog... $ECHO_C" >&6
+if test "${struct_lastlog+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <utmp.h>
+#ifdef HAVE_LASTLOG_H
+#include <lastlog.h>
+#endif
+
+int
+main ()
+{
+struct lastlog ll;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"                         || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  struct_lastlog=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+struct_lastlog=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $struct_lastlog" >&5
+echo "${ECHO_T}$struct_lastlog" >&6
+if test x$struct_lastlog = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_STRUCT_LASTLOG 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for struct lastlogx" >&5
+echo $ECHO_N "checking for struct lastlogx... $ECHO_C" >&6
+if test "${struct_lastlogx+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <utmpx.h>
+#ifdef HAVE_LASTLOG_H
+#include <lastlog.h>
+#endif
+
+int
+main ()
+{
+struct lastlogx ll;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"                         || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  struct_lastlogx=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+struct_lastlogx=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $struct_lastlogx" >&5
+echo "${ECHO_T}$struct_lastlogx" >&6
+if test x$struct_lastlogx = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_STRUCT_LASTLOGX 1
+_ACEOF
+
+fi
+
+
+echo "$as_me:$LINENO: checking where utmp is located" >&5
+echo $ECHO_N "checking where utmp is located... $ECHO_C" >&6
+if test "${path_utmp+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+    { echo "$as_me:$LINENO: WARNING: Define UTMP_FILE in config.h manually" >&5
+echo "$as_me: WARNING: Define UTMP_FILE in config.h manually" >&2;}
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdio.h>
+#include <sys/types.h>
+#include <utmp.h>
+#include <errno.h>
+main()
+{
+    char **u, *utmplist[] = {
+    "/var/run/utmp", "/var/adm/utmp", "/etc/utmp", "/usr/etc/utmp", "/usr/adm/utmp", NULL };
+    FILE *a, *f=fopen("conftestval", "w");
+    if (!f) exit(1);
+#ifdef UTMP_FILE
+    fprintf(f, "%s\n", UTMP_FILE);
+    exit(0);
+#endif
+#ifdef _PATH_UTMP
+    fprintf(f, "%s\n", _PATH_UTMP);
+    exit(0);
+#endif
+    for (u = utmplist; *u; u++) {
+       if ((a = fopen(*u, "r")) != NULL || errno == EACCES) {
+           fprintf(f, "%s\n", *u);
+           exit(0);
+       }
+    }
+    exit(0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  path_utmp=`cat conftestval`
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+path_utmp=
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+echo "$as_me:$LINENO: result: $path_utmp" >&5
+echo "${ECHO_T}$path_utmp" >&6
+if test x$path_utmp != x; then
+
+cat >>confdefs.h <<_ACEOF
+#define UTMP_FILE "$path_utmp"
+_ACEOF
+
+fi
+
+
+echo "$as_me:$LINENO: checking where utmpx is located" >&5
+echo $ECHO_N "checking where utmpx is located... $ECHO_C" >&6
+if test "${path_utmpx+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+    { echo "$as_me:$LINENO: WARNING: Define UTMPX_FILE in config.h manually" >&5
+echo "$as_me: WARNING: Define UTMPX_FILE in config.h manually" >&2;}
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdio.h>
+#include <sys/types.h>
+#include <utmpx.h>
+#include <errno.h>
+#include <sys/stat.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+main()
+{
+    char **u, *p, *utmplist[] = {
+#ifdef UTMPX_FILE
+       UTMPX_FILE,
+#endif
+#ifdef _PATH_UTMPX
+       _PATH_UTMPX,
+#endif
+    "/var/adm/utmpx", "/etc/utmpx", NULL };
+    FILE *a, *f=fopen("conftestval", "w");
+    struct stat statu, statux;
+    if (!f) exit(1);
+    for (u = utmplist; *u; u++) {
+       if ((a = fopen(*u, "r")) != NULL || errno == EACCES) {
+           if (stat(*u, &statux) < 0)
+               continue;
+           p = strdup(*u);
+           p[strlen(p) - 1] = '\0';
+           if (stat(p, &statu) >= 0
+               && (statu.st_mtime - statux.st_mtime > 86400))
+               continue;
+           fprintf(f, "%s\n", *u);
+           exit(0);
+       }
+    }
+    exit(0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  path_utmpx=`cat conftestval`
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+path_utmpx=
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+echo "$as_me:$LINENO: result: $path_utmpx" >&5
+echo "${ECHO_T}$path_utmpx" >&6
+if test x$path_utmpx != x; then
+
+cat >>confdefs.h <<_ACEOF
+#define UTMPX_FILE "$path_utmpx"
+_ACEOF
+
+fi
+
+
+echo "$as_me:$LINENO: checking where wtmp is located" >&5
+echo $ECHO_N "checking where wtmp is located... $ECHO_C" >&6
+if test "${path_wtmp+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+    { echo "$as_me:$LINENO: WARNING: Define WTMP_FILE in config.h manually" >&5
+echo "$as_me: WARNING: Define WTMP_FILE in config.h manually" >&2;}
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdio.h>
+#include <sys/types.h>
+#ifdef HAVE_UTMP_H
+#include <utmp.h>
+#endif
+#include <errno.h>
+main()
+{
+    char **w, *wtmplist[] = {
+    "/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp", NULL };
+    FILE *a, *f=fopen("conftestval", "w");
+    if (!f) exit(1);
+#ifdef WTMP_FILE
+    fprintf(f, "%s\n", WTMP_FILE);
+    exit(0);
+#endif
+#ifdef _PATH_WTMP
+    fprintf(f, "%s\n", _PATH_WTMP);
+    exit(0);
+#endif
+    for (w = wtmplist; *w; w++) {
+       if ((a = fopen(*w, "r")) != NULL || errno == EACCES) {
+           fprintf(f, "%s\n", *w);
+           exit(0);
+       }
+    }
+    exit(0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  path_wtmp=`cat conftestval`
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+path_wtmp=
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+echo "$as_me:$LINENO: result: $path_wtmp" >&5
+echo "${ECHO_T}$path_wtmp" >&6
+if test x$path_wtmp != x; then
+
+cat >>confdefs.h <<_ACEOF
+#define WTMP_FILE "$path_wtmp"
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking where wtmpx is located" >&5
+echo $ECHO_N "checking where wtmpx is located... $ECHO_C" >&6
+if test "${path_wtmpx+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+    { echo "$as_me:$LINENO: WARNING: Define WTMPX_FILE in config.h manually" >&5
+echo "$as_me: WARNING: Define WTMPX_FILE in config.h manually" >&2;}
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdio.h>
+#ifdef HAVE_UTMPX_H
+#include <utmpx.h>
+#endif
+#include <errno.h>
+main()
+{
+    char **w, *wtmplist[] = {
+    "/var/log/wtmpx", "/var/adm/wtmpx", NULL };
+    FILE *a, *f=fopen("conftestval", "w");
+    if (!f) exit(1);
+#ifdef WTMPX_FILE
+    fprintf(f, "%s\n", WTMPX_FILE);
+    exit(0);
+#endif
+#ifdef _PATH_WTMPX
+    fprintf(f, "%s\n", _PATH_WTMPX);
+    exit(0);
+#endif
+    for (w = wtmplist; *w; w++) {
+       if ((a = fopen(*w, "r")) != NULL || errno == EACCES) {
+           fprintf(f, "%s\n", *w);
+           exit(0);
+       }
+    }
+    exit(0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  path_wtmpx=`cat conftestval`
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+path_wtmpx=
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+echo "$as_me:$LINENO: result: $path_wtmpx" >&5
+echo "${ECHO_T}$path_wtmpx" >&6
+if test x$path_wtmpx != x; then
+
+cat >>confdefs.h <<_ACEOF
+#define WTMPX_FILE "$path_wtmpx"
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking where lastlog is located" >&5
+echo $ECHO_N "checking where lastlog is located... $ECHO_C" >&6
+if test "${path_lastlog+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+    { echo "$as_me:$LINENO: WARNING: Define LASTLOG_FILE in config.h manually" >&5
+echo "$as_me: WARNING: Define LASTLOG_FILE in config.h manually" >&2;}
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdio.h>
+#include <sys/types.h>
+#ifdef HAVE_UTMPX_H
+#include <utmpx.h>
+#elif defined(HAVE_UTMP_H)
+#include <utmp.h>
+#endif
+#ifdef HAVE_LASTLOG_H
+#include <lastlog.h>
+#endif
+#include <errno.h>
+main()
+{
+    char **w, *lastloglist[] = { "/var/log/lastlog", NULL };
+    FILE *a, *f=fopen("conftestval", "w");
+    if (!f) exit(1);
+#ifdef LASTLOG_FILE
+    fprintf(f, "%s\n", LASTLOG_FILE);
+    exit(0);
+#endif
+#ifdef _PATH_LASTLOG
+    fprintf(f, "%s\n", _PATH_LASTLOG);
+    exit(0);
+#endif
+    for (w = lastloglist; *w; w++) {
+       if ((a = fopen(*w, "r")) != NULL || errno == EACCES) {
+           fprintf(f, "%s\n", *w);
+           exit(0);
+       }
+    }
+    exit(0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  path_lastlog=`cat conftestval`
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+path_lastlog=
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+echo "$as_me:$LINENO: result: $path_lastlog" >&5
+echo "${ECHO_T}$path_lastlog" >&6
+if test x$path_lastlog != x; then
+
+cat >>confdefs.h <<_ACEOF
+#define LASTLOG_FILE "$path_lastlog"
+_ACEOF
+
+  if test -d "$path_lastlog"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define LASTLOG_IS_DIR 1
+_ACEOF
+
+  fi
+fi
+
+echo "$as_me:$LINENO: checking where lastlogx is located" >&5
+echo $ECHO_N "checking where lastlogx is located... $ECHO_C" >&6
+if test "${path_lastlogx+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+    { echo "$as_me:$LINENO: WARNING: Define LASTLOGX_FILE in config.h manually" >&5
+echo "$as_me: WARNING: Define LASTLOGX_FILE in config.h manually" >&2;}
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdio.h>
+#ifdef HAVE_UTMPX_H
+#include <utmpx.h>
+#endif
+#include <errno.h>
+main()
+{
+    char **w, *wtmplist[] = { "/var/log/lastlogx", "/var/adm/lastlogx", NULL };
+    FILE *a, *f=fopen("conftestval", "w");
+    if (!f) exit(1);
+#ifdef LASTLOGX_FILE
+    fprintf(f, "%s\n", LASTLOGX_FILE);
+    exit(0);
+#endif
+#ifdef _PATH_LASTLOGX
+    fprintf(f, "%s\n", _PATH_LASTLOGX);
+    exit(0);
+#endif
+    for (w = wtmplist; *w; w++) {
+       if ((a = fopen(*w, "r")) != NULL || errno == EACCES) {
+           fprintf(f, "%s\n", *w);
+           exit(0);
+       }
+    }
+    exit(0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  path_lastlogx=`cat conftestval`
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+path_lastlogx=
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+echo "$as_me:$LINENO: result: $path_lastlogx" >&5
+echo "${ECHO_T}$path_lastlogx" >&6
+if test x$path_lastlogx != x; then
+
+cat >>confdefs.h <<_ACEOF
+#define LASTLOGX_FILE "$path_lastlogx"
+_ACEOF
+
+fi
+
 
 
 echo "$as_me:$LINENO: checking where ttys/ttytab is located" >&5
@@ -10191,92 +11714,607 @@ echo $ECHO_N "checking where ttys/ttytab is located... $ECHO_C" >&6
 if test "${rxvt_cv_path_ttytab+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  for ttys_file in     /etc/ttys /etc/ttytab;
-do
-  if test -f "$ttys_file" ; then
-    rxvt_cv_path_ttytab=$ttys_file
-    break
-  fi
-done
+  for ttys_file in     /etc/ttys /etc/ttytab;
+do
+  if test -f "$ttys_file" ; then
+    rxvt_cv_path_ttytab=$ttys_file
+    break
+  fi
+done
+
+fi
+echo "$as_me:$LINENO: result: $rxvt_cv_path_ttytab" >&5
+echo "${ECHO_T}$rxvt_cv_path_ttytab" >&6
+if test x$rxvt_cv_path_ttytab != x; then
+
+cat >>confdefs.h <<_ACEOF
+#define TTYTAB_FILENAME "$rxvt_cv_path_ttytab"
+_ACEOF
+
+fi
+
+
+ac_save_LIBS=$LIBS
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="$CFLAGS $X_CFLAGS"
+LIBS="$LIBS $X_LIBS $X_EXTRA_LIBS -lX11"
+if test x$rxvt_cv_rpath = xyes -o x$rxvt_cv_R = xyes; then
+  LIBS=`echo $LIBS | sed "$R_TRANSLATE"`
+fi
+echo "$as_me:$LINENO: checking for working Xlocale" >&5
+echo $ECHO_N "checking for working Xlocale... $ECHO_C" >&6
+if test "${rxvt_cv_func_xlocale+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+    { echo "$as_me:$LINENO: WARNING: Define NO_XLOCALE in config.h manually" >&5
+echo "$as_me: WARNING: Define NO_XLOCALE in config.h manually" >&2;}
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <X11/Xlib.h>
+main() {
+char *p;
+if ((p = XSetLocaleModifiers("@im=none")) != NULL && *p)
+exit (XSupportsLocale() ? 0 : 1);
+else
+exit (1);}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+    rxvt_cv_func_xlocale=yes
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+rxvt_cv_func_xlocale=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+echo "$as_me:$LINENO: result: $rxvt_cv_func_xlocale" >&5
+echo "${ECHO_T}$rxvt_cv_func_xlocale" >&6
+if test x$rxvt_cv_func_xlocale = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_XLOCALE 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for working X setlocale" >&5
+echo $ECHO_N "checking for working X setlocale... $ECHO_C" >&6
+if test "${rxvt_cv_func_xsetlocale+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#define X_LOCALE 1
+#include <X11/Xlocale.h>
+int
+main ()
+{
+setlocale(LC_CTYPE, "");
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"                         || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  rxvt_cv_func_xsetlocale=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+rxvt_cv_func_xsetlocale=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $rxvt_cv_func_xsetlocale" >&5
+echo "${ECHO_T}$rxvt_cv_func_xsetlocale" >&6
+if test x$rxvt_cv_func_xsetlocale = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_XSETLOCALE 1
+_ACEOF
+
+fi
+LIBS=$ac_save_LIBS
+CFLAGS=$ac_save_CFLAGS
+
+echo "$as_me:$LINENO: checking for working plain setlocale" >&5
+echo $ECHO_N "checking for working plain setlocale... $ECHO_C" >&6
+if test "${rxvt_cv_func_setlocale+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <clocale>
+int
+main ()
+{
+setlocale(LC_CTYPE, "");
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"                         || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  rxvt_cv_func_setlocale=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+rxvt_cv_func_setlocale=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $rxvt_cv_func_setlocale" >&5
+echo "${ECHO_T}$rxvt_cv_func_setlocale" >&6
+if test x$rxvt_cv_func_setlocale = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_SETLOCALE 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for working nl_langinfo" >&5
+echo $ECHO_N "checking for working nl_langinfo... $ECHO_C" >&6
+if test "${rxvt_cv_func_nl_langinfo+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <langinfo.h>
+int
+main ()
+{
+nl_langinfo(CODESET);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"                         || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  rxvt_cv_func_nl_langinfo=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+rxvt_cv_func_nl_langinfo=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $rxvt_cv_func_nl_langinfo" >&5
+echo "${ECHO_T}$rxvt_cv_func_nl_langinfo" >&6
+if test x$rxvt_cv_func_nl_langinfo = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_NL_LANGINFO 1
+_ACEOF
+
+fi
+
+
+echo "$as_me:$LINENO: checking for unix-compliant filehandle passing ability" >&5
+echo $ECHO_N "checking for unix-compliant filehandle passing ability... $ECHO_C" >&6
+if test "${can_pass_fds+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <cstddef> // broken bsds (is that redundant) need this
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/uio.h>
+
+int
+main ()
+{
+
+{
+  msghdr msg;
+  iovec iov;
+  char buf [100];
+  char data = 0;
+
+  iov.iov_base = &data;
+  iov.iov_len  = 1;
+
+  msg.msg_iov        = &iov;
+  msg.msg_iovlen     = 1;
+  msg.msg_control    = buf;
+  msg.msg_controllen = sizeof buf;
+
+  cmsghdr *cmsg = CMSG_FIRSTHDR (&msg);
+  cmsg->cmsg_level = SOL_SOCKET;
+  cmsg->cmsg_type  = SCM_RIGHTS;
+  cmsg->cmsg_len   = 100;
+
+  *(int *)CMSG_DATA (cmsg) = 5;
+
+  return sendmsg (3, &msg, 0);
+}
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"                         || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  can_pass_fds=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
+can_pass_fds=no
 fi
-echo "$as_me:$LINENO: result: $rxvt_cv_path_ttytab" >&5
-echo "${ECHO_T}$rxvt_cv_path_ttytab" >&6
-if test x$rxvt_cv_path_ttytab != x; then
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $can_pass_fds" >&5
+echo "${ECHO_T}$can_pass_fds" >&6
+if test x$can_pass_fds = xyes; then
 
-cat >>confdefs.h <<_ACEOF
-#define TTYTAB_FILENAME "$rxvt_cv_path_ttytab"
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_UNIX_FDPASS 1
 _ACEOF
 
+else
+   { { echo "$as_me:$LINENO: error: libptytty requires unix-compliant filehandle passing ability" >&5
+echo "$as_me: error: libptytty requires unix-compliant filehandle passing ability" >&2;}
+   { (exit 1); exit 1; }; }
 fi
 
 
-ac_save_LIBS=$LIBS
-ac_save_CFLAGS=$CFLAGS
-CFLAGS="$CFLAGS $X_CFLAGS"
-LIBS="$LIBS $X_LIBS $X_EXTRA_LIBS -lX11"
-if test x$rxvt_cv_rpath = xyes -o x$rxvt_cv_R = xyes; then
-  LIBS=`echo $LIBS | sed "$R_TRANSLATE"`
-fi
-echo "$as_me:$LINENO: checking for working Xlocale" >&5
-echo $ECHO_N "checking for working Xlocale... $ECHO_C" >&6
-if test "${rxvt_cv_func_xlocale+set}" = set; then
+echo "$as_me:$LINENO: checking for broken XIM callback" >&5
+echo $ECHO_N "checking for broken XIM callback... $ECHO_C" >&6
+if test "${rxvt_broken_ximcb+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test "$cross_compiling" = yes; then
-    { echo "$as_me:$LINENO: WARNING: Define NO_XLOCALE in config.h manually" >&5
-echo "$as_me: WARNING: Define NO_XLOCALE in config.h manually" >&2;}
 else
   cat >conftest.$ac_ext <<_ACEOF
+
+#include <X11/Xlib.h>
+
+void im_destroy_cb (XIC unused1, XPointer client_data, XPointer unused3);
+
+void f() {
+  XIMCallback cb;
+  cb.callback = im_destroy_cb;
+}
+
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"                         || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  rxvt_broken_ximcb=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+rxvt_broken_ximcb=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $rxvt_broken_ximcb" >&5
+echo "${ECHO_T}$rxvt_broken_ximcb" >&6
+
+if test x$rxvt_broken_ximcb = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define XIMCB_PROTO_BROKEN 1
+_ACEOF
+
+fi
+
+
+
+
+
+
+
+for ac_header in \
+  pty.h \
+  util.h \
+  libutil.h \
+  sys/ioctl.h \
+  sys/stropts.h \
+
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <X11/Xlib.h>
-main() {
-char *p;
-if ((p = XSetLocaleModifiers("@im=none")) != NULL && *p)
-exit (XSupportsLocale() ? 0 : 1);
-else
-exit (1);}
+$ac_includes_default
+#include <$ac_header>
 _ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"                         || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-    rxvt_cv_func_xlocale=yes
+  ac_header_compiler=yes
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-( exit $ac_status )
-rxvt_cv_func_xlocale=no
+ac_header_compiler=no
 fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
 fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
 fi
-echo "$as_me:$LINENO: result: $rxvt_cv_func_xlocale" >&5
-echo "${ECHO_T}$rxvt_cv_func_xlocale" >&6
-if test x$rxvt_cv_func_xlocale = xyes; then
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_XLOCALE 1
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
 
-echo "$as_me:$LINENO: checking for working X setlocale" >&5
-echo $ECHO_N "checking for working X setlocale... $ECHO_C" >&6
-if test "${rxvt_cv_func_xsetlocale+set}" = set; then
+done
+
+
+
+
+
+
+
+for ac_func in \
+  revoke \
+  _getpty \
+  getpt \
+  posix_openpt \
+  isastream \
+
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -10285,12 +12323,47 @@ _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#define X_LOCALE 1
-#include <X11/Xlocale.h>
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
 int
 main ()
 {
-setlocale(LC_CTYPE, "");
+return f != $ac_func;
   ;
   return 0;
 }
@@ -10316,44 +12389,118 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  rxvt_cv_func_xsetlocale=yes
+  eval "$as_ac_var=yes"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-rxvt_cv_func_xsetlocale=no
+eval "$as_ac_var=no"
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $rxvt_cv_func_xsetlocale" >&5
-echo "${ECHO_T}$rxvt_cv_func_xsetlocale" >&6
-if test x$rxvt_cv_func_xsetlocale = xyes; then
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+have_clone=no
+
+echo "$as_me:$LINENO: checking for /dev/ptym/clone" >&5
+echo $ECHO_N "checking for /dev/ptym/clone... $ECHO_C" >&6
+if test -e /dev/ptym/clone; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
 
 cat >>confdefs.h <<\_ACEOF
-#define HAVE_XSETLOCALE 1
+#define HAVE_DEV_CLONE 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define CLONE_DEVICE "/dev/ptym/clone"
 _ACEOF
 
+  have_clone=yes
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
-LIBS=$ac_save_LIBS
-CFLAGS=$ac_save_CFLAGS
 
-echo "$as_me:$LINENO: checking for working plain setlocale" >&5
-echo $ECHO_N "checking for working plain setlocale... $ECHO_C" >&6
-if test "${rxvt_cv_func_setlocale+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+echo "$as_me:$LINENO: checking for /dev/ptc" >&5
+echo $ECHO_N "checking for /dev/ptc... $ECHO_C" >&6
+if test -e /dev/ptc; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_DEV_PTC 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define CLONE_DEVICE "/dev/ptc"
+_ACEOF
+
+  have_clone=yes
 else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+case $host in
+  *-*-cygwin*)
+    have_clone=yes
+
+cat >>confdefs.h <<\_ACEOF
+#define CLONE_DEVICE "/dev/ptmx"
+_ACEOF
+
+    ;;
+  *)
+    echo "$as_me:$LINENO: checking for /dev/ptmx" >&5
+echo $ECHO_N "checking for /dev/ptmx... $ECHO_C" >&6
+    if test -e /dev/ptmx; then
+      echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_DEV_PTMX 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define CLONE_DEVICE "/dev/ptmx"
+_ACEOF
+
+      have_clone=yes
+    else
+      echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+    fi
+    ;;
+esac
+
+if test x$ac_cv_func_getpt = xyes -o x$ac_cv_func_posix_openpt = xyes -o x$have_clone = xyes; then
+  echo "$as_me:$LINENO: checking for UNIX98 ptys" >&5
+echo $ECHO_N "checking for UNIX98 ptys... $ECHO_C" >&6
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <clocale>
+#include <stdlib.h>
 int
 main ()
 {
-setlocale(LC_CTYPE, "");
+grantpt(0);unlockpt(0);ptsname(0);
   ;
   return 0;
 }
@@ -10379,29 +12526,33 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  rxvt_cv_func_setlocale=yes
+  unix98_pty=yes
+
+cat >>confdefs.h <<\_ACEOF
+#define UNIX98_PTY 1
+_ACEOF
+
+               echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-rxvt_cv_func_setlocale=no
+echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $rxvt_cv_func_setlocale" >&5
-echo "${ECHO_T}$rxvt_cv_func_setlocale" >&6
-if test x$rxvt_cv_func_setlocale = xyes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SETLOCALE 1
-_ACEOF
 
-fi
+if test -z "$unix98_pty"; then
 
-echo "$as_me:$LINENO: checking for working nl_langinfo" >&5
-echo $ECHO_N "checking for working nl_langinfo... $ECHO_C" >&6
-if test "${rxvt_cv_func_nl_langinfo+set}" = set; then
+for ac_func in openpty
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -10410,11 +12561,47 @@ _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <langinfo.h>
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
 int
 main ()
 {
-nl_langinfo(CODESET);
+return f != $ac_func;
   ;
   return 0;
 }
@@ -10440,48 +12627,56 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  rxvt_cv_func_nl_langinfo=yes
+  eval "$as_ac_var=yes"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-rxvt_cv_func_nl_langinfo=no
+eval "$as_ac_var=no"
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $rxvt_cv_func_nl_langinfo" >&5
-echo "${ECHO_T}$rxvt_cv_func_nl_langinfo" >&6
-if test x$rxvt_cv_func_nl_langinfo = xyes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_NL_LANGINFO 1
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
-fi
-
-SCM_RIGHTS_CHECK
-
-echo "$as_me:$LINENO: checking for broken XIM callback" >&5
-echo $ECHO_N "checking for broken XIM callback... $ECHO_C" >&6
-if test "${rxvt_broken_ximcb+set}" = set; then
+else
+  echo "$as_me:$LINENO: checking for openpty in -lutil" >&5
+echo $ECHO_N "checking for openpty in -lutil... $ECHO_C" >&6
+if test "${ac_cv_lib_util_openpty+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-
-#include <X11/Xlib.h>
-
-void im_destroy_cb (XIC unused1, XPointer client_data, XPointer unused3);
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lutil  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 
-void f() {
-  XIMCallback cb;
-  cb.callback = im_destroy_cb;
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char openpty ();
+int
+main ()
+{
+openpty ();
+  ;
+  return 0;
 }
-
 _ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
@@ -10494,33 +12689,37 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
+        { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  rxvt_broken_ximcb=yes
+  ac_cv_lib_util_openpty=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-rxvt_broken_ximcb=no
+ac_cv_lib_util_openpty=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $rxvt_broken_ximcb" >&5
-echo "${ECHO_T}$rxvt_broken_ximcb" >&6
-
-if test x$rxvt_broken_ximcb = xyes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define XIMCB_PROTO_BROKEN 1
+echo "$as_me:$LINENO: result: $ac_cv_lib_util_openpty" >&5
+echo "${ECHO_T}$ac_cv_lib_util_openpty" >&6
+if test $ac_cv_lib_util_openpty = yes; then
+  cat >>confdefs.h <<\_ACEOF
+#define HAVE_OPENPTY 1
 _ACEOF
+ LIBS="$LIBS -lutil"
+fi
+
+fi
+done
 
 fi
 
-PTY_CHECK
 
 if test x$support_xft = xyes; then
   # Extract the first word of "pkg-config", so it can be a program name with args.
diff --git a/ptytty.m4 b/ptytty.m4
new file mode 100644 (file)
index 0000000..74e9c84
--- /dev/null
+++ b/ptytty.m4
@@ -0,0 +1,442 @@
+AC_DEFUN([PTY_CHECK],
+[
+AC_CHECK_HEADERS( \
+  pty.h \
+  util.h \
+  libutil.h \
+  sys/ioctl.h \
+  sys/stropts.h \
+)
+
+AC_CHECK_FUNCS( \
+  revoke \
+  _getpty \
+  getpt \
+  posix_openpt \
+  isastream \
+)
+
+have_clone=no
+
+AC_MSG_CHECKING(for /dev/ptym/clone)
+if test -e /dev/ptym/clone; then
+  AC_MSG_RESULT(yes)
+  AC_DEFINE(HAVE_DEV_CLONE, 1, [Define to 1 if you have /dev/ptym/clone])
+  AC_DEFINE(CLONE_DEVICE, "/dev/ptym/clone", [clone device filename])
+  have_clone=yes
+else
+  AC_MSG_RESULT(no)
+fi
+
+AC_MSG_CHECKING(for /dev/ptc)
+if test -e /dev/ptc; then
+  AC_MSG_RESULT(yes)
+  AC_DEFINE(HAVE_DEV_PTC, 1, [Define to 1 if you have /dev/ptc])
+  AC_DEFINE(CLONE_DEVICE, "/dev/ptc", [clone device filename])
+  have_clone=yes
+else
+  AC_MSG_RESULT(no)
+fi
+
+case $host in
+  *-*-cygwin*)
+    have_clone=yes
+    AC_DEFINE(CLONE_DEVICE, "/dev/ptmx", [clone device filename])
+    ;;
+  *)
+    AC_MSG_CHECKING(for /dev/ptmx)
+    if test -e /dev/ptmx; then
+      AC_MSG_RESULT(yes)
+      AC_DEFINE(HAVE_DEV_PTMX, 1, [Define to 1 if you have /dev/ptmx])
+      AC_DEFINE(CLONE_DEVICE, "/dev/ptmx", [clone device filename])
+      have_clone=yes
+    else
+      AC_MSG_RESULT(no)
+    fi
+    ;;
+esac
+
+if test x$ac_cv_func_getpt = xyes -o x$ac_cv_func_posix_openpt = xyes -o x$have_clone = xyes; then
+  AC_MSG_CHECKING(for UNIX98 ptys)
+  AC_TRY_LINK([#include <stdlib.h>],
+              [grantpt(0);unlockpt(0);ptsname(0);],
+              [unix98_pty=yes
+               AC_DEFINE(UNIX98_PTY, 1, "")
+               AC_MSG_RESULT(yes)],
+              [AC_MSG_RESULT(no)])
+fi
+
+if test -z "$unix98_pty"; then
+  AC_CHECK_FUNCS(openpty, [], [AC_CHECK_LIB(util, openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"])])
+fi
+])
+
+AC_DEFUN([UTMP_CHECK],
+[
+AC_CHECK_FUNCS( \
+       ttyslot \
+       updwtmp \
+       updwtmpx \
+)
+
+AC_CHECK_HEADERS( \
+       utmp.h \
+       utmpx.h \
+       lastlog.h \
+)
+
+dnl# --------------------------------------------------------------------------
+dnl# DO ALL UTMP AND WTMP CHECKING
+dnl# --------------------------------------------------------------------------
+dnl# check for host field in utmp structure
+
+dnl# --------------------------------------------
+AC_CHECK_HEADER(utmp.h,
+[AC_CACHE_CHECK([for struct utmp], struct_utmp,
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
+#include <utmp.h>]], [[struct utmp ut;]])],[struct_utmp=yes],[struct_utmp=no])])
+if test x$struct_utmp = xyes; then
+  AC_DEFINE(HAVE_STRUCT_UTMP, 1, Define if utmp.h has struct utmp)
+fi
+]
+
+AC_CACHE_CHECK(for ut_host in utmp struct, struct_utmp_host,
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
+#include <utmp.h>]], [[struct utmp ut; ut.ut_host;]])],[struct_utmp_host=yes],[struct_utmp_host=no])])
+if test x$struct_utmp_host = xyes; then
+  AC_DEFINE(HAVE_UTMP_HOST, 1, Define if struct utmp contains ut_host)
+fi
+
+AC_CACHE_CHECK(for ut_pid in utmp struct, struct_utmp_pid,
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
+#include <utmp.h>]], [[struct utmp ut; ut.ut_pid;]])],[struct_utmp_pid=yes],[struct_utmp_pid=no])])
+if test x$struct_utmp_pid = xyes; then
+  AC_DEFINE(HAVE_UTMP_PID, 1, Define if struct utmp contains ut_pid)
+fi
+) dnl# AC_CHECK_HEADER(utmp.h
+
+dnl# --------------------------------------------
+
+AC_CHECK_HEADER(utmpx.h,
+[AC_CACHE_CHECK([for struct utmpx], struct_utmpx,
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
+#include <utmpx.h>]], [[struct utmpx ut;]])],[struct_utmpx=yes],[struct_utmpx=no])])
+if test x$struct_utmpx = xyes; then
+  AC_DEFINE(HAVE_STRUCT_UTMPX, 1, Define if utmpx.h has struct utmpx)
+fi
+]
+
+AC_CACHE_CHECK(for host in utmpx struct, struct_utmpx_host,
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
+#include <utmpx.h>]], [[struct utmpx utx; utx.ut_host;]])],[struct_utmpx_host=yes],[struct_utmpx_host=no])])
+if test x$struct_utmpx_host = xyes; then
+  AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host)
+fi
+
+AC_CACHE_CHECK(for session in utmpx struct, struct_utmpx_session,
+[AC_TRY_COMPILE([#include <sys/types.h>
+#include <utmpx.h>],
+[struct utmpx utx; utx.ut_session;],
+struct_utmpx_session=yes, struct_utmpx_session=no)])
+if test x$struct_utmpx_session = xyes; then
+  AC_DEFINE(HAVE_UTMPX_SESSION, 1, Define if struct utmpx contains ut_session)
+fi
+) dnl# AC_CHECK_HEADER(utmpx.h
+
+dnl# --------------------------------------------------------------------------
+dnl# check for struct lastlog
+AC_CACHE_CHECK(for struct lastlog, struct_lastlog,
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
+#include <utmp.h>
+#ifdef HAVE_LASTLOG_H
+#include <lastlog.h>
+#endif
+]], [[struct lastlog ll;]])],[struct_lastlog=yes],[struct_lastlog=no])])
+if test x$struct_lastlog = xyes; then
+  AC_DEFINE(HAVE_STRUCT_LASTLOG, 1, Define if utmp.h or lastlog.h has struct lastlog)
+fi
+
+dnl# check for struct lastlogx
+AC_CACHE_CHECK(for struct lastlogx, struct_lastlogx,
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
+#include <utmpx.h>
+#ifdef HAVE_LASTLOG_H
+#include <lastlog.h>
+#endif
+]], [[struct lastlogx ll;]])],[struct_lastlogx=yes],[struct_lastlogx=no])])
+if test x$struct_lastlogx = xyes; then
+  AC_DEFINE(HAVE_STRUCT_LASTLOGX, 1, Define if utmpx.h or lastlog.h has struct lastlogx)
+fi
+
+dnl# --------------------------------------------------------------------------
+dnl# FIND FILES
+dnl# --------------------------------------------------------------------------
+
+dnl# find utmp
+AC_CACHE_CHECK(where utmp is located, path_utmp,
+[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
+#include <sys/types.h>
+#include <utmp.h>
+#include <errno.h>
+main()
+{
+    char **u, *utmplist[] = {
+    "/var/run/utmp", "/var/adm/utmp", "/etc/utmp", "/usr/etc/utmp", "/usr/adm/utmp", NULL };
+    FILE *a, *f=fopen("conftestval", "w");
+    if (!f) exit(1);
+#ifdef UTMP_FILE
+    fprintf(f, "%s\n", UTMP_FILE);
+    exit(0);
+#endif
+#ifdef _PATH_UTMP
+    fprintf(f, "%s\n", _PATH_UTMP);
+    exit(0);
+#endif
+    for (u = utmplist; *u; u++) {
+       if ((a = fopen(*u, "r")) != NULL || errno == EACCES) {
+           fprintf(f, "%s\n", *u);
+           exit(0);
+       }
+    }
+    exit(0);
+}]])],[path_utmp=`cat conftestval`],[path_utmp=],[dnl
+  AC_MSG_WARN(Define UTMP_FILE in config.h manually)])])
+if test x$path_utmp != x; then
+  AC_DEFINE_UNQUOTED(UTMP_FILE, "$path_utmp", Define location of utmp)
+fi
+
+dnl# --------------------------------------------------------------------------
+
+dnl# find utmpx - if a utmp file exists at the same location and is more than
+dnl# a day newer, then dump the utmpx.  People leave lots of junk around.
+AC_CACHE_CHECK(where utmpx is located, path_utmpx,
+[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
+#include <sys/types.h>
+#include <utmpx.h>
+#include <errno.h>
+#include <sys/stat.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+main()
+{
+    char **u, *p, *utmplist[] = {
+#ifdef UTMPX_FILE
+       UTMPX_FILE,
+#endif
+#ifdef _PATH_UTMPX
+       _PATH_UTMPX,
+#endif
+    "/var/adm/utmpx", "/etc/utmpx", NULL };
+    FILE *a, *f=fopen("conftestval", "w");
+    struct stat statu, statux;
+    if (!f) exit(1);
+    for (u = utmplist; *u; u++) {
+       if ((a = fopen(*u, "r")) != NULL || errno == EACCES) {
+           if (stat(*u, &statux) < 0)
+               continue;
+           p = strdup(*u);
+           p[strlen(p) - 1] = '\0';
+           if (stat(p, &statu) >= 0
+               && (statu.st_mtime - statux.st_mtime > 86400))
+               continue;
+           fprintf(f, "%s\n", *u);
+           exit(0);
+       }
+    }
+    exit(0);
+}]])],[path_utmpx=`cat conftestval`],[path_utmpx=],[dnl
+  AC_MSG_WARN(Define UTMPX_FILE in config.h manually)])])
+if test x$path_utmpx != x; then
+  AC_DEFINE_UNQUOTED(UTMPX_FILE, "$path_utmpx", Define location of utmpx)
+fi
+
+dnl# --------------------------------------------------------------------------
+
+dnl# find wtmp
+AC_CACHE_CHECK(where wtmp is located, path_wtmp,
+[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
+#include <sys/types.h>
+#ifdef HAVE_UTMP_H
+#include <utmp.h>
+#endif
+#include <errno.h>
+main()
+{
+    char **w, *wtmplist[] = {
+    "/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp", NULL }; 
+    FILE *a, *f=fopen("conftestval", "w");
+    if (!f) exit(1);
+#ifdef WTMP_FILE
+    fprintf(f, "%s\n", WTMP_FILE);
+    exit(0);
+#endif
+#ifdef _PATH_WTMP
+    fprintf(f, "%s\n", _PATH_WTMP);
+    exit(0);
+#endif
+    for (w = wtmplist; *w; w++) {
+       if ((a = fopen(*w, "r")) != NULL || errno == EACCES) {
+           fprintf(f, "%s\n", *w);
+           exit(0);
+       }
+    }
+    exit(0);
+}]])],[path_wtmp=`cat conftestval`],[path_wtmp=],[dnl
+  AC_MSG_WARN(Define WTMP_FILE in config.h manually)])])
+if test x$path_wtmp != x; then
+  AC_DEFINE_UNQUOTED(WTMP_FILE, "$path_wtmp", Define location of wtmp)
+fi
+dnl# --------------------------------------------------------------------------
+
+dnl# find wtmpx
+AC_CACHE_CHECK(where wtmpx is located, path_wtmpx,
+[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
+#ifdef HAVE_UTMPX_H
+#include <utmpx.h>
+#endif
+#include <errno.h>
+main()
+{
+    char **w, *wtmplist[] = {
+    "/var/log/wtmpx", "/var/adm/wtmpx", NULL }; 
+    FILE *a, *f=fopen("conftestval", "w");
+    if (!f) exit(1);
+#ifdef WTMPX_FILE
+    fprintf(f, "%s\n", WTMPX_FILE);
+    exit(0);
+#endif
+#ifdef _PATH_WTMPX
+    fprintf(f, "%s\n", _PATH_WTMPX);
+    exit(0);
+#endif
+    for (w = wtmplist; *w; w++) {
+       if ((a = fopen(*w, "r")) != NULL || errno == EACCES) {
+           fprintf(f, "%s\n", *w);
+           exit(0);
+       }
+    }
+    exit(0);
+}]])],[path_wtmpx=`cat conftestval`],[path_wtmpx=],[dnl
+  AC_MSG_WARN(Define WTMPX_FILE in config.h manually)])])
+if test x$path_wtmpx != x; then
+  AC_DEFINE_UNQUOTED(WTMPX_FILE, "$path_wtmpx", Define location of wtmpx)
+fi
+dnl# --------------------------------------------------------------------------
+
+dnl# find lastlog
+AC_CACHE_CHECK(where lastlog is located, path_lastlog,
+[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
+#include <sys/types.h>
+#ifdef HAVE_UTMPX_H
+#include <utmpx.h>
+#elif defined(HAVE_UTMP_H)
+#include <utmp.h>
+#endif
+#ifdef HAVE_LASTLOG_H
+#include <lastlog.h>
+#endif
+#include <errno.h>
+main()
+{
+    char **w, *lastloglist[] = { "/var/log/lastlog", NULL };
+    FILE *a, *f=fopen("conftestval", "w");
+    if (!f) exit(1);
+#ifdef LASTLOG_FILE
+    fprintf(f, "%s\n", LASTLOG_FILE);
+    exit(0);
+#endif
+#ifdef _PATH_LASTLOG
+    fprintf(f, "%s\n", _PATH_LASTLOG);
+    exit(0);
+#endif
+    for (w = lastloglist; *w; w++) {
+       if ((a = fopen(*w, "r")) != NULL || errno == EACCES) {
+           fprintf(f, "%s\n", *w);
+           exit(0);
+       }
+    }
+    exit(0);
+}]])],[path_lastlog=`cat conftestval`],[path_lastlog=],[dnl
+  AC_MSG_WARN(Define LASTLOG_FILE in config.h manually)])])
+if test x$path_lastlog != x; then
+  AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$path_lastlog", Define location of lastlog)
+  if test -d "$path_lastlog"; then
+    AC_DEFINE(LASTLOG_IS_DIR, 1, Define if lastlog is provided via a directory)
+  fi
+fi
+dnl# --------------------------------------------------------------------------
+
+dnl# find lastlogx
+AC_CACHE_CHECK(where lastlogx is located, path_lastlogx,
+[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
+#ifdef HAVE_UTMPX_H
+#include <utmpx.h>
+#endif
+#include <errno.h>
+main()
+{
+    char **w, *wtmplist[] = { "/var/log/lastlogx", "/var/adm/lastlogx", NULL };
+    FILE *a, *f=fopen("conftestval", "w");
+    if (!f) exit(1);
+#ifdef LASTLOGX_FILE
+    fprintf(f, "%s\n", LASTLOGX_FILE);
+    exit(0);
+#endif
+#ifdef _PATH_LASTLOGX
+    fprintf(f, "%s\n", _PATH_LASTLOGX);
+    exit(0);
+#endif
+    for (w = wtmplist; *w; w++) {
+       if ((a = fopen(*w, "r")) != NULL || errno == EACCES) {
+           fprintf(f, "%s\n", *w);
+           exit(0);
+       }
+    }
+    exit(0);
+}]])],[path_lastlogx=`cat conftestval`],[path_lastlogx=],[dnl
+  AC_MSG_WARN(Define LASTLOGX_FILE in config.h manually)])])
+if test x$path_lastlogx != x; then
+  AC_DEFINE_UNQUOTED(LASTLOGX_FILE, "$path_lastlogx", Define location of lastlogx)
+fi
+])
+
+AC_DEFUN([SCM_RIGHTS_CHECK],
+[
+AC_CACHE_CHECK(for unix-compliant filehandle passing ability, can_pass_fds,
+[AC_TRY_LINK([
+#include <cstddef> // broken bsds (is that redundant) need this
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/uio.h>
+],[
+{
+  msghdr msg;
+  iovec iov;
+  char buf [100];
+  char data = 0;
+
+  iov.iov_base = &data;
+  iov.iov_len  = 1;
+
+  msg.msg_iov        = &iov;
+  msg.msg_iovlen     = 1;
+  msg.msg_control    = buf;
+  msg.msg_controllen = sizeof buf;
+
+  cmsghdr *cmsg = CMSG_FIRSTHDR (&msg);
+  cmsg->cmsg_level = SOL_SOCKET;
+  cmsg->cmsg_type  = SCM_RIGHTS;
+  cmsg->cmsg_len   = 100;
+
+  *(int *)CMSG_DATA (cmsg) = 5;
+
+  return sendmsg (3, &msg, 0);
+}
+],[can_pass_fds=yes],[can_pass_fds=no])])
+if test x$can_pass_fds = xyes; then
+   AC_DEFINE(HAVE_UNIX_FDPASS, 1, Define if sys/socket.h defines the necessary macros/functions for file handle passing)
+else
+   AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability])
+fi
+])
index 6bd831fe35ced8517f4897a9298d4caa3b2ecac2..d7f4a47d063af1769ee920fe1d4760a0dfcfec07 100644 (file)
@@ -21,7 +21,6 @@
  *----------------------------------------------------------------------*/
 
 #include "../config.h"
-#include "rxvt.h"
 
 #include <sys/uio.h>
 #include <sys/types.h>
 
 #include "fdpass.h"
 
-#include <cstdio> //d
-
 #ifndef CMSG_LEN // CMSG_SPACe && CMSG_LEN are rfc2292 extensions to unix
 # define CMSG_LEN(len) (sizeof (cmsghdr) + len)
 #endif
 
 int
-rxvt_send_fd (int socket, int fd)
+ptytty_send_fd (int socket, int fd)
 {
   msghdr msg;
   iovec iov;
@@ -66,7 +63,7 @@ rxvt_send_fd (int socket, int fd)
 }
 
 int
-rxvt_recv_fd (int socket)
+ptytty_recv_fd (int socket)
 {
   msghdr msg;
   iovec iov;
index b8a576d2404cb0b65c49993fbe16804a4d0a2e71..5ce6f79894abf8c71f8e4bc8b10b64b451662850 100644 (file)
@@ -21,9 +21,8 @@
  *----------------------------------------------------------------------*/
 
 #include "../config.h"
-#include "rxvt.h"
 
-int rxvt_send_fd (int socket, int fd);
-int rxvt_recv_fd (int socket);
+int ptytty_send_fd (int socket, int fd);
+int ptytty_recv_fd (int socket);
 
 
index 465e3be15f8ef652dd0d0926152e8b0452bc828d..4a198a9719f60257aafc2edc5a0a8c86c14fdd7c 100644 (file)
  *----------------------------------------------------------------------*/
 
 #include "../config.h"
-#include "rxvt.h"
+
 #include "ptytty.h"
 
 #if UTMP_SUPPORT
 
 #if HAVE_STRUCT_UTMP
-static int              rxvt_write_bsd_utmp              (int utmp_pos, struct utmp *wu);
-static void             rxvt_update_wtmp                 (const char *fname, const struct utmp *putmp);
+static int              write_bsd_utmp              (int utmp_pos, struct utmp *wu);
+static void             update_wtmp                 (const char *fname, const struct utmp *putmp);
 #endif
 
-static void             rxvt_update_lastlog              (const char *fname, const char *pty, const char *host);
+static void             update_lastlog              (const char *fname, const char *pty, const char *host);
 
 /*
  * BSD style utmp entry
@@ -57,7 +57,7 @@ static void             rxvt_update_lastlog              (const char *fname, con
  * make and write utmp and wtmp entries
  */
 void
-rxvt_ptytty_unix::login (int cmd_pid, bool login_shell, const char *hostname)
+ptytty_unix::login (int cmd_pid, bool login_shell, const char *hostname)
 {
   const char *pty = name;
 
@@ -86,7 +86,7 @@ rxvt_ptytty_unix::login (int cmd_pid, bool login_shell, const char *hostname)
     sprintf (ut_id, "vt%02x", (i & 0xff));     /* sysv naming */
   else if (strncmp (pty, "pty", 3) && strncmp (pty, "tty", 3))
     {
-      rxvt_warn ("can't parse tty name \"%s\", not adding utmp entry.\n", pty);
+      warn ("can't parse tty name \"%s\", not adding utmp entry.\n", pty);
       return;
     }
 #endif
@@ -171,7 +171,7 @@ rxvt_ptytty_unix::login (int cmd_pid, bool login_shell, const char *hostname)
     dup2 (tty, STDIN_FILENO);
 
     i = ttyslot ();
-    if (rxvt_write_bsd_utmp (i, ut))
+    if (write_bsd_utmp (i, ut))
       utmp_pos = i;
 
     dup2 (fdstdin, STDIN_FILENO);
@@ -190,7 +190,7 @@ rxvt_ptytty_unix::login (int cmd_pid, bool login_shell, const char *hostname)
               continue;
             if (!strcmp (ut->ut_line, name))
               {
-                if (!rxvt_write_bsd_utmp (i, ut))
+                if (!write_bsd_utmp (i, ut))
                   i = 0;
                 utmp_pos = i;
                 fclose (fd0);
@@ -211,21 +211,21 @@ rxvt_ptytty_unix::login (int cmd_pid, bool login_shell, const char *hostname)
     {
 # ifdef HAVE_STRUCT_UTMP
 #  ifdef HAVE_UPDWTMP
-      updwtmp (RXVT_WTMP_FILE, ut);
+      updwtmp (WTMP_FILE, ut);
 #  else
-      rxvt_update_wtmp (RXVT_WTMP_FILE, ut);
+      update_wtmp (WTMP_FILE, ut);
 #  endif
 # endif
 # if defined(HAVE_STRUCT_UTMPX) && defined(HAVE_UPDWTMPX)
-      updwtmpx (RXVT_WTMPX_FILE, utx);
+      updwtmpx (WTMPX_FILE, utx);
 # endif
     }
 #endif
-#if defined(LASTLOG_SUPPORT) && defined(RXVT_LASTLOG_FILE)
+#if defined(LASTLOG_SUPPORT) && defined(LASTLOG_FILE)
 #ifdef LOG_ONLY_ON_LOGIN
   if (login_shell)
 #endif
-    rxvt_update_lastlog (RXVT_LASTLOG_FILE, pty, hostname);
+    update_lastlog (LASTLOG_FILE, pty, hostname);
 #endif
 }
 
@@ -234,7 +234,7 @@ rxvt_ptytty_unix::login (int cmd_pid, bool login_shell, const char *hostname)
  * remove utmp and wtmp entries
  */
 void
-rxvt_ptytty_unix::logout ()
+ptytty_unix::logout ()
 {
   if (!cmd_pid)
     return;
@@ -289,13 +289,13 @@ rxvt_ptytty_unix::logout ()
     {
 # ifdef HAVE_STRUCT_UTMP
 #  ifdef HAVE_UPDWTMP
-      updwtmp (RXVT_WTMP_FILE, ut);
+      updwtmp (WTMP_FILE, ut);
 #  else
-      rxvt_update_wtmp (RXVT_WTMP_FILE, ut);
+      update_wtmp (WTMP_FILE, ut);
 #  endif
 # endif
 # if defined(HAVE_STRUCT_UTMPX) && defined(HAVE_UPDWTMPX)
-      updwtmpx (RXVT_WTMPX_FILE, utx);
+      updwtmpx (WTMPX_FILE, utx);
 # endif
     }
 #endif
@@ -310,7 +310,7 @@ rxvt_ptytty_unix::logout ()
   endutent ();
 # else
   memset (ut, 0, sizeof (struct utmp));
-  rxvt_write_bsd_utmp (utmp_pos, ut);
+  write_bsd_utmp (utmp_pos, ut);
 # endif
 #endif
 #ifdef HAVE_STRUCT_UTMPX
@@ -328,11 +328,11 @@ rxvt_ptytty_unix::logout ()
  */
 #if defined(HAVE_STRUCT_UTMP) && !defined(HAVE_UTMP_PID)
 static int
-rxvt_write_bsd_utmp (int utmp_pos, struct utmp *wu)
+write_bsd_utmp (int utmp_pos, struct utmp *wu)
 {
   int             fd;
 
-  if (utmp_pos <= 0 || (fd = open (RXVT_UTMP_FILE, O_WRONLY)) == -1)
+  if (utmp_pos <= 0 || (fd = open (UTMP_FILE, O_WRONLY)) == -1)
     return 0;
 
   if (lseek (fd, (off_t) (utmp_pos * sizeof (struct utmp)), SEEK_SET) != -1)
@@ -348,7 +348,7 @@ rxvt_write_bsd_utmp (int utmp_pos, struct utmp *wu)
  */
 #if defined(WTMP_SUPPORT) && !defined(HAVE_UPDWTMP) && defined(HAVE_STRUCT_UTMP)
 static void
-rxvt_update_wtmp (const char *fname, const struct utmp *putmp)
+update_wtmp (const char *fname, const struct utmp *putmp)
 {
   int             fd, gotlock, retry;
   struct flock    lck; /* fcntl locking scheme */
@@ -389,7 +389,7 @@ rxvt_update_wtmp (const char *fname, const struct utmp *putmp)
 /* ------------------------------------------------------------------------- */
 #ifdef LASTLOG_SUPPORT
 static void
-rxvt_update_lastlog (const char *fname, const char *pty, const char *host)
+update_lastlog (const char *fname, const char *pty, const char *host)
 {
 # ifdef HAVE_STRUCT_LASTLOGX
   struct lastlogx llx;
@@ -409,14 +409,14 @@ rxvt_update_lastlog (const char *fname, const char *pty, const char *host)
   llx.ll_tv.tv_usec = 0;
   strncpy (llx.ll_line, pty, sizeof (llx.ll_line));
   strncpy (llx.ll_host, host, sizeof (llx.ll_host));
-  updlastlogx (RXVT_LASTLOGX_FILE, getuid (), &llx);
+  updlastlogx (LASTLOGX_FILE, getuid (), &llx);
 # endif
 
 # ifdef HAVE_STRUCT_LASTLOG
   pwent = getpwuid (getuid ());
   if (!pwent)
     {
-      rxvt_warn ("no entry in password file, not updating lastlog.\n");
+      warn ("no entry in password file, not updating lastlog.\n");
       return;
     }
 
@@ -450,8 +450,11 @@ rxvt_update_lastlog (const char *fname, const char *pty, const char *host)
 /* ------------------------------------------------------------------------- */
 
 #else
+
 void
-rxvt_ptytty_unix::login (int cmd_pid, bool login_shell, const char *hostname)
+ptytty_unix::login (int cmd_pid, bool login_shell, const char *hostname)
 {
 }
-#endif                         /* UTMP_SUPPORT */
+
+#endif
+
index b2203d21ff061e83f17cd02c6c1ddfa4496cea0e..56c72d27fd624dc9935d5f6fd7451d2707e7b91d 100644 (file)
@@ -476,7 +476,7 @@ rxvt_term::init (int argc, const char *const *argv, stringvec *envv)
     scrollBar.setIdle ();    /* set existence for size calculations */
 #endif
 
-  pty = rxvt_new_ptytty ();
+  pty = ptytty_new ();
 
   create_windows (argc, argv);
 
@@ -561,7 +561,7 @@ rxvt_init ()
       || gid != getegid ())
     {
 #if PTYTTY_HELPER
-      rxvt_ptytty_server ();
+      ptytty_server ();
 #else
       rxvt_warn ("running setuid/setgid without pty helper compiled in, continuing unprivileged.\n");
 #endif
index 18f738c25159b16af3a4ba9bea1f7fb4ef69a206..0cb2a7fbfb991c2b004489bae2471fef6b8479ba 100644 (file)
@@ -22,7 +22,9 @@
  *---------------------------------------------------------------------*/
 
 #include "../config.h"         /* NECESSARY */
-#include "rxvt.h"
+
+#include "fdpass.h"
+#include "ptytty.h"
 
 #include <cstdlib>
 #include <cstring>
 
 #include <cstdio>
 
-#include "rxvtutil.h"
-#include "fdpass.h"
-#include "ptytty.h"
-
 /////////////////////////////////////////////////////////////////////////////
 
 /* ------------------------------------------------------------------------- *
@@ -244,7 +242,7 @@ control_tty (int fd_tty)
 }
 
 void
-rxvt_ptytty::close_tty ()
+ptytty::close_tty ()
 {
   if (tty < 0)
     return;
@@ -254,13 +252,13 @@ rxvt_ptytty::close_tty ()
 }
 
 bool
-rxvt_ptytty::make_controlling_tty ()
+ptytty::make_controlling_tty ()
 {
   return control_tty (tty) >= 0;
 }
 
 void
-rxvt_ptytty::set_utf8_mode (bool on)
+ptytty::set_utf8_mode (bool on)
 {
 #ifdef IUTF8
   if (pty < 0)
@@ -309,7 +307,7 @@ static struct ttyconf {
     }
 } ttyconf;
 
-rxvt_ptytty_unix::rxvt_ptytty_unix ()
+ptytty_unix::ptytty_unix ()
 {
   name = 0;
 #if UTMP_SUPPORT
@@ -317,7 +315,7 @@ rxvt_ptytty_unix::rxvt_ptytty_unix ()
 #endif
 }
 
-rxvt_ptytty_unix::~rxvt_ptytty_unix ()
+ptytty_unix::~ptytty_unix ()
 {
 #if UTMP_SUPPORT
   logout ();
@@ -326,7 +324,7 @@ rxvt_ptytty_unix::~rxvt_ptytty_unix ()
 }
 
 void
-rxvt_ptytty_unix::put ()
+ptytty_unix::put ()
 {
   chmod (name, RESTORE_TTY_MODE);
   chown (name, 0, ttyconf.gid);
@@ -343,7 +341,7 @@ rxvt_ptytty_unix::put ()
 }
 
 bool
-rxvt_ptytty_unix::get ()
+ptytty_unix::get ()
 {
   /* get master (pty) */
   if ((pty = get_pty (&tty, &name)) < 0)
@@ -381,25 +379,30 @@ struct command
 {
   enum { get, login, destroy } type;
 
-  rxvt_ptytty *id;
+  ptytty *id;
 
   bool login_shell;
   int cmd_pid;
   char hostname[512]; // arbitrary, but should be plenty
 };
 
-struct rxvt_ptytty_proxy : zero_initialized, rxvt_ptytty
+struct ptytty_proxy : ptytty
 {
-  rxvt_ptytty *id;
+  ptytty *id;
 
-  ~rxvt_ptytty_proxy ();
+  ptytty_proxy ()
+  : id(0)
+  {
+  }
+
+  ~ptytty_proxy ();
 
   bool get ();
   void login (int cmd_pid, bool login_shell, const char *hostname);
 };
 
 bool
-rxvt_ptytty_proxy::get ()
+ptytty_proxy::get ()
 {
   command cmd;
 
@@ -408,20 +411,20 @@ rxvt_ptytty_proxy::get ()
   write (sock_fd, &cmd, sizeof (cmd));
 
   if (read (sock_fd, &id, sizeof (id)) != sizeof (id))
-    rxvt_fatal ("protocol error while creating pty using helper process, aborting.\n");
+    fatal ("protocol error while creating pty using helper process, aborting.\n");
 
   if (!id)
     return false;
 
-  if ((pty = rxvt_recv_fd (sock_fd)) < 0
-      || (tty = rxvt_recv_fd (sock_fd)) < 0)
-    rxvt_fatal ("protocol error while reading pty/tty fds from helper process, aborting.\n");
+  if ((pty = ptytty_recv_fd (sock_fd)) < 0
+      || (tty = ptytty_recv_fd (sock_fd)) < 0)
+    fatal ("protocol error while reading pty/tty fds from helper process, aborting.\n");
 
   return true;
 }
 
 void
-rxvt_ptytty_proxy::login (int cmd_pid, bool login_shell, const char *hostname)
+ptytty_proxy::login (int cmd_pid, bool login_shell, const char *hostname)
 {
   command cmd;
 
@@ -434,36 +437,39 @@ rxvt_ptytty_proxy::login (int cmd_pid, bool login_shell, const char *hostname)
   write (sock_fd, &cmd, sizeof (cmd));
 }
 
-rxvt_ptytty_proxy::~rxvt_ptytty_proxy ()
+ptytty_proxy::~ptytty_proxy ()
 {
-  command cmd;
+  if (id)
+    {
+      command cmd;
 
-  cmd.type = command::destroy;
-  cmd.id = id;
+      cmd.type = command::destroy;
+      cmd.id = id;
 
-  write (sock_fd, &cmd, sizeof (cmd));
+      write (sock_fd, &cmd, sizeof (cmd));
+    }
 }
 
 static
 void serve ()
 {
   command cmd;
-  vector<rxvt_ptytty *> ptys;
+  vector<ptytty *> ptys;
 
   while (read (sock_fd, &cmd, sizeof (command)) == sizeof (command))
     {
       if (cmd.type == command::get)
         {
           // -> id ptyfd ttyfd
-          cmd.id = new rxvt_ptytty_unix;
+          cmd.id = new ptytty_unix;
 
           if (cmd.id->get ())
             {
               write (sock_fd, &cmd.id, sizeof (cmd.id));
               ptys.push_back (cmd.id);
 
-              rxvt_send_fd (sock_fd, cmd.id->pty);
-              rxvt_send_fd (sock_fd, cmd.id->tty);
+              ptytty_send_fd (sock_fd, cmd.id->pty);
+              ptytty_send_fd (sock_fd, cmd.id->tty);
             }
           else
             {
@@ -484,7 +490,7 @@ void serve ()
         }
       else if (cmd.type == command::destroy)
         {
-          rxvt_ptytty **pty = find (ptys.begin (), ptys.end (), cmd.id);
+          ptytty **pty = find (ptys.begin (), ptys.end (), cmd.id);
 
           if (pty)
             {
@@ -497,25 +503,25 @@ void serve ()
     }
 
   // destroy all ptys
-  for (rxvt_ptytty **i = ptys.end (); i-- > ptys.begin (); )
+  for (ptytty **i = ptys.end (); i-- > ptys.begin (); )
     delete *i;
 }
 
-void rxvt_ptytty_server ()
+void ptytty_server ()
 {
   int sv[2];
 
   if (socketpair (AF_UNIX, SOCK_STREAM, 0, sv))
-    rxvt_fatal ("could not create socket to communicate with pty/sessiondb helper, aborting.\n");
+    fatal ("could not create socket to communicate with pty/sessiondb helper, aborting.\n");
 
   pid = fork ();
 
   if (pid < 0)
-    rxvt_fatal ("could not create pty/sessiondb helper process, aborting.\n");
+    fatal ("could not create pty/sessiondb helper process, aborting.\n");
 
   if (pid)
     {
-      // client, urxvt
+      // client, process
       sock_fd = sv[0];
       close (sv[1]);
       fcntl (sock_fd, F_SETFD, FD_CLOEXEC);
@@ -537,16 +543,16 @@ void rxvt_ptytty_server ()
 #endif
 
 // a "factory" *g*
-rxvt_ptytty *
-rxvt_new_ptytty ()
+ptytty *
+new_ptytty ()
 {
 #if PTYTTY_HELPER
   if (pid > 0)
     // use helper process
-    return new rxvt_ptytty_proxy;
+    return new ptytty_proxy;
   else
 #endif
-    return new rxvt_ptytty_unix;
+    return new ptytty_unix;
 }
 
 /*----------------------- end-of-file (C source) -----------------------*/
index 0b76250161a78ffaea8baf91c61ba4f04d38ecf4..8f4782d2d6398cbf8bd2e46c46ab1eef05214cd3 100644 (file)
@@ -1,19 +1,20 @@
 #ifndef PTYTTY_H
 #define PTYTTY_H
 
-#include "rxvt.h"
-#include "feature.h"
+#include "libptytty.h"
+
+#include "ptytty_conf.h"
 
 #if defined(HAVE__GETPTY) || defined(HAVE_OPENPTY) || defined(UNIX98_PTY)
 # define NO_SETOWNER_TTYDEV 1
 #endif
 
 #if UTMP_SUPPORT
-# if !defined(RXVT_UTMPX_FILE) || !defined(HAVE_STRUCT_UTMPX) || defined(__GLIBC__)
+# if !defined(UTMPX_FILE) || !defined(HAVE_STRUCT_UTMPX) || defined(__GLIBC__)
 #  undef HAVE_UTMPX_H
 #  undef HAVE_STRUCT_UTMPX
 # endif
-# if !defined(RXVT_UTMP_FILE) || !defined(HAVE_STRUCT_UTMP)
+# if !defined(UTMP_FILE) || !defined(HAVE_STRUCT_UTMP)
 #  undef HAVE_UTMP_H
 #  undef HAVE_STRUCT_UTMP
 # endif
@@ -35,7 +36,7 @@
 
 # include <pwd.h>
 
-# ifdef RXVT_UTMP_SYSV
+# ifdef UTMP_SYSV
 #  ifndef USER_PROCESS
 #   define USER_PROCESS                7
 #  endif
 
 #endif
 
-struct rxvt_ptytty_unix : rxvt_ptytty
+struct ptytty_unix : ptytty
 {
   char *name;
 
 public:
 
-  rxvt_ptytty_unix ();
-  ~rxvt_ptytty_unix ();
+  ptytty_unix ();
+  ~ptytty_unix ();
 
   bool get ();
   void put ();
index 708779ffd581d1e5030cbb395b3073892aeda3bf..a9496d51468589ccd9a7e20911ee545eaea23ed1 100644 (file)
@@ -37,6 +37,7 @@
 #include "rxvttoolkit.h"
 #include "iom.h"
 #include "salloc.h"
+#include "libptytty.h"
 
 #include "rxvtperl.h"
 
@@ -203,30 +204,6 @@ typedef struct {
 } bgPixmap_t;
 #endif
 
-struct rxvt_ptytty {
-  int pty; // pty file descriptor; connected to rxvt
-  int tty; // tty file descriptor; connected to child
-
-  rxvt_ptytty ()
-  : pty(-1), tty(-1)
-  {
-  }
-
-  virtual ~rxvt_ptytty ()
-  {
-  }
-
-  virtual bool get () = 0;
-  virtual void login (int cmd_pid, bool login_shell, const char *hostname) = 0;
-
-  void close_tty ();
-  bool make_controlling_tty ();
-  void set_utf8_mode (bool on);
-};
-
-rxvt_ptytty *rxvt_new_ptytty (); // create a new pty object
-void rxvt_ptytty_server (); // start the ptytty server process
-
 /*
  * the 'essential' information for reporting Mouse Events
  * pared down from XButtonEvent
@@ -1153,7 +1130,7 @@ struct rxvt_term : zero_initialized, rxvt_vars {
   char           *cmdbuf_ptr, *cmdbuf_endp;
   char            cmdbuf_base[CBUFSIZ];
 
-  rxvt_ptytty    *pty;
+  ptytty         *pty;
 
   rxvt_salloc    *talloc;             // text line allocator
   rxvt_salloc    *ralloc;             // rend line allocator
diff --git a/update_ptytty b/update_ptytty
new file mode 100755 (executable)
index 0000000..7fac88d
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+for i in ptytty.m4 src/libptytty.h src/ptytty.C src/ptytty.h src/logging.C src/fdpass.h src/fdpass.C; do
+   cp ../libptytty/$i $i
+done