1 |
dnl this file is part of libptytty, do not make local modifications |
2 |
dnl http://software.schmorp.de/pkg/libptytty |
3 |
|
4 |
AC_DEFUN([PTY_CHECK], |
5 |
[ |
6 |
AC_CHECK_HEADERS( \ |
7 |
pty.h \ |
8 |
util.h \ |
9 |
libutil.h \ |
10 |
sys/ioctl.h \ |
11 |
sys/stropts.h \ |
12 |
) |
13 |
|
14 |
AC_CHECK_FUNCS( \ |
15 |
revoke \ |
16 |
_getpty \ |
17 |
getpt \ |
18 |
posix_openpt \ |
19 |
isastream \ |
20 |
) |
21 |
|
22 |
have_clone=no |
23 |
|
24 |
AC_MSG_CHECKING(for /dev/ptym/clone) |
25 |
if test -e /dev/ptym/clone; then |
26 |
AC_MSG_RESULT(yes) |
27 |
AC_DEFINE(HAVE_DEV_CLONE, 1, [Define to 1 if you have /dev/ptym/clone]) |
28 |
AC_DEFINE(CLONE_DEVICE, "/dev/ptym/clone", [clone device filename]) |
29 |
have_clone=yes |
30 |
else |
31 |
AC_MSG_RESULT(no) |
32 |
fi |
33 |
|
34 |
AC_MSG_CHECKING(for /dev/ptc) |
35 |
if test -e /dev/ptc; then |
36 |
AC_MSG_RESULT(yes) |
37 |
AC_DEFINE(HAVE_DEV_PTC, 1, [Define to 1 if you have /dev/ptc]) |
38 |
AC_DEFINE(CLONE_DEVICE, "/dev/ptc", [clone device filename]) |
39 |
have_clone=yes |
40 |
else |
41 |
AC_MSG_RESULT(no) |
42 |
fi |
43 |
|
44 |
case $host in |
45 |
*-*-cygwin*) |
46 |
have_clone=yes |
47 |
AC_DEFINE(CLONE_DEVICE, "/dev/ptmx", [clone device filename]) |
48 |
;; |
49 |
*) |
50 |
AC_MSG_CHECKING(for /dev/ptmx) |
51 |
if test -e /dev/ptmx; then |
52 |
AC_MSG_RESULT(yes) |
53 |
AC_DEFINE(HAVE_DEV_PTMX, 1, [Define to 1 if you have /dev/ptmx]) |
54 |
AC_DEFINE(CLONE_DEVICE, "/dev/ptmx", [clone device filename]) |
55 |
have_clone=yes |
56 |
else |
57 |
AC_MSG_RESULT(no) |
58 |
fi |
59 |
;; |
60 |
esac |
61 |
|
62 |
if 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) |
64 |
AC_TRY_LINK([#include <stdlib.h>], |
65 |
[grantpt(0);unlockpt(0);ptsname(0);], |
66 |
[unix98_pty=yes |
67 |
AC_DEFINE(UNIX98_PTY, 1, "") |
68 |
AC_MSG_RESULT(yes)], |
69 |
[AC_MSG_RESULT(no)]) |
70 |
fi |
71 |
|
72 |
if test -z "$unix98_pty"; then |
73 |
AC_CHECK_FUNCS(openpty, [], [AC_CHECK_LIB(util, openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"])]) |
74 |
fi |
75 |
]) |
76 |
|
77 |
AC_DEFUN([UTMP_CHECK], |
78 |
[ |
79 |
AC_ARG_ENABLE(utmp, |
80 |
[ --enable-utmp enable utmp (utmpx) support], |
81 |
[if test x$enableval = xyes -o x$enableval = xno; then |
82 |
support_utmp=$enableval |
83 |
fi]) |
84 |
|
85 |
AC_ARG_ENABLE(wtmp, |
86 |
[ --enable-wtmp enable wtmp (wtmpx) support (requires --enable-utmp)], |
87 |
[if test x$enableval = xyes -o x$enableval = xno; then |
88 |
support_wtmp=$enableval |
89 |
fi]) |
90 |
|
91 |
AC_ARG_ENABLE(lastlog, |
92 |
[ --enable-lastlog enable lastlog support (requires --enable-utmp)], |
93 |
[if test x$enableval = xyes -o x$enableval = xno; then |
94 |
support_lastlog=$enableval |
95 |
fi]) |
96 |
|
97 |
if test x$support_utmp = xyes; then |
98 |
AC_DEFINE(UTMP_SUPPORT, 1, Define if you want to have utmp/utmpx support) |
99 |
fi |
100 |
if test x$support_wtmp = xyes; then |
101 |
AC_DEFINE(WTMP_SUPPORT, 1, Define if you want to have wtmp support when utmp/utmpx is enabled) |
102 |
fi |
103 |
if test x$support_lastlog = xyes; then |
104 |
AC_DEFINE(LASTLOG_SUPPORT, 1, Define if you want to have lastlog support when utmp/utmpx is enabled) |
105 |
fi |
106 |
|
107 |
AC_CHECK_FUNCS( \ |
108 |
ttyslot \ |
109 |
updwtmp \ |
110 |
updwtmpx \ |
111 |
) |
112 |
|
113 |
AC_CHECK_HEADERS( \ |
114 |
utmp.h \ |
115 |
utmpx.h \ |
116 |
lastlog.h \ |
117 |
) |
118 |
|
119 |
dnl# -------------------------------------------------------------------------- |
120 |
dnl# DO ALL UTMP AND WTMP CHECKING |
121 |
dnl# -------------------------------------------------------------------------- |
122 |
dnl# check for host field in utmp structure |
123 |
|
124 |
dnl# -------------------------------------------- |
125 |
AC_CHECK_HEADER(utmp.h, |
126 |
[AC_CACHE_CHECK([for struct utmp], struct_utmp, |
127 |
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
128 |
#include <utmp.h>]], [[struct utmp ut;]])],[struct_utmp=yes],[struct_utmp=no])]) |
129 |
if test x$struct_utmp = xyes; then |
130 |
AC_DEFINE(HAVE_STRUCT_UTMP, 1, Define if utmp.h has struct utmp) |
131 |
fi |
132 |
] |
133 |
|
134 |
AC_CACHE_CHECK(for ut_host in utmp struct, struct_utmp_host, |
135 |
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
136 |
#include <utmp.h>]], [[struct utmp ut; ut.ut_host;]])],[struct_utmp_host=yes],[struct_utmp_host=no])]) |
137 |
if test x$struct_utmp_host = xyes; then |
138 |
AC_DEFINE(HAVE_UTMP_HOST, 1, Define if struct utmp contains ut_host) |
139 |
fi |
140 |
|
141 |
AC_CACHE_CHECK(for ut_pid in utmp struct, struct_utmp_pid, |
142 |
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
143 |
#include <utmp.h>]], [[struct utmp ut; ut.ut_pid;]])],[struct_utmp_pid=yes],[struct_utmp_pid=no])]) |
144 |
if test x$struct_utmp_pid = xyes; then |
145 |
AC_DEFINE(HAVE_UTMP_PID, 1, Define if struct utmp contains ut_pid) |
146 |
fi |
147 |
) dnl# AC_CHECK_HEADER(utmp.h |
148 |
|
149 |
dnl# -------------------------------------------- |
150 |
|
151 |
AC_CHECK_HEADER(utmpx.h, |
152 |
[AC_CACHE_CHECK([for struct utmpx], struct_utmpx, |
153 |
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
154 |
#include <utmpx.h>]], [[struct utmpx ut;]])],[struct_utmpx=yes],[struct_utmpx=no])]) |
155 |
if test x$struct_utmpx = xyes; then |
156 |
AC_DEFINE(HAVE_STRUCT_UTMPX, 1, Define if utmpx.h has struct utmpx) |
157 |
fi |
158 |
] |
159 |
|
160 |
AC_CACHE_CHECK(for host in utmpx struct, struct_utmpx_host, |
161 |
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
162 |
#include <utmpx.h>]], [[struct utmpx utx; utx.ut_host;]])],[struct_utmpx_host=yes],[struct_utmpx_host=no])]) |
163 |
if test x$struct_utmpx_host = xyes; then |
164 |
AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host) |
165 |
fi |
166 |
|
167 |
AC_CACHE_CHECK(for session in utmpx struct, struct_utmpx_session, |
168 |
[AC_TRY_COMPILE([#include <sys/types.h> |
169 |
#include <utmpx.h>], |
170 |
[struct utmpx utx; utx.ut_session;], |
171 |
struct_utmpx_session=yes, struct_utmpx_session=no)]) |
172 |
if test x$struct_utmpx_session = xyes; then |
173 |
AC_DEFINE(HAVE_UTMPX_SESSION, 1, Define if struct utmpx contains ut_session) |
174 |
fi |
175 |
) dnl# AC_CHECK_HEADER(utmpx.h |
176 |
|
177 |
dnl# -------------------------------------------------------------------------- |
178 |
dnl# check for struct lastlog |
179 |
AC_CACHE_CHECK(for struct lastlog, struct_lastlog, |
180 |
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
181 |
#include <utmp.h> |
182 |
#ifdef HAVE_LASTLOG_H |
183 |
#include <lastlog.h> |
184 |
#endif |
185 |
]], [[struct lastlog ll;]])],[struct_lastlog=yes],[struct_lastlog=no])]) |
186 |
if test x$struct_lastlog = xyes; then |
187 |
AC_DEFINE(HAVE_STRUCT_LASTLOG, 1, Define if utmp.h or lastlog.h has struct lastlog) |
188 |
fi |
189 |
|
190 |
dnl# check for struct lastlogx |
191 |
AC_CACHE_CHECK(for struct lastlogx, struct_lastlogx, |
192 |
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
193 |
#include <utmpx.h> |
194 |
#ifdef HAVE_LASTLOG_H |
195 |
#include <lastlog.h> |
196 |
#endif |
197 |
]], [[struct lastlogx ll;]])],[struct_lastlogx=yes],[struct_lastlogx=no])]) |
198 |
if test x$struct_lastlogx = xyes; then |
199 |
AC_DEFINE(HAVE_STRUCT_LASTLOGX, 1, Define if utmpx.h or lastlog.h has struct lastlogx) |
200 |
fi |
201 |
|
202 |
dnl# -------------------------------------------------------------------------- |
203 |
dnl# FIND FILES |
204 |
dnl# -------------------------------------------------------------------------- |
205 |
|
206 |
dnl# find utmp |
207 |
AC_CACHE_CHECK(where utmp is located, path_utmp, |
208 |
[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
209 |
#include <sys/types.h> |
210 |
#include <utmp.h> |
211 |
#include <errno.h> |
212 |
main() |
213 |
{ |
214 |
char **u, *utmplist[] = { |
215 |
"/var/run/utmp", "/var/adm/utmp", "/etc/utmp", "/usr/etc/utmp", "/usr/adm/utmp", NULL }; |
216 |
FILE *a, *f=fopen("conftestval", "w"); |
217 |
if (!f) exit(1); |
218 |
#ifdef UTMP_FILE |
219 |
fprintf(f, "%s\n", UTMP_FILE); |
220 |
exit(0); |
221 |
#endif |
222 |
#ifdef _PATH_UTMP |
223 |
fprintf(f, "%s\n", _PATH_UTMP); |
224 |
exit(0); |
225 |
#endif |
226 |
for (u = utmplist; *u; u++) { |
227 |
if ((a = fopen(*u, "r")) != NULL || errno == EACCES) { |
228 |
fprintf(f, "%s\n", *u); |
229 |
exit(0); |
230 |
} |
231 |
} |
232 |
exit(0); |
233 |
}]])],[path_utmp=`cat conftestval`],[path_utmp=],[dnl |
234 |
AC_MSG_WARN(Define UTMP_FILE in config.h manually)])]) |
235 |
if test x$path_utmp != x; then |
236 |
AC_DEFINE_UNQUOTED(UTMP_FILE, "$path_utmp", Define location of utmp) |
237 |
fi |
238 |
|
239 |
dnl# -------------------------------------------------------------------------- |
240 |
|
241 |
dnl# find utmpx - if a utmp file exists at the same location and is more than |
242 |
dnl# a day newer, then dump the utmpx. People leave lots of junk around. |
243 |
AC_CACHE_CHECK(where utmpx is located, path_utmpx, |
244 |
[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
245 |
#include <sys/types.h> |
246 |
#include <utmpx.h> |
247 |
#include <errno.h> |
248 |
#include <sys/stat.h> |
249 |
#ifdef HAVE_STRING_H |
250 |
#include <string.h> |
251 |
#endif |
252 |
main() |
253 |
{ |
254 |
char **u, *p, *utmplist[] = { |
255 |
#ifdef UTMPX_FILE |
256 |
UTMPX_FILE, |
257 |
#endif |
258 |
#ifdef _PATH_UTMPX |
259 |
_PATH_UTMPX, |
260 |
#endif |
261 |
"/var/adm/utmpx", "/etc/utmpx", NULL }; |
262 |
FILE *a, *f=fopen("conftestval", "w"); |
263 |
struct stat statu, statux; |
264 |
if (!f) exit(1); |
265 |
for (u = utmplist; *u; u++) { |
266 |
if ((a = fopen(*u, "r")) != NULL || errno == EACCES) { |
267 |
if (stat(*u, &statux) < 0) |
268 |
continue; |
269 |
p = strdup(*u); |
270 |
p[strlen(p) - 1] = '\0'; |
271 |
if (stat(p, &statu) >= 0 |
272 |
&& (statu.st_mtime - statux.st_mtime > 86400)) |
273 |
continue; |
274 |
fprintf(f, "%s\n", *u); |
275 |
exit(0); |
276 |
} |
277 |
} |
278 |
exit(0); |
279 |
}]])],[path_utmpx=`cat conftestval`],[path_utmpx=],[dnl |
280 |
AC_MSG_WARN(Define UTMPX_FILE in config.h manually)])]) |
281 |
if test x$path_utmpx != x; then |
282 |
AC_DEFINE_UNQUOTED(UTMPX_FILE, "$path_utmpx", Define location of utmpx) |
283 |
fi |
284 |
|
285 |
dnl# -------------------------------------------------------------------------- |
286 |
|
287 |
dnl# find wtmp |
288 |
AC_CACHE_CHECK(where wtmp is located, path_wtmp, |
289 |
[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
290 |
#include <sys/types.h> |
291 |
#ifdef HAVE_UTMP_H |
292 |
#include <utmp.h> |
293 |
#endif |
294 |
#include <errno.h> |
295 |
main() |
296 |
{ |
297 |
char **w, *wtmplist[] = { |
298 |
"/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp", NULL }; |
299 |
FILE *a, *f=fopen("conftestval", "w"); |
300 |
if (!f) exit(1); |
301 |
#ifdef WTMP_FILE |
302 |
fprintf(f, "%s\n", WTMP_FILE); |
303 |
exit(0); |
304 |
#endif |
305 |
#ifdef _PATH_WTMP |
306 |
fprintf(f, "%s\n", _PATH_WTMP); |
307 |
exit(0); |
308 |
#endif |
309 |
for (w = wtmplist; *w; w++) { |
310 |
if ((a = fopen(*w, "r")) != NULL || errno == EACCES) { |
311 |
fprintf(f, "%s\n", *w); |
312 |
exit(0); |
313 |
} |
314 |
} |
315 |
exit(0); |
316 |
}]])],[path_wtmp=`cat conftestval`],[path_wtmp=],[dnl |
317 |
AC_MSG_WARN(Define WTMP_FILE in config.h manually)])]) |
318 |
if test x$path_wtmp != x; then |
319 |
AC_DEFINE_UNQUOTED(WTMP_FILE, "$path_wtmp", Define location of wtmp) |
320 |
fi |
321 |
dnl# -------------------------------------------------------------------------- |
322 |
|
323 |
dnl# find wtmpx |
324 |
AC_CACHE_CHECK(where wtmpx is located, path_wtmpx, |
325 |
[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
326 |
#ifdef HAVE_UTMPX_H |
327 |
#include <utmpx.h> |
328 |
#endif |
329 |
#include <errno.h> |
330 |
main() |
331 |
{ |
332 |
char **w, *wtmplist[] = { |
333 |
"/var/log/wtmpx", "/var/adm/wtmpx", NULL }; |
334 |
FILE *a, *f=fopen("conftestval", "w"); |
335 |
if (!f) exit(1); |
336 |
#ifdef WTMPX_FILE |
337 |
fprintf(f, "%s\n", WTMPX_FILE); |
338 |
exit(0); |
339 |
#endif |
340 |
#ifdef _PATH_WTMPX |
341 |
fprintf(f, "%s\n", _PATH_WTMPX); |
342 |
exit(0); |
343 |
#endif |
344 |
for (w = wtmplist; *w; w++) { |
345 |
if ((a = fopen(*w, "r")) != NULL || errno == EACCES) { |
346 |
fprintf(f, "%s\n", *w); |
347 |
exit(0); |
348 |
} |
349 |
} |
350 |
exit(0); |
351 |
}]])],[path_wtmpx=`cat conftestval`],[path_wtmpx=],[dnl |
352 |
AC_MSG_WARN(Define WTMPX_FILE in config.h manually)])]) |
353 |
if test x$path_wtmpx != x; then |
354 |
AC_DEFINE_UNQUOTED(WTMPX_FILE, "$path_wtmpx", Define location of wtmpx) |
355 |
fi |
356 |
dnl# -------------------------------------------------------------------------- |
357 |
|
358 |
dnl# find lastlog |
359 |
AC_CACHE_CHECK(where lastlog is located, path_lastlog, |
360 |
[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
361 |
#include <sys/types.h> |
362 |
#ifdef HAVE_UTMPX_H |
363 |
#include <utmpx.h> |
364 |
#elif defined(HAVE_UTMP_H) |
365 |
#include <utmp.h> |
366 |
#endif |
367 |
#ifdef HAVE_LASTLOG_H |
368 |
#include <lastlog.h> |
369 |
#endif |
370 |
#include <errno.h> |
371 |
main() |
372 |
{ |
373 |
char **w, *lastloglist[] = { "/var/log/lastlog", NULL }; |
374 |
FILE *a, *f=fopen("conftestval", "w"); |
375 |
if (!f) exit(1); |
376 |
#ifdef LASTLOG_FILE |
377 |
fprintf(f, "%s\n", LASTLOG_FILE); |
378 |
exit(0); |
379 |
#endif |
380 |
#ifdef _PATH_LASTLOG |
381 |
fprintf(f, "%s\n", _PATH_LASTLOG); |
382 |
exit(0); |
383 |
#endif |
384 |
for (w = lastloglist; *w; w++) { |
385 |
if ((a = fopen(*w, "r")) != NULL || errno == EACCES) { |
386 |
fprintf(f, "%s\n", *w); |
387 |
exit(0); |
388 |
} |
389 |
} |
390 |
exit(0); |
391 |
}]])],[path_lastlog=`cat conftestval`],[path_lastlog=],[dnl |
392 |
AC_MSG_WARN(Define LASTLOG_FILE in config.h manually)])]) |
393 |
if test x$path_lastlog != x; then |
394 |
AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$path_lastlog", Define location of lastlog) |
395 |
if test -d "$path_lastlog"; then |
396 |
AC_DEFINE(LASTLOG_IS_DIR, 1, Define if lastlog is provided via a directory) |
397 |
fi |
398 |
fi |
399 |
dnl# -------------------------------------------------------------------------- |
400 |
|
401 |
dnl# find lastlogx |
402 |
AC_CACHE_CHECK(where lastlogx is located, path_lastlogx, |
403 |
[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
404 |
#ifdef HAVE_UTMPX_H |
405 |
#include <utmpx.h> |
406 |
#endif |
407 |
#include <errno.h> |
408 |
main() |
409 |
{ |
410 |
char **w, *wtmplist[] = { "/var/log/lastlogx", "/var/adm/lastlogx", NULL }; |
411 |
FILE *a, *f=fopen("conftestval", "w"); |
412 |
if (!f) exit(1); |
413 |
#ifdef LASTLOGX_FILE |
414 |
fprintf(f, "%s\n", LASTLOGX_FILE); |
415 |
exit(0); |
416 |
#endif |
417 |
#ifdef _PATH_LASTLOGX |
418 |
fprintf(f, "%s\n", _PATH_LASTLOGX); |
419 |
exit(0); |
420 |
#endif |
421 |
for (w = wtmplist; *w; w++) { |
422 |
if ((a = fopen(*w, "r")) != NULL || errno == EACCES) { |
423 |
fprintf(f, "%s\n", *w); |
424 |
exit(0); |
425 |
} |
426 |
} |
427 |
exit(0); |
428 |
}]])],[path_lastlogx=`cat conftestval`],[path_lastlogx=],[dnl |
429 |
AC_MSG_WARN(Define LASTLOGX_FILE in config.h manually)])]) |
430 |
if test x$path_lastlogx != x; then |
431 |
AC_DEFINE_UNQUOTED(LASTLOGX_FILE, "$path_lastlogx", Define location of lastlogx) |
432 |
fi |
433 |
|
434 |
if test x$support_utmp != xyes; then |
435 |
echo " utmp support: disabled" |
436 |
echo |
437 |
else |
438 |
echo " utmp support: enabled |
439 |
utmp file: $path_utmp |
440 |
utmpx file: $path_utmpx |
441 |
wtmp file: $path_wtmp |
442 |
wtmpx file: $path_wtmpx |
443 |
lastlog file: $path_lastlog |
444 |
lastlogx file: $path_lastlogx" |
445 |
fi |
446 |
]) |
447 |
|
448 |
AC_DEFUN([SCM_RIGHTS_CHECK], |
449 |
[ |
450 |
AC_CACHE_CHECK(for unix-compliant filehandle passing ability, can_pass_fds, |
451 |
[AC_TRY_LINK([ |
452 |
#include <cstddef> // broken bsds (is that redundant) need this |
453 |
#include <sys/types.h> |
454 |
#include <sys/socket.h> |
455 |
#include <sys/uio.h> |
456 |
],[ |
457 |
{ |
458 |
msghdr msg; |
459 |
iovec iov; |
460 |
char buf [100]; |
461 |
char data = 0; |
462 |
|
463 |
iov.iov_base = &data; |
464 |
iov.iov_len = 1; |
465 |
|
466 |
msg.msg_iov = &iov; |
467 |
msg.msg_iovlen = 1; |
468 |
msg.msg_control = buf; |
469 |
msg.msg_controllen = sizeof buf; |
470 |
|
471 |
cmsghdr *cmsg = CMSG_FIRSTHDR (&msg); |
472 |
cmsg->cmsg_level = SOL_SOCKET; |
473 |
cmsg->cmsg_type = SCM_RIGHTS; |
474 |
cmsg->cmsg_len = 100; |
475 |
|
476 |
*(int *)CMSG_DATA (cmsg) = 5; |
477 |
|
478 |
return sendmsg (3, &msg, 0); |
479 |
} |
480 |
],[can_pass_fds=yes],[can_pass_fds=no])]) |
481 |
if test x$can_pass_fds = xyes; then |
482 |
AC_DEFINE(HAVE_UNIX_FDPASS, 1, Define if sys/socket.h defines the necessary macros/functions for file handle passing) |
483 |
else |
484 |
AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability]) |
485 |
fi |
486 |
]) |
487 |
|
488 |
AC_DEFUN([TTY_GROUP_CHECK], |
489 |
[ |
490 |
AC_CACHE_CHECK([for tty group], tty_group, |
491 |
[AC_TRY_RUN([ |
492 |
#include <sys/types.h> |
493 |
#include <sys/stat.h> |
494 |
#include <unistd.h> |
495 |
#include <grp.h> |
496 |
|
497 |
main() |
498 |
{ |
499 |
struct stat st; |
500 |
struct group *gr; |
501 |
char *tty; |
502 |
gr = getgrnam("tty"); |
503 |
tty = ttyname(0); |
504 |
if (gr != 0 |
505 |
&& tty != 0 |
506 |
&& (stat(tty, &st)) == 0 |
507 |
&& st.st_gid == gr->gr_gid) |
508 |
return 0; |
509 |
else |
510 |
return 1; |
511 |
}], |
512 |
[tty_group=yes],[tty_group=no],[tty_group=no])]) |
513 |
if test x$tty_group = xyes; then |
514 |
AC_DEFINE(TTY_GID_SUPPORT, 1, "") |
515 |
fi]) |
516 |
|