dnl CF_UTMP_UT_NAME version: 8 updated: 2021/01/02 09:31:20
dnl ---------------
dnl Check if UTMP/UTMPX struct defines ut_name member
AC_DEFUN([CF_UTMP_UT_NAME],
[
if test "$cf_cv_have_utmp" != no ; then
AC_CACHE_CHECK(if ${cf_cv_have_utmp}.ut_name is declared,cf_cv_have_utmp_ut_name,[
	cf_cv_have_utmp_ut_name=no
cf_utmp_includes="
#include <sys/types.h>
#include <${cf_cv_have_utmp}.h>
#define getutent getutxent
#ifdef USE_LASTLOG
#include <lastlog.h>		/* may conflict with utmpx.h on Linux */
#endif
"
for cf_header in ut_name ut_user ; do
	AC_TRY_COMPILE([$cf_utmp_includes],
	[struct $cf_cv_have_utmp x;
	 char *name = x.$cf_header;
	 (void)x;
	 (void)name;
	],
	[cf_cv_have_utmp_ut_name=$cf_header
	 break])
done
])

case "$cf_cv_have_utmp_ut_name" in
(no)
	AC_MSG_ERROR(Cannot find declaration for ut.ut_name)
	;;
(ut_user)
	AC_DEFINE(ut_name,ut_user,[Define to rename UTMP/UTMPX struct ut_name member])
	;;
esac
fi
])dnl
