1 | dnl this file is part of libptytty, do not make local modifications |
1 | dnl this file is part of libptytty, do not make local modifications |
2 | dnl http://software.schmorp.de/pkg/libptytty |
2 | dnl http://software.schmorp.de/pkg/libptytty |
|
|
3 | |
|
|
4 | AC_DEFUN([PT_FIND_FILE], |
|
|
5 | [AC_CACHE_CHECK(where $1 is located, pt_cv_path_$1, |
|
|
6 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
7 | #include <stdlib.h> |
|
|
8 | $5 |
|
|
9 | #include <errno.h> |
|
|
10 | int main() |
|
|
11 | { |
|
|
12 | char **path, *list[] = { $4, NULL }; |
|
|
13 | FILE *a, *f=fopen("conftestval", "w"); |
|
|
14 | if (!f) exit(1); |
|
|
15 | #ifdef $2 |
|
|
16 | fprintf(f, "%s\n", $2); |
|
|
17 | exit(0); |
|
|
18 | #endif |
|
|
19 | #ifdef $3 |
|
|
20 | fprintf(f, "%s\n", $3); |
|
|
21 | exit(0); |
|
|
22 | #endif |
|
|
23 | for (path = list; *path; path++) { |
|
|
24 | if ((a = fopen(*path, "r")) != NULL || errno == EACCES) { |
|
|
25 | fprintf(f, "%s\n", *path); |
|
|
26 | exit(0); |
|
|
27 | } |
|
|
28 | } |
|
|
29 | exit(0); |
|
|
30 | }]])],[pt_cv_path_$1=`cat conftestval`],[pt_cv_path_$1=], |
|
|
31 | [AC_MSG_WARN(Define $2 in config.h manually)])]) |
|
|
32 | if test x$pt_cv_path_$1 != x; then |
|
|
33 | AC_DEFINE_UNQUOTED($2, "$pt_cv_path_$1", Define location of $1) |
|
|
34 | fi]) |
3 | |
35 | |
4 | AC_DEFUN([PTY_CHECK], |
36 | AC_DEFUN([PTY_CHECK], |
5 | [ |
37 | [ |
6 | AC_CHECK_HEADERS( \ |
38 | AC_CHECK_HEADERS( \ |
7 | pty.h \ |
39 | pty.h \ |
… | |
… | |
194 | dnl# -------------------------------------------------------------------------- |
226 | dnl# -------------------------------------------------------------------------- |
195 | dnl# FIND FILES |
227 | dnl# FIND FILES |
196 | dnl# -------------------------------------------------------------------------- |
228 | dnl# -------------------------------------------------------------------------- |
197 | |
229 | |
198 | dnl# find utmp |
230 | dnl# find utmp |
199 | AC_CACHE_CHECK(where utmp is located, pt_cv_path_utmp, |
231 | PT_FIND_FILE([utmp], [UTMP_FILE], [_PATH_UTMP], |
200 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
232 | ["/var/run/utmp", "/var/adm/utmp", "/etc/utmp", "/usr/etc/utmp", "/usr/adm/utmp"],[ |
201 | #include <stdlib.h> |
|
|
202 | #include <sys/types.h> |
233 | #include <sys/types.h> |
203 | #include <utmp.h> |
234 | #include <utmp.h> |
204 | #include <errno.h> |
235 | ]) |
205 | int main() |
|
|
206 | { |
|
|
207 | char **u, *utmplist[] = { |
|
|
208 | "/var/run/utmp", "/var/adm/utmp", "/etc/utmp", "/usr/etc/utmp", "/usr/adm/utmp", NULL }; |
|
|
209 | FILE *a, *f=fopen("conftestval", "w"); |
|
|
210 | if (!f) exit(1); |
|
|
211 | #ifdef UTMP_FILE |
|
|
212 | fprintf(f, "%s\n", UTMP_FILE); |
|
|
213 | exit(0); |
|
|
214 | #endif |
|
|
215 | #ifdef _PATH_UTMP |
|
|
216 | fprintf(f, "%s\n", _PATH_UTMP); |
|
|
217 | exit(0); |
|
|
218 | #endif |
|
|
219 | for (u = utmplist; *u; u++) { |
|
|
220 | if ((a = fopen(*u, "r")) != NULL || errno == EACCES) { |
|
|
221 | fprintf(f, "%s\n", *u); |
|
|
222 | exit(0); |
|
|
223 | } |
|
|
224 | } |
|
|
225 | exit(0); |
|
|
226 | }]])],[pt_cv_path_utmp=`cat conftestval`],[pt_cv_path_utmp=],[dnl |
|
|
227 | AC_MSG_WARN(Define UTMP_FILE in config.h manually)])]) |
|
|
228 | if test x$pt_cv_path_utmp != x; then |
|
|
229 | AC_DEFINE_UNQUOTED(UTMP_FILE, "$pt_cv_path_utmp", Define location of utmp) |
|
|
230 | fi |
|
|
231 | |
236 | |
232 | dnl# -------------------------------------------------------------------------- |
237 | dnl# -------------------------------------------------------------------------- |
233 | |
238 | |
234 | dnl# find wtmp |
239 | dnl# find wtmp |
235 | AC_CACHE_CHECK(where wtmp is located, pt_cv_path_wtmp, |
240 | PT_FIND_FILE([wtmp], [WTMP_FILE], [_PATH_WTMP], |
236 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
241 | ["/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp"],[ |
237 | #include <stdlib.h> |
|
|
238 | #include <sys/types.h> |
242 | #include <sys/types.h> |
239 | #ifdef HAVE_UTMP_H |
243 | #ifdef HAVE_UTMP_H |
240 | #include <utmp.h> |
244 | #include <utmp.h> |
241 | #endif |
245 | #endif |
242 | #include <errno.h> |
246 | ]) |
243 | int main() |
|
|
244 | { |
|
|
245 | char **w, *wtmplist[] = { |
|
|
246 | "/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp", NULL }; |
|
|
247 | FILE *a, *f=fopen("conftestval", "w"); |
|
|
248 | if (!f) exit(1); |
|
|
249 | #ifdef WTMP_FILE |
|
|
250 | fprintf(f, "%s\n", WTMP_FILE); |
|
|
251 | exit(0); |
|
|
252 | #endif |
|
|
253 | #ifdef _PATH_WTMP |
|
|
254 | fprintf(f, "%s\n", _PATH_WTMP); |
|
|
255 | exit(0); |
|
|
256 | #endif |
|
|
257 | for (w = wtmplist; *w; w++) { |
|
|
258 | if ((a = fopen(*w, "r")) != NULL || errno == EACCES) { |
|
|
259 | fprintf(f, "%s\n", *w); |
|
|
260 | exit(0); |
|
|
261 | } |
|
|
262 | } |
|
|
263 | exit(0); |
|
|
264 | }]])],[pt_cv_path_wtmp=`cat conftestval`],[pt_cv_path_wtmp=],[dnl |
|
|
265 | AC_MSG_WARN(Define WTMP_FILE in config.h manually)])]) |
|
|
266 | if test x$pt_cv_path_wtmp != x; then |
|
|
267 | AC_DEFINE_UNQUOTED(WTMP_FILE, "$pt_cv_path_wtmp", Define location of wtmp) |
|
|
268 | fi |
|
|
269 | dnl# -------------------------------------------------------------------------- |
247 | dnl# -------------------------------------------------------------------------- |
270 | |
248 | |
271 | dnl# find wtmpx |
249 | dnl# find wtmpx |
272 | AC_CACHE_CHECK(where wtmpx is located, pt_cv_path_wtmpx, |
250 | PT_FIND_FILE([wtmpx], [WTMPX_FILE], [_PATH_WTMPX], |
273 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
251 | ["/var/log/wtmpx", "/var/adm/wtmpx"],[ |
274 | #include <stdlib.h> |
|
|
275 | #ifdef HAVE_UTMPX_H |
252 | #ifdef HAVE_UTMPX_H |
276 | #include <utmpx.h> |
253 | #include <utmpx.h> |
277 | #endif |
254 | #endif |
278 | #include <errno.h> |
255 | ]) |
279 | int main() |
|
|
280 | { |
|
|
281 | char **w, *wtmplist[] = { |
|
|
282 | "/var/log/wtmpx", "/var/adm/wtmpx", NULL }; |
|
|
283 | FILE *a, *f=fopen("conftestval", "w"); |
|
|
284 | if (!f) exit(1); |
|
|
285 | #ifdef WTMPX_FILE |
|
|
286 | fprintf(f, "%s\n", WTMPX_FILE); |
|
|
287 | exit(0); |
|
|
288 | #endif |
|
|
289 | #ifdef _PATH_WTMPX |
|
|
290 | fprintf(f, "%s\n", _PATH_WTMPX); |
|
|
291 | exit(0); |
|
|
292 | #endif |
|
|
293 | for (w = wtmplist; *w; w++) { |
|
|
294 | if ((a = fopen(*w, "r")) != NULL || errno == EACCES) { |
|
|
295 | fprintf(f, "%s\n", *w); |
|
|
296 | exit(0); |
|
|
297 | } |
|
|
298 | } |
|
|
299 | exit(0); |
|
|
300 | }]])],[pt_cv_path_wtmpx=`cat conftestval`],[pt_cv_path_wtmpx=],[dnl |
|
|
301 | AC_MSG_WARN(Define WTMPX_FILE in config.h manually)])]) |
|
|
302 | if test x$pt_cv_path_wtmpx != x; then |
|
|
303 | AC_DEFINE_UNQUOTED(WTMPX_FILE, "$pt_cv_path_wtmpx", Define location of wtmpx) |
|
|
304 | fi |
|
|
305 | dnl# -------------------------------------------------------------------------- |
256 | dnl# -------------------------------------------------------------------------- |
306 | |
257 | |
307 | dnl# find lastlog |
258 | dnl# find lastlog |
308 | AC_CACHE_CHECK(where lastlog is located, pt_cv_path_lastlog, |
259 | PT_FIND_FILE([lastlog], [LASTLOG_FILE], [_PATH_LASTLOG], |
309 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
260 | ["/var/log/lastlog"],[ |
310 | #include <stdlib.h> |
|
|
311 | #include <sys/types.h> |
261 | #include <sys/types.h> |
312 | #ifdef HAVE_UTMP_H |
262 | #ifdef HAVE_UTMP_H |
313 | #include <utmp.h> |
263 | #include <utmp.h> |
314 | #endif |
264 | #endif |
315 | #ifdef HAVE_LASTLOG_H |
265 | #ifdef HAVE_LASTLOG_H |
316 | #include <lastlog.h> |
266 | #include <lastlog.h> |
317 | #endif |
267 | #endif |
318 | #include <errno.h> |
268 | ]) |
319 | int main() |
|
|
320 | { |
|
|
321 | char **w, *lastloglist[] = { "/var/log/lastlog", NULL }; |
|
|
322 | FILE *a, *f=fopen("conftestval", "w"); |
|
|
323 | if (!f) exit(1); |
|
|
324 | #ifdef LASTLOG_FILE |
|
|
325 | fprintf(f, "%s\n", LASTLOG_FILE); |
|
|
326 | exit(0); |
|
|
327 | #endif |
|
|
328 | #ifdef _PATH_LASTLOG |
|
|
329 | fprintf(f, "%s\n", _PATH_LASTLOG); |
|
|
330 | exit(0); |
|
|
331 | #endif |
|
|
332 | for (w = lastloglist; *w; w++) { |
|
|
333 | if ((a = fopen(*w, "r")) != NULL || errno == EACCES) { |
|
|
334 | fprintf(f, "%s\n", *w); |
|
|
335 | exit(0); |
|
|
336 | } |
|
|
337 | } |
|
|
338 | exit(0); |
|
|
339 | }]])],[pt_cv_path_lastlog=`cat conftestval`],[pt_cv_path_lastlog=],[dnl |
|
|
340 | AC_MSG_WARN(Define LASTLOG_FILE in config.h manually)])]) |
|
|
341 | if test x$pt_cv_path_lastlog != x; then |
|
|
342 | AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$pt_cv_path_lastlog", Define location of lastlog) |
|
|
343 | fi |
|
|
344 | dnl# -------------------------------------------------------------------------- |
269 | dnl# -------------------------------------------------------------------------- |
345 | |
270 | |
346 | dnl# find lastlogx |
271 | dnl# find lastlogx |
347 | AC_CACHE_CHECK(where lastlogx is located, pt_cv_path_lastlogx, |
272 | PT_FIND_FILE([lastlogx], [LASTLOGX_FILE], [_PATH_LASTLOGX], |
348 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
273 | ["/var/log/lastlogx", "/var/adm/lastlogx"],[ |
349 | #include <stdlib.h> |
|
|
350 | #ifdef HAVE_UTMPX_H |
274 | #ifdef HAVE_UTMPX_H |
351 | #include <utmpx.h> |
275 | #include <utmpx.h> |
352 | #endif |
276 | #endif |
353 | #include <errno.h> |
277 | ]) |
354 | int main() |
|
|
355 | { |
|
|
356 | char **w, *wtmplist[] = { "/var/log/lastlogx", "/var/adm/lastlogx", NULL }; |
|
|
357 | FILE *a, *f=fopen("conftestval", "w"); |
|
|
358 | if (!f) exit(1); |
|
|
359 | #ifdef LASTLOGX_FILE |
|
|
360 | fprintf(f, "%s\n", LASTLOGX_FILE); |
|
|
361 | exit(0); |
|
|
362 | #endif |
|
|
363 | #ifdef _PATH_LASTLOGX |
|
|
364 | fprintf(f, "%s\n", _PATH_LASTLOGX); |
|
|
365 | exit(0); |
|
|
366 | #endif |
|
|
367 | for (w = wtmplist; *w; w++) { |
|
|
368 | if ((a = fopen(*w, "r")) != NULL || errno == EACCES) { |
|
|
369 | fprintf(f, "%s\n", *w); |
|
|
370 | exit(0); |
|
|
371 | } |
|
|
372 | } |
|
|
373 | exit(0); |
|
|
374 | }]])],[pt_cv_path_lastlogx=`cat conftestval`],[pt_cv_path_lastlogx=],[dnl |
|
|
375 | AC_MSG_WARN(Define LASTLOGX_FILE in config.h manually)])]) |
|
|
376 | if test x$pt_cv_path_lastlogx != x; then |
|
|
377 | AC_DEFINE_UNQUOTED(LASTLOGX_FILE, "$pt_cv_path_lastlogx", Define location of lastlogx) |
|
|
378 | fi |
|
|
379 | ]) |
278 | ]) |
380 | |
279 | |
381 | AC_DEFUN([SCM_RIGHTS_CHECK], |
280 | AC_DEFUN([SCM_RIGHTS_CHECK], |
382 | [ |
281 | [ |
383 | AC_CACHE_CHECK(for unix-compliant filehandle passing ability, pt_cv_can_pass_fds, |
282 | AC_CACHE_CHECK(for unix-compliant filehandle passing ability, pt_cv_can_pass_fds, |