… | |
… | |
24 | setresuid \ |
24 | setresuid \ |
25 | ) |
25 | ) |
26 | |
26 | |
27 | have_clone=no |
27 | have_clone=no |
28 | |
28 | |
29 | AC_MSG_CHECKING(for /dev/ptym/clone) |
|
|
30 | if test -e /dev/ptym/clone; then |
|
|
31 | AC_MSG_RESULT(yes) |
|
|
32 | AC_DEFINE(HAVE_DEV_CLONE, 1, [Define to 1 if you have /dev/ptym/clone]) |
|
|
33 | AC_DEFINE(CLONE_DEVICE, "/dev/ptym/clone", [clone device filename]) |
|
|
34 | have_clone=yes |
|
|
35 | else |
|
|
36 | AC_MSG_RESULT(no) |
|
|
37 | fi |
|
|
38 | |
|
|
39 | AC_MSG_CHECKING(for /dev/ptc) |
29 | AC_MSG_CHECKING(for /dev/ptc) |
40 | if test -e /dev/ptc; then |
30 | if test -e /dev/ptc; then |
41 | AC_MSG_RESULT(yes) |
31 | AC_MSG_RESULT(yes) |
42 | AC_DEFINE(HAVE_DEV_PTC, 1, [Define to 1 if you have /dev/ptc]) |
|
|
43 | AC_DEFINE(CLONE_DEVICE, "/dev/ptc", [clone device filename]) |
32 | AC_DEFINE(CLONE_DEVICE, "/dev/ptc", [clone device filename]) |
44 | have_clone=yes |
33 | have_clone=yes |
45 | else |
34 | else |
46 | AC_MSG_RESULT(no) |
35 | AC_MSG_RESULT(no) |
47 | fi |
36 | fi |
… | |
… | |
73 | AC_MSG_RESULT(yes)], |
62 | AC_MSG_RESULT(yes)], |
74 | [AC_MSG_RESULT(no)]) |
63 | [AC_MSG_RESULT(no)]) |
75 | fi |
64 | fi |
76 | |
65 | |
77 | if test -z "$unix98_pty"; then |
66 | if test -z "$unix98_pty"; then |
78 | 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, "")) |
79 | fi |
68 | fi |
80 | ]) |
69 | ]) |
81 | |
70 | |
82 | AC_DEFUN([UTMP_CHECK], |
71 | AC_DEFUN([UTMP_CHECK], |
83 | [ |
72 | [ |
… | |
… | |
126 | dnl# -------------------------------------------------------------------------- |
115 | dnl# -------------------------------------------------------------------------- |
127 | dnl# check for host field in utmp structure |
116 | dnl# check for host field in utmp structure |
128 | |
117 | |
129 | dnl# -------------------------------------------- |
118 | dnl# -------------------------------------------- |
130 | AC_CHECK_HEADERS(utmp.h, |
119 | AC_CHECK_HEADERS(utmp.h, |
131 | [AC_CACHE_CHECK([for struct utmp], struct_utmp, |
120 | [AC_CACHE_CHECK([for struct utmp], pt_cv_struct_utmp, |
132 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
121 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
133 | #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])]) |
134 | if test x$struct_utmp = xyes; then |
123 | if test x$pt_cv_struct_utmp = xyes; then |
135 | 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) |
136 | fi |
125 | fi |
137 | ] |
126 | ] |
138 | |
127 | |
139 | 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, |
140 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
129 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
141 | #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])]) |
142 | if test x$struct_utmp_host = xyes; then |
131 | if test x$pt_cv_struct_utmp_host = xyes; then |
143 | 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) |
144 | fi |
133 | fi |
145 | |
134 | |
146 | 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, |
147 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
136 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
148 | #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])]) |
149 | if test x$struct_utmp_pid = xyes; then |
138 | if test x$pt_cv_struct_utmp_pid = xyes; then |
150 | 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) |
151 | fi |
140 | fi |
152 | ) dnl# AC_CHECK_HEADERS(utmp.h |
141 | ) dnl# AC_CHECK_HEADERS(utmp.h |
153 | |
142 | |
154 | dnl# -------------------------------------------- |
143 | dnl# -------------------------------------------- |
155 | |
144 | |
156 | AC_CHECK_HEADERS(utmpx.h, |
145 | AC_CHECK_HEADERS(utmpx.h, |
157 | [AC_CACHE_CHECK([for struct utmpx], struct_utmpx, |
146 | [AC_CACHE_CHECK([for struct utmpx], pt_cv_struct_utmpx, |
158 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
147 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
159 | #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])]) |
160 | if test x$struct_utmpx = xyes; then |
149 | if test x$pt_cv_struct_utmpx = xyes; then |
161 | 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) |
162 | fi |
151 | fi |
163 | ] |
152 | ] |
164 | |
153 | |
165 | 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, |
166 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
155 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
167 | #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])]) |
168 | if test x$struct_utmpx_host = xyes; then |
157 | if test x$pt_cv_struct_utmpx_host = xyes; then |
169 | 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) |
170 | fi |
159 | fi |
171 | |
160 | |
172 | 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, |
173 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
162 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
174 | #include <utmpx.h>]], [[struct utmpx utx; utx.ut_session;]])],[struct_utmpx_session=yes],[struct_utmpx_session=no])]) |
163 | #include <utmpx.h>]], [[struct utmpx utx; utx.ut_session;]])],[pt_cv_struct_utmpx_session=yes],[pt_cv_struct_utmpx_session=no])]) |
175 | if test x$struct_utmpx_session = xyes; then |
164 | if test x$pt_cv_struct_utmpx_session = xyes; then |
176 | 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) |
177 | fi |
166 | fi |
178 | ) dnl# AC_CHECK_HEADERS(utmpx.h |
167 | ) dnl# AC_CHECK_HEADERS(utmpx.h |
179 | |
168 | |
180 | dnl# -------------------------------------------------------------------------- |
169 | dnl# -------------------------------------------------------------------------- |
181 | dnl# check for struct lastlog |
170 | dnl# check for struct lastlog |
182 | AC_CACHE_CHECK(for struct lastlog, struct_lastlog, |
171 | AC_CACHE_CHECK(for struct lastlog, pt_cv_struct_lastlog, |
183 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
172 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
184 | #include <utmp.h> |
173 | #include <utmp.h> |
185 | #ifdef HAVE_LASTLOG_H |
174 | #ifdef HAVE_LASTLOG_H |
186 | #include <lastlog.h> |
175 | #include <lastlog.h> |
187 | #endif |
176 | #endif |
188 | ]], [[struct lastlog ll;]])],[struct_lastlog=yes],[struct_lastlog=no])]) |
177 | ]], [[struct lastlog ll;]])],[pt_cv_struct_lastlog=yes],[pt_cv_struct_lastlog=no])]) |
189 | if test x$struct_lastlog = xyes; then |
178 | if test x$pt_cv_struct_lastlog = xyes; then |
190 | 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) |
191 | fi |
180 | fi |
192 | |
181 | |
193 | dnl# check for struct lastlogx |
182 | dnl# check for struct lastlogx |
194 | AC_CACHE_CHECK(for struct lastlogx, struct_lastlogx, |
183 | AC_CACHE_CHECK(for struct lastlogx, pt_cv_struct_lastlogx, |
195 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
184 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
196 | #include <utmpx.h> |
185 | #include <utmpx.h> |
197 | #ifdef HAVE_LASTLOG_H |
186 | #ifdef HAVE_LASTLOG_H |
198 | #include <lastlog.h> |
187 | #include <lastlog.h> |
199 | #endif |
188 | #endif |
200 | ]], [[struct lastlogx ll;]])],[struct_lastlogx=yes],[struct_lastlogx=no])]) |
189 | ]], [[struct lastlogx ll;]])],[pt_cv_struct_lastlogx=yes],[pt_cv_struct_lastlogx=no])]) |
201 | if test x$struct_lastlogx = xyes; then |
190 | if test x$pt_cv_struct_lastlogx = xyes; then |
202 | 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) |
203 | fi |
192 | fi |
204 | |
193 | |
205 | dnl# -------------------------------------------------------------------------- |
194 | dnl# -------------------------------------------------------------------------- |
206 | dnl# FIND FILES |
195 | dnl# FIND FILES |
207 | dnl# -------------------------------------------------------------------------- |
196 | dnl# -------------------------------------------------------------------------- |
208 | |
197 | |
209 | dnl# find utmp |
198 | dnl# find utmp |
210 | AC_CACHE_CHECK(where utmp is located, path_utmp, |
199 | AC_CACHE_CHECK(where utmp is located, pt_cv_path_utmp, |
211 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
200 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
212 | #include <stdlib.h> |
201 | #include <stdlib.h> |
213 | #include <sys/types.h> |
202 | #include <sys/types.h> |
214 | #include <utmp.h> |
203 | #include <utmp.h> |
215 | #include <errno.h> |
204 | #include <errno.h> |
216 | main() |
205 | int main() |
217 | { |
206 | { |
218 | char **u, *utmplist[] = { |
207 | char **u, *utmplist[] = { |
219 | "/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 }; |
220 | FILE *a, *f=fopen("conftestval", "w"); |
209 | FILE *a, *f=fopen("conftestval", "w"); |
221 | if (!f) exit(1); |
210 | if (!f) exit(1); |
… | |
… | |
232 | fprintf(f, "%s\n", *u); |
221 | fprintf(f, "%s\n", *u); |
233 | exit(0); |
222 | exit(0); |
234 | } |
223 | } |
235 | } |
224 | } |
236 | exit(0); |
225 | exit(0); |
237 | }]])],[path_utmp=`cat conftestval`],[path_utmp=],[dnl |
226 | }]])],[pt_cv_path_utmp=`cat conftestval`],[pt_cv_path_utmp=],[dnl |
238 | AC_MSG_WARN(Define UTMP_FILE in config.h manually)])]) |
227 | AC_MSG_WARN(Define UTMP_FILE in config.h manually)])]) |
239 | if test x$path_utmp != x; then |
228 | if test x$pt_cv_path_utmp != x; then |
240 | 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) |
241 | fi |
|
|
242 | |
|
|
243 | dnl# -------------------------------------------------------------------------- |
|
|
244 | |
|
|
245 | dnl# find utmpx - if a utmp file exists at the same location and is more than |
|
|
246 | dnl# a day newer, then dump the utmpx. People leave lots of junk around. |
|
|
247 | AC_CACHE_CHECK(where utmpx is located, path_utmpx, |
|
|
248 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
249 | #include <stdlib.h> |
|
|
250 | #include <sys/types.h> |
|
|
251 | #include <utmpx.h> |
|
|
252 | #include <errno.h> |
|
|
253 | #include <sys/stat.h> |
|
|
254 | #ifdef HAVE_STRING_H |
|
|
255 | #include <string.h> |
|
|
256 | #endif |
|
|
257 | main() |
|
|
258 | { |
|
|
259 | char **u, *p, *utmplist[] = { |
|
|
260 | #ifdef UTMPX_FILE |
|
|
261 | UTMPX_FILE, |
|
|
262 | #endif |
|
|
263 | #ifdef _PATH_UTMPX |
|
|
264 | _PATH_UTMPX, |
|
|
265 | #endif |
|
|
266 | "/var/adm/utmpx", "/etc/utmpx", NULL }; |
|
|
267 | FILE *a, *f=fopen("conftestval", "w"); |
|
|
268 | struct stat statu, statux; |
|
|
269 | if (!f) exit(1); |
|
|
270 | for (u = utmplist; *u; u++) { |
|
|
271 | if ((a = fopen(*u, "r")) != NULL || errno == EACCES) { |
|
|
272 | if (stat(*u, &statux) < 0) |
|
|
273 | continue; |
|
|
274 | p = strdup(*u); |
|
|
275 | p[strlen(p) - 1] = '\0'; |
|
|
276 | if (stat(p, &statu) >= 0 |
|
|
277 | && (statu.st_mtime - statux.st_mtime > 86400)) |
|
|
278 | continue; |
|
|
279 | fprintf(f, "%s\n", *u); |
|
|
280 | exit(0); |
|
|
281 | } |
|
|
282 | } |
|
|
283 | exit(0); |
|
|
284 | }]])],[path_utmpx=`cat conftestval`],[path_utmpx=],[dnl |
|
|
285 | AC_MSG_WARN(Define UTMPX_FILE in config.h manually)])]) |
|
|
286 | if test x$path_utmpx != x; then |
|
|
287 | AC_DEFINE_UNQUOTED(UTMPX_FILE, "$path_utmpx", Define location of utmpx) |
|
|
288 | fi |
230 | fi |
289 | |
231 | |
290 | dnl# -------------------------------------------------------------------------- |
232 | dnl# -------------------------------------------------------------------------- |
291 | |
233 | |
292 | dnl# find wtmp |
234 | dnl# find wtmp |
293 | AC_CACHE_CHECK(where wtmp is located, path_wtmp, |
235 | AC_CACHE_CHECK(where wtmp is located, pt_cv_path_wtmp, |
294 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
236 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
295 | #include <stdlib.h> |
237 | #include <stdlib.h> |
296 | #include <sys/types.h> |
238 | #include <sys/types.h> |
297 | #ifdef HAVE_UTMP_H |
239 | #ifdef HAVE_UTMP_H |
298 | #include <utmp.h> |
240 | #include <utmp.h> |
299 | #endif |
241 | #endif |
300 | #include <errno.h> |
242 | #include <errno.h> |
301 | main() |
243 | int main() |
302 | { |
244 | { |
303 | char **w, *wtmplist[] = { |
245 | char **w, *wtmplist[] = { |
304 | "/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 }; |
305 | FILE *a, *f=fopen("conftestval", "w"); |
247 | FILE *a, *f=fopen("conftestval", "w"); |
306 | if (!f) exit(1); |
248 | if (!f) exit(1); |
… | |
… | |
317 | fprintf(f, "%s\n", *w); |
259 | fprintf(f, "%s\n", *w); |
318 | exit(0); |
260 | exit(0); |
319 | } |
261 | } |
320 | } |
262 | } |
321 | exit(0); |
263 | exit(0); |
322 | }]])],[path_wtmp=`cat conftestval`],[path_wtmp=],[dnl |
264 | }]])],[pt_cv_path_wtmp=`cat conftestval`],[pt_cv_path_wtmp=],[dnl |
323 | AC_MSG_WARN(Define WTMP_FILE in config.h manually)])]) |
265 | AC_MSG_WARN(Define WTMP_FILE in config.h manually)])]) |
324 | if test x$path_wtmp != x; then |
266 | if test x$pt_cv_path_wtmp != x; then |
325 | 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) |
326 | fi |
268 | fi |
327 | dnl# -------------------------------------------------------------------------- |
269 | dnl# -------------------------------------------------------------------------- |
328 | |
270 | |
329 | dnl# find wtmpx |
271 | dnl# find wtmpx |
330 | AC_CACHE_CHECK(where wtmpx is located, path_wtmpx, |
272 | AC_CACHE_CHECK(where wtmpx is located, pt_cv_path_wtmpx, |
331 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
273 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
332 | #include <stdlib.h> |
274 | #include <stdlib.h> |
333 | #ifdef HAVE_UTMPX_H |
275 | #ifdef HAVE_UTMPX_H |
334 | #include <utmpx.h> |
276 | #include <utmpx.h> |
335 | #endif |
277 | #endif |
336 | #include <errno.h> |
278 | #include <errno.h> |
337 | main() |
279 | int main() |
338 | { |
280 | { |
339 | char **w, *wtmplist[] = { |
281 | char **w, *wtmplist[] = { |
340 | "/var/log/wtmpx", "/var/adm/wtmpx", NULL }; |
282 | "/var/log/wtmpx", "/var/adm/wtmpx", NULL }; |
341 | FILE *a, *f=fopen("conftestval", "w"); |
283 | FILE *a, *f=fopen("conftestval", "w"); |
342 | if (!f) exit(1); |
284 | if (!f) exit(1); |
… | |
… | |
353 | fprintf(f, "%s\n", *w); |
295 | fprintf(f, "%s\n", *w); |
354 | exit(0); |
296 | exit(0); |
355 | } |
297 | } |
356 | } |
298 | } |
357 | exit(0); |
299 | exit(0); |
358 | }]])],[path_wtmpx=`cat conftestval`],[path_wtmpx=],[dnl |
300 | }]])],[pt_cv_path_wtmpx=`cat conftestval`],[pt_cv_path_wtmpx=],[dnl |
359 | AC_MSG_WARN(Define WTMPX_FILE in config.h manually)])]) |
301 | AC_MSG_WARN(Define WTMPX_FILE in config.h manually)])]) |
360 | if test x$path_wtmpx != x; then |
302 | if test x$pt_cv_path_wtmpx != x; then |
361 | 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) |
362 | fi |
304 | fi |
363 | dnl# -------------------------------------------------------------------------- |
305 | dnl# -------------------------------------------------------------------------- |
364 | |
306 | |
365 | dnl# find lastlog |
307 | dnl# find lastlog |
366 | AC_CACHE_CHECK(where lastlog is located, path_lastlog, |
308 | AC_CACHE_CHECK(where lastlog is located, pt_cv_path_lastlog, |
367 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
309 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
368 | #include <stdlib.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> |
… | |
… | |
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 | fi |
345 | fi |
404 | dnl# -------------------------------------------------------------------------- |
346 | dnl# -------------------------------------------------------------------------- |
405 | |
347 | |
406 | dnl# find lastlogx |
348 | dnl# find lastlogx |
407 | AC_CACHE_CHECK(where lastlogx is located, path_lastlogx, |
349 | AC_CACHE_CHECK(where lastlogx is located, pt_cv_path_lastlogx, |
408 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
350 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
409 | #include <stdlib.h> |
351 | #include <stdlib.h> |
410 | #ifdef HAVE_UTMPX_H |
352 | #ifdef HAVE_UTMPX_H |
411 | #include <utmpx.h> |
353 | #include <utmpx.h> |
412 | #endif |
354 | #endif |
413 | #include <errno.h> |
355 | #include <errno.h> |
414 | main() |
356 | int main() |
415 | { |
357 | { |
416 | char **w, *wtmplist[] = { "/var/log/lastlogx", "/var/adm/lastlogx", NULL }; |
358 | char **w, *wtmplist[] = { "/var/log/lastlogx", "/var/adm/lastlogx", NULL }; |
417 | FILE *a, *f=fopen("conftestval", "w"); |
359 | FILE *a, *f=fopen("conftestval", "w"); |
418 | if (!f) exit(1); |
360 | if (!f) exit(1); |
419 | #ifdef LASTLOGX_FILE |
361 | #ifdef LASTLOGX_FILE |
… | |
… | |
429 | fprintf(f, "%s\n", *w); |
371 | fprintf(f, "%s\n", *w); |
430 | exit(0); |
372 | exit(0); |
431 | } |
373 | } |
432 | } |
374 | } |
433 | exit(0); |
375 | exit(0); |
434 | }]])],[path_lastlogx=`cat conftestval`],[path_lastlogx=],[dnl |
376 | }]])],[pt_cv_path_lastlogx=`cat conftestval`],[pt_cv_path_lastlogx=],[dnl |
435 | AC_MSG_WARN(Define LASTLOGX_FILE in config.h manually)])]) |
377 | AC_MSG_WARN(Define LASTLOGX_FILE in config.h manually)])]) |
436 | if test x$path_lastlogx != x; then |
378 | if test x$pt_cv_path_lastlogx != x; then |
437 | 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) |
438 | fi |
380 | fi |
439 | ]) |
381 | ]) |
440 | |
382 | |
441 | AC_DEFUN([SCM_RIGHTS_CHECK], |
383 | AC_DEFUN([SCM_RIGHTS_CHECK], |
442 | [ |
384 | [ |
443 | 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, |
444 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
386 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
445 | #include <cstddef> // broken bsds (is that redundant?) need this |
387 | #include <cstddef> // broken bsds (is that redundant?) need this |
446 | #include <sys/types.h> |
388 | #include <sys/types.h> |
447 | #include <sys/socket.h> |
389 | #include <sys/socket.h> |
448 | #include <sys/uio.h> |
390 | #include <sys/uio.h> |
… | |
… | |
468 | |
410 | |
469 | *(int *)CMSG_DATA (cmsg) = 5; |
411 | *(int *)CMSG_DATA (cmsg) = 5; |
470 | |
412 | |
471 | return sendmsg (3, &msg, 0); |
413 | return sendmsg (3, &msg, 0); |
472 | } |
414 | } |
473 | ]])],[can_pass_fds=yes],[can_pass_fds=no])]) |
415 | ]])],[pt_cv_can_pass_fds=yes],[pt_cv_can_pass_fds=no])]) |
474 | if test x$can_pass_fds = xyes; then |
416 | if test x$pt_cv_can_pass_fds = xyes; then |
475 | 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) |
476 | else |
418 | else |
477 | AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability]) |
419 | AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability]) |
478 | fi |
420 | fi |
479 | ]) |
421 | ]) |
480 | |
422 | |
481 | AC_DEFUN([TTY_GROUP_CHECK], |
423 | AC_DEFUN([TTY_GROUP_CHECK], |
482 | [ |
424 | [ |
483 | AC_CACHE_CHECK([for tty group], tty_group, |
425 | AC_CACHE_CHECK([for tty group], pt_cv_tty_group, |
484 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
426 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
485 | #include <sys/types.h> |
427 | #include <sys/types.h> |
486 | #include <sys/stat.h> |
428 | #include <sys/stat.h> |
487 | #include <unistd.h> |
429 | #include <unistd.h> |
488 | #include <grp.h> |
430 | #include <grp.h> |
489 | |
431 | |
490 | main() |
432 | int main() |
491 | { |
433 | { |
492 | struct stat st; |
434 | struct stat st; |
493 | struct group *gr; |
435 | struct group *gr; |
494 | char *tty; |
436 | char *tty; |
495 | gr = getgrnam("tty"); |
437 | gr = getgrnam("tty"); |
… | |
… | |
499 | && (stat(tty, &st)) == 0 |
441 | && (stat(tty, &st)) == 0 |
500 | && st.st_gid == gr->gr_gid) |
442 | && st.st_gid == gr->gr_gid) |
501 | return 0; |
443 | return 0; |
502 | else |
444 | else |
503 | return 1; |
445 | return 1; |
504 | }]])],[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])]) |
505 | if test x$tty_group = xyes; then |
447 | if test x$pt_cv_tty_group = xyes; then |
506 | AC_DEFINE(TTY_GID_SUPPORT, 1, "") |
448 | AC_DEFINE(TTY_GID_SUPPORT, 1, "") |
507 | fi]) |
449 | fi]) |
508 | |
450 | |