|
|
1 | dnl this file is part of libptytty, do not make local modifications |
|
|
2 | dnl http://software.schmorp.de/pkg/libptytty |
|
|
3 | |
1 | AC_DEFUN([PTY_CHECK], |
4 | AC_DEFUN([PTY_CHECK], |
2 | [ |
5 | [ |
3 | AC_CHECK_HEADERS( \ |
6 | AC_CHECK_HEADERS( \ |
4 | pty.h \ |
7 | pty.h \ |
5 | util.h \ |
8 | util.h \ |
… | |
… | |
12 | revoke \ |
15 | revoke \ |
13 | _getpty \ |
16 | _getpty \ |
14 | getpt \ |
17 | getpt \ |
15 | posix_openpt \ |
18 | posix_openpt \ |
16 | isastream \ |
19 | isastream \ |
|
|
20 | setuid \ |
|
|
21 | seteuid \ |
|
|
22 | setreuid \ |
|
|
23 | setresuid \ |
17 | ) |
24 | ) |
18 | |
25 | |
19 | have_clone=no |
26 | have_clone=no |
20 | |
27 | |
21 | AC_MSG_CHECKING(for /dev/ptym/clone) |
28 | AC_MSG_CHECKING(for /dev/ptym/clone) |
… | |
… | |
71 | fi |
78 | fi |
72 | ]) |
79 | ]) |
73 | |
80 | |
74 | AC_DEFUN([UTMP_CHECK], |
81 | AC_DEFUN([UTMP_CHECK], |
75 | [ |
82 | [ |
|
|
83 | support_utmp=yes |
|
|
84 | support_wtmp=yes |
|
|
85 | support_lastlog=yes |
|
|
86 | |
|
|
87 | AC_ARG_ENABLE(utmp, |
|
|
88 | [ --enable-utmp enable utmp (utmpx) support], |
|
|
89 | [if test x$enableval = xyes -o x$enableval = xno; then |
|
|
90 | support_utmp=$enableval |
|
|
91 | fi]) |
|
|
92 | |
|
|
93 | AC_ARG_ENABLE(wtmp, |
|
|
94 | [ --enable-wtmp enable wtmp (wtmpx) support (requires --enable-utmp)], |
|
|
95 | [if test x$enableval = xyes -o x$enableval = xno; then |
|
|
96 | support_wtmp=$enableval |
|
|
97 | fi]) |
|
|
98 | |
|
|
99 | AC_ARG_ENABLE(lastlog, |
|
|
100 | [ --enable-lastlog enable lastlog support (requires --enable-utmp)], |
|
|
101 | [if test x$enableval = xyes -o x$enableval = xno; then |
|
|
102 | support_lastlog=$enableval |
|
|
103 | fi]) |
|
|
104 | |
|
|
105 | if test x$support_utmp = xyes; then |
|
|
106 | AC_DEFINE(UTMP_SUPPORT, 1, Define if you want to have utmp/utmpx support) |
|
|
107 | fi |
|
|
108 | if test x$support_wtmp = xyes; then |
|
|
109 | AC_DEFINE(WTMP_SUPPORT, 1, Define if you want to have wtmp support when utmp/utmpx is enabled) |
|
|
110 | fi |
|
|
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) |
|
|
113 | fi |
|
|
114 | |
76 | AC_CHECK_FUNCS( \ |
115 | AC_CHECK_FUNCS( \ |
77 | ttyslot \ |
116 | ttyslot \ |
78 | updwtmp \ |
117 | updwtmp \ |
79 | updwtmpx \ |
118 | updwtmpx \ |
80 | ) |
119 | ) |
… | |
… | |
173 | dnl# -------------------------------------------------------------------------- |
212 | dnl# -------------------------------------------------------------------------- |
174 | |
213 | |
175 | dnl# find utmp |
214 | dnl# find utmp |
176 | AC_CACHE_CHECK(where utmp is located, path_utmp, |
215 | AC_CACHE_CHECK(where utmp is located, path_utmp, |
177 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
216 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
217 | #include <stdlib.h> |
178 | #include <sys/types.h> |
218 | #include <sys/types.h> |
179 | #include <utmp.h> |
219 | #include <utmp.h> |
180 | #include <errno.h> |
220 | #include <errno.h> |
181 | main() |
221 | main() |
182 | { |
222 | { |
… | |
… | |
209 | |
249 | |
210 | dnl# find utmpx - if a utmp file exists at the same location and is more than |
250 | dnl# find utmpx - if a utmp file exists at the same location and is more than |
211 | dnl# a day newer, then dump the utmpx. People leave lots of junk around. |
251 | dnl# a day newer, then dump the utmpx. People leave lots of junk around. |
212 | AC_CACHE_CHECK(where utmpx is located, path_utmpx, |
252 | AC_CACHE_CHECK(where utmpx is located, path_utmpx, |
213 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
253 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
254 | #include <stdlib.h> |
214 | #include <sys/types.h> |
255 | #include <sys/types.h> |
215 | #include <utmpx.h> |
256 | #include <utmpx.h> |
216 | #include <errno.h> |
257 | #include <errno.h> |
217 | #include <sys/stat.h> |
258 | #include <sys/stat.h> |
218 | #ifdef HAVE_STRING_H |
259 | #ifdef HAVE_STRING_H |
… | |
… | |
254 | dnl# -------------------------------------------------------------------------- |
295 | dnl# -------------------------------------------------------------------------- |
255 | |
296 | |
256 | dnl# find wtmp |
297 | dnl# find wtmp |
257 | AC_CACHE_CHECK(where wtmp is located, path_wtmp, |
298 | AC_CACHE_CHECK(where wtmp is located, path_wtmp, |
258 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
299 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
300 | #include <stdlib.h> |
259 | #include <sys/types.h> |
301 | #include <sys/types.h> |
260 | #ifdef HAVE_UTMP_H |
302 | #ifdef HAVE_UTMP_H |
261 | #include <utmp.h> |
303 | #include <utmp.h> |
262 | #endif |
304 | #endif |
263 | #include <errno.h> |
305 | #include <errno.h> |
264 | main() |
306 | main() |
265 | { |
307 | { |
266 | char **w, *wtmplist[] = { |
308 | char **w, *wtmplist[] = { |
267 | "/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp", NULL }; |
309 | "/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp", NULL }; |
268 | FILE *a, *f=fopen("conftestval", "w"); |
310 | FILE *a, *f=fopen("conftestval", "w"); |
269 | if (!f) exit(1); |
311 | if (!f) exit(1); |
270 | #ifdef WTMP_FILE |
312 | #ifdef WTMP_FILE |
271 | fprintf(f, "%s\n", WTMP_FILE); |
313 | fprintf(f, "%s\n", WTMP_FILE); |
272 | exit(0); |
314 | exit(0); |
… | |
… | |
290 | dnl# -------------------------------------------------------------------------- |
332 | dnl# -------------------------------------------------------------------------- |
291 | |
333 | |
292 | dnl# find wtmpx |
334 | dnl# find wtmpx |
293 | AC_CACHE_CHECK(where wtmpx is located, path_wtmpx, |
335 | AC_CACHE_CHECK(where wtmpx is located, path_wtmpx, |
294 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
336 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
337 | #include <stdlib.h> |
295 | #ifdef HAVE_UTMPX_H |
338 | #ifdef HAVE_UTMPX_H |
296 | #include <utmpx.h> |
339 | #include <utmpx.h> |
297 | #endif |
340 | #endif |
298 | #include <errno.h> |
341 | #include <errno.h> |
299 | main() |
342 | main() |
300 | { |
343 | { |
301 | char **w, *wtmplist[] = { |
344 | char **w, *wtmplist[] = { |
302 | "/var/log/wtmpx", "/var/adm/wtmpx", NULL }; |
345 | "/var/log/wtmpx", "/var/adm/wtmpx", NULL }; |
303 | FILE *a, *f=fopen("conftestval", "w"); |
346 | FILE *a, *f=fopen("conftestval", "w"); |
304 | if (!f) exit(1); |
347 | if (!f) exit(1); |
305 | #ifdef WTMPX_FILE |
348 | #ifdef WTMPX_FILE |
306 | fprintf(f, "%s\n", WTMPX_FILE); |
349 | fprintf(f, "%s\n", WTMPX_FILE); |
307 | exit(0); |
350 | exit(0); |
… | |
… | |
325 | dnl# -------------------------------------------------------------------------- |
368 | dnl# -------------------------------------------------------------------------- |
326 | |
369 | |
327 | dnl# find lastlog |
370 | dnl# find lastlog |
328 | AC_CACHE_CHECK(where lastlog is located, path_lastlog, |
371 | AC_CACHE_CHECK(where lastlog is located, path_lastlog, |
329 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
372 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
373 | #include <stdlib.h> |
330 | #include <sys/types.h> |
374 | #include <sys/types.h> |
331 | #ifdef HAVE_UTMPX_H |
375 | #ifdef HAVE_UTMPX_H |
332 | #include <utmpx.h> |
376 | #include <utmpx.h> |
333 | #elif defined(HAVE_UTMP_H) |
377 | #elif defined(HAVE_UTMP_H) |
334 | #include <utmp.h> |
378 | #include <utmp.h> |
… | |
… | |
368 | dnl# -------------------------------------------------------------------------- |
412 | dnl# -------------------------------------------------------------------------- |
369 | |
413 | |
370 | dnl# find lastlogx |
414 | dnl# find lastlogx |
371 | AC_CACHE_CHECK(where lastlogx is located, path_lastlogx, |
415 | AC_CACHE_CHECK(where lastlogx is located, path_lastlogx, |
372 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
416 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
417 | #include <stdlib.h> |
373 | #ifdef HAVE_UTMPX_H |
418 | #ifdef HAVE_UTMPX_H |
374 | #include <utmpx.h> |
419 | #include <utmpx.h> |
375 | #endif |
420 | #endif |
376 | #include <errno.h> |
421 | #include <errno.h> |
377 | main() |
422 | main() |
… | |
… | |
403 | |
448 | |
404 | AC_DEFUN([SCM_RIGHTS_CHECK], |
449 | AC_DEFUN([SCM_RIGHTS_CHECK], |
405 | [ |
450 | [ |
406 | AC_CACHE_CHECK(for unix-compliant filehandle passing ability, can_pass_fds, |
451 | AC_CACHE_CHECK(for unix-compliant filehandle passing ability, can_pass_fds, |
407 | [AC_TRY_LINK([ |
452 | [AC_TRY_LINK([ |
408 | #include <cstddef> // broken bsds (is that redundant) need this |
453 | #include <cstddef> // broken bsds (is that redundant?) need this |
409 | #include <sys/types.h> |
454 | #include <sys/types.h> |
410 | #include <sys/socket.h> |
455 | #include <sys/socket.h> |
411 | #include <sys/uio.h> |
456 | #include <sys/uio.h> |
412 | ],[ |
457 | ],[ |
413 | { |
458 | { |
… | |
… | |
438 | AC_DEFINE(HAVE_UNIX_FDPASS, 1, Define if sys/socket.h defines the necessary macros/functions for file handle passing) |
483 | AC_DEFINE(HAVE_UNIX_FDPASS, 1, Define if sys/socket.h defines the necessary macros/functions for file handle passing) |
439 | else |
484 | else |
440 | AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability]) |
485 | AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability]) |
441 | fi |
486 | fi |
442 | ]) |
487 | ]) |
|
|
488 | |
|
|
489 | AC_DEFUN([TTY_GROUP_CHECK], |
|
|
490 | [ |
|
|
491 | AC_CACHE_CHECK([for tty group], tty_group, |
|
|
492 | [AC_TRY_RUN([ |
|
|
493 | #include <sys/types.h> |
|
|
494 | #include <sys/stat.h> |
|
|
495 | #include <unistd.h> |
|
|
496 | #include <grp.h> |
|
|
497 | |
|
|
498 | main() |
|
|
499 | { |
|
|
500 | struct stat st; |
|
|
501 | struct group *gr; |
|
|
502 | char *tty; |
|
|
503 | gr = getgrnam("tty"); |
|
|
504 | tty = ttyname(0); |
|
|
505 | if (gr != 0 |
|
|
506 | && tty != 0 |
|
|
507 | && (stat(tty, &st)) == 0 |
|
|
508 | && st.st_gid == gr->gr_gid) |
|
|
509 | return 0; |
|
|
510 | else |
|
|
511 | return 1; |
|
|
512 | }], |
|
|
513 | [tty_group=yes],[tty_group=no],[tty_group=no])]) |
|
|
514 | if test x$tty_group = xyes; then |
|
|
515 | AC_DEFINE(TTY_GID_SUPPORT, 1, "") |
|
|
516 | fi]) |
|
|
517 | |