ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/aclocal.m4
(Generate patch)

Comparing rxvt-unicode/aclocal.m4 (file contents):
Revision 1.2 by ayin, Fri Jan 20 23:52:55 2006 UTC vs.
Revision 1.3 by ayin, Sat Jan 21 18:14:57 2006 UTC

227 fi 227 fi
228 done 228 done
229done]) 229done])
230fi 230fi
231]) 231])
232
233AC_DEFUN([PTY_CHECK],
234[
235AC_CHECK_HEADERS( \
236 pty.h \
237 util.h \
238 libutil.h \
239 sys/ioctl.h \
240 sys/stropts.h \
241)
242
243AC_CHECK_FUNCS( \
244 revoke \
245 _getpty \
246 getpt \
247 posix_openpt \
248 isastream \
249)
250
251have_clone=no
252
253AC_MSG_CHECKING(for /dev/ptym/clone)
254if 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
259else
260 AC_MSG_RESULT(no)
261fi
262
263AC_MSG_CHECKING(for /dev/ptc)
264if 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
269else
270 AC_MSG_RESULT(no)
271fi
272
273case $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 ;;
289esac
290
291if 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)])
299fi
300
301if test -z "$unix98_pty"; then
302 AC_CHECK_FUNCS(openpty, [], [AC_CHECK_LIB(util, openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"])])
303fi
304])
305
306AC_DEFUN([UTMP_CHECK],
307[
308AC_CHECK_FUNCS( \
309 ttyslot \
310 updwtmp \
311 updwtmpx \
312)
313
314AC_CHECK_HEADERS( \
315 utmp.h \
316 utmpx.h \
317 lastlog.h \
318)
319
320dnl# --------------------------------------------------------------------------
321dnl# DO ALL UTMP AND WTMP CHECKING
322dnl# --------------------------------------------------------------------------
323dnl# check for host field in utmp structure
324
325dnl# --------------------------------------------
326AC_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])])
330if test x$rxvt_cv_struct_utmp = xyes; then
331 AC_DEFINE(HAVE_STRUCT_UTMP, 1, Define if utmp.h has struct utmp)
332fi
333]
334
335AC_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])])
338if test x$rxvt_cv_struct_utmp_host = xyes; then
339 AC_DEFINE(HAVE_UTMP_HOST, 1, Define if struct utmp contains ut_host)
340fi
341
342AC_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])])
345if test x$rxvt_cv_struct_utmp_pid = xyes; then
346 AC_DEFINE(HAVE_UTMP_PID, 1, Define if struct utmp contains ut_pid)
347fi
348) dnl# AC_CHECK_HEADER(utmp.h
349
350dnl# --------------------------------------------
351
352AC_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])])
356if test x$rxvt_cv_struct_utmpx = xyes; then
357 AC_DEFINE(HAVE_STRUCT_UTMPX, 1, Define if utmpx.h has struct utmpx)
358fi
359]
360
361AC_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])])
364if test x$rxvt_cv_struct_utmpx_host = xyes; then
365 AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host)
366fi
367
368AC_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;],
372rxvt_cv_struct_utmpx_session=yes, rxvt_cv_struct_utmpx_session=no)])
373if test x$rxvt_cv_struct_utmpx_session = xyes; then
374 AC_DEFINE(HAVE_UTMPX_SESSION, 1, Define if struct utmpx contains ut_session)
375fi
376) dnl# AC_CHECK_HEADER(utmpx.h
377
378dnl# --------------------------------------------------------------------------
379dnl# check for struct lastlog
380AC_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])])
387if 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)
389fi
390
391dnl# check for struct lastlogx
392AC_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])])
399if 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)
401fi
402
403dnl# --------------------------------------------------------------------------
404dnl# FIND FILES
405dnl# --------------------------------------------------------------------------
406
407dnl# find utmp
408AC_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>
413main()
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)])])
436if test x$rxvt_cv_path_utmp != x; then
437 AC_DEFINE_UNQUOTED(RXVT_UTMP_FILE, "$rxvt_cv_path_utmp", Define location of utmp)
438fi
439
440dnl# --------------------------------------------------------------------------
441
442dnl# find utmpx - if a utmp file exists at the same location and is more than
443dnl# a day newer, then dump the utmpx. People leave lots of junk around.
444AC_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
453main()
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)])])
482if test x$rxvt_cv_path_utmpx != x; then
483 AC_DEFINE_UNQUOTED(RXVT_UTMPX_FILE, "$rxvt_cv_path_utmpx", Define location of utmpx)
484fi
485
486dnl# --------------------------------------------------------------------------
487
488dnl# find wtmp
489AC_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>
496main()
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)])])
519if test x$rxvt_cv_path_wtmp != x; then
520 AC_DEFINE_UNQUOTED(RXVT_WTMP_FILE, "$rxvt_cv_path_wtmp", Define location of wtmp)
521fi
522dnl# --------------------------------------------------------------------------
523
524dnl# find wtmpx
525AC_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>
531main()
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)])])
554if test x$rxvt_cv_path_wtmpx != x; then
555 AC_DEFINE_UNQUOTED(RXVT_WTMPX_FILE, "$rxvt_cv_path_wtmpx", Define location of wtmpx)
556fi
557dnl# --------------------------------------------------------------------------
558
559dnl# find lastlog
560AC_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>
572main()
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)])])
594if 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
599fi
600dnl# --------------------------------------------------------------------------
601
602dnl# find lastlogx
603AC_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>
609main()
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)])])
631if test x$rxvt_cv_path_lastlogx != x; then
632 AC_DEFINE_UNQUOTED(RXVT_LASTLOGX_FILE, "$rxvt_cv_path_lastlogx", Define location of lastlogx)
633fi
634])
635

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines