1 |
sf-exg |
1.24 |
AC_DEFUN([PT_FIND_FILE], |
2 |
sf-exg |
1.31 |
[AC_CACHE_CHECK(for a fallback location of $1, pt_cv_path_$1, [ |
3 |
|
|
if test "$cross_compiling" != yes; then |
4 |
|
|
for file in $3; do |
5 |
|
|
if test -f "$file"; then |
6 |
|
|
pt_cv_path_$1=$file |
7 |
|
|
break |
8 |
|
|
fi |
9 |
|
|
done |
10 |
|
|
fi]) |
11 |
sf-exg |
1.24 |
if test x$pt_cv_path_$1 != x; then |
12 |
sf-exg |
1.31 |
AC_DEFINE_UNQUOTED($2, "$pt_cv_path_$1", Define to a fallback location of $1) |
13 |
|
|
elif test "$cross_compiling" = yes; then |
14 |
|
|
AC_MSG_WARN(Define $2 in config.h manually) |
15 |
sf-exg |
1.24 |
fi]) |
16 |
|
|
|
17 |
ayin |
1.1 |
AC_DEFUN([PTY_CHECK], |
18 |
|
|
[ |
19 |
|
|
AC_CHECK_HEADERS( \ |
20 |
|
|
pty.h \ |
21 |
|
|
util.h \ |
22 |
|
|
libutil.h \ |
23 |
|
|
sys/ioctl.h \ |
24 |
root |
1.17 |
stropts.h \ |
25 |
ayin |
1.1 |
) |
26 |
|
|
|
27 |
|
|
AC_CHECK_FUNCS( \ |
28 |
|
|
revoke \ |
29 |
|
|
_getpty \ |
30 |
|
|
getpt \ |
31 |
|
|
posix_openpt \ |
32 |
|
|
isastream \ |
33 |
root |
1.7 |
setuid \ |
34 |
|
|
seteuid \ |
35 |
|
|
setreuid \ |
36 |
|
|
setresuid \ |
37 |
ayin |
1.1 |
) |
38 |
|
|
|
39 |
sf-exg |
1.29 |
AC_MSG_CHECKING(for UNIX98 ptys) |
40 |
|
|
AC_LINK_IFELSE( |
41 |
|
|
[AC_LANG_PROGRAM( |
42 |
|
|
[[#include <stdlib.h>]], |
43 |
|
|
[[grantpt(0);unlockpt(0);ptsname(0);]])], |
44 |
|
|
[unix98_pty=yes |
45 |
|
|
AC_DEFINE(UNIX98_PTY, 1, "") |
46 |
|
|
AC_MSG_RESULT(yes)], |
47 |
|
|
[AC_MSG_RESULT(no)]) |
48 |
ayin |
1.1 |
|
49 |
|
|
if test -z "$unix98_pty"; then |
50 |
sf-exg |
1.21 |
AC_SEARCH_LIBS(openpty, util, AC_DEFINE(HAVE_OPENPTY, 1, "")) |
51 |
ayin |
1.1 |
fi |
52 |
|
|
]) |
53 |
|
|
|
54 |
|
|
AC_DEFUN([UTMP_CHECK], |
55 |
|
|
[ |
56 |
ayin |
1.5 |
support_utmp=yes |
57 |
|
|
support_wtmp=yes |
58 |
|
|
support_lastlog=yes |
59 |
|
|
|
60 |
ayin |
1.4 |
AC_ARG_ENABLE(utmp, |
61 |
ayin |
1.11 |
[AS_HELP_STRING([--enable-utmp],[enable utmp (utmpx) support])], |
62 |
ayin |
1.4 |
[if test x$enableval = xyes -o x$enableval = xno; then |
63 |
|
|
support_utmp=$enableval |
64 |
|
|
fi]) |
65 |
|
|
|
66 |
|
|
AC_ARG_ENABLE(wtmp, |
67 |
ayin |
1.11 |
[AS_HELP_STRING([--enable-wtmp],[enable wtmp (wtmpx) support (requires --enable-utmp)])], |
68 |
ayin |
1.4 |
[if test x$enableval = xyes -o x$enableval = xno; then |
69 |
|
|
support_wtmp=$enableval |
70 |
|
|
fi]) |
71 |
|
|
|
72 |
|
|
AC_ARG_ENABLE(lastlog, |
73 |
ayin |
1.11 |
[AS_HELP_STRING([--enable-lastlog],[enable lastlog support (requires --enable-utmp)])], |
74 |
ayin |
1.4 |
[if test x$enableval = xyes -o x$enableval = xno; then |
75 |
|
|
support_lastlog=$enableval |
76 |
|
|
fi]) |
77 |
|
|
|
78 |
|
|
if test x$support_utmp = xyes; then |
79 |
|
|
AC_DEFINE(UTMP_SUPPORT, 1, Define if you want to have utmp/utmpx support) |
80 |
|
|
fi |
81 |
|
|
if test x$support_wtmp = xyes; then |
82 |
|
|
AC_DEFINE(WTMP_SUPPORT, 1, Define if you want to have wtmp support when utmp/utmpx is enabled) |
83 |
|
|
fi |
84 |
|
|
if test x$support_lastlog = xyes; then |
85 |
|
|
AC_DEFINE(LASTLOG_SUPPORT, 1, Define if you want to have lastlog support when utmp/utmpx is enabled) |
86 |
|
|
fi |
87 |
|
|
|
88 |
sf-exg |
1.34 |
case $host in |
89 |
|
|
*-*-solaris*) |
90 |
|
|
AC_DEFINE(__EXTENSIONS__, 1, Enable declarations in utmp.h on Solaris when the XPG4v2 namespace is active) |
91 |
|
|
;; |
92 |
|
|
esac |
93 |
|
|
|
94 |
sf-exg |
1.39 |
AC_CHECK_HEADERS(utmp.h, [ |
95 |
sf-exg |
1.26 |
AC_CHECK_TYPES([struct utmp], [], [], [ |
96 |
|
|
#include <sys/types.h> |
97 |
|
|
#include <utmp.h> |
98 |
|
|
]) |
99 |
ayin |
1.1 |
|
100 |
sf-exg |
1.26 |
AC_CHECK_MEMBER([struct utmp.ut_host], |
101 |
|
|
[AC_DEFINE(HAVE_UTMP_HOST, 1, Define if struct utmp contains ut_host)], [], [ |
102 |
|
|
#include <sys/types.h> |
103 |
|
|
#include <utmp.h> |
104 |
|
|
]) |
105 |
ayin |
1.1 |
|
106 |
sf-exg |
1.26 |
AC_CHECK_MEMBER([struct utmp.ut_pid], |
107 |
|
|
[AC_DEFINE(HAVE_UTMP_PID, 1, Define if struct utmp contains ut_pid)], [], [ |
108 |
|
|
#include <sys/types.h> |
109 |
|
|
#include <utmp.h> |
110 |
|
|
]) |
111 |
ayin |
1.1 |
|
112 |
sf-exg |
1.40 |
AC_CHECK_FUNCS([updwtmp]) |
113 |
|
|
|
114 |
|
|
AC_CHECK_HEADERS([lastlog.h]) |
115 |
|
|
|
116 |
|
|
AC_CHECK_TYPES([struct lastlog], [], [], [ |
117 |
|
|
#include <sys/types.h> |
118 |
|
|
#include <utmp.h> |
119 |
|
|
#ifdef HAVE_LASTLOG_H |
120 |
|
|
#include <lastlog.h> |
121 |
|
|
#endif |
122 |
|
|
]) |
123 |
|
|
|
124 |
|
|
PT_FIND_FILE([utmp], [PT_UTMP_FILE], |
125 |
|
|
["/var/run/utmp" "/var/adm/utmp" "/etc/utmp" "/usr/etc/utmp" "/usr/adm/utmp"]) |
126 |
|
|
|
127 |
|
|
PT_FIND_FILE([wtmp], [PT_WTMP_FILE], |
128 |
|
|
["/var/log/wtmp" "/var/adm/wtmp" "/etc/wtmp" "/usr/etc/wtmp" "/usr/adm/wtmp"]) |
129 |
|
|
|
130 |
|
|
PT_FIND_FILE([lastlog], [PT_LASTLOG_FILE], |
131 |
|
|
["/var/log/lastlog" "/var/adm/lastlog"]) |
132 |
|
|
|
133 |
|
|
]) |
134 |
ayin |
1.1 |
|
135 |
sf-exg |
1.39 |
AC_CHECK_HEADERS(utmpx.h, [ |
136 |
sf-exg |
1.26 |
AC_CHECK_TYPES([struct utmpx], [], [], [ |
137 |
|
|
#include <sys/types.h> |
138 |
|
|
#include <utmpx.h> |
139 |
|
|
]) |
140 |
ayin |
1.1 |
|
141 |
sf-exg |
1.26 |
AC_CHECK_MEMBER([struct utmpx.ut_host], |
142 |
|
|
[AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host)], [], [ |
143 |
|
|
#include <sys/types.h> |
144 |
|
|
#include <utmpx.h> |
145 |
|
|
]) |
146 |
ayin |
1.1 |
|
147 |
sf-exg |
1.40 |
AC_CHECK_FUNCS([updwtmpx updlastlogx]) |
148 |
ayin |
1.1 |
|
149 |
sf-exg |
1.26 |
AC_CHECK_TYPES([struct lastlogx], [], [], [ |
150 |
|
|
#include <sys/types.h> |
151 |
ayin |
1.1 |
#include <utmpx.h> |
152 |
sf-exg |
1.26 |
]) |
153 |
ayin |
1.1 |
|
154 |
sf-exg |
1.31 |
PT_FIND_FILE([wtmpx], [PT_WTMPX_FILE], |
155 |
|
|
["/var/log/wtmpx" "/var/adm/wtmpx"]) |
156 |
ayin |
1.1 |
|
157 |
sf-exg |
1.31 |
PT_FIND_FILE([lastlogx], [PT_LASTLOGX_FILE], |
158 |
|
|
["/var/log/lastlogx" "/var/adm/lastlogx"]) |
159 |
ayin |
1.1 |
]) |
160 |
|
|
|
161 |
sf-exg |
1.40 |
]) |
162 |
|
|
|
163 |
ayin |
1.1 |
AC_DEFUN([SCM_RIGHTS_CHECK], |
164 |
|
|
[ |
165 |
sf-exg |
1.38 |
AH_TEMPLATE([_XOPEN_SOURCE], [Enable declarations of msg_control and msg_controllen on Solaris]) |
166 |
sf-exg |
1.34 |
case $host in |
167 |
|
|
*-*-solaris*) |
168 |
sf-exg |
1.38 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
169 |
|
|
#if __STDC_VERSION__ >= 199901L |
170 |
|
|
error |
171 |
|
|
#endif |
172 |
|
|
]])],[AC_DEFINE(_XOPEN_SOURCE, 500)],[AC_DEFINE(_XOPEN_SOURCE, 600)]) |
173 |
sf-exg |
1.34 |
AC_SEARCH_LIBS(sendmsg, socket) |
174 |
|
|
;; |
175 |
|
|
esac |
176 |
|
|
|
177 |
sf-exg |
1.18 |
AC_CACHE_CHECK(for unix-compliant filehandle passing ability, pt_cv_can_pass_fds, |
178 |
ayin |
1.16 |
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
179 |
sf-exg |
1.36 |
#include <stddef.h> // broken bsds (is that redundant?) need this |
180 |
ayin |
1.1 |
#include <sys/types.h> |
181 |
|
|
#include <sys/socket.h> |
182 |
|
|
#include <sys/uio.h> |
183 |
ayin |
1.16 |
]], [[ |
184 |
ayin |
1.1 |
{ |
185 |
|
|
msghdr msg; |
186 |
|
|
iovec iov; |
187 |
|
|
char buf [100]; |
188 |
|
|
char data = 0; |
189 |
|
|
|
190 |
|
|
iov.iov_base = &data; |
191 |
|
|
iov.iov_len = 1; |
192 |
|
|
|
193 |
|
|
msg.msg_iov = &iov; |
194 |
|
|
msg.msg_iovlen = 1; |
195 |
|
|
msg.msg_control = buf; |
196 |
|
|
msg.msg_controllen = sizeof buf; |
197 |
|
|
|
198 |
|
|
cmsghdr *cmsg = CMSG_FIRSTHDR (&msg); |
199 |
|
|
cmsg->cmsg_level = SOL_SOCKET; |
200 |
|
|
cmsg->cmsg_type = SCM_RIGHTS; |
201 |
|
|
cmsg->cmsg_len = 100; |
202 |
|
|
|
203 |
|
|
*(int *)CMSG_DATA (cmsg) = 5; |
204 |
|
|
|
205 |
|
|
return sendmsg (3, &msg, 0); |
206 |
|
|
} |
207 |
sf-exg |
1.18 |
]])],[pt_cv_can_pass_fds=yes],[pt_cv_can_pass_fds=no])]) |
208 |
|
|
if test x$pt_cv_can_pass_fds = xyes; then |
209 |
ayin |
1.1 |
AC_DEFINE(HAVE_UNIX_FDPASS, 1, Define if sys/socket.h defines the necessary macros/functions for file handle passing) |
210 |
|
|
else |
211 |
|
|
AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability]) |
212 |
|
|
fi |
213 |
|
|
]) |
214 |
ayin |
1.3 |
|
215 |
|
|
AC_DEFUN([TTY_GROUP_CHECK], |
216 |
|
|
[ |
217 |
sf-exg |
1.18 |
AC_CACHE_CHECK([for tty group], pt_cv_tty_group, |
218 |
ayin |
1.16 |
[AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
219 |
ayin |
1.3 |
#include <sys/types.h> |
220 |
|
|
#include <sys/stat.h> |
221 |
|
|
#include <unistd.h> |
222 |
|
|
#include <grp.h> |
223 |
|
|
|
224 |
sf-exg |
1.22 |
int main() |
225 |
ayin |
1.3 |
{ |
226 |
|
|
struct stat st; |
227 |
|
|
struct group *gr; |
228 |
|
|
char *tty; |
229 |
|
|
gr = getgrnam("tty"); |
230 |
|
|
tty = ttyname(0); |
231 |
|
|
if (gr != 0 |
232 |
|
|
&& tty != 0 |
233 |
|
|
&& (stat(tty, &st)) == 0 |
234 |
|
|
&& st.st_gid == gr->gr_gid) |
235 |
|
|
return 0; |
236 |
|
|
else |
237 |
|
|
return 1; |
238 |
sf-exg |
1.18 |
}]])],[pt_cv_tty_group=yes],[pt_cv_tty_group=no],[pt_cv_tty_group=no])]) |
239 |
|
|
if test x$pt_cv_tty_group = xyes; then |
240 |
ayin |
1.3 |
AC_DEFINE(TTY_GID_SUPPORT, 1, "") |
241 |
|
|
fi]) |
242 |
|
|
|