and struct utmpx.ut_exit.__e_termination. HP-UX uses the latter.
Only update ut_exit if we detect one or the other.
/* Define to 1 if `ut_exit' is a member of `struct utmpx'. */
#undef HAVE_STRUCT_UTMPX_UT_EXIT
+/* Define to 1 if `ut_exit.e_termination' is a member of `struct utmpx'. */
+#undef HAVE_STRUCT_UTMPX_UT_EXIT_E_TERMINATION
+
+/* Define to 1 if `ut_exit.__e_termination' is a member of `struct utmpx'. */
+#undef HAVE_STRUCT_UTMPX_UT_EXIT___E_TERMINATION
+
/* Define to 1 if `ut_id' is a member of `struct utmpx'. */
#undef HAVE_STRUCT_UTMPX_UT_ID
/* Define to 1 if `ut_exit' is a member of `struct utmp'. */
#undef HAVE_STRUCT_UTMP_UT_EXIT
+/* Define to 1 if `ut_exit.e_termination' is a member of `struct utmp'. */
+#undef HAVE_STRUCT_UTMP_UT_EXIT_E_TERMINATION
+
+/* Define to 1 if `ut_exit.__e_termination' is a member of `struct utmp'. */
+#undef HAVE_STRUCT_UTMP_UT_EXIT___E_TERMINATION
+
/* Define to 1 if `ut_id' is a member of `struct utmp'. */
#undef HAVE_STRUCT_UTMP_UT_ID
_ACEOF
-fi
-ac_fn_c_check_member "$LINENO" "struct utmpx" "ut_exit" "ac_cv_member_struct_utmpx_ut_exit" "
- #include <sys/types.h>
- #include <utmpx.h>
-
-"
-if test "x$ac_cv_member_struct_utmpx_ut_exit" = x""yes; then :
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_STRUCT_UTMPX_UT_EXIT 1
-_ACEOF
-
-
fi
ac_fn_c_check_member "$LINENO" "struct utmpx" "ut_pid" "ac_cv_member_struct_utmpx_ut_pid" "
#include <sys/types.h>
fi
-else
- ac_fn_c_check_member "$LINENO" "struct utmp" "ut_id" "ac_cv_member_struct_utmp_ut_id" "
+ ac_fn_c_check_member "$LINENO" "struct utmpx" "ut_exit.__e_termination" "ac_cv_member_struct_utmpx_ut_exit___e_termination" "
#include <sys/types.h>
- #include <utmp.h>
+ #include <utmpx.h>
"
-if test "x$ac_cv_member_struct_utmp_ut_id" = x""yes; then :
+if test "x$ac_cv_member_struct_utmpx_ut_exit___e_termination" = x""yes; then :
cat >>confdefs.h <<_ACEOF
-#define HAVE_STRUCT_UTMP_UT_ID 1
+#define HAVE_STRUCT_UTMPX_UT_EXIT___E_TERMINATION 1
+_ACEOF
+
+$as_echo "#define HAVE_STRUCT_UTMPX_UT_EXIT 1" >>confdefs.h
+
+else
+
+ ac_fn_c_check_member "$LINENO" "struct utmpx" "ut_exit.e_termination" "ac_cv_member_struct_utmpx_ut_exit_e_termination" "
+ #include <sys/types.h>
+ #include <utmpx.h>
+
+"
+if test "x$ac_cv_member_struct_utmpx_ut_exit_e_termination" = x""yes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_UTMPX_UT_EXIT_E_TERMINATION 1
_ACEOF
+$as_echo "#define HAVE_STRUCT_UTMPX_UT_EXIT 1" >>confdefs.h
fi
-ac_fn_c_check_member "$LINENO" "struct utmp" "ut_exit" "ac_cv_member_struct_utmp_ut_exit" "
+
+
+fi
+
+else
+ ac_fn_c_check_member "$LINENO" "struct utmp" "ut_id" "ac_cv_member_struct_utmp_ut_id" "
#include <sys/types.h>
#include <utmp.h>
"
-if test "x$ac_cv_member_struct_utmp_ut_exit" = x""yes; then :
+if test "x$ac_cv_member_struct_utmp_ut_id" = x""yes; then :
cat >>confdefs.h <<_ACEOF
-#define HAVE_STRUCT_UTMP_UT_EXIT 1
+#define HAVE_STRUCT_UTMP_UT_ID 1
_ACEOF
_ACEOF
+fi
+
+ ac_fn_c_check_member "$LINENO" "struct utmp" "ut_exit.__e_termination" "ac_cv_member_struct_utmp_ut_exit___e_termination" "
+ #include <sys/types.h>
+ #include <utmp.h>
+
+"
+if test "x$ac_cv_member_struct_utmp_ut_exit___e_termination" = x""yes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_UTMP_UT_EXIT___E_TERMINATION 1
+_ACEOF
+
+$as_echo "#define HAVE_STRUCT_UTMP_UT_EXIT 1" >>confdefs.h
+
+else
+
+ ac_fn_c_check_member "$LINENO" "struct utmp" "ut_exit.e_termination" "ac_cv_member_struct_utmp_ut_exit_e_termination" "
+ #include <sys/types.h>
+ #include <utmp.h>
+
+"
+if test "x$ac_cv_member_struct_utmp_ut_exit_e_termination" = x""yes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_UTMP_UT_EXIT_E_TERMINATION 1
+_ACEOF
+
+$as_echo "#define HAVE_STRUCT_UTMP_UT_EXIT 1" >>confdefs.h
+
+fi
+
+
fi
fi
+
+
dnl Check for utmp/utmpx struct members.
dnl
if test $ac_cv_header_utmpx_h = "yes"; then
- AC_CHECK_MEMBERS([struct utmpx.ut_id, struct utmpx.ut_exit, struct utmpx.ut_pid, struct utmpx.ut_tv, struct utmpx.ut_type], [], [], [
+ AC_CHECK_MEMBERS([struct utmpx.ut_id, struct utmpx.ut_pid, struct utmpx.ut_tv, struct utmpx.ut_type], [], [], [
+ #include <sys/types.h>
+ #include <utmpx.h>
+ ])
+ dnl
+ dnl Check for ut_exit.__e_termination first, then ut_exit.e_termination
+ dnl
+ AC_CHECK_MEMBERS([struct utmpx.ut_exit.__e_termination], [AC_DEFINE(HAVE_STRUCT_UTMPX_UT_EXIT)], [
+ AC_CHECK_MEMBERS([struct utmpx.ut_exit.e_termination], [AC_DEFINE(HAVE_STRUCT_UTMPX_UT_EXIT)], [], [
+ #include <sys/types.h>
+ #include <utmpx.h>
+ ])
+ ], [
#include <sys/types.h>
#include <utmpx.h>
])
else
- AC_CHECK_MEMBERS([struct utmp.ut_id, struct utmp.ut_exit, struct utmp.ut_pid, struct utmp.ut_tv, struct utmp.ut_type, struct utmp.ut_user], [], [], [
+ AC_CHECK_MEMBERS([struct utmp.ut_id, struct utmp.ut_pid, struct utmp.ut_tv, struct utmp.ut_type, struct utmp.ut_user], [], [], [
+ #include <sys/types.h>
+ #include <utmp.h>
+ ])
+ dnl
+ dnl Check for ut_exit.__e_termination first, then ut_exit.e_termination
+ dnl
+ AC_CHECK_MEMBERS([struct utmp.ut_exit.__e_termination], [AC_DEFINE(HAVE_STRUCT_UTMP_UT_EXIT)], [
+ AC_CHECK_MEMBERS([struct utmp.ut_exit.e_termination], [AC_DEFINE(HAVE_STRUCT_UTMP_UT_EXIT)], [], [
+ #include <sys/types.h>
+ #include <utmp.h>
+ ])
+ ], [
#include <sys/types.h>
#include <utmp.h>
])
AH_TEMPLATE(WITHOUT_PASSWD, [Define to avoid using the passwd/shadow file for authentication.])
AH_TEMPLATE(sig_atomic_t, [Define to `int' if <signal.h> does not define.])
AH_TEMPLATE(__signed, [Define to `signed' or nothing if compiler does not support a signed type qualifier.])
+AH_TEMPLATE(HAVE_STRUCT_UTMP_UT_EXIT, [Define to 1 if `ut_exit' is a member of `struct utmp'.])
+AH_TEMPLATE(HAVE_STRUCT_UTMPX_UT_EXIT, [Define to 1 if `ut_exit' is a member of `struct utmpx'.])
dnl
dnl Bits to copy verbatim into config.h.in
# endif
#endif
+/* HP-UX has __e_termination and __e_exit, others lack the __ */
+#if defined(HAVE_STRUCT_UTMPX_UT_EXIT_E_TERMINATION) || defined(HAVE_STRUCT_UTMP_UT_EXIT_E_TERMINATION)
+# undef __e_termination
+# define __e_termination e_termination
+# undef __e_exit
+# define __e_exit e_exit
+#endif
+
#if defined(HAVE_GETUTXID) || defined(HAVE_GETUTID)
/*
* Create ut_id from the new ut_line and the old ut_id.
ut->ut_type = DEAD_PROCESS;
# endif
# if defined(HAVE_STRUCT_UTMPX_UT_EXIT) || defined(HAVE_STRUCT_UTMP_UT_EXIT)
- ut->ut_exit.e_exit = WEXITSTATUS(status);
- ut->ut_exit.e_termination = WIFEXITED(status) ? WEXITSTATUS(status) : 0;
+ ut->ut_exit.__e_exit = WEXITSTATUS(status);
+ ut->ut_exit.__e_termination = WIFEXITED(status) ? WEXITSTATUS(status) : 0;
# endif
utmp_settime(ut);
if (pututxline(ut) != NULL)