… | |
… | |
83 | support_utmp=yes |
83 | support_utmp=yes |
84 | support_wtmp=yes |
84 | support_wtmp=yes |
85 | support_lastlog=yes |
85 | support_lastlog=yes |
86 | |
86 | |
87 | AC_ARG_ENABLE(utmp, |
87 | AC_ARG_ENABLE(utmp, |
88 | [ --enable-utmp enable utmp (utmpx) support], |
88 | [AS_HELP_STRING([--enable-utmp],[enable utmp (utmpx) support])], |
89 | [if test x$enableval = xyes -o x$enableval = xno; then |
89 | [if test x$enableval = xyes -o x$enableval = xno; then |
90 | support_utmp=$enableval |
90 | support_utmp=$enableval |
91 | fi]) |
91 | fi]) |
92 | |
92 | |
93 | AC_ARG_ENABLE(wtmp, |
93 | AC_ARG_ENABLE(wtmp, |
94 | [ --enable-wtmp enable wtmp (wtmpx) support (requires --enable-utmp)], |
94 | [AS_HELP_STRING([--enable-wtmp],[enable wtmp (wtmpx) support (requires --enable-utmp)])], |
95 | [if test x$enableval = xyes -o x$enableval = xno; then |
95 | [if test x$enableval = xyes -o x$enableval = xno; then |
96 | support_wtmp=$enableval |
96 | support_wtmp=$enableval |
97 | fi]) |
97 | fi]) |
98 | |
98 | |
99 | AC_ARG_ENABLE(lastlog, |
99 | AC_ARG_ENABLE(lastlog, |
100 | [ --enable-lastlog enable lastlog support (requires --enable-utmp)], |
100 | [AS_HELP_STRING([--enable-lastlog],[enable lastlog support (requires --enable-utmp)])], |
101 | [if test x$enableval = xyes -o x$enableval = xno; then |
101 | [if test x$enableval = xyes -o x$enableval = xno; then |
102 | support_lastlog=$enableval |
102 | support_lastlog=$enableval |
103 | fi]) |
103 | fi]) |
104 | |
104 | |
105 | if test x$support_utmp = xyes; then |
105 | if test x$support_utmp = xyes; then |
… | |
… | |
111 | if test x$support_lastlog = xyes; then |
111 | if test x$support_lastlog = xyes; then |
112 | AC_DEFINE(LASTLOG_SUPPORT, 1, Define if you want to have lastlog support when utmp/utmpx is enabled) |
112 | AC_DEFINE(LASTLOG_SUPPORT, 1, Define if you want to have lastlog support when utmp/utmpx is enabled) |
113 | fi |
113 | fi |
114 | |
114 | |
115 | AC_CHECK_FUNCS( \ |
115 | AC_CHECK_FUNCS( \ |
116 | ttyslot \ |
|
|
117 | updwtmp \ |
116 | updwtmp \ |
118 | updwtmpx \ |
117 | updwtmpx \ |
|
|
118 | updlastlogx \ |
119 | ) |
119 | ) |
120 | |
120 | |
121 | AC_CHECK_HEADERS( \ |
121 | AC_CHECK_HEADERS(lastlog.h) |
122 | utmp.h \ |
|
|
123 | utmpx.h \ |
|
|
124 | lastlog.h \ |
|
|
125 | ) |
|
|
126 | |
122 | |
127 | dnl# -------------------------------------------------------------------------- |
123 | dnl# -------------------------------------------------------------------------- |
128 | dnl# DO ALL UTMP AND WTMP CHECKING |
124 | dnl# DO ALL UTMP AND WTMP CHECKING |
129 | dnl# -------------------------------------------------------------------------- |
125 | dnl# -------------------------------------------------------------------------- |
130 | dnl# check for host field in utmp structure |
126 | dnl# check for host field in utmp structure |
131 | |
127 | |
132 | dnl# -------------------------------------------- |
128 | dnl# -------------------------------------------- |
133 | AC_CHECK_HEADER(utmp.h, |
129 | AC_CHECK_HEADERS(utmp.h, |
134 | [AC_CACHE_CHECK([for struct utmp], struct_utmp, |
130 | [AC_CACHE_CHECK([for struct utmp], struct_utmp, |
135 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
131 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
136 | #include <utmp.h>]], [[struct utmp ut;]])],[struct_utmp=yes],[struct_utmp=no])]) |
132 | #include <utmp.h>]], [[struct utmp ut;]])],[struct_utmp=yes],[struct_utmp=no])]) |
137 | if test x$struct_utmp = xyes; then |
133 | if test x$struct_utmp = xyes; then |
138 | AC_DEFINE(HAVE_STRUCT_UTMP, 1, Define if utmp.h has struct utmp) |
134 | AC_DEFINE(HAVE_STRUCT_UTMP, 1, Define if utmp.h has struct utmp) |
… | |
… | |
150 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
146 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
151 | #include <utmp.h>]], [[struct utmp ut; ut.ut_pid;]])],[struct_utmp_pid=yes],[struct_utmp_pid=no])]) |
147 | #include <utmp.h>]], [[struct utmp ut; ut.ut_pid;]])],[struct_utmp_pid=yes],[struct_utmp_pid=no])]) |
152 | if test x$struct_utmp_pid = xyes; then |
148 | if test x$struct_utmp_pid = xyes; then |
153 | AC_DEFINE(HAVE_UTMP_PID, 1, Define if struct utmp contains ut_pid) |
149 | AC_DEFINE(HAVE_UTMP_PID, 1, Define if struct utmp contains ut_pid) |
154 | fi |
150 | fi |
155 | ) dnl# AC_CHECK_HEADER(utmp.h |
151 | ) dnl# AC_CHECK_HEADERS(utmp.h |
156 | |
152 | |
157 | dnl# -------------------------------------------- |
153 | dnl# -------------------------------------------- |
158 | |
154 | |
159 | AC_CHECK_HEADER(utmpx.h, |
155 | AC_CHECK_HEADERS(utmpx.h, |
160 | [AC_CACHE_CHECK([for struct utmpx], struct_utmpx, |
156 | [AC_CACHE_CHECK([for struct utmpx], struct_utmpx, |
161 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
157 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
162 | #include <utmpx.h>]], [[struct utmpx ut;]])],[struct_utmpx=yes],[struct_utmpx=no])]) |
158 | #include <utmpx.h>]], [[struct utmpx ut;]])],[struct_utmpx=yes],[struct_utmpx=no])]) |
163 | if test x$struct_utmpx = xyes; then |
159 | if test x$struct_utmpx = xyes; then |
164 | AC_DEFINE(HAVE_STRUCT_UTMPX, 1, Define if utmpx.h has struct utmpx) |
160 | AC_DEFINE(HAVE_STRUCT_UTMPX, 1, Define if utmpx.h has struct utmpx) |
… | |
… | |
178 | [struct utmpx utx; utx.ut_session;], |
174 | [struct utmpx utx; utx.ut_session;], |
179 | struct_utmpx_session=yes, struct_utmpx_session=no)]) |
175 | struct_utmpx_session=yes, struct_utmpx_session=no)]) |
180 | if test x$struct_utmpx_session = xyes; then |
176 | if test x$struct_utmpx_session = xyes; then |
181 | AC_DEFINE(HAVE_UTMPX_SESSION, 1, Define if struct utmpx contains ut_session) |
177 | AC_DEFINE(HAVE_UTMPX_SESSION, 1, Define if struct utmpx contains ut_session) |
182 | fi |
178 | fi |
183 | ) dnl# AC_CHECK_HEADER(utmpx.h |
179 | ) dnl# AC_CHECK_HEADERS(utmpx.h |
184 | |
180 | |
185 | dnl# -------------------------------------------------------------------------- |
181 | dnl# -------------------------------------------------------------------------- |
186 | dnl# check for struct lastlog |
182 | dnl# check for struct lastlog |
187 | AC_CACHE_CHECK(for struct lastlog, struct_lastlog, |
183 | AC_CACHE_CHECK(for struct lastlog, struct_lastlog, |
188 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
184 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
… | |
… | |
212 | dnl# -------------------------------------------------------------------------- |
208 | dnl# -------------------------------------------------------------------------- |
213 | |
209 | |
214 | dnl# find utmp |
210 | dnl# find utmp |
215 | AC_CACHE_CHECK(where utmp is located, path_utmp, |
211 | AC_CACHE_CHECK(where utmp is located, path_utmp, |
216 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
212 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
213 | #include <stdlib.h> |
217 | #include <sys/types.h> |
214 | #include <sys/types.h> |
218 | #include <utmp.h> |
215 | #include <utmp.h> |
219 | #include <errno.h> |
216 | #include <errno.h> |
220 | main() |
217 | main() |
221 | { |
218 | { |
… | |
… | |
248 | |
245 | |
249 | dnl# find utmpx - if a utmp file exists at the same location and is more than |
246 | dnl# find utmpx - if a utmp file exists at the same location and is more than |
250 | dnl# a day newer, then dump the utmpx. People leave lots of junk around. |
247 | dnl# a day newer, then dump the utmpx. People leave lots of junk around. |
251 | AC_CACHE_CHECK(where utmpx is located, path_utmpx, |
248 | AC_CACHE_CHECK(where utmpx is located, path_utmpx, |
252 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
249 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
250 | #include <stdlib.h> |
253 | #include <sys/types.h> |
251 | #include <sys/types.h> |
254 | #include <utmpx.h> |
252 | #include <utmpx.h> |
255 | #include <errno.h> |
253 | #include <errno.h> |
256 | #include <sys/stat.h> |
254 | #include <sys/stat.h> |
257 | #ifdef HAVE_STRING_H |
255 | #ifdef HAVE_STRING_H |
… | |
… | |
293 | dnl# -------------------------------------------------------------------------- |
291 | dnl# -------------------------------------------------------------------------- |
294 | |
292 | |
295 | dnl# find wtmp |
293 | dnl# find wtmp |
296 | AC_CACHE_CHECK(where wtmp is located, path_wtmp, |
294 | AC_CACHE_CHECK(where wtmp is located, path_wtmp, |
297 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
295 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
296 | #include <stdlib.h> |
298 | #include <sys/types.h> |
297 | #include <sys/types.h> |
299 | #ifdef HAVE_UTMP_H |
298 | #ifdef HAVE_UTMP_H |
300 | #include <utmp.h> |
299 | #include <utmp.h> |
301 | #endif |
300 | #endif |
302 | #include <errno.h> |
301 | #include <errno.h> |
303 | main() |
302 | main() |
304 | { |
303 | { |
305 | char **w, *wtmplist[] = { |
304 | char **w, *wtmplist[] = { |
306 | "/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp", NULL }; |
305 | "/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp", NULL }; |
307 | FILE *a, *f=fopen("conftestval", "w"); |
306 | FILE *a, *f=fopen("conftestval", "w"); |
308 | if (!f) exit(1); |
307 | if (!f) exit(1); |
309 | #ifdef WTMP_FILE |
308 | #ifdef WTMP_FILE |
310 | fprintf(f, "%s\n", WTMP_FILE); |
309 | fprintf(f, "%s\n", WTMP_FILE); |
311 | exit(0); |
310 | exit(0); |
… | |
… | |
329 | dnl# -------------------------------------------------------------------------- |
328 | dnl# -------------------------------------------------------------------------- |
330 | |
329 | |
331 | dnl# find wtmpx |
330 | dnl# find wtmpx |
332 | AC_CACHE_CHECK(where wtmpx is located, path_wtmpx, |
331 | AC_CACHE_CHECK(where wtmpx is located, path_wtmpx, |
333 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
332 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
333 | #include <stdlib.h> |
334 | #ifdef HAVE_UTMPX_H |
334 | #ifdef HAVE_UTMPX_H |
335 | #include <utmpx.h> |
335 | #include <utmpx.h> |
336 | #endif |
336 | #endif |
337 | #include <errno.h> |
337 | #include <errno.h> |
338 | main() |
338 | main() |
339 | { |
339 | { |
340 | char **w, *wtmplist[] = { |
340 | char **w, *wtmplist[] = { |
341 | "/var/log/wtmpx", "/var/adm/wtmpx", NULL }; |
341 | "/var/log/wtmpx", "/var/adm/wtmpx", NULL }; |
342 | FILE *a, *f=fopen("conftestval", "w"); |
342 | FILE *a, *f=fopen("conftestval", "w"); |
343 | if (!f) exit(1); |
343 | if (!f) exit(1); |
344 | #ifdef WTMPX_FILE |
344 | #ifdef WTMPX_FILE |
345 | fprintf(f, "%s\n", WTMPX_FILE); |
345 | fprintf(f, "%s\n", WTMPX_FILE); |
346 | exit(0); |
346 | exit(0); |
… | |
… | |
364 | dnl# -------------------------------------------------------------------------- |
364 | dnl# -------------------------------------------------------------------------- |
365 | |
365 | |
366 | dnl# find lastlog |
366 | dnl# find lastlog |
367 | AC_CACHE_CHECK(where lastlog is located, path_lastlog, |
367 | AC_CACHE_CHECK(where lastlog is located, path_lastlog, |
368 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
368 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
369 | #include <stdlib.h> |
369 | #include <sys/types.h> |
370 | #include <sys/types.h> |
370 | #ifdef HAVE_UTMPX_H |
371 | #ifdef HAVE_UTMPX_H |
371 | #include <utmpx.h> |
372 | #include <utmpx.h> |
372 | #elif defined(HAVE_UTMP_H) |
373 | #elif defined(HAVE_UTMP_H) |
373 | #include <utmp.h> |
374 | #include <utmp.h> |
… | |
… | |
398 | exit(0); |
399 | exit(0); |
399 | }]])],[path_lastlog=`cat conftestval`],[path_lastlog=],[dnl |
400 | }]])],[path_lastlog=`cat conftestval`],[path_lastlog=],[dnl |
400 | AC_MSG_WARN(Define LASTLOG_FILE in config.h manually)])]) |
401 | AC_MSG_WARN(Define LASTLOG_FILE in config.h manually)])]) |
401 | if test x$path_lastlog != x; then |
402 | if test x$path_lastlog != x; then |
402 | AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$path_lastlog", Define location of lastlog) |
403 | AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$path_lastlog", Define location of lastlog) |
403 | if test -d "$path_lastlog"; then |
|
|
404 | AC_DEFINE(LASTLOG_IS_DIR, 1, Define if lastlog is provided via a directory) |
|
|
405 | fi |
|
|
406 | fi |
404 | fi |
407 | dnl# -------------------------------------------------------------------------- |
405 | dnl# -------------------------------------------------------------------------- |
408 | |
406 | |
409 | dnl# find lastlogx |
407 | dnl# find lastlogx |
410 | AC_CACHE_CHECK(where lastlogx is located, path_lastlogx, |
408 | AC_CACHE_CHECK(where lastlogx is located, path_lastlogx, |
411 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
409 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
410 | #include <stdlib.h> |
412 | #ifdef HAVE_UTMPX_H |
411 | #ifdef HAVE_UTMPX_H |
413 | #include <utmpx.h> |
412 | #include <utmpx.h> |
414 | #endif |
413 | #endif |
415 | #include <errno.h> |
414 | #include <errno.h> |
416 | main() |
415 | main() |