/* define this if struct utmp has an ut_type member */
#undef HAVE_UT_TYPE
+/* define this if struct utmp has an ut_host member */
+#undef HAVE_UT_HOST
+
/* define this if the OS has broken non-reentrant gethostby{name,addr}() */
#undef HAVE_NONREENTRANT_NETDB
AC_DEFINE(HAVE_UT_TYPE)
fi
+AC_CACHE_CHECK([for ut_host in struct utmp], ac_cv_struct_ut_host,
+[AC_TRY_COMPILE([#include <utmp.h>], [struct utmp ut; ut.ut_host;],
+ac_cv_struct_ut_host=yes, ac_cv_struct_ut_host=no)])
+if test $ac_cv_struct_ut_host = yes; then
+ AC_DEFINE(HAVE_UT_HOST)
+fi
+
dnl Checks for library functions.
AC_FUNC_GETPGRP
AC_PROG_GCC_TRADITIONAL
#ifdef HAVE_UT_TYPE
if (put->ut_type == USER_PROCESS) {
#endif
+#ifdef HAVE_UT_HOST
if (*put->ut_host)
safestrncpy(hbuf, put->ut_host, 24);
else
+#endif
safestrncpy(hbuf, put->ut_line, 24);
#ifdef HAVE_UT_TYPE
}