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