ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/aclocal.m4
Revision: 1.3
Committed: Sat Jan 21 18:14:57 2006 UTC (18 years, 3 months ago) by ayin
Branch: MAIN
Changes since 1.2: +404 -0 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 dnl> test to find the hard-to-find libXpm
2 dnl> mostly copied from AC_PATH_X & AC_PATH_DIRECT, but explictly set
3
4 AC_DEFUN([VT_FIND_LIBXPM],
5 [
6 AC_REQUIRE_CPP()
7
8 # Initialize some more variables set by options.
9 # The variables have the same names as the options, with
10 # dashes changed to underlines.
11
12 # If we find XPM, set shell vars xpm_includes and xpm_libraries to the
13 # paths, otherwise set no_xpm=yes.
14 # Uses ac_ vars as temps to allow command line to override cache and checks.
15 AC_MSG_CHECKING(for libXpm)
16
17 AC_ARG_WITH(xpm_includes,
18 [ --with-xpm-includes=DIR use XPM includes in DIR],
19 xpm_includes="$withval", xpm_includes=NO)
20 AC_ARG_WITH(xpm_library,
21 [ --with-xpm-library=DIR use XPM library in DIR],
22 xpm_libraries="$withval", xpm_libraries=NO)
23
24 # --without-xpm overrides everything else, but does not touch the cache.
25 AC_ARG_WITH(xpm,
26 [ --with-xpm use XPM])
27 if test "$with_xpm" = no; then
28 have_xpm=disabled
29 else
30 AC_CACHE_VAL(ac_cv_have_xpm, [
31 vt_xpm_include_X11=no
32 if test -n "$xpm_includes"; then
33 vt_xpm_includes=$xpm_includes
34 else
35 vt_xpm_includes=NO
36 fi
37 if test -n "$xpm_libraries"; then
38 vt_xpm_libraries=$xpm_libraries
39 else
40 vt_xpm_libraries=NO
41 fi
42
43 VT_XPM_DIRECT
44
45 if test "$vt_xpm_includes" = NO -o "$vt_xpm_libraries" = NO; then
46 ac_cv_have_xpm="have_xpm=no"
47 else
48 ac_cv_have_xpm="have_xpm=yes \
49 vt_xpm_includes=$vt_xpm_includes vt_xpm_libraries=$vt_xpm_libraries \
50 vt_xpm_include_X11=$vt_xpm_include_X11"
51 fi])dnl
52 eval "$ac_cv_have_xpm"
53 fi
54
55 if test "$have_xpm" != yes; then
56 AC_MSG_RESULT($have_xpm)
57 no_xpm=yes
58 else
59 if test "$xpm_includes" != NO; then
60 if test "$xpm_includes" = "$vt_xpm_includes"; then
61 if test -r "$xpm_includes/X11/xpm.h"; then
62 vt_xpm_include_X11=yes
63 fi
64 else
65 vt_xpm_include_X11=no
66 if test -z "$xpm_includes"; then
67 AC_TRY_CPP([#include <X11/xpm.h>],
68 vt_xpm_include_X11=yes)
69 else
70 if test -r "$xpm_includes/X11/xpm.h"; then
71 vt_xpm_include_X11=yes
72 fi
73 fi
74 fi
75 vt_xpm_includes=$xpm_includes
76 fi
77 if test "x$xpm_libraries" != xNO; then
78 vt_xpm_libraries=$xpm_libraries
79 fi
80 # Update the cache value to reflect the command line values.
81 ac_cv_have_xpm="have_xpm=yes \
82 vt_xpm_includes=$vt_xpm_includes vt_xpm_libraries=$vt_xpm_libraries \
83 vt_xpm_include_X11=$vt_xpm_include_X11"
84 eval "$ac_cv_have_xpm"
85 AC_MSG_RESULT([-I$vt_xpm_includes, -L$vt_xpm_libraries])
86 if test -n "$vt_xpm_includes"; then
87 XPM_CPPFLAGS="-DHAVE_LIBXPM"
88 fi
89 if test -n "$vt_xpm_includes"; then
90 XPM_CFLAGS="-I$vt_xpm_includes"
91 fi
92 XPM_LIBS="-lXpm"
93 if test -n "$vt_xpm_libraries"; then
94 XPM_LIBS="-L$vt_xpm_libraries $XPM_LIBS"
95 fi
96 if test "x$vt_xpm_include_X11" = xyes; then
97 AC_DEFINE(XPM_INC_X11, 1, Define if you include <X11/xpm.h> on a normal include path (be careful))
98 fi
99 fi
100
101 AC_SUBST(XPM_CPPFLAGS)
102 AC_SUBST(XPM_CFLAGS)
103 AC_SUBST(XPM_LIBS)
104 ])
105
106 dnl Internal subroutine of VT_FIND_LIBXPM
107 dnl Set vt_xpm_include and vt_xpm_libr
108 # -------------- find xpm.h and Xpm.a/Xpm.so/Xpm.sl
109 AC_DEFUN([VT_XPM_DIRECT],
110 [if test "$vt_xpm_includes" = NO; then
111 # Guess where to find xpm.h
112
113 ac_save_CPPFLAGS="$CPPFLAGS"
114 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
115
116 # First, try using that file with no special directory specified.
117 AC_TRY_CPP([#include <X11/xpm.h>],
118 [# We can compile using X headers with no special include directory.
119 vt_xpm_includes=
120 vt_xpm_include_X11=yes],
121 [CPPFLAGS="$ac_save_CPPFLAGS"
122 # Look for the header file in a standard set of common directories.
123 for ac_dir in \
124 /usr/X11/include \
125 /usr/X11R6/include \
126 /usr/X11R5/include \
127 /usr/X11R4/include \
128 \
129 /usr/include/X11 \
130 /usr/include/X11R6 \
131 /usr/include/X11R5 \
132 /usr/include/X11R4 \
133 \
134 /usr/local/X11/include \
135 /usr/local/X11R6/include \
136 /usr/local/X11R5/include \
137 /usr/local/X11R4/include \
138 \
139 /usr/local/include/X11 \
140 /usr/local/include/X11R6 \
141 /usr/local/include/X11R5 \
142 /usr/local/include/X11R4 \
143 \
144 /usr/X386/include \
145 /usr/x386/include \
146 /usr/XFree86/include/X11 \
147 \
148 /usr/include \
149 /usr/local/include \
150 /usr/unsupported/include \
151 /usr/athena/include \
152 /usr/local/x11r5/include \
153 /usr/lpp/Xamples/include \
154 \
155 /usr/openwin/include \
156 /usr/openwin/share/include \
157 ; \
158 do
159 if test -r "$ac_dir/X11/xpm.h"; then
160 vt_xpm_includes="$ac_dir"
161 vt_xpm_include_X11=yes
162 break
163 else
164 if test -r "$ac_dir/xpm.h"; then
165 vt_xpm_includes=$ac_dir
166 break
167 fi
168 fi
169 done])
170 fi
171
172 if test "$vt_xpm_libraries" = NO; then
173 # Check for the libraries.
174
175 # See if we find them without any special options.
176 # Don't add to $LIBS permanently.
177 ac_save_LIBS="$LIBS"
178 LIBS="$LIBS $X_LIBS -lXpm -lX11"
179 AC_TRY_LINK(, [XpmReadFileToPixmap()],
180 [LIBS="$ac_save_LIBS"
181 # We can link libXpm with no special library path.
182 vt_xpm_libraries=],
183 [LIBS="$ac_save_LIBS"
184 # First see if replacing the include by lib works.
185 for ac_dir in \
186 `echo "$vt_xpm_includes" | sed 's,include/X11,lib,;s,include,lib,'` \
187 /usr/X11/lib \
188 /usr/X11R6/lib \
189 /usr/X11R5/lib \
190 /usr/X11R4/lib \
191 \
192 /usr/lib/X11 \
193 /usr/lib/X11R6 \
194 /usr/lib/X11R5 \
195 /usr/lib/X11R4 \
196 \
197 /usr/local/X11/lib \
198 /usr/local/X11R6/lib \
199 /usr/local/X11R5/lib \
200 /usr/local/X11R4/lib \
201 \
202 /usr/local/lib/X11 \
203 /usr/local/lib/X11R6 \
204 /usr/local/lib/X11R5 \
205 /usr/local/lib/X11R4 \
206 \
207 /usr/X386/lib \
208 /usr/x386/lib \
209 /usr/XFree86/lib/X11 \
210 \
211 /usr/lib \
212 /usr/local/lib \
213 /usr/unsupported/lib \
214 /usr/athena/lib \
215 /usr/local/x11r5/lib \
216 /usr/lpp/Xamples/lib \
217 \
218 /usr/openwin/lib \
219 /usr/openwin/share/lib \
220 ; \
221 do
222 dnl XXX Shouldn't this really use AC_TRY_LINK to be portable & robust??
223 for ac_extension in a so sl; do
224 if test -r $ac_dir/libXpm.$ac_extension; then
225 vt_xpm_libraries=$ac_dir
226 break 2
227 fi
228 done
229 done])
230 fi
231 ])
232
233 AC_DEFUN([PTY_CHECK],
234 [
235 AC_CHECK_HEADERS( \
236 pty.h \
237 util.h \
238 libutil.h \
239 sys/ioctl.h \
240 sys/stropts.h \
241 )
242
243 AC_CHECK_FUNCS( \
244 revoke \
245 _getpty \
246 getpt \
247 posix_openpt \
248 isastream \
249 )
250
251 have_clone=no
252
253 AC_MSG_CHECKING(for /dev/ptym/clone)
254 if test -e /dev/ptym/clone; then
255 AC_MSG_RESULT(yes)
256 AC_DEFINE(HAVE_DEV_CLONE, 1, [Define to 1 if you have /dev/ptym/clone])
257 AC_DEFINE(CLONE_DEVICE, "/dev/ptym/clone", [clone device filename])
258 have_clone=yes
259 else
260 AC_MSG_RESULT(no)
261 fi
262
263 AC_MSG_CHECKING(for /dev/ptc)
264 if test -e /dev/ptc; then
265 AC_MSG_RESULT(yes)
266 AC_DEFINE(HAVE_DEV_PTC, 1, [Define to 1 if you have /dev/ptc])
267 AC_DEFINE(CLONE_DEVICE, "/dev/ptc", [clone device filename])
268 have_clone=yes
269 else
270 AC_MSG_RESULT(no)
271 fi
272
273 case $host in
274 *-*-cygwin*)
275 have_clone=yes
276 AC_DEFINE(CLONE_DEVICE, "/dev/ptmx", [clone device filename])
277 ;;
278 *)
279 AC_MSG_CHECKING(for /dev/ptmx)
280 if test -e /dev/ptmx; then
281 AC_MSG_RESULT(yes)
282 AC_DEFINE(HAVE_DEV_PTMX, 1, [Define to 1 if you have /dev/ptmx])
283 AC_DEFINE(CLONE_DEVICE, "/dev/ptmx", [clone device filename])
284 have_clone=yes
285 else
286 AC_MSG_RESULT(no)
287 fi
288 ;;
289 esac
290
291 if test x$ac_cv_func_getpt = xyes -o x$ac_cv_func_posix_openpt = xyes -o x$have_clone = xyes; then
292 AC_MSG_CHECKING(for UNIX98 ptys)
293 AC_TRY_LINK([#include <stdlib.h>],
294 [grantpt(0);unlockpt(0);ptsname(0);],
295 [unix98_pty=yes
296 AC_DEFINE(UNIX98_PTY, 1, "")
297 AC_MSG_RESULT(yes)],
298 [AC_MSG_RESULT(no)])
299 fi
300
301 if test -z "$unix98_pty"; then
302 AC_CHECK_FUNCS(openpty, [], [AC_CHECK_LIB(util, openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"])])
303 fi
304 ])
305
306 AC_DEFUN([UTMP_CHECK],
307 [
308 AC_CHECK_FUNCS( \
309 ttyslot \
310 updwtmp \
311 updwtmpx \
312 )
313
314 AC_CHECK_HEADERS( \
315 utmp.h \
316 utmpx.h \
317 lastlog.h \
318 )
319
320 dnl# --------------------------------------------------------------------------
321 dnl# DO ALL UTMP AND WTMP CHECKING
322 dnl# --------------------------------------------------------------------------
323 dnl# check for host field in utmp structure
324
325 dnl# --------------------------------------------
326 AC_CHECK_HEADER(utmp.h,
327 [AC_CACHE_CHECK([for struct utmp], rxvt_cv_struct_utmp,
328 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
329 #include <utmp.h>]], [[struct utmp ut;]])],[rxvt_cv_struct_utmp=yes],[rxvt_cv_struct_utmp=no])])
330 if test x$rxvt_cv_struct_utmp = xyes; then
331 AC_DEFINE(HAVE_STRUCT_UTMP, 1, Define if utmp.h has struct utmp)
332 fi
333 ]
334
335 AC_CACHE_CHECK(for ut_host in utmp struct, rxvt_cv_struct_utmp_host,
336 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
337 #include <utmp.h>]], [[struct utmp ut; ut.ut_host;]])],[rxvt_cv_struct_utmp_host=yes],[rxvt_cv_struct_utmp_host=no])])
338 if test x$rxvt_cv_struct_utmp_host = xyes; then
339 AC_DEFINE(HAVE_UTMP_HOST, 1, Define if struct utmp contains ut_host)
340 fi
341
342 AC_CACHE_CHECK(for ut_pid in utmp struct, rxvt_cv_struct_utmp_pid,
343 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
344 #include <utmp.h>]], [[struct utmp ut; ut.ut_pid;]])],[rxvt_cv_struct_utmp_pid=yes],[rxvt_cv_struct_utmp_pid=no])])
345 if test x$rxvt_cv_struct_utmp_pid = xyes; then
346 AC_DEFINE(HAVE_UTMP_PID, 1, Define if struct utmp contains ut_pid)
347 fi
348 ) dnl# AC_CHECK_HEADER(utmp.h
349
350 dnl# --------------------------------------------
351
352 AC_CHECK_HEADER(utmpx.h,
353 [AC_CACHE_CHECK([for struct utmpx], rxvt_cv_struct_utmpx,
354 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
355 #include <utmpx.h>]], [[struct utmpx ut;]])],[rxvt_cv_struct_utmpx=yes],[rxvt_cv_struct_utmpx=no])])
356 if test x$rxvt_cv_struct_utmpx = xyes; then
357 AC_DEFINE(HAVE_STRUCT_UTMPX, 1, Define if utmpx.h has struct utmpx)
358 fi
359 ]
360
361 AC_CACHE_CHECK(for host in utmpx struct, rxvt_cv_struct_utmpx_host,
362 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
363 #include <utmpx.h>]], [[struct utmpx utx; utx.ut_host;]])],[rxvt_cv_struct_utmpx_host=yes],[rxvt_cv_struct_utmpx_host=no])])
364 if test x$rxvt_cv_struct_utmpx_host = xyes; then
365 AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host)
366 fi
367
368 AC_CACHE_CHECK(for session in utmpx struct, rxvt_cv_struct_utmpx_session,
369 [AC_TRY_COMPILE([#include <sys/types.h>
370 #include <utmpx.h>],
371 [struct utmpx utx; utx.ut_session;],
372 rxvt_cv_struct_utmpx_session=yes, rxvt_cv_struct_utmpx_session=no)])
373 if test x$rxvt_cv_struct_utmpx_session = xyes; then
374 AC_DEFINE(HAVE_UTMPX_SESSION, 1, Define if struct utmpx contains ut_session)
375 fi
376 ) dnl# AC_CHECK_HEADER(utmpx.h
377
378 dnl# --------------------------------------------------------------------------
379 dnl# check for struct lastlog
380 AC_CACHE_CHECK(for struct lastlog, rxvt_cv_struct_lastlog,
381 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
382 #include <utmp.h>
383 #ifdef HAVE_LASTLOG_H
384 #include <lastlog.h>
385 #endif
386 ]], [[struct lastlog ll;]])],[rxvt_cv_struct_lastlog=yes],[rxvt_cv_struct_lastlog=no])])
387 if test x$rxvt_cv_struct_lastlog = xyes; then
388 AC_DEFINE(HAVE_STRUCT_LASTLOG, 1, Define if utmp.h or lastlog.h has struct lastlog)
389 fi
390
391 dnl# check for struct lastlogx
392 AC_CACHE_CHECK(for struct lastlogx, rxvt_cv_struct_lastlogx,
393 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
394 #include <utmpx.h>
395 #ifdef HAVE_LASTLOG_H
396 #include <lastlog.h>
397 #endif
398 ]], [[struct lastlogx ll;]])],[rxvt_cv_struct_lastlogx=yes],[rxvt_cv_struct_lastlogx=no])])
399 if test x$rxvt_cv_struct_lastlogx = xyes; then
400 AC_DEFINE(HAVE_STRUCT_LASTLOGX, 1, Define if utmpx.h or lastlog.h has struct lastlogx)
401 fi
402
403 dnl# --------------------------------------------------------------------------
404 dnl# FIND FILES
405 dnl# --------------------------------------------------------------------------
406
407 dnl# find utmp
408 AC_CACHE_CHECK(where utmp is located, rxvt_cv_path_utmp,
409 [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
410 #include <sys/types.h>
411 #include <utmp.h>
412 #include <errno.h>
413 main()
414 {
415 char **u, *utmplist[] = {
416 "/var/run/utmp", "/var/adm/utmp", "/etc/utmp", "/usr/etc/utmp", "/usr/adm/utmp", NULL };
417 FILE *a, *f=fopen("conftestval", "w");
418 if (!f) exit(1);
419 #ifdef UTMP_FILE
420 fprintf(f, "%s\n", UTMP_FILE);
421 exit(0);
422 #endif
423 #ifdef _PATH_UTMP
424 fprintf(f, "%s\n", _PATH_UTMP);
425 exit(0);
426 #endif
427 for (u = utmplist; *u; u++) {
428 if ((a = fopen(*u, "r")) != NULL || errno == EACCES) {
429 fprintf(f, "%s\n", *u);
430 exit(0);
431 }
432 }
433 exit(0);
434 }]])],[rxvt_cv_path_utmp=`cat conftestval`],[rxvt_cv_path_utmp=],[dnl
435 AC_MSG_WARN(Define RXVT_UTMP_FILE in config.h manually)])])
436 if test x$rxvt_cv_path_utmp != x; then
437 AC_DEFINE_UNQUOTED(RXVT_UTMP_FILE, "$rxvt_cv_path_utmp", Define location of utmp)
438 fi
439
440 dnl# --------------------------------------------------------------------------
441
442 dnl# find utmpx - if a utmp file exists at the same location and is more than
443 dnl# a day newer, then dump the utmpx. People leave lots of junk around.
444 AC_CACHE_CHECK(where utmpx is located, rxvt_cv_path_utmpx,
445 [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
446 #include <sys/types.h>
447 #include <utmpx.h>
448 #include <errno.h>
449 #include <sys/stat.h>
450 #ifdef HAVE_STRING_H
451 #include <string.h>
452 #endif
453 main()
454 {
455 char **u, *p, *utmplist[] = {
456 #ifdef UTMPX_FILE
457 UTMPX_FILE,
458 #endif
459 #ifdef _PATH_UTMPX
460 _PATH_UTMPX,
461 #endif
462 "/var/adm/utmpx", "/etc/utmpx", NULL };
463 FILE *a, *f=fopen("conftestval", "w");
464 struct stat statu, statux;
465 if (!f) exit(1);
466 for (u = utmplist; *u; u++) {
467 if ((a = fopen(*u, "r")) != NULL || errno == EACCES) {
468 if (stat(*u, &statux) < 0)
469 continue;
470 p = strdup(*u);
471 p[strlen(p) - 1] = '\0';
472 if (stat(p, &statu) >= 0
473 && (statu.st_mtime - statux.st_mtime > 86400))
474 continue;
475 fprintf(f, "%s\n", *u);
476 exit(0);
477 }
478 }
479 exit(0);
480 }]])],[rxvt_cv_path_utmpx=`cat conftestval`],[rxvt_cv_path_utmpx=],[dnl
481 AC_MSG_WARN(Define RXVT_UTMPX_FILE in config.h manually)])])
482 if test x$rxvt_cv_path_utmpx != x; then
483 AC_DEFINE_UNQUOTED(RXVT_UTMPX_FILE, "$rxvt_cv_path_utmpx", Define location of utmpx)
484 fi
485
486 dnl# --------------------------------------------------------------------------
487
488 dnl# find wtmp
489 AC_CACHE_CHECK(where wtmp is located, rxvt_cv_path_wtmp,
490 [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
491 #include <sys/types.h>
492 #ifdef HAVE_UTMP_H
493 #include <utmp.h>
494 #endif
495 #include <errno.h>
496 main()
497 {
498 char **w, *wtmplist[] = {
499 "/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp", NULL };
500 FILE *a, *f=fopen("conftestval", "w");
501 if (!f) exit(1);
502 #ifdef WTMP_FILE
503 fprintf(f, "%s\n", WTMP_FILE);
504 exit(0);
505 #endif
506 #ifdef _PATH_WTMP
507 fprintf(f, "%s\n", _PATH_WTMP);
508 exit(0);
509 #endif
510 for (w = wtmplist; *w; w++) {
511 if ((a = fopen(*w, "r")) != NULL || errno == EACCES) {
512 fprintf(f, "%s\n", *w);
513 exit(0);
514 }
515 }
516 exit(0);
517 }]])],[rxvt_cv_path_wtmp=`cat conftestval`],[rxvt_cv_path_wtmp=],[dnl
518 AC_MSG_WARN(Define RXVT_WTMP_FILE in config.h manually)])])
519 if test x$rxvt_cv_path_wtmp != x; then
520 AC_DEFINE_UNQUOTED(RXVT_WTMP_FILE, "$rxvt_cv_path_wtmp", Define location of wtmp)
521 fi
522 dnl# --------------------------------------------------------------------------
523
524 dnl# find wtmpx
525 AC_CACHE_CHECK(where wtmpx is located, rxvt_cv_path_wtmpx,
526 [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
527 #ifdef HAVE_UTMPX_H
528 #include <utmpx.h>
529 #endif
530 #include <errno.h>
531 main()
532 {
533 char **w, *wtmplist[] = {
534 "/var/log/wtmpx", "/var/adm/wtmpx", NULL };
535 FILE *a, *f=fopen("conftestval", "w");
536 if (!f) exit(1);
537 #ifdef WTMPX_FILE
538 fprintf(f, "%s\n", WTMPX_FILE);
539 exit(0);
540 #endif
541 #ifdef _PATH_WTMPX
542 fprintf(f, "%s\n", _PATH_WTMPX);
543 exit(0);
544 #endif
545 for (w = wtmplist; *w; w++) {
546 if ((a = fopen(*w, "r")) != NULL || errno == EACCES) {
547 fprintf(f, "%s\n", *w);
548 exit(0);
549 }
550 }
551 exit(0);
552 }]])],[rxvt_cv_path_wtmpx=`cat conftestval`],[rxvt_cv_path_wtmpx=],[dnl
553 AC_MSG_WARN(Define RXVT_WTMPX_FILE in config.h manually)])])
554 if test x$rxvt_cv_path_wtmpx != x; then
555 AC_DEFINE_UNQUOTED(RXVT_WTMPX_FILE, "$rxvt_cv_path_wtmpx", Define location of wtmpx)
556 fi
557 dnl# --------------------------------------------------------------------------
558
559 dnl# find lastlog
560 AC_CACHE_CHECK(where lastlog is located, rxvt_cv_path_lastlog,
561 [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
562 #include <sys/types.h>
563 #ifdef HAVE_UTMPX_H
564 #include <utmpx.h>
565 #elif defined(HAVE_UTMP_H)
566 #include <utmp.h>
567 #endif
568 #ifdef HAVE_LASTLOG_H
569 #include <lastlog.h>
570 #endif
571 #include <errno.h>
572 main()
573 {
574 char **w, *lastloglist[] = { "/var/log/lastlog", NULL };
575 FILE *a, *f=fopen("conftestval", "w");
576 if (!f) exit(1);
577 #ifdef LASTLOG_FILE
578 fprintf(f, "%s\n", LASTLOG_FILE);
579 exit(0);
580 #endif
581 #ifdef _PATH_LASTLOG
582 fprintf(f, "%s\n", _PATH_LASTLOG);
583 exit(0);
584 #endif
585 for (w = lastloglist; *w; w++) {
586 if ((a = fopen(*w, "r")) != NULL || errno == EACCES) {
587 fprintf(f, "%s\n", *w);
588 exit(0);
589 }
590 }
591 exit(0);
592 }]])],[rxvt_cv_path_lastlog=`cat conftestval`],[rxvt_cv_path_lastlog=],[dnl
593 AC_MSG_WARN(Define RXVT_LASTLOG_FILE in config.h manually)])])
594 if test x$rxvt_cv_path_lastlog != x; then
595 AC_DEFINE_UNQUOTED(RXVT_LASTLOG_FILE, "$rxvt_cv_path_lastlog", Define location of lastlog)
596 if test -d "$rxvt_cv_path_lastlog"; then
597 AC_DEFINE(LASTLOG_IS_DIR, 1, Define if lastlog is provided via a directory)
598 fi
599 fi
600 dnl# --------------------------------------------------------------------------
601
602 dnl# find lastlogx
603 AC_CACHE_CHECK(where lastlogx is located, rxvt_cv_path_lastlogx,
604 [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
605 #ifdef HAVE_UTMPX_H
606 #include <utmpx.h>
607 #endif
608 #include <errno.h>
609 main()
610 {
611 char **w, *wtmplist[] = { "/var/log/lastlogx", "/var/adm/lastlogx", NULL };
612 FILE *a, *f=fopen("conftestval", "w");
613 if (!f) exit(1);
614 #ifdef LASTLOGX_FILE
615 fprintf(f, "%s\n", LASTLOGX_FILE);
616 exit(0);
617 #endif
618 #ifdef _PATH_LASTLOGX
619 fprintf(f, "%s\n", _PATH_LASTLOGX);
620 exit(0);
621 #endif
622 for (w = wtmplist; *w; w++) {
623 if ((a = fopen(*w, "r")) != NULL || errno == EACCES) {
624 fprintf(f, "%s\n", *w);
625 exit(0);
626 }
627 }
628 exit(0);
629 }]])],[rxvt_cv_path_lastlogx=`cat conftestval`],[rxvt_cv_path_lastlogx=],[dnl
630 AC_MSG_WARN(Define RXVT_LASTLOGX_FILE in config.h manually)])])
631 if test x$rxvt_cv_path_lastlogx != x; then
632 AC_DEFINE_UNQUOTED(RXVT_LASTLOGX_FILE, "$rxvt_cv_path_lastlogx", Define location of lastlogx)
633 fi
634 ])
635