|
|
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 \ |
6 | libutil.h \ |
9 | libutil.h \ |
7 | sys/ioctl.h \ |
10 | sys/ioctl.h \ |
8 | sys/stropts.h \ |
11 | sys/stropts.h \ |
|
|
12 | stropts.h \ |
9 | ) |
13 | ) |
10 | |
14 | |
11 | AC_CHECK_FUNCS( \ |
15 | AC_CHECK_FUNCS( \ |
12 | revoke \ |
16 | revoke \ |
13 | _getpty \ |
17 | _getpty \ |
14 | getpt \ |
18 | getpt \ |
15 | posix_openpt \ |
19 | posix_openpt \ |
16 | isastream \ |
20 | isastream \ |
|
|
21 | setuid \ |
|
|
22 | seteuid \ |
|
|
23 | setreuid \ |
|
|
24 | setresuid \ |
17 | ) |
25 | ) |
18 | |
26 | |
19 | have_clone=no |
27 | have_clone=no |
20 | |
28 | |
21 | AC_MSG_CHECKING(for /dev/ptym/clone) |
29 | AC_MSG_CHECKING(for /dev/ptym/clone) |
… | |
… | |
56 | ;; |
64 | ;; |
57 | esac |
65 | esac |
58 | |
66 | |
59 | if test x$ac_cv_func_getpt = xyes -o x$ac_cv_func_posix_openpt = xyes -o x$have_clone = xyes; then |
67 | if test x$ac_cv_func_getpt = xyes -o x$ac_cv_func_posix_openpt = xyes -o x$have_clone = xyes; then |
60 | AC_MSG_CHECKING(for UNIX98 ptys) |
68 | AC_MSG_CHECKING(for UNIX98 ptys) |
61 | AC_TRY_LINK([#include <stdlib.h>], |
69 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>]], |
62 | [grantpt(0);unlockpt(0);ptsname(0);], |
70 | [[grantpt(0);unlockpt(0);ptsname(0);]])], |
63 | [unix98_pty=yes |
71 | [unix98_pty=yes |
64 | AC_DEFINE(UNIX98_PTY, 1, "") |
72 | AC_DEFINE(UNIX98_PTY, 1, "") |
65 | AC_MSG_RESULT(yes)], |
73 | AC_MSG_RESULT(yes)], |
66 | [AC_MSG_RESULT(no)]) |
74 | [AC_MSG_RESULT(no)]) |
67 | fi |
75 | fi |
… | |
… | |
71 | fi |
79 | fi |
72 | ]) |
80 | ]) |
73 | |
81 | |
74 | AC_DEFUN([UTMP_CHECK], |
82 | AC_DEFUN([UTMP_CHECK], |
75 | [ |
83 | [ |
|
|
84 | support_utmp=yes |
|
|
85 | support_wtmp=yes |
|
|
86 | support_lastlog=yes |
|
|
87 | |
|
|
88 | AC_ARG_ENABLE(utmp, |
|
|
89 | [AS_HELP_STRING([--enable-utmp],[enable utmp (utmpx) support])], |
|
|
90 | [if test x$enableval = xyes -o x$enableval = xno; then |
|
|
91 | support_utmp=$enableval |
|
|
92 | fi]) |
|
|
93 | |
|
|
94 | AC_ARG_ENABLE(wtmp, |
|
|
95 | [AS_HELP_STRING([--enable-wtmp],[enable wtmp (wtmpx) support (requires --enable-utmp)])], |
|
|
96 | [if test x$enableval = xyes -o x$enableval = xno; then |
|
|
97 | support_wtmp=$enableval |
|
|
98 | fi]) |
|
|
99 | |
|
|
100 | AC_ARG_ENABLE(lastlog, |
|
|
101 | [AS_HELP_STRING([--enable-lastlog],[enable lastlog support (requires --enable-utmp)])], |
|
|
102 | [if test x$enableval = xyes -o x$enableval = xno; then |
|
|
103 | support_lastlog=$enableval |
|
|
104 | fi]) |
|
|
105 | |
|
|
106 | if test x$support_utmp = xyes; then |
|
|
107 | AC_DEFINE(UTMP_SUPPORT, 1, Define if you want to have utmp/utmpx support) |
|
|
108 | fi |
|
|
109 | if test x$support_wtmp = xyes; then |
|
|
110 | AC_DEFINE(WTMP_SUPPORT, 1, Define if you want to have wtmp support when utmp/utmpx is enabled) |
|
|
111 | fi |
|
|
112 | if test x$support_lastlog = xyes; then |
|
|
113 | AC_DEFINE(LASTLOG_SUPPORT, 1, Define if you want to have lastlog support when utmp/utmpx is enabled) |
|
|
114 | fi |
|
|
115 | |
76 | AC_CHECK_FUNCS( \ |
116 | AC_CHECK_FUNCS( \ |
77 | ttyslot \ |
|
|
78 | updwtmp \ |
117 | updwtmp \ |
79 | updwtmpx \ |
118 | updwtmpx \ |
|
|
119 | updlastlogx \ |
80 | ) |
120 | ) |
81 | |
121 | |
82 | AC_CHECK_HEADERS( \ |
122 | AC_CHECK_HEADERS(lastlog.h) |
83 | utmp.h \ |
|
|
84 | utmpx.h \ |
|
|
85 | lastlog.h \ |
|
|
86 | ) |
|
|
87 | |
123 | |
88 | dnl# -------------------------------------------------------------------------- |
124 | dnl# -------------------------------------------------------------------------- |
89 | dnl# DO ALL UTMP AND WTMP CHECKING |
125 | dnl# DO ALL UTMP AND WTMP CHECKING |
90 | dnl# -------------------------------------------------------------------------- |
126 | dnl# -------------------------------------------------------------------------- |
91 | dnl# check for host field in utmp structure |
127 | dnl# check for host field in utmp structure |
92 | |
128 | |
93 | dnl# -------------------------------------------- |
129 | dnl# -------------------------------------------- |
94 | AC_CHECK_HEADER(utmp.h, |
130 | AC_CHECK_HEADERS(utmp.h, |
95 | [AC_CACHE_CHECK([for struct utmp], struct_utmp, |
131 | [AC_CACHE_CHECK([for struct utmp], struct_utmp, |
96 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
132 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
97 | #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])]) |
98 | if test x$struct_utmp = xyes; then |
134 | if test x$struct_utmp = xyes; then |
99 | 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) |
… | |
… | |
111 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
147 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
112 | #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])]) |
113 | if test x$struct_utmp_pid = xyes; then |
149 | if test x$struct_utmp_pid = xyes; then |
114 | 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) |
115 | fi |
151 | fi |
116 | ) dnl# AC_CHECK_HEADER(utmp.h |
152 | ) dnl# AC_CHECK_HEADERS(utmp.h |
117 | |
153 | |
118 | dnl# -------------------------------------------- |
154 | dnl# -------------------------------------------- |
119 | |
155 | |
120 | AC_CHECK_HEADER(utmpx.h, |
156 | AC_CHECK_HEADERS(utmpx.h, |
121 | [AC_CACHE_CHECK([for struct utmpx], struct_utmpx, |
157 | [AC_CACHE_CHECK([for struct utmpx], struct_utmpx, |
122 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
158 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
123 | #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])]) |
124 | if test x$struct_utmpx = xyes; then |
160 | if test x$struct_utmpx = xyes; then |
125 | 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) |
… | |
… | |
132 | if test x$struct_utmpx_host = xyes; then |
168 | if test x$struct_utmpx_host = xyes; then |
133 | 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) |
134 | fi |
170 | fi |
135 | |
171 | |
136 | AC_CACHE_CHECK(for session in utmpx struct, struct_utmpx_session, |
172 | AC_CACHE_CHECK(for session in utmpx struct, struct_utmpx_session, |
137 | [AC_TRY_COMPILE([#include <sys/types.h> |
173 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
138 | #include <utmpx.h>], |
174 | #include <utmpx.h>]], [[struct utmpx utx; utx.ut_session;]])],[struct_utmpx_session=yes],[struct_utmpx_session=no])]) |
139 | [struct utmpx utx; utx.ut_session;], |
|
|
140 | struct_utmpx_session=yes, struct_utmpx_session=no)]) |
|
|
141 | if test x$struct_utmpx_session = xyes; then |
175 | if test x$struct_utmpx_session = xyes; then |
142 | 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) |
143 | fi |
177 | fi |
144 | ) dnl# AC_CHECK_HEADER(utmpx.h |
178 | ) dnl# AC_CHECK_HEADERS(utmpx.h |
145 | |
179 | |
146 | dnl# -------------------------------------------------------------------------- |
180 | dnl# -------------------------------------------------------------------------- |
147 | dnl# check for struct lastlog |
181 | dnl# check for struct lastlog |
148 | AC_CACHE_CHECK(for struct lastlog, struct_lastlog, |
182 | AC_CACHE_CHECK(for struct lastlog, struct_lastlog, |
149 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
183 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
… | |
… | |
173 | dnl# -------------------------------------------------------------------------- |
207 | dnl# -------------------------------------------------------------------------- |
174 | |
208 | |
175 | dnl# find utmp |
209 | dnl# find utmp |
176 | AC_CACHE_CHECK(where utmp is located, path_utmp, |
210 | AC_CACHE_CHECK(where utmp is located, path_utmp, |
177 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
211 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
212 | #include <stdlib.h> |
178 | #include <sys/types.h> |
213 | #include <sys/types.h> |
179 | #include <utmp.h> |
214 | #include <utmp.h> |
180 | #include <errno.h> |
215 | #include <errno.h> |
181 | main() |
216 | main() |
182 | { |
217 | { |
… | |
… | |
209 | |
244 | |
210 | dnl# find utmpx - if a utmp file exists at the same location and is more than |
245 | 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. |
246 | dnl# a day newer, then dump the utmpx. People leave lots of junk around. |
212 | AC_CACHE_CHECK(where utmpx is located, path_utmpx, |
247 | AC_CACHE_CHECK(where utmpx is located, path_utmpx, |
213 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
248 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
249 | #include <stdlib.h> |
214 | #include <sys/types.h> |
250 | #include <sys/types.h> |
215 | #include <utmpx.h> |
251 | #include <utmpx.h> |
216 | #include <errno.h> |
252 | #include <errno.h> |
217 | #include <sys/stat.h> |
253 | #include <sys/stat.h> |
218 | #ifdef HAVE_STRING_H |
254 | #ifdef HAVE_STRING_H |
… | |
… | |
254 | dnl# -------------------------------------------------------------------------- |
290 | dnl# -------------------------------------------------------------------------- |
255 | |
291 | |
256 | dnl# find wtmp |
292 | dnl# find wtmp |
257 | AC_CACHE_CHECK(where wtmp is located, path_wtmp, |
293 | AC_CACHE_CHECK(where wtmp is located, path_wtmp, |
258 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
294 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
295 | #include <stdlib.h> |
259 | #include <sys/types.h> |
296 | #include <sys/types.h> |
260 | #ifdef HAVE_UTMP_H |
297 | #ifdef HAVE_UTMP_H |
261 | #include <utmp.h> |
298 | #include <utmp.h> |
262 | #endif |
299 | #endif |
263 | #include <errno.h> |
300 | #include <errno.h> |
264 | main() |
301 | main() |
265 | { |
302 | { |
266 | char **w, *wtmplist[] = { |
303 | char **w, *wtmplist[] = { |
267 | "/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 }; |
268 | FILE *a, *f=fopen("conftestval", "w"); |
305 | FILE *a, *f=fopen("conftestval", "w"); |
269 | if (!f) exit(1); |
306 | if (!f) exit(1); |
270 | #ifdef WTMP_FILE |
307 | #ifdef WTMP_FILE |
271 | fprintf(f, "%s\n", WTMP_FILE); |
308 | fprintf(f, "%s\n", WTMP_FILE); |
272 | exit(0); |
309 | exit(0); |
… | |
… | |
290 | dnl# -------------------------------------------------------------------------- |
327 | dnl# -------------------------------------------------------------------------- |
291 | |
328 | |
292 | dnl# find wtmpx |
329 | dnl# find wtmpx |
293 | AC_CACHE_CHECK(where wtmpx is located, path_wtmpx, |
330 | AC_CACHE_CHECK(where wtmpx is located, path_wtmpx, |
294 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
331 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
332 | #include <stdlib.h> |
295 | #ifdef HAVE_UTMPX_H |
333 | #ifdef HAVE_UTMPX_H |
296 | #include <utmpx.h> |
334 | #include <utmpx.h> |
297 | #endif |
335 | #endif |
298 | #include <errno.h> |
336 | #include <errno.h> |
299 | main() |
337 | main() |
300 | { |
338 | { |
301 | char **w, *wtmplist[] = { |
339 | char **w, *wtmplist[] = { |
302 | "/var/log/wtmpx", "/var/adm/wtmpx", NULL }; |
340 | "/var/log/wtmpx", "/var/adm/wtmpx", NULL }; |
303 | FILE *a, *f=fopen("conftestval", "w"); |
341 | FILE *a, *f=fopen("conftestval", "w"); |
304 | if (!f) exit(1); |
342 | if (!f) exit(1); |
305 | #ifdef WTMPX_FILE |
343 | #ifdef WTMPX_FILE |
306 | fprintf(f, "%s\n", WTMPX_FILE); |
344 | fprintf(f, "%s\n", WTMPX_FILE); |
307 | exit(0); |
345 | exit(0); |
… | |
… | |
325 | dnl# -------------------------------------------------------------------------- |
363 | dnl# -------------------------------------------------------------------------- |
326 | |
364 | |
327 | dnl# find lastlog |
365 | dnl# find lastlog |
328 | AC_CACHE_CHECK(where lastlog is located, path_lastlog, |
366 | AC_CACHE_CHECK(where lastlog is located, path_lastlog, |
329 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
367 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
368 | #include <stdlib.h> |
330 | #include <sys/types.h> |
369 | #include <sys/types.h> |
331 | #ifdef HAVE_UTMPX_H |
370 | #ifdef HAVE_UTMPX_H |
332 | #include <utmpx.h> |
371 | #include <utmpx.h> |
333 | #elif defined(HAVE_UTMP_H) |
372 | #elif defined(HAVE_UTMP_H) |
334 | #include <utmp.h> |
373 | #include <utmp.h> |
… | |
… | |
359 | exit(0); |
398 | exit(0); |
360 | }]])],[path_lastlog=`cat conftestval`],[path_lastlog=],[dnl |
399 | }]])],[path_lastlog=`cat conftestval`],[path_lastlog=],[dnl |
361 | AC_MSG_WARN(Define LASTLOG_FILE in config.h manually)])]) |
400 | AC_MSG_WARN(Define LASTLOG_FILE in config.h manually)])]) |
362 | if test x$path_lastlog != x; then |
401 | if test x$path_lastlog != x; then |
363 | AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$path_lastlog", Define location of lastlog) |
402 | AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$path_lastlog", Define location of lastlog) |
364 | if test -d "$path_lastlog"; then |
|
|
365 | AC_DEFINE(LASTLOG_IS_DIR, 1, Define if lastlog is provided via a directory) |
|
|
366 | fi |
|
|
367 | fi |
403 | fi |
368 | dnl# -------------------------------------------------------------------------- |
404 | dnl# -------------------------------------------------------------------------- |
369 | |
405 | |
370 | dnl# find lastlogx |
406 | dnl# find lastlogx |
371 | AC_CACHE_CHECK(where lastlogx is located, path_lastlogx, |
407 | AC_CACHE_CHECK(where lastlogx is located, path_lastlogx, |
372 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
408 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
409 | #include <stdlib.h> |
373 | #ifdef HAVE_UTMPX_H |
410 | #ifdef HAVE_UTMPX_H |
374 | #include <utmpx.h> |
411 | #include <utmpx.h> |
375 | #endif |
412 | #endif |
376 | #include <errno.h> |
413 | #include <errno.h> |
377 | main() |
414 | main() |
… | |
… | |
402 | ]) |
439 | ]) |
403 | |
440 | |
404 | AC_DEFUN([SCM_RIGHTS_CHECK], |
441 | AC_DEFUN([SCM_RIGHTS_CHECK], |
405 | [ |
442 | [ |
406 | AC_CACHE_CHECK(for unix-compliant filehandle passing ability, can_pass_fds, |
443 | AC_CACHE_CHECK(for unix-compliant filehandle passing ability, can_pass_fds, |
407 | [AC_TRY_LINK([ |
444 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
408 | #include <cstddef> // broken bsds (is that redundant) need this |
445 | #include <cstddef> // broken bsds (is that redundant?) need this |
409 | #include <sys/types.h> |
446 | #include <sys/types.h> |
410 | #include <sys/socket.h> |
447 | #include <sys/socket.h> |
411 | #include <sys/uio.h> |
448 | #include <sys/uio.h> |
412 | ],[ |
449 | ]], [[ |
413 | { |
450 | { |
414 | msghdr msg; |
451 | msghdr msg; |
415 | iovec iov; |
452 | iovec iov; |
416 | char buf [100]; |
453 | char buf [100]; |
417 | char data = 0; |
454 | char data = 0; |
… | |
… | |
431 | |
468 | |
432 | *(int *)CMSG_DATA (cmsg) = 5; |
469 | *(int *)CMSG_DATA (cmsg) = 5; |
433 | |
470 | |
434 | return sendmsg (3, &msg, 0); |
471 | return sendmsg (3, &msg, 0); |
435 | } |
472 | } |
436 | ],[can_pass_fds=yes],[can_pass_fds=no])]) |
473 | ]])],[can_pass_fds=yes],[can_pass_fds=no])]) |
437 | if test x$can_pass_fds = xyes; then |
474 | if test x$can_pass_fds = xyes; then |
438 | 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) |
439 | else |
476 | else |
440 | AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability]) |
477 | AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability]) |
441 | fi |
478 | fi |
442 | ]) |
479 | ]) |
|
|
480 | |
|
|
481 | AC_DEFUN([TTY_GROUP_CHECK], |
|
|
482 | [ |
|
|
483 | AC_CACHE_CHECK([for tty group], tty_group, |
|
|
484 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
|
|
485 | #include <sys/types.h> |
|
|
486 | #include <sys/stat.h> |
|
|
487 | #include <unistd.h> |
|
|
488 | #include <grp.h> |
|
|
489 | |
|
|
490 | main() |
|
|
491 | { |
|
|
492 | struct stat st; |
|
|
493 | struct group *gr; |
|
|
494 | char *tty; |
|
|
495 | gr = getgrnam("tty"); |
|
|
496 | tty = ttyname(0); |
|
|
497 | if (gr != 0 |
|
|
498 | && tty != 0 |
|
|
499 | && (stat(tty, &st)) == 0 |
|
|
500 | && st.st_gid == gr->gr_gid) |
|
|
501 | return 0; |
|
|
502 | else |
|
|
503 | return 1; |
|
|
504 | }]])],[tty_group=yes],[tty_group=no],[tty_group=no])]) |
|
|
505 | if test x$tty_group = xyes; then |
|
|
506 | AC_DEFINE(TTY_GID_SUPPORT, 1, "") |
|
|
507 | fi]) |
|
|
508 | |