|
|
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 | [AS_HELP_STRING([--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 | [AS_HELP_STRING([--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 | [AS_HELP_STRING([--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 \ |
|
|
78 | updwtmp \ |
116 | updwtmp \ |
79 | updwtmpx \ |
117 | updwtmpx \ |
|
|
118 | updlastlogx \ |
80 | ) |
119 | ) |
81 | |
120 | |
82 | AC_CHECK_HEADERS( \ |
121 | AC_CHECK_HEADERS(lastlog.h) |
83 | utmp.h \ |
|
|
84 | utmpx.h \ |
|
|
85 | lastlog.h \ |
|
|
86 | ) |
|
|
87 | |
122 | |
88 | dnl# -------------------------------------------------------------------------- |
123 | dnl# -------------------------------------------------------------------------- |
89 | dnl# DO ALL UTMP AND WTMP CHECKING |
124 | dnl# DO ALL UTMP AND WTMP CHECKING |
90 | dnl# -------------------------------------------------------------------------- |
125 | dnl# -------------------------------------------------------------------------- |
91 | dnl# check for host field in utmp structure |
126 | dnl# check for host field in utmp structure |
92 | |
127 | |
93 | dnl# -------------------------------------------- |
128 | dnl# -------------------------------------------- |
94 | AC_CHECK_HEADER(utmp.h, |
129 | AC_CHECK_HEADERS(utmp.h, |
95 | [AC_CACHE_CHECK([for struct utmp], struct_utmp, |
130 | [AC_CACHE_CHECK([for struct utmp], struct_utmp, |
96 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
131 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
97 | #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])]) |
98 | if test x$struct_utmp = xyes; then |
133 | if test x$struct_utmp = xyes; then |
99 | 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) |
… | |
… | |
111 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
146 | [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])]) |
147 | #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 |
148 | if test x$struct_utmp_pid = xyes; then |
114 | 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) |
115 | fi |
150 | fi |
116 | ) dnl# AC_CHECK_HEADER(utmp.h |
151 | ) dnl# AC_CHECK_HEADERS(utmp.h |
117 | |
152 | |
118 | dnl# -------------------------------------------- |
153 | dnl# -------------------------------------------- |
119 | |
154 | |
120 | AC_CHECK_HEADER(utmpx.h, |
155 | AC_CHECK_HEADERS(utmpx.h, |
121 | [AC_CACHE_CHECK([for struct utmpx], struct_utmpx, |
156 | [AC_CACHE_CHECK([for struct utmpx], struct_utmpx, |
122 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
157 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
123 | #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])]) |
124 | if test x$struct_utmpx = xyes; then |
159 | if test x$struct_utmpx = xyes; then |
125 | 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) |
… | |
… | |
139 | [struct utmpx utx; utx.ut_session;], |
174 | [struct utmpx utx; utx.ut_session;], |
140 | struct_utmpx_session=yes, struct_utmpx_session=no)]) |
175 | struct_utmpx_session=yes, struct_utmpx_session=no)]) |
141 | if test x$struct_utmpx_session = xyes; then |
176 | if test x$struct_utmpx_session = xyes; then |
142 | AC_DEFINE(HAVE_UTMPX_SESSION, 1, Define if struct utmpx contains ut_session) |
177 | AC_DEFINE(HAVE_UTMPX_SESSION, 1, Define if struct utmpx contains ut_session) |
143 | fi |
178 | fi |
144 | ) dnl# AC_CHECK_HEADER(utmpx.h |
179 | ) dnl# AC_CHECK_HEADERS(utmpx.h |
145 | |
180 | |
146 | dnl# -------------------------------------------------------------------------- |
181 | dnl# -------------------------------------------------------------------------- |
147 | dnl# check for struct lastlog |
182 | dnl# check for struct lastlog |
148 | AC_CACHE_CHECK(for struct lastlog, struct_lastlog, |
183 | AC_CACHE_CHECK(for struct lastlog, struct_lastlog, |
149 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
184 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
… | |
… | |
173 | dnl# -------------------------------------------------------------------------- |
208 | dnl# -------------------------------------------------------------------------- |
174 | |
209 | |
175 | dnl# find utmp |
210 | dnl# find utmp |
176 | AC_CACHE_CHECK(where utmp is located, path_utmp, |
211 | AC_CACHE_CHECK(where utmp is located, path_utmp, |
177 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
212 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
213 | #include <stdlib.h> |
178 | #include <sys/types.h> |
214 | #include <sys/types.h> |
179 | #include <utmp.h> |
215 | #include <utmp.h> |
180 | #include <errno.h> |
216 | #include <errno.h> |
181 | main() |
217 | main() |
182 | { |
218 | { |
… | |
… | |
209 | |
245 | |
210 | dnl# find utmpx - if a utmp file exists at the same location and is more than |
246 | 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. |
247 | dnl# a day newer, then dump the utmpx. People leave lots of junk around. |
212 | AC_CACHE_CHECK(where utmpx is located, path_utmpx, |
248 | AC_CACHE_CHECK(where utmpx is located, path_utmpx, |
213 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
249 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
250 | #include <stdlib.h> |
214 | #include <sys/types.h> |
251 | #include <sys/types.h> |
215 | #include <utmpx.h> |
252 | #include <utmpx.h> |
216 | #include <errno.h> |
253 | #include <errno.h> |
217 | #include <sys/stat.h> |
254 | #include <sys/stat.h> |
218 | #ifdef HAVE_STRING_H |
255 | #ifdef HAVE_STRING_H |
… | |
… | |
254 | dnl# -------------------------------------------------------------------------- |
291 | dnl# -------------------------------------------------------------------------- |
255 | |
292 | |
256 | dnl# find wtmp |
293 | dnl# find wtmp |
257 | AC_CACHE_CHECK(where wtmp is located, path_wtmp, |
294 | AC_CACHE_CHECK(where wtmp is located, path_wtmp, |
258 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
295 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
296 | #include <stdlib.h> |
259 | #include <sys/types.h> |
297 | #include <sys/types.h> |
260 | #ifdef HAVE_UTMP_H |
298 | #ifdef HAVE_UTMP_H |
261 | #include <utmp.h> |
299 | #include <utmp.h> |
262 | #endif |
300 | #endif |
263 | #include <errno.h> |
301 | #include <errno.h> |
264 | main() |
302 | main() |
265 | { |
303 | { |
266 | char **w, *wtmplist[] = { |
304 | char **w, *wtmplist[] = { |
267 | "/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp", NULL }; |
305 | "/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp", NULL }; |
268 | FILE *a, *f=fopen("conftestval", "w"); |
306 | FILE *a, *f=fopen("conftestval", "w"); |
269 | if (!f) exit(1); |
307 | if (!f) exit(1); |
270 | #ifdef WTMP_FILE |
308 | #ifdef WTMP_FILE |
271 | fprintf(f, "%s\n", WTMP_FILE); |
309 | fprintf(f, "%s\n", WTMP_FILE); |
272 | exit(0); |
310 | exit(0); |
… | |
… | |
290 | dnl# -------------------------------------------------------------------------- |
328 | dnl# -------------------------------------------------------------------------- |
291 | |
329 | |
292 | dnl# find wtmpx |
330 | dnl# find wtmpx |
293 | AC_CACHE_CHECK(where wtmpx is located, path_wtmpx, |
331 | AC_CACHE_CHECK(where wtmpx is located, path_wtmpx, |
294 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
332 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
333 | #include <stdlib.h> |
295 | #ifdef HAVE_UTMPX_H |
334 | #ifdef HAVE_UTMPX_H |
296 | #include <utmpx.h> |
335 | #include <utmpx.h> |
297 | #endif |
336 | #endif |
298 | #include <errno.h> |
337 | #include <errno.h> |
299 | main() |
338 | main() |
300 | { |
339 | { |
301 | char **w, *wtmplist[] = { |
340 | char **w, *wtmplist[] = { |
302 | "/var/log/wtmpx", "/var/adm/wtmpx", NULL }; |
341 | "/var/log/wtmpx", "/var/adm/wtmpx", NULL }; |
303 | FILE *a, *f=fopen("conftestval", "w"); |
342 | FILE *a, *f=fopen("conftestval", "w"); |
304 | if (!f) exit(1); |
343 | if (!f) exit(1); |
305 | #ifdef WTMPX_FILE |
344 | #ifdef WTMPX_FILE |
306 | fprintf(f, "%s\n", WTMPX_FILE); |
345 | fprintf(f, "%s\n", WTMPX_FILE); |
307 | exit(0); |
346 | exit(0); |
… | |
… | |
325 | dnl# -------------------------------------------------------------------------- |
364 | dnl# -------------------------------------------------------------------------- |
326 | |
365 | |
327 | dnl# find lastlog |
366 | dnl# find lastlog |
328 | AC_CACHE_CHECK(where lastlog is located, path_lastlog, |
367 | AC_CACHE_CHECK(where lastlog is located, path_lastlog, |
329 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
368 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
369 | #include <stdlib.h> |
330 | #include <sys/types.h> |
370 | #include <sys/types.h> |
331 | #ifdef HAVE_UTMPX_H |
371 | #ifdef HAVE_UTMPX_H |
332 | #include <utmpx.h> |
372 | #include <utmpx.h> |
333 | #elif defined(HAVE_UTMP_H) |
373 | #elif defined(HAVE_UTMP_H) |
334 | #include <utmp.h> |
374 | #include <utmp.h> |
… | |
… | |
359 | exit(0); |
399 | exit(0); |
360 | }]])],[path_lastlog=`cat conftestval`],[path_lastlog=],[dnl |
400 | }]])],[path_lastlog=`cat conftestval`],[path_lastlog=],[dnl |
361 | AC_MSG_WARN(Define LASTLOG_FILE in config.h manually)])]) |
401 | AC_MSG_WARN(Define LASTLOG_FILE in config.h manually)])]) |
362 | if test x$path_lastlog != x; then |
402 | if test x$path_lastlog != x; then |
363 | AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$path_lastlog", Define location of lastlog) |
403 | 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 |
404 | fi |
368 | dnl# -------------------------------------------------------------------------- |
405 | dnl# -------------------------------------------------------------------------- |
369 | |
406 | |
370 | dnl# find lastlogx |
407 | dnl# find lastlogx |
371 | AC_CACHE_CHECK(where lastlogx is located, path_lastlogx, |
408 | AC_CACHE_CHECK(where lastlogx is located, path_lastlogx, |
372 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
409 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
410 | #include <stdlib.h> |
373 | #ifdef HAVE_UTMPX_H |
411 | #ifdef HAVE_UTMPX_H |
374 | #include <utmpx.h> |
412 | #include <utmpx.h> |
375 | #endif |
413 | #endif |
376 | #include <errno.h> |
414 | #include <errno.h> |
377 | main() |
415 | main() |
… | |
… | |
403 | |
441 | |
404 | AC_DEFUN([SCM_RIGHTS_CHECK], |
442 | AC_DEFUN([SCM_RIGHTS_CHECK], |
405 | [ |
443 | [ |
406 | AC_CACHE_CHECK(for unix-compliant filehandle passing ability, can_pass_fds, |
444 | AC_CACHE_CHECK(for unix-compliant filehandle passing ability, can_pass_fds, |
407 | [AC_TRY_LINK([ |
445 | [AC_TRY_LINK([ |
408 | #include <cstddef> // broken bsds (is that redundant) need this |
446 | #include <cstddef> // broken bsds (is that redundant?) need this |
409 | #include <sys/types.h> |
447 | #include <sys/types.h> |
410 | #include <sys/socket.h> |
448 | #include <sys/socket.h> |
411 | #include <sys/uio.h> |
449 | #include <sys/uio.h> |
412 | ],[ |
450 | ],[ |
413 | { |
451 | { |
… | |
… | |
438 | AC_DEFINE(HAVE_UNIX_FDPASS, 1, Define if sys/socket.h defines the necessary macros/functions for file handle passing) |
476 | AC_DEFINE(HAVE_UNIX_FDPASS, 1, Define if sys/socket.h defines the necessary macros/functions for file handle passing) |
439 | else |
477 | else |
440 | AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability]) |
478 | AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability]) |
441 | fi |
479 | fi |
442 | ]) |
480 | ]) |
|
|
481 | |
|
|
482 | AC_DEFUN([TTY_GROUP_CHECK], |
|
|
483 | [ |
|
|
484 | AC_CACHE_CHECK([for tty group], tty_group, |
|
|
485 | [AC_TRY_RUN([ |
|
|
486 | #include <sys/types.h> |
|
|
487 | #include <sys/stat.h> |
|
|
488 | #include <unistd.h> |
|
|
489 | #include <grp.h> |
|
|
490 | |
|
|
491 | main() |
|
|
492 | { |
|
|
493 | struct stat st; |
|
|
494 | struct group *gr; |
|
|
495 | char *tty; |
|
|
496 | gr = getgrnam("tty"); |
|
|
497 | tty = ttyname(0); |
|
|
498 | if (gr != 0 |
|
|
499 | && tty != 0 |
|
|
500 | && (stat(tty, &st)) == 0 |
|
|
501 | && st.st_gid == gr->gr_gid) |
|
|
502 | return 0; |
|
|
503 | else |
|
|
504 | return 1; |
|
|
505 | }], |
|
|
506 | [tty_group=yes],[tty_group=no],[tty_group=no])]) |
|
|
507 | if test x$tty_group = xyes; then |
|
|
508 | AC_DEFINE(TTY_GID_SUPPORT, 1, "") |
|
|
509 | fi]) |
|
|
510 | |