… | |
… | |
63 | ;; |
63 | ;; |
64 | esac |
64 | esac |
65 | |
65 | |
66 | if test x$ac_cv_func_getpt = xyes -o x$ac_cv_func_posix_openpt = xyes -o x$have_clone = xyes; then |
66 | if 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) |
67 | AC_MSG_CHECKING(for UNIX98 ptys) |
68 | AC_TRY_LINK([#include <stdlib.h>], |
68 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>]], |
69 | [grantpt(0);unlockpt(0);ptsname(0);], |
69 | [[grantpt(0);unlockpt(0);ptsname(0);]])], |
70 | [unix98_pty=yes |
70 | [unix98_pty=yes |
71 | AC_DEFINE(UNIX98_PTY, 1, "") |
71 | AC_DEFINE(UNIX98_PTY, 1, "") |
72 | AC_MSG_RESULT(yes)], |
72 | AC_MSG_RESULT(yes)], |
73 | [AC_MSG_RESULT(no)]) |
73 | [AC_MSG_RESULT(no)]) |
74 | fi |
74 | fi |
… | |
… | |
83 | support_utmp=yes |
83 | support_utmp=yes |
84 | support_wtmp=yes |
84 | support_wtmp=yes |
85 | support_lastlog=yes |
85 | support_lastlog=yes |
86 | |
86 | |
87 | AC_ARG_ENABLE(utmp, |
87 | AC_ARG_ENABLE(utmp, |
88 | [ --enable-utmp enable utmp (utmpx) support], |
88 | [AS_HELP_STRING([--enable-utmp],[enable utmp (utmpx) support])], |
89 | [if test x$enableval = xyes -o x$enableval = xno; then |
89 | [if test x$enableval = xyes -o x$enableval = xno; then |
90 | support_utmp=$enableval |
90 | support_utmp=$enableval |
91 | fi]) |
91 | fi]) |
92 | |
92 | |
93 | AC_ARG_ENABLE(wtmp, |
93 | AC_ARG_ENABLE(wtmp, |
94 | [ --enable-wtmp enable wtmp (wtmpx) support (requires --enable-utmp)], |
94 | [AS_HELP_STRING([--enable-wtmp],[enable wtmp (wtmpx) support (requires --enable-utmp)])], |
95 | [if test x$enableval = xyes -o x$enableval = xno; then |
95 | [if test x$enableval = xyes -o x$enableval = xno; then |
96 | support_wtmp=$enableval |
96 | support_wtmp=$enableval |
97 | fi]) |
97 | fi]) |
98 | |
98 | |
99 | AC_ARG_ENABLE(lastlog, |
99 | AC_ARG_ENABLE(lastlog, |
100 | [ --enable-lastlog enable lastlog support (requires --enable-utmp)], |
100 | [AS_HELP_STRING([--enable-lastlog],[enable lastlog support (requires --enable-utmp)])], |
101 | [if test x$enableval = xyes -o x$enableval = xno; then |
101 | [if test x$enableval = xyes -o x$enableval = xno; then |
102 | support_lastlog=$enableval |
102 | support_lastlog=$enableval |
103 | fi]) |
103 | fi]) |
104 | |
104 | |
105 | if test x$support_utmp = xyes; then |
105 | if test x$support_utmp = xyes; then |
… | |
… | |
111 | if test x$support_lastlog = xyes; then |
111 | if 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) |
112 | AC_DEFINE(LASTLOG_SUPPORT, 1, Define if you want to have lastlog support when utmp/utmpx is enabled) |
113 | fi |
113 | fi |
114 | |
114 | |
115 | AC_CHECK_FUNCS( \ |
115 | AC_CHECK_FUNCS( \ |
116 | ttyslot \ |
|
|
117 | updwtmp \ |
116 | updwtmp \ |
118 | updwtmpx \ |
117 | updwtmpx \ |
|
|
118 | updlastlogx \ |
119 | ) |
119 | ) |
120 | |
120 | |
121 | AC_CHECK_HEADERS( \ |
121 | AC_CHECK_HEADERS(lastlog.h) |
122 | utmp.h \ |
|
|
123 | utmpx.h \ |
|
|
124 | lastlog.h \ |
|
|
125 | ) |
|
|
126 | |
122 | |
127 | dnl# -------------------------------------------------------------------------- |
123 | dnl# -------------------------------------------------------------------------- |
128 | dnl# DO ALL UTMP AND WTMP CHECKING |
124 | dnl# DO ALL UTMP AND WTMP CHECKING |
129 | dnl# -------------------------------------------------------------------------- |
125 | dnl# -------------------------------------------------------------------------- |
130 | dnl# check for host field in utmp structure |
126 | dnl# check for host field in utmp structure |
131 | |
127 | |
132 | dnl# -------------------------------------------- |
128 | dnl# -------------------------------------------- |
133 | AC_CHECK_HEADER(utmp.h, |
129 | AC_CHECK_HEADERS(utmp.h, |
134 | [AC_CACHE_CHECK([for struct utmp], struct_utmp, |
130 | [AC_CACHE_CHECK([for struct utmp], struct_utmp, |
135 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
131 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
136 | #include <utmp.h>]], [[struct utmp ut;]])],[struct_utmp=yes],[struct_utmp=no])]) |
132 | #include <utmp.h>]], [[struct utmp ut;]])],[struct_utmp=yes],[struct_utmp=no])]) |
137 | if test x$struct_utmp = xyes; then |
133 | if test x$struct_utmp = xyes; then |
138 | AC_DEFINE(HAVE_STRUCT_UTMP, 1, Define if utmp.h has struct utmp) |
134 | AC_DEFINE(HAVE_STRUCT_UTMP, 1, Define if utmp.h has struct utmp) |
… | |
… | |
150 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
146 | [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])]) |
147 | #include <utmp.h>]], [[struct utmp ut; ut.ut_pid;]])],[struct_utmp_pid=yes],[struct_utmp_pid=no])]) |
152 | if test x$struct_utmp_pid = xyes; then |
148 | if test x$struct_utmp_pid = xyes; then |
153 | AC_DEFINE(HAVE_UTMP_PID, 1, Define if struct utmp contains ut_pid) |
149 | AC_DEFINE(HAVE_UTMP_PID, 1, Define if struct utmp contains ut_pid) |
154 | fi |
150 | fi |
155 | ) dnl# AC_CHECK_HEADER(utmp.h |
151 | ) dnl# AC_CHECK_HEADERS(utmp.h |
156 | |
152 | |
157 | dnl# -------------------------------------------- |
153 | dnl# -------------------------------------------- |
158 | |
154 | |
159 | AC_CHECK_HEADER(utmpx.h, |
155 | AC_CHECK_HEADERS(utmpx.h, |
160 | [AC_CACHE_CHECK([for struct utmpx], struct_utmpx, |
156 | [AC_CACHE_CHECK([for struct utmpx], struct_utmpx, |
161 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
157 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
162 | #include <utmpx.h>]], [[struct utmpx ut;]])],[struct_utmpx=yes],[struct_utmpx=no])]) |
158 | #include <utmpx.h>]], [[struct utmpx ut;]])],[struct_utmpx=yes],[struct_utmpx=no])]) |
163 | if test x$struct_utmpx = xyes; then |
159 | if test x$struct_utmpx = xyes; then |
164 | AC_DEFINE(HAVE_STRUCT_UTMPX, 1, Define if utmpx.h has struct utmpx) |
160 | AC_DEFINE(HAVE_STRUCT_UTMPX, 1, Define if utmpx.h has struct utmpx) |
… | |
… | |
171 | if test x$struct_utmpx_host = xyes; then |
167 | if test x$struct_utmpx_host = xyes; then |
172 | AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host) |
168 | AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host) |
173 | fi |
169 | fi |
174 | |
170 | |
175 | AC_CACHE_CHECK(for session in utmpx struct, struct_utmpx_session, |
171 | AC_CACHE_CHECK(for session in utmpx struct, struct_utmpx_session, |
176 | [AC_TRY_COMPILE([#include <sys/types.h> |
172 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
177 | #include <utmpx.h>], |
173 | #include <utmpx.h>]], [[struct utmpx utx; utx.ut_session;]])],[struct_utmpx_session=yes],[struct_utmpx_session=no])]) |
178 | [struct utmpx utx; utx.ut_session;], |
|
|
179 | struct_utmpx_session=yes, struct_utmpx_session=no)]) |
|
|
180 | if test x$struct_utmpx_session = xyes; then |
174 | if test x$struct_utmpx_session = xyes; then |
181 | AC_DEFINE(HAVE_UTMPX_SESSION, 1, Define if struct utmpx contains ut_session) |
175 | AC_DEFINE(HAVE_UTMPX_SESSION, 1, Define if struct utmpx contains ut_session) |
182 | fi |
176 | fi |
183 | ) dnl# AC_CHECK_HEADER(utmpx.h |
177 | ) dnl# AC_CHECK_HEADERS(utmpx.h |
184 | |
178 | |
185 | dnl# -------------------------------------------------------------------------- |
179 | dnl# -------------------------------------------------------------------------- |
186 | dnl# check for struct lastlog |
180 | dnl# check for struct lastlog |
187 | AC_CACHE_CHECK(for struct lastlog, struct_lastlog, |
181 | AC_CACHE_CHECK(for struct lastlog, struct_lastlog, |
188 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
182 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
… | |
… | |
403 | exit(0); |
397 | exit(0); |
404 | }]])],[path_lastlog=`cat conftestval`],[path_lastlog=],[dnl |
398 | }]])],[path_lastlog=`cat conftestval`],[path_lastlog=],[dnl |
405 | AC_MSG_WARN(Define LASTLOG_FILE in config.h manually)])]) |
399 | AC_MSG_WARN(Define LASTLOG_FILE in config.h manually)])]) |
406 | if test x$path_lastlog != x; then |
400 | if test x$path_lastlog != x; then |
407 | AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$path_lastlog", Define location of lastlog) |
401 | 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 |
|
|
411 | fi |
402 | fi |
412 | dnl# -------------------------------------------------------------------------- |
403 | dnl# -------------------------------------------------------------------------- |
413 | |
404 | |
414 | dnl# find lastlogx |
405 | dnl# find lastlogx |
415 | AC_CACHE_CHECK(where lastlogx is located, path_lastlogx, |
406 | AC_CACHE_CHECK(where lastlogx is located, path_lastlogx, |
… | |
… | |
447 | ]) |
438 | ]) |
448 | |
439 | |
449 | AC_DEFUN([SCM_RIGHTS_CHECK], |
440 | AC_DEFUN([SCM_RIGHTS_CHECK], |
450 | [ |
441 | [ |
451 | AC_CACHE_CHECK(for unix-compliant filehandle passing ability, can_pass_fds, |
442 | AC_CACHE_CHECK(for unix-compliant filehandle passing ability, can_pass_fds, |
452 | [AC_TRY_LINK([ |
443 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
453 | #include <cstddef> // broken bsds (is that redundant?) need this |
444 | #include <cstddef> // broken bsds (is that redundant?) need this |
454 | #include <sys/types.h> |
445 | #include <sys/types.h> |
455 | #include <sys/socket.h> |
446 | #include <sys/socket.h> |
456 | #include <sys/uio.h> |
447 | #include <sys/uio.h> |
457 | ],[ |
448 | ]], [[ |
458 | { |
449 | { |
459 | msghdr msg; |
450 | msghdr msg; |
460 | iovec iov; |
451 | iovec iov; |
461 | char buf [100]; |
452 | char buf [100]; |
462 | char data = 0; |
453 | char data = 0; |
… | |
… | |
476 | |
467 | |
477 | *(int *)CMSG_DATA (cmsg) = 5; |
468 | *(int *)CMSG_DATA (cmsg) = 5; |
478 | |
469 | |
479 | return sendmsg (3, &msg, 0); |
470 | return sendmsg (3, &msg, 0); |
480 | } |
471 | } |
481 | ],[can_pass_fds=yes],[can_pass_fds=no])]) |
472 | ]])],[can_pass_fds=yes],[can_pass_fds=no])]) |
482 | if test x$can_pass_fds = xyes; then |
473 | if 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) |
474 | AC_DEFINE(HAVE_UNIX_FDPASS, 1, Define if sys/socket.h defines the necessary macros/functions for file handle passing) |
484 | else |
475 | else |
485 | AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability]) |
476 | AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability]) |
486 | fi |
477 | fi |
487 | ]) |
478 | ]) |
488 | |
479 | |
489 | AC_DEFUN([TTY_GROUP_CHECK], |
480 | AC_DEFUN([TTY_GROUP_CHECK], |
490 | [ |
481 | [ |
491 | AC_CACHE_CHECK([for tty group], tty_group, |
482 | AC_CACHE_CHECK([for tty group], tty_group, |
492 | [AC_TRY_RUN([ |
483 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
493 | #include <sys/types.h> |
484 | #include <sys/types.h> |
494 | #include <sys/stat.h> |
485 | #include <sys/stat.h> |
495 | #include <unistd.h> |
486 | #include <unistd.h> |
496 | #include <grp.h> |
487 | #include <grp.h> |
497 | |
488 | |
… | |
… | |
507 | && (stat(tty, &st)) == 0 |
498 | && (stat(tty, &st)) == 0 |
508 | && st.st_gid == gr->gr_gid) |
499 | && st.st_gid == gr->gr_gid) |
509 | return 0; |
500 | return 0; |
510 | else |
501 | else |
511 | return 1; |
502 | return 1; |
512 | }], |
|
|
513 | [tty_group=yes],[tty_group=no],[tty_group=no])]) |
503 | }]])],[tty_group=yes],[tty_group=no],[tty_group=no])]) |
514 | if test x$tty_group = xyes; then |
504 | if test x$tty_group = xyes; then |
515 | AC_DEFINE(TTY_GID_SUPPORT, 1, "") |
505 | AC_DEFINE(TTY_GID_SUPPORT, 1, "") |
516 | fi]) |
506 | fi]) |
517 | |
507 | |