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

Comparing rxvt-unicode/ptytty.m4 (file contents):
Revision 1.2 by root, Sun Jan 22 01:00:46 2006 UTC vs.
Revision 1.12 by root, Mon May 5 16:51:52 2008 UTC

7 pty.h \ 7 pty.h \
8 util.h \ 8 util.h \
9 libutil.h \ 9 libutil.h \
10 sys/ioctl.h \ 10 sys/ioctl.h \
11 sys/stropts.h \ 11 sys/stropts.h \
12 stropts.h \
12) 13)
13 14
14AC_CHECK_FUNCS( \ 15AC_CHECK_FUNCS( \
15 revoke \ 16 revoke \
16 _getpty \ 17 _getpty \
17 getpt \ 18 getpt \
18 posix_openpt \ 19 posix_openpt \
19 isastream \ 20 isastream \
21 setuid \
22 seteuid \
23 setreuid \
24 setresuid \
20) 25)
21 26
22have_clone=no 27have_clone=no
23 28
24AC_MSG_CHECKING(for /dev/ptym/clone) 29AC_MSG_CHECKING(for /dev/ptym/clone)
59 ;; 64 ;;
60esac 65esac
61 66
62if test x$ac_cv_func_getpt = xyes -o x$ac_cv_func_posix_openpt = xyes -o x$have_clone = xyes; then 67if test x$ac_cv_func_getpt = xyes -o x$ac_cv_func_posix_openpt = xyes -o x$have_clone = xyes; then
63 AC_MSG_CHECKING(for UNIX98 ptys) 68 AC_MSG_CHECKING(for UNIX98 ptys)
64 AC_TRY_LINK([#include <stdlib.h>], 69 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>]],
65 [grantpt(0);unlockpt(0);ptsname(0);], 70 [[grantpt(0);unlockpt(0);ptsname(0);]])],
66 [unix98_pty=yes 71 [unix98_pty=yes
67 AC_DEFINE(UNIX98_PTY, 1, "") 72 AC_DEFINE(UNIX98_PTY, 1, "")
68 AC_MSG_RESULT(yes)], 73 AC_MSG_RESULT(yes)],
69 [AC_MSG_RESULT(no)]) 74 [AC_MSG_RESULT(no)])
70fi 75fi
74fi 79fi
75]) 80])
76 81
77AC_DEFUN([UTMP_CHECK], 82AC_DEFUN([UTMP_CHECK],
78[ 83[
84support_utmp=yes
85support_wtmp=yes
86support_lastlog=yes
87
88AC_ARG_ENABLE(utmp,
89 [AS_HELP_STRING([--enable-utmp],[enable utmp (utmpx) support])],
90 [if test x$enableval = xyes -o x$enableval = xno; then
91 support_utmp=$enableval
92 fi])
93
94AC_ARG_ENABLE(wtmp,
95 [AS_HELP_STRING([--enable-wtmp],[enable wtmp (wtmpx) support (requires --enable-utmp)])],
96 [if test x$enableval = xyes -o x$enableval = xno; then
97 support_wtmp=$enableval
98 fi])
99
100AC_ARG_ENABLE(lastlog,
101 [AS_HELP_STRING([--enable-lastlog],[enable lastlog support (requires --enable-utmp)])],
102 [if test x$enableval = xyes -o x$enableval = xno; then
103 support_lastlog=$enableval
104 fi])
105
106if test x$support_utmp = xyes; then
107 AC_DEFINE(UTMP_SUPPORT, 1, Define if you want to have utmp/utmpx support)
108fi
109if test x$support_wtmp = xyes; then
110 AC_DEFINE(WTMP_SUPPORT, 1, Define if you want to have wtmp support when utmp/utmpx is enabled)
111fi
112if test x$support_lastlog = xyes; then
113 AC_DEFINE(LASTLOG_SUPPORT, 1, Define if you want to have lastlog support when utmp/utmpx is enabled)
114fi
115
79AC_CHECK_FUNCS( \ 116AC_CHECK_FUNCS( \
80 ttyslot \
81 updwtmp \ 117 updwtmp \
82 updwtmpx \ 118 updwtmpx \
119 updlastlogx \
83) 120)
84 121
85AC_CHECK_HEADERS( \ 122AC_CHECK_HEADERS(lastlog.h)
86 utmp.h \
87 utmpx.h \
88 lastlog.h \
89)
90 123
91dnl# -------------------------------------------------------------------------- 124dnl# --------------------------------------------------------------------------
92dnl# DO ALL UTMP AND WTMP CHECKING 125dnl# DO ALL UTMP AND WTMP CHECKING
93dnl# -------------------------------------------------------------------------- 126dnl# --------------------------------------------------------------------------
94dnl# check for host field in utmp structure 127dnl# check for host field in utmp structure
95 128
96dnl# -------------------------------------------- 129dnl# --------------------------------------------
97AC_CHECK_HEADER(utmp.h, 130AC_CHECK_HEADERS(utmp.h,
98[AC_CACHE_CHECK([for struct utmp], struct_utmp, 131[AC_CACHE_CHECK([for struct utmp], struct_utmp,
99[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 132[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
100#include <utmp.h>]], [[struct utmp ut;]])],[struct_utmp=yes],[struct_utmp=no])]) 133#include <utmp.h>]], [[struct utmp ut;]])],[struct_utmp=yes],[struct_utmp=no])])
101if test x$struct_utmp = xyes; then 134if test x$struct_utmp = xyes; then
102 AC_DEFINE(HAVE_STRUCT_UTMP, 1, Define if utmp.h has struct utmp) 135 AC_DEFINE(HAVE_STRUCT_UTMP, 1, Define if utmp.h has struct utmp)
114[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 147[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
115#include <utmp.h>]], [[struct utmp ut; ut.ut_pid;]])],[struct_utmp_pid=yes],[struct_utmp_pid=no])]) 148#include <utmp.h>]], [[struct utmp ut; ut.ut_pid;]])],[struct_utmp_pid=yes],[struct_utmp_pid=no])])
116if test x$struct_utmp_pid = xyes; then 149if test x$struct_utmp_pid = xyes; then
117 AC_DEFINE(HAVE_UTMP_PID, 1, Define if struct utmp contains ut_pid) 150 AC_DEFINE(HAVE_UTMP_PID, 1, Define if struct utmp contains ut_pid)
118fi 151fi
119) dnl# AC_CHECK_HEADER(utmp.h 152) dnl# AC_CHECK_HEADERS(utmp.h
120 153
121dnl# -------------------------------------------- 154dnl# --------------------------------------------
122 155
123AC_CHECK_HEADER(utmpx.h, 156AC_CHECK_HEADERS(utmpx.h,
124[AC_CACHE_CHECK([for struct utmpx], struct_utmpx, 157[AC_CACHE_CHECK([for struct utmpx], struct_utmpx,
125[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 158[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
126#include <utmpx.h>]], [[struct utmpx ut;]])],[struct_utmpx=yes],[struct_utmpx=no])]) 159#include <utmpx.h>]], [[struct utmpx ut;]])],[struct_utmpx=yes],[struct_utmpx=no])])
127if test x$struct_utmpx = xyes; then 160if test x$struct_utmpx = xyes; then
128 AC_DEFINE(HAVE_STRUCT_UTMPX, 1, Define if utmpx.h has struct utmpx) 161 AC_DEFINE(HAVE_STRUCT_UTMPX, 1, Define if utmpx.h has struct utmpx)
135if test x$struct_utmpx_host = xyes; then 168if test x$struct_utmpx_host = xyes; then
136 AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host) 169 AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host)
137fi 170fi
138 171
139AC_CACHE_CHECK(for session in utmpx struct, struct_utmpx_session, 172AC_CACHE_CHECK(for session in utmpx struct, struct_utmpx_session,
140[AC_TRY_COMPILE([#include <sys/types.h> 173[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
141#include <utmpx.h>], 174#include <utmpx.h>]], [[struct utmpx utx; utx.ut_session;]])],[struct_utmpx_session=yes],[struct_utmpx_session=no])])
142[struct utmpx utx; utx.ut_session;],
143struct_utmpx_session=yes, struct_utmpx_session=no)])
144if test x$struct_utmpx_session = xyes; then 175if test x$struct_utmpx_session = xyes; then
145 AC_DEFINE(HAVE_UTMPX_SESSION, 1, Define if struct utmpx contains ut_session) 176 AC_DEFINE(HAVE_UTMPX_SESSION, 1, Define if struct utmpx contains ut_session)
146fi 177fi
147) dnl# AC_CHECK_HEADER(utmpx.h 178) dnl# AC_CHECK_HEADERS(utmpx.h
148 179
149dnl# -------------------------------------------------------------------------- 180dnl# --------------------------------------------------------------------------
150dnl# check for struct lastlog 181dnl# check for struct lastlog
151AC_CACHE_CHECK(for struct lastlog, struct_lastlog, 182AC_CACHE_CHECK(for struct lastlog, struct_lastlog,
152[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 183[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
176dnl# -------------------------------------------------------------------------- 207dnl# --------------------------------------------------------------------------
177 208
178dnl# find utmp 209dnl# find utmp
179AC_CACHE_CHECK(where utmp is located, path_utmp, 210AC_CACHE_CHECK(where utmp is located, path_utmp,
180[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> 211[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
212#include <stdlib.h>
181#include <sys/types.h> 213#include <sys/types.h>
182#include <utmp.h> 214#include <utmp.h>
183#include <errno.h> 215#include <errno.h>
184main() 216main()
185{ 217{
212 244
213dnl# find utmpx - if a utmp file exists at the same location and is more than 245dnl# find utmpx - if a utmp file exists at the same location and is more than
214dnl# a day newer, then dump the utmpx. People leave lots of junk around. 246dnl# a day newer, then dump the utmpx. People leave lots of junk around.
215AC_CACHE_CHECK(where utmpx is located, path_utmpx, 247AC_CACHE_CHECK(where utmpx is located, path_utmpx,
216[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> 248[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
249#include <stdlib.h>
217#include <sys/types.h> 250#include <sys/types.h>
218#include <utmpx.h> 251#include <utmpx.h>
219#include <errno.h> 252#include <errno.h>
220#include <sys/stat.h> 253#include <sys/stat.h>
221#ifdef HAVE_STRING_H 254#ifdef HAVE_STRING_H
257dnl# -------------------------------------------------------------------------- 290dnl# --------------------------------------------------------------------------
258 291
259dnl# find wtmp 292dnl# find wtmp
260AC_CACHE_CHECK(where wtmp is located, path_wtmp, 293AC_CACHE_CHECK(where wtmp is located, path_wtmp,
261[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> 294[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
295#include <stdlib.h>
262#include <sys/types.h> 296#include <sys/types.h>
263#ifdef HAVE_UTMP_H 297#ifdef HAVE_UTMP_H
264#include <utmp.h> 298#include <utmp.h>
265#endif 299#endif
266#include <errno.h> 300#include <errno.h>
267main() 301main()
268{ 302{
269 char **w, *wtmplist[] = { 303 char **w, *wtmplist[] = {
270 "/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp", NULL }; 304 "/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp", NULL };
271 FILE *a, *f=fopen("conftestval", "w"); 305 FILE *a, *f=fopen("conftestval", "w");
272 if (!f) exit(1); 306 if (!f) exit(1);
273#ifdef WTMP_FILE 307#ifdef WTMP_FILE
274 fprintf(f, "%s\n", WTMP_FILE); 308 fprintf(f, "%s\n", WTMP_FILE);
275 exit(0); 309 exit(0);
293dnl# -------------------------------------------------------------------------- 327dnl# --------------------------------------------------------------------------
294 328
295dnl# find wtmpx 329dnl# find wtmpx
296AC_CACHE_CHECK(where wtmpx is located, path_wtmpx, 330AC_CACHE_CHECK(where wtmpx is located, path_wtmpx,
297[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> 331[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
332#include <stdlib.h>
298#ifdef HAVE_UTMPX_H 333#ifdef HAVE_UTMPX_H
299#include <utmpx.h> 334#include <utmpx.h>
300#endif 335#endif
301#include <errno.h> 336#include <errno.h>
302main() 337main()
303{ 338{
304 char **w, *wtmplist[] = { 339 char **w, *wtmplist[] = {
305 "/var/log/wtmpx", "/var/adm/wtmpx", NULL }; 340 "/var/log/wtmpx", "/var/adm/wtmpx", NULL };
306 FILE *a, *f=fopen("conftestval", "w"); 341 FILE *a, *f=fopen("conftestval", "w");
307 if (!f) exit(1); 342 if (!f) exit(1);
308#ifdef WTMPX_FILE 343#ifdef WTMPX_FILE
309 fprintf(f, "%s\n", WTMPX_FILE); 344 fprintf(f, "%s\n", WTMPX_FILE);
310 exit(0); 345 exit(0);
328dnl# -------------------------------------------------------------------------- 363dnl# --------------------------------------------------------------------------
329 364
330dnl# find lastlog 365dnl# find lastlog
331AC_CACHE_CHECK(where lastlog is located, path_lastlog, 366AC_CACHE_CHECK(where lastlog is located, path_lastlog,
332[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> 367[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
368#include <stdlib.h>
333#include <sys/types.h> 369#include <sys/types.h>
334#ifdef HAVE_UTMPX_H 370#ifdef HAVE_UTMPX_H
335#include <utmpx.h> 371#include <utmpx.h>
336#elif defined(HAVE_UTMP_H) 372#elif defined(HAVE_UTMP_H)
337#include <utmp.h> 373#include <utmp.h>
362 exit(0); 398 exit(0);
363}]])],[path_lastlog=`cat conftestval`],[path_lastlog=],[dnl 399}]])],[path_lastlog=`cat conftestval`],[path_lastlog=],[dnl
364 AC_MSG_WARN(Define LASTLOG_FILE in config.h manually)])]) 400 AC_MSG_WARN(Define LASTLOG_FILE in config.h manually)])])
365if test x$path_lastlog != x; then 401if test x$path_lastlog != x; then
366 AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$path_lastlog", Define location of lastlog) 402 AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$path_lastlog", Define location of lastlog)
367 if test -d "$path_lastlog"; then
368 AC_DEFINE(LASTLOG_IS_DIR, 1, Define if lastlog is provided via a directory)
369 fi
370fi 403fi
371dnl# -------------------------------------------------------------------------- 404dnl# --------------------------------------------------------------------------
372 405
373dnl# find lastlogx 406dnl# find lastlogx
374AC_CACHE_CHECK(where lastlogx is located, path_lastlogx, 407AC_CACHE_CHECK(where lastlogx is located, path_lastlogx,
375[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> 408[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
409#include <stdlib.h>
376#ifdef HAVE_UTMPX_H 410#ifdef HAVE_UTMPX_H
377#include <utmpx.h> 411#include <utmpx.h>
378#endif 412#endif
379#include <errno.h> 413#include <errno.h>
380main() 414main()
405]) 439])
406 440
407AC_DEFUN([SCM_RIGHTS_CHECK], 441AC_DEFUN([SCM_RIGHTS_CHECK],
408[ 442[
409AC_CACHE_CHECK(for unix-compliant filehandle passing ability, can_pass_fds, 443AC_CACHE_CHECK(for unix-compliant filehandle passing ability, can_pass_fds,
410[AC_TRY_LINK([ 444[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
411#include <cstddef> // broken bsds (is that redundant) need this 445#include <cstddef> // broken bsds (is that redundant?) need this
412#include <sys/types.h> 446#include <sys/types.h>
413#include <sys/socket.h> 447#include <sys/socket.h>
414#include <sys/uio.h> 448#include <sys/uio.h>
415],[ 449]], [[
416{ 450{
417 msghdr msg; 451 msghdr msg;
418 iovec iov; 452 iovec iov;
419 char buf [100]; 453 char buf [100];
420 char data = 0; 454 char data = 0;
434 468
435 *(int *)CMSG_DATA (cmsg) = 5; 469 *(int *)CMSG_DATA (cmsg) = 5;
436 470
437 return sendmsg (3, &msg, 0); 471 return sendmsg (3, &msg, 0);
438} 472}
439],[can_pass_fds=yes],[can_pass_fds=no])]) 473]])],[can_pass_fds=yes],[can_pass_fds=no])])
440if test x$can_pass_fds = xyes; then 474if test x$can_pass_fds = xyes; then
441 AC_DEFINE(HAVE_UNIX_FDPASS, 1, Define if sys/socket.h defines the necessary macros/functions for file handle passing) 475 AC_DEFINE(HAVE_UNIX_FDPASS, 1, Define if sys/socket.h defines the necessary macros/functions for file handle passing)
442else 476else
443 AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability]) 477 AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability])
444fi 478fi
445]) 479])
480
481AC_DEFUN([TTY_GROUP_CHECK],
482[
483AC_CACHE_CHECK([for tty group], tty_group,
484[AC_RUN_IFELSE([AC_LANG_SOURCE([[
485#include <sys/types.h>
486#include <sys/stat.h>
487#include <unistd.h>
488#include <grp.h>
489
490main()
491{
492 struct stat st;
493 struct group *gr;
494 char *tty;
495 gr = getgrnam("tty");
496 tty = ttyname(0);
497 if (gr != 0
498 && tty != 0
499 && (stat(tty, &st)) == 0
500 && st.st_gid == gr->gr_gid)
501 return 0;
502 else
503 return 1;
504}]])],[tty_group=yes],[tty_group=no],[tty_group=no])])
505if test x$tty_group = xyes; then
506 AC_DEFINE(TTY_GID_SUPPORT, 1, "")
507fi])
508

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines