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

Comparing libptytty/ptytty.m4 (file contents):
Revision 1.9 by ayin, Mon May 7 13:46:06 2007 UTC vs.
Revision 1.17 by root, Mon May 5 16:51:28 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 \
63 ;; 64 ;;
64esac 65esac
65 66
66if 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
67 AC_MSG_CHECKING(for UNIX98 ptys) 68 AC_MSG_CHECKING(for UNIX98 ptys)
68 AC_TRY_LINK([#include <stdlib.h>], 69 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>]],
69 [grantpt(0);unlockpt(0);ptsname(0);], 70 [[grantpt(0);unlockpt(0);ptsname(0);]])],
70 [unix98_pty=yes 71 [unix98_pty=yes
71 AC_DEFINE(UNIX98_PTY, 1, "") 72 AC_DEFINE(UNIX98_PTY, 1, "")
72 AC_MSG_RESULT(yes)], 73 AC_MSG_RESULT(yes)],
73 [AC_MSG_RESULT(no)]) 74 [AC_MSG_RESULT(no)])
74fi 75fi
83support_utmp=yes 84support_utmp=yes
84support_wtmp=yes 85support_wtmp=yes
85support_lastlog=yes 86support_lastlog=yes
86 87
87AC_ARG_ENABLE(utmp, 88AC_ARG_ENABLE(utmp,
88 [ --enable-utmp enable utmp (utmpx) support], 89 [AS_HELP_STRING([--enable-utmp],[enable utmp (utmpx) support])],
89 [if test x$enableval = xyes -o x$enableval = xno; then 90 [if test x$enableval = xyes -o x$enableval = xno; then
90 support_utmp=$enableval 91 support_utmp=$enableval
91 fi]) 92 fi])
92 93
93AC_ARG_ENABLE(wtmp, 94AC_ARG_ENABLE(wtmp,
94 [ --enable-wtmp enable wtmp (wtmpx) support (requires --enable-utmp)], 95 [AS_HELP_STRING([--enable-wtmp],[enable wtmp (wtmpx) support (requires --enable-utmp)])],
95 [if test x$enableval = xyes -o x$enableval = xno; then 96 [if test x$enableval = xyes -o x$enableval = xno; then
96 support_wtmp=$enableval 97 support_wtmp=$enableval
97 fi]) 98 fi])
98 99
99AC_ARG_ENABLE(lastlog, 100AC_ARG_ENABLE(lastlog,
100 [ --enable-lastlog enable lastlog support (requires --enable-utmp)], 101 [AS_HELP_STRING([--enable-lastlog],[enable lastlog support (requires --enable-utmp)])],
101 [if test x$enableval = xyes -o x$enableval = xno; then 102 [if test x$enableval = xyes -o x$enableval = xno; then
102 support_lastlog=$enableval 103 support_lastlog=$enableval
103 fi]) 104 fi])
104 105
105if test x$support_utmp = xyes; then 106if test x$support_utmp = xyes; then
111if test x$support_lastlog = xyes; then 112if 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) 113 AC_DEFINE(LASTLOG_SUPPORT, 1, Define if you want to have lastlog support when utmp/utmpx is enabled)
113fi 114fi
114 115
115AC_CHECK_FUNCS( \ 116AC_CHECK_FUNCS( \
116 ttyslot \
117 updwtmp \ 117 updwtmp \
118 updwtmpx \ 118 updwtmpx \
119 updlastlogx \
119) 120)
120 121
121AC_CHECK_HEADERS( \ 122AC_CHECK_HEADERS(lastlog.h)
122 utmp.h \
123 utmpx.h \
124 lastlog.h \
125)
126 123
127dnl# -------------------------------------------------------------------------- 124dnl# --------------------------------------------------------------------------
128dnl# DO ALL UTMP AND WTMP CHECKING 125dnl# DO ALL UTMP AND WTMP CHECKING
129dnl# -------------------------------------------------------------------------- 126dnl# --------------------------------------------------------------------------
130dnl# check for host field in utmp structure 127dnl# check for host field in utmp structure
131 128
132dnl# -------------------------------------------- 129dnl# --------------------------------------------
133AC_CHECK_HEADER(utmp.h, 130AC_CHECK_HEADERS(utmp.h,
134[AC_CACHE_CHECK([for struct utmp], struct_utmp, 131[AC_CACHE_CHECK([for struct utmp], struct_utmp,
135[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 132[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
136#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])])
137if test x$struct_utmp = xyes; then 134if test x$struct_utmp = xyes; then
138 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)
150[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 147[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])]) 148#include <utmp.h>]], [[struct utmp ut; ut.ut_pid;]])],[struct_utmp_pid=yes],[struct_utmp_pid=no])])
152if test x$struct_utmp_pid = xyes; then 149if test x$struct_utmp_pid = xyes; then
153 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)
154fi 151fi
155) dnl# AC_CHECK_HEADER(utmp.h 152) dnl# AC_CHECK_HEADERS(utmp.h
156 153
157dnl# -------------------------------------------- 154dnl# --------------------------------------------
158 155
159AC_CHECK_HEADER(utmpx.h, 156AC_CHECK_HEADERS(utmpx.h,
160[AC_CACHE_CHECK([for struct utmpx], struct_utmpx, 157[AC_CACHE_CHECK([for struct utmpx], struct_utmpx,
161[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 158[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
162#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])])
163if test x$struct_utmpx = xyes; then 160if test x$struct_utmpx = xyes; then
164 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)
171if test x$struct_utmpx_host = xyes; then 168if test x$struct_utmpx_host = xyes; then
172 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)
173fi 170fi
174 171
175AC_CACHE_CHECK(for session in utmpx struct, struct_utmpx_session, 172AC_CACHE_CHECK(for session in utmpx struct, struct_utmpx_session,
176[AC_TRY_COMPILE([#include <sys/types.h> 173[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
177#include <utmpx.h>], 174#include <utmpx.h>]], [[struct utmpx utx; utx.ut_session;]])],[struct_utmpx_session=yes],[struct_utmpx_session=no])])
178[struct utmpx utx; utx.ut_session;],
179struct_utmpx_session=yes, struct_utmpx_session=no)])
180if test x$struct_utmpx_session = xyes; then 175if test x$struct_utmpx_session = xyes; then
181 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)
182fi 177fi
183) dnl# AC_CHECK_HEADER(utmpx.h 178) dnl# AC_CHECK_HEADERS(utmpx.h
184 179
185dnl# -------------------------------------------------------------------------- 180dnl# --------------------------------------------------------------------------
186dnl# check for struct lastlog 181dnl# check for struct lastlog
187AC_CACHE_CHECK(for struct lastlog, struct_lastlog, 182AC_CACHE_CHECK(for struct lastlog, struct_lastlog,
188[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 183[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
304#endif 299#endif
305#include <errno.h> 300#include <errno.h>
306main() 301main()
307{ 302{
308 char **w, *wtmplist[] = { 303 char **w, *wtmplist[] = {
309 "/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 };
310 FILE *a, *f=fopen("conftestval", "w"); 305 FILE *a, *f=fopen("conftestval", "w");
311 if (!f) exit(1); 306 if (!f) exit(1);
312#ifdef WTMP_FILE 307#ifdef WTMP_FILE
313 fprintf(f, "%s\n", WTMP_FILE); 308 fprintf(f, "%s\n", WTMP_FILE);
314 exit(0); 309 exit(0);
340#endif 335#endif
341#include <errno.h> 336#include <errno.h>
342main() 337main()
343{ 338{
344 char **w, *wtmplist[] = { 339 char **w, *wtmplist[] = {
345 "/var/log/wtmpx", "/var/adm/wtmpx", NULL }; 340 "/var/log/wtmpx", "/var/adm/wtmpx", NULL };
346 FILE *a, *f=fopen("conftestval", "w"); 341 FILE *a, *f=fopen("conftestval", "w");
347 if (!f) exit(1); 342 if (!f) exit(1);
348#ifdef WTMPX_FILE 343#ifdef WTMPX_FILE
349 fprintf(f, "%s\n", WTMPX_FILE); 344 fprintf(f, "%s\n", WTMPX_FILE);
350 exit(0); 345 exit(0);
403 exit(0); 398 exit(0);
404}]])],[path_lastlog=`cat conftestval`],[path_lastlog=],[dnl 399}]])],[path_lastlog=`cat conftestval`],[path_lastlog=],[dnl
405 AC_MSG_WARN(Define LASTLOG_FILE in config.h manually)])]) 400 AC_MSG_WARN(Define LASTLOG_FILE in config.h manually)])])
406if test x$path_lastlog != x; then 401if test x$path_lastlog != x; then
407 AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$path_lastlog", Define location of lastlog) 402 AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$path_lastlog", Define location of lastlog)
408 if test -d "$path_lastlog"; then
409 AC_DEFINE(LASTLOG_IS_DIR, 1, Define if lastlog is provided via a directory)
410 fi
411fi 403fi
412dnl# -------------------------------------------------------------------------- 404dnl# --------------------------------------------------------------------------
413 405
414dnl# find lastlogx 406dnl# find lastlogx
415AC_CACHE_CHECK(where lastlogx is located, path_lastlogx, 407AC_CACHE_CHECK(where lastlogx is located, path_lastlogx,
447]) 439])
448 440
449AC_DEFUN([SCM_RIGHTS_CHECK], 441AC_DEFUN([SCM_RIGHTS_CHECK],
450[ 442[
451AC_CACHE_CHECK(for unix-compliant filehandle passing ability, can_pass_fds, 443AC_CACHE_CHECK(for unix-compliant filehandle passing ability, can_pass_fds,
452[AC_TRY_LINK([ 444[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
453#include <cstddef> // broken bsds (is that redundant?) need this 445#include <cstddef> // broken bsds (is that redundant?) need this
454#include <sys/types.h> 446#include <sys/types.h>
455#include <sys/socket.h> 447#include <sys/socket.h>
456#include <sys/uio.h> 448#include <sys/uio.h>
457],[ 449]], [[
458{ 450{
459 msghdr msg; 451 msghdr msg;
460 iovec iov; 452 iovec iov;
461 char buf [100]; 453 char buf [100];
462 char data = 0; 454 char data = 0;
476 468
477 *(int *)CMSG_DATA (cmsg) = 5; 469 *(int *)CMSG_DATA (cmsg) = 5;
478 470
479 return sendmsg (3, &msg, 0); 471 return sendmsg (3, &msg, 0);
480} 472}
481],[can_pass_fds=yes],[can_pass_fds=no])]) 473]])],[can_pass_fds=yes],[can_pass_fds=no])])
482if test x$can_pass_fds = xyes; then 474if test x$can_pass_fds = xyes; then
483 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)
484else 476else
485 AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability]) 477 AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability])
486fi 478fi
487]) 479])
488 480
489AC_DEFUN([TTY_GROUP_CHECK], 481AC_DEFUN([TTY_GROUP_CHECK],
490[ 482[
491AC_CACHE_CHECK([for tty group], tty_group, 483AC_CACHE_CHECK([for tty group], tty_group,
492[AC_TRY_RUN([ 484[AC_RUN_IFELSE([AC_LANG_SOURCE([[
493#include <sys/types.h> 485#include <sys/types.h>
494#include <sys/stat.h> 486#include <sys/stat.h>
495#include <unistd.h> 487#include <unistd.h>
496#include <grp.h> 488#include <grp.h>
497 489
507 && (stat(tty, &st)) == 0 499 && (stat(tty, &st)) == 0
508 && st.st_gid == gr->gr_gid) 500 && st.st_gid == gr->gr_gid)
509 return 0; 501 return 0;
510 else 502 else
511 return 1; 503 return 1;
512}],
513[tty_group=yes],[tty_group=no],[tty_group=no])]) 504}]])],[tty_group=yes],[tty_group=no],[tty_group=no])])
514if test x$tty_group = xyes; then 505if test x$tty_group = xyes; then
515 AC_DEFINE(TTY_GID_SUPPORT, 1, "") 506 AC_DEFINE(TTY_GID_SUPPORT, 1, "")
516fi]) 507fi])
517 508

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines