… | |
… | |
229 | AC_DEFINE_UNQUOTED(UTMP_FILE, "$pt_cv_path_utmp", Define location of utmp) |
229 | AC_DEFINE_UNQUOTED(UTMP_FILE, "$pt_cv_path_utmp", Define location of utmp) |
230 | fi |
230 | fi |
231 | |
231 | |
232 | dnl# -------------------------------------------------------------------------- |
232 | dnl# -------------------------------------------------------------------------- |
233 | |
233 | |
234 | dnl# find utmpx - if a utmp file exists at the same location and is more than |
|
|
235 | dnl# a day newer, then dump the utmpx. People leave lots of junk around. |
|
|
236 | AC_CACHE_CHECK(where utmpx is located, pt_cv_path_utmpx, |
|
|
237 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
238 | #include <stdlib.h> |
|
|
239 | #include <sys/types.h> |
|
|
240 | #include <utmpx.h> |
|
|
241 | #include <errno.h> |
|
|
242 | #include <sys/stat.h> |
|
|
243 | #ifdef HAVE_STRING_H |
|
|
244 | #include <string.h> |
|
|
245 | #endif |
|
|
246 | main() |
|
|
247 | { |
|
|
248 | char **u, *p, *utmplist[] = { |
|
|
249 | #ifdef UTMPX_FILE |
|
|
250 | UTMPX_FILE, |
|
|
251 | #endif |
|
|
252 | #ifdef _PATH_UTMPX |
|
|
253 | _PATH_UTMPX, |
|
|
254 | #endif |
|
|
255 | "/var/adm/utmpx", "/etc/utmpx", NULL }; |
|
|
256 | FILE *a, *f=fopen("conftestval", "w"); |
|
|
257 | struct stat statu, statux; |
|
|
258 | if (!f) exit(1); |
|
|
259 | for (u = utmplist; *u; u++) { |
|
|
260 | if ((a = fopen(*u, "r")) != NULL || errno == EACCES) { |
|
|
261 | if (stat(*u, &statux) < 0) |
|
|
262 | continue; |
|
|
263 | p = strdup(*u); |
|
|
264 | p[strlen(p) - 1] = '\0'; |
|
|
265 | if (stat(p, &statu) >= 0 |
|
|
266 | && (statu.st_mtime - statux.st_mtime > 86400)) |
|
|
267 | continue; |
|
|
268 | fprintf(f, "%s\n", *u); |
|
|
269 | exit(0); |
|
|
270 | } |
|
|
271 | } |
|
|
272 | exit(0); |
|
|
273 | }]])],[pt_cv_path_utmpx=`cat conftestval`],[pt_cv_path_utmpx=],[dnl |
|
|
274 | AC_MSG_WARN(Define UTMPX_FILE in config.h manually)])]) |
|
|
275 | if test x$pt_cv_path_utmpx != x; then |
|
|
276 | AC_DEFINE_UNQUOTED(UTMPX_FILE, "$pt_cv_path_utmpx", Define location of utmpx) |
|
|
277 | fi |
|
|
278 | |
|
|
279 | dnl# -------------------------------------------------------------------------- |
|
|
280 | |
|
|
281 | dnl# find wtmp |
234 | dnl# find wtmp |
282 | AC_CACHE_CHECK(where wtmp is located, pt_cv_path_wtmp, |
235 | AC_CACHE_CHECK(where wtmp is located, pt_cv_path_wtmp, |
283 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
236 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
284 | #include <stdlib.h> |
237 | #include <stdlib.h> |
285 | #include <sys/types.h> |
238 | #include <sys/types.h> |