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