1 | dnl this file is part of libptytty, do not make local modifications |
1 | AC_DEFUN([PT_FIND_FILE], |
2 | dnl http://software.schmorp.de/pkg/libptytty |
2 | [AC_CACHE_CHECK(for a fallback location of $1, pt_cv_path_$1, [ |
|
|
3 | if test "$cross_compiling" != yes; then |
|
|
4 | for file in $3; do |
|
|
5 | if test -f "$file"; then |
|
|
6 | pt_cv_path_$1=$file |
|
|
7 | break |
|
|
8 | fi |
|
|
9 | done |
|
|
10 | fi]) |
|
|
11 | if test x$pt_cv_path_$1 != x; then |
|
|
12 | AC_DEFINE_UNQUOTED($2, "$pt_cv_path_$1", Define to a fallback location of $1) |
|
|
13 | elif test "$cross_compiling" = yes; then |
|
|
14 | AC_MSG_WARN(Define $2 in config.h manually) |
|
|
15 | fi]) |
3 | |
16 | |
4 | AC_DEFUN([PTY_CHECK], |
17 | AC_DEFUN([PTY_CHECK], |
5 | [ |
18 | [ |
6 | AC_CHECK_HEADERS( \ |
19 | AC_CHECK_HEADERS( \ |
7 | pty.h \ |
20 | pty.h \ |
… | |
… | |
22 | seteuid \ |
35 | seteuid \ |
23 | setreuid \ |
36 | setreuid \ |
24 | setresuid \ |
37 | setresuid \ |
25 | ) |
38 | ) |
26 | |
39 | |
27 | have_clone=no |
|
|
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) |
|
|
40 | if test -e /dev/ptc; then |
|
|
41 | 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]) |
|
|
44 | have_clone=yes |
|
|
45 | else |
|
|
46 | AC_MSG_RESULT(no) |
|
|
47 | fi |
|
|
48 | |
|
|
49 | case $host in |
|
|
50 | *-*-cygwin*) |
|
|
51 | have_clone=yes |
|
|
52 | AC_DEFINE(CLONE_DEVICE, "/dev/ptmx", [clone device filename]) |
|
|
53 | ;; |
|
|
54 | *) |
|
|
55 | AC_MSG_CHECKING(for /dev/ptmx) |
|
|
56 | if test -e /dev/ptmx; then |
|
|
57 | AC_MSG_RESULT(yes) |
|
|
58 | AC_DEFINE(HAVE_DEV_PTMX, 1, [Define to 1 if you have /dev/ptmx]) |
|
|
59 | AC_DEFINE(CLONE_DEVICE, "/dev/ptmx", [clone device filename]) |
|
|
60 | have_clone=yes |
|
|
61 | else |
|
|
62 | AC_MSG_RESULT(no) |
|
|
63 | fi |
|
|
64 | ;; |
|
|
65 | esac |
|
|
66 | |
|
|
67 | if test x$ac_cv_func_getpt = xyes -o x$ac_cv_func_posix_openpt = xyes -o x$have_clone = xyes; then |
|
|
68 | AC_MSG_CHECKING(for UNIX98 ptys) |
40 | AC_MSG_CHECKING(for UNIX98 ptys) |
69 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>]], |
41 | AC_LINK_IFELSE( |
|
|
42 | [AC_LANG_PROGRAM( |
|
|
43 | [[#include <stdlib.h>]], |
70 | [[grantpt(0);unlockpt(0);ptsname(0);]])], |
44 | [[grantpt(0);unlockpt(0);ptsname(0);]])], |
71 | [unix98_pty=yes |
45 | [unix98_pty=yes |
72 | AC_DEFINE(UNIX98_PTY, 1, "") |
46 | AC_DEFINE(UNIX98_PTY, 1, "") |
73 | AC_MSG_RESULT(yes)], |
47 | AC_MSG_RESULT(yes)], |
74 | [AC_MSG_RESULT(no)]) |
48 | [AC_MSG_RESULT(no)]) |
75 | fi |
|
|
76 | |
49 | |
77 | if test -z "$unix98_pty"; then |
50 | if test -z "$unix98_pty"; then |
78 | AC_CHECK_FUNCS(openpty, [], [AC_CHECK_LIB(util, openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"])]) |
51 | AC_SEARCH_LIBS(openpty, util, AC_DEFINE(HAVE_OPENPTY, 1, "")) |
79 | fi |
52 | fi |
80 | ]) |
53 | ]) |
81 | |
54 | |
82 | AC_DEFUN([UTMP_CHECK], |
55 | AC_DEFUN([UTMP_CHECK], |
83 | [ |
56 | [ |
… | |
… | |
119 | updlastlogx \ |
92 | updlastlogx \ |
120 | ) |
93 | ) |
121 | |
94 | |
122 | AC_CHECK_HEADERS(lastlog.h) |
95 | AC_CHECK_HEADERS(lastlog.h) |
123 | |
96 | |
|
|
97 | case $host in |
|
|
98 | *-*-solaris*) |
|
|
99 | AC_DEFINE(__EXTENSIONS__, 1, Enable declarations in utmp.h on Solaris when the XPG4v2 namespace is active) |
|
|
100 | ;; |
|
|
101 | esac |
|
|
102 | |
124 | dnl# -------------------------------------------------------------------------- |
103 | dnl# -------------------------------------------------------------------------- |
125 | dnl# DO ALL UTMP AND WTMP CHECKING |
104 | dnl# DO ALL UTMP AND WTMP CHECKING |
126 | dnl# -------------------------------------------------------------------------- |
105 | dnl# -------------------------------------------------------------------------- |
127 | dnl# check for host field in utmp structure |
106 | dnl# check for host field in utmp structure |
128 | |
107 | |
129 | dnl# -------------------------------------------- |
108 | dnl# -------------------------------------------- |
130 | AC_CHECK_HEADERS(utmp.h, |
109 | AC_CHECK_HEADERS(utmp.h, |
131 | [AC_CACHE_CHECK([for struct utmp], struct_utmp, |
110 | AC_CHECK_TYPES([struct utmp], [], [], [ |
132 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
111 | #include <sys/types.h> |
133 | #include <utmp.h>]], [[struct utmp ut;]])],[struct_utmp=yes],[struct_utmp=no])]) |
112 | #include <utmp.h> |
134 | if test x$struct_utmp = xyes; then |
113 | ]) |
135 | AC_DEFINE(HAVE_STRUCT_UTMP, 1, Define if utmp.h has struct utmp) |
|
|
136 | fi |
|
|
137 | ] |
|
|
138 | |
114 | |
139 | AC_CACHE_CHECK(for ut_host in utmp struct, struct_utmp_host, |
115 | AC_CHECK_MEMBER([struct utmp.ut_host], |
140 | [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])]) |
|
|
142 | if test x$struct_utmp_host = xyes; then |
|
|
143 | AC_DEFINE(HAVE_UTMP_HOST, 1, Define if struct utmp contains ut_host) |
116 | [AC_DEFINE(HAVE_UTMP_HOST, 1, Define if struct utmp contains ut_host)], [], [ |
144 | fi |
117 | #include <sys/types.h> |
|
|
118 | #include <utmp.h> |
|
|
119 | ]) |
145 | |
120 | |
146 | AC_CACHE_CHECK(for ut_pid in utmp struct, struct_utmp_pid, |
121 | AC_CHECK_MEMBER([struct utmp.ut_pid], |
147 | [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])]) |
|
|
149 | if test x$struct_utmp_pid = xyes; then |
|
|
150 | AC_DEFINE(HAVE_UTMP_PID, 1, Define if struct utmp contains ut_pid) |
122 | [AC_DEFINE(HAVE_UTMP_PID, 1, Define if struct utmp contains ut_pid)], [], [ |
151 | fi |
123 | #include <sys/types.h> |
|
|
124 | #include <utmp.h> |
|
|
125 | ]) |
152 | ) dnl# AC_CHECK_HEADERS(utmp.h |
126 | ) dnl# AC_CHECK_HEADERS(utmp.h |
153 | |
127 | |
154 | dnl# -------------------------------------------- |
128 | dnl# -------------------------------------------- |
155 | |
129 | |
156 | AC_CHECK_HEADERS(utmpx.h, |
130 | AC_CHECK_HEADERS(utmpx.h, |
157 | [AC_CACHE_CHECK([for struct utmpx], struct_utmpx, |
131 | AC_CHECK_TYPES([struct utmpx], [], [], [ |
158 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
132 | #include <sys/types.h> |
159 | #include <utmpx.h>]], [[struct utmpx ut;]])],[struct_utmpx=yes],[struct_utmpx=no])]) |
133 | #include <utmpx.h> |
160 | if test x$struct_utmpx = xyes; then |
134 | ]) |
161 | AC_DEFINE(HAVE_STRUCT_UTMPX, 1, Define if utmpx.h has struct utmpx) |
|
|
162 | fi |
|
|
163 | ] |
|
|
164 | |
135 | |
165 | AC_CACHE_CHECK(for host in utmpx struct, struct_utmpx_host, |
136 | AC_CHECK_MEMBER([struct utmpx.ut_host], |
166 | [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])]) |
|
|
168 | if test x$struct_utmpx_host = xyes; then |
|
|
169 | AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host) |
137 | [AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host)], [], [ |
170 | fi |
138 | #include <sys/types.h> |
171 | |
139 | #include <utmpx.h> |
172 | AC_CACHE_CHECK(for session in utmpx struct, struct_utmpx_session, |
140 | ]) |
173 | [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])]) |
|
|
175 | if test x$struct_utmpx_session = xyes; then |
|
|
176 | AC_DEFINE(HAVE_UTMPX_SESSION, 1, Define if struct utmpx contains ut_session) |
|
|
177 | fi |
|
|
178 | ) dnl# AC_CHECK_HEADERS(utmpx.h |
141 | ) dnl# AC_CHECK_HEADERS(utmpx.h |
179 | |
142 | |
180 | dnl# -------------------------------------------------------------------------- |
143 | dnl# -------------------------------------------------------------------------- |
181 | dnl# check for struct lastlog |
144 | dnl# check for struct lastlog |
182 | AC_CACHE_CHECK(for struct lastlog, struct_lastlog, |
145 | AC_CHECK_TYPES([struct lastlog], [], [], [ |
183 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
146 | #include <sys/types.h> |
184 | #include <utmp.h> |
147 | #include <utmp.h> |
185 | #ifdef HAVE_LASTLOG_H |
148 | #ifdef HAVE_LASTLOG_H |
186 | #include <lastlog.h> |
149 | #include <lastlog.h> |
187 | #endif |
150 | #endif |
188 | ]], [[struct lastlog ll;]])],[struct_lastlog=yes],[struct_lastlog=no])]) |
151 | ]) |
189 | if test x$struct_lastlog = xyes; then |
|
|
190 | AC_DEFINE(HAVE_STRUCT_LASTLOG, 1, Define if utmp.h or lastlog.h has struct lastlog) |
|
|
191 | fi |
|
|
192 | |
152 | |
193 | dnl# check for struct lastlogx |
153 | dnl# check for struct lastlogx |
194 | AC_CACHE_CHECK(for struct lastlogx, struct_lastlogx, |
154 | AC_CHECK_TYPES([struct lastlogx], [], [], [ |
195 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
155 | #include <sys/types.h> |
196 | #include <utmpx.h> |
156 | #include <utmpx.h> |
197 | #ifdef HAVE_LASTLOG_H |
157 | #ifdef HAVE_LASTLOG_H |
198 | #include <lastlog.h> |
158 | #include <lastlog.h> |
199 | #endif |
159 | #endif |
200 | ]], [[struct lastlogx ll;]])],[struct_lastlogx=yes],[struct_lastlogx=no])]) |
160 | ]) |
201 | if test x$struct_lastlogx = xyes; then |
|
|
202 | AC_DEFINE(HAVE_STRUCT_LASTLOGX, 1, Define if utmpx.h or lastlog.h has struct lastlogx) |
|
|
203 | fi |
|
|
204 | |
161 | |
205 | dnl# -------------------------------------------------------------------------- |
162 | dnl# -------------------------------------------------------------------------- |
206 | dnl# FIND FILES |
163 | dnl# FIND FILES |
207 | dnl# -------------------------------------------------------------------------- |
164 | dnl# -------------------------------------------------------------------------- |
208 | |
165 | |
209 | dnl# find utmp |
166 | dnl# find utmp |
210 | AC_CACHE_CHECK(where utmp is located, path_utmp, |
167 | PT_FIND_FILE([utmp], [PT_UTMP_FILE], |
211 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
212 | #include <stdlib.h> |
|
|
213 | #include <sys/types.h> |
|
|
214 | #include <utmp.h> |
|
|
215 | #include <errno.h> |
|
|
216 | main() |
|
|
217 | { |
|
|
218 | char **u, *utmplist[] = { |
|
|
219 | "/var/run/utmp", "/var/adm/utmp", "/etc/utmp", "/usr/etc/utmp", "/usr/adm/utmp", NULL }; |
168 | ["/var/run/utmp" "/var/adm/utmp" "/etc/utmp" "/usr/etc/utmp" "/usr/adm/utmp"]) |
220 | FILE *a, *f=fopen("conftestval", "w"); |
|
|
221 | if (!f) exit(1); |
|
|
222 | #ifdef UTMP_FILE |
|
|
223 | fprintf(f, "%s\n", UTMP_FILE); |
|
|
224 | exit(0); |
|
|
225 | #endif |
|
|
226 | #ifdef _PATH_UTMP |
|
|
227 | fprintf(f, "%s\n", _PATH_UTMP); |
|
|
228 | exit(0); |
|
|
229 | #endif |
|
|
230 | for (u = utmplist; *u; u++) { |
|
|
231 | if ((a = fopen(*u, "r")) != NULL || errno == EACCES) { |
|
|
232 | fprintf(f, "%s\n", *u); |
|
|
233 | exit(0); |
|
|
234 | } |
|
|
235 | } |
|
|
236 | exit(0); |
|
|
237 | }]])],[path_utmp=`cat conftestval`],[path_utmp=],[dnl |
|
|
238 | AC_MSG_WARN(Define UTMP_FILE in config.h manually)])]) |
|
|
239 | if test x$path_utmp != x; then |
|
|
240 | AC_DEFINE_UNQUOTED(UTMP_FILE, "$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 |
|
|
289 | |
169 | |
290 | dnl# -------------------------------------------------------------------------- |
170 | dnl# -------------------------------------------------------------------------- |
291 | |
171 | |
292 | dnl# find wtmp |
172 | dnl# find wtmp |
293 | AC_CACHE_CHECK(where wtmp is located, path_wtmp, |
173 | PT_FIND_FILE([wtmp], [PT_WTMP_FILE], |
294 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
295 | #include <stdlib.h> |
|
|
296 | #include <sys/types.h> |
|
|
297 | #ifdef HAVE_UTMP_H |
|
|
298 | #include <utmp.h> |
|
|
299 | #endif |
|
|
300 | #include <errno.h> |
|
|
301 | main() |
|
|
302 | { |
|
|
303 | char **w, *wtmplist[] = { |
|
|
304 | "/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp", NULL }; |
174 | ["/var/log/wtmp" "/var/adm/wtmp" "/etc/wtmp" "/usr/etc/wtmp" "/usr/adm/wtmp"]) |
305 | FILE *a, *f=fopen("conftestval", "w"); |
|
|
306 | if (!f) exit(1); |
|
|
307 | #ifdef WTMP_FILE |
|
|
308 | fprintf(f, "%s\n", WTMP_FILE); |
|
|
309 | exit(0); |
|
|
310 | #endif |
|
|
311 | #ifdef _PATH_WTMP |
|
|
312 | fprintf(f, "%s\n", _PATH_WTMP); |
|
|
313 | exit(0); |
|
|
314 | #endif |
|
|
315 | for (w = wtmplist; *w; w++) { |
|
|
316 | if ((a = fopen(*w, "r")) != NULL || errno == EACCES) { |
|
|
317 | fprintf(f, "%s\n", *w); |
|
|
318 | exit(0); |
|
|
319 | } |
|
|
320 | } |
|
|
321 | exit(0); |
|
|
322 | }]])],[path_wtmp=`cat conftestval`],[path_wtmp=],[dnl |
|
|
323 | AC_MSG_WARN(Define WTMP_FILE in config.h manually)])]) |
|
|
324 | if test x$path_wtmp != x; then |
|
|
325 | AC_DEFINE_UNQUOTED(WTMP_FILE, "$path_wtmp", Define location of wtmp) |
|
|
326 | fi |
|
|
327 | dnl# -------------------------------------------------------------------------- |
175 | dnl# -------------------------------------------------------------------------- |
328 | |
176 | |
329 | dnl# find wtmpx |
177 | dnl# find wtmpx |
330 | AC_CACHE_CHECK(where wtmpx is located, path_wtmpx, |
178 | PT_FIND_FILE([wtmpx], [PT_WTMPX_FILE], |
331 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
332 | #include <stdlib.h> |
|
|
333 | #ifdef HAVE_UTMPX_H |
|
|
334 | #include <utmpx.h> |
|
|
335 | #endif |
|
|
336 | #include <errno.h> |
|
|
337 | main() |
|
|
338 | { |
|
|
339 | char **w, *wtmplist[] = { |
|
|
340 | "/var/log/wtmpx", "/var/adm/wtmpx", NULL }; |
179 | ["/var/log/wtmpx" "/var/adm/wtmpx"]) |
341 | FILE *a, *f=fopen("conftestval", "w"); |
|
|
342 | if (!f) exit(1); |
|
|
343 | #ifdef WTMPX_FILE |
|
|
344 | fprintf(f, "%s\n", WTMPX_FILE); |
|
|
345 | exit(0); |
|
|
346 | #endif |
|
|
347 | #ifdef _PATH_WTMPX |
|
|
348 | fprintf(f, "%s\n", _PATH_WTMPX); |
|
|
349 | exit(0); |
|
|
350 | #endif |
|
|
351 | for (w = wtmplist; *w; w++) { |
|
|
352 | if ((a = fopen(*w, "r")) != NULL || errno == EACCES) { |
|
|
353 | fprintf(f, "%s\n", *w); |
|
|
354 | exit(0); |
|
|
355 | } |
|
|
356 | } |
|
|
357 | exit(0); |
|
|
358 | }]])],[path_wtmpx=`cat conftestval`],[path_wtmpx=],[dnl |
|
|
359 | AC_MSG_WARN(Define WTMPX_FILE in config.h manually)])]) |
|
|
360 | if test x$path_wtmpx != x; then |
|
|
361 | AC_DEFINE_UNQUOTED(WTMPX_FILE, "$path_wtmpx", Define location of wtmpx) |
|
|
362 | fi |
|
|
363 | dnl# -------------------------------------------------------------------------- |
180 | dnl# -------------------------------------------------------------------------- |
364 | |
181 | |
365 | dnl# find lastlog |
182 | dnl# find lastlog |
366 | AC_CACHE_CHECK(where lastlog is located, path_lastlog, |
183 | PT_FIND_FILE([lastlog], [PT_LASTLOG_FILE], |
367 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
184 | ["/var/log/lastlog" "/var/adm/lastlog"]) |
368 | #include <stdlib.h> |
|
|
369 | #include <sys/types.h> |
|
|
370 | #ifdef HAVE_UTMPX_H |
|
|
371 | #include <utmpx.h> |
|
|
372 | #elif defined(HAVE_UTMP_H) |
|
|
373 | #include <utmp.h> |
|
|
374 | #endif |
|
|
375 | #ifdef HAVE_LASTLOG_H |
|
|
376 | #include <lastlog.h> |
|
|
377 | #endif |
|
|
378 | #include <errno.h> |
|
|
379 | main() |
|
|
380 | { |
|
|
381 | char **w, *lastloglist[] = { "/var/log/lastlog", NULL }; |
|
|
382 | FILE *a, *f=fopen("conftestval", "w"); |
|
|
383 | if (!f) exit(1); |
|
|
384 | #ifdef LASTLOG_FILE |
|
|
385 | fprintf(f, "%s\n", LASTLOG_FILE); |
|
|
386 | exit(0); |
|
|
387 | #endif |
|
|
388 | #ifdef _PATH_LASTLOG |
|
|
389 | fprintf(f, "%s\n", _PATH_LASTLOG); |
|
|
390 | exit(0); |
|
|
391 | #endif |
|
|
392 | for (w = lastloglist; *w; w++) { |
|
|
393 | if ((a = fopen(*w, "r")) != NULL || errno == EACCES) { |
|
|
394 | fprintf(f, "%s\n", *w); |
|
|
395 | exit(0); |
|
|
396 | } |
|
|
397 | } |
|
|
398 | exit(0); |
|
|
399 | }]])],[path_lastlog=`cat conftestval`],[path_lastlog=],[dnl |
|
|
400 | AC_MSG_WARN(Define LASTLOG_FILE in config.h manually)])]) |
|
|
401 | if test x$path_lastlog != x; then |
|
|
402 | AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$path_lastlog", Define location of lastlog) |
|
|
403 | fi |
|
|
404 | dnl# -------------------------------------------------------------------------- |
185 | dnl# -------------------------------------------------------------------------- |
405 | |
186 | |
406 | dnl# find lastlogx |
187 | dnl# find lastlogx |
407 | AC_CACHE_CHECK(where lastlogx is located, path_lastlogx, |
188 | PT_FIND_FILE([lastlogx], [PT_LASTLOGX_FILE], |
408 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
189 | ["/var/log/lastlogx" "/var/adm/lastlogx"]) |
409 | #include <stdlib.h> |
|
|
410 | #ifdef HAVE_UTMPX_H |
|
|
411 | #include <utmpx.h> |
|
|
412 | #endif |
|
|
413 | #include <errno.h> |
|
|
414 | main() |
|
|
415 | { |
|
|
416 | char **w, *wtmplist[] = { "/var/log/lastlogx", "/var/adm/lastlogx", NULL }; |
|
|
417 | FILE *a, *f=fopen("conftestval", "w"); |
|
|
418 | if (!f) exit(1); |
|
|
419 | #ifdef LASTLOGX_FILE |
|
|
420 | fprintf(f, "%s\n", LASTLOGX_FILE); |
|
|
421 | exit(0); |
|
|
422 | #endif |
|
|
423 | #ifdef _PATH_LASTLOGX |
|
|
424 | fprintf(f, "%s\n", _PATH_LASTLOGX); |
|
|
425 | exit(0); |
|
|
426 | #endif |
|
|
427 | for (w = wtmplist; *w; w++) { |
|
|
428 | if ((a = fopen(*w, "r")) != NULL || errno == EACCES) { |
|
|
429 | fprintf(f, "%s\n", *w); |
|
|
430 | exit(0); |
|
|
431 | } |
|
|
432 | } |
|
|
433 | exit(0); |
|
|
434 | }]])],[path_lastlogx=`cat conftestval`],[path_lastlogx=],[dnl |
|
|
435 | AC_MSG_WARN(Define LASTLOGX_FILE in config.h manually)])]) |
|
|
436 | if test x$path_lastlogx != x; then |
|
|
437 | AC_DEFINE_UNQUOTED(LASTLOGX_FILE, "$path_lastlogx", Define location of lastlogx) |
|
|
438 | fi |
|
|
439 | ]) |
190 | ]) |
440 | |
191 | |
441 | AC_DEFUN([SCM_RIGHTS_CHECK], |
192 | AC_DEFUN([SCM_RIGHTS_CHECK], |
442 | [ |
193 | [ |
|
|
194 | case $host in |
|
|
195 | *-*-solaris*) |
|
|
196 | AC_DEFINE(_XOPEN_SOURCE, 500, Enable declarations of msg_control and msg_controllen on Solaris) |
|
|
197 | AC_SEARCH_LIBS(sendmsg, socket) |
|
|
198 | ;; |
|
|
199 | esac |
|
|
200 | |
443 | AC_CACHE_CHECK(for unix-compliant filehandle passing ability, can_pass_fds, |
201 | AC_CACHE_CHECK(for unix-compliant filehandle passing ability, pt_cv_can_pass_fds, |
444 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
202 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
445 | #include <cstddef> // broken bsds (is that redundant?) need this |
203 | #include <cstddef> // broken bsds (is that redundant?) need this |
446 | #include <sys/types.h> |
204 | #include <sys/types.h> |
447 | #include <sys/socket.h> |
205 | #include <sys/socket.h> |
448 | #include <sys/uio.h> |
206 | #include <sys/uio.h> |
… | |
… | |
468 | |
226 | |
469 | *(int *)CMSG_DATA (cmsg) = 5; |
227 | *(int *)CMSG_DATA (cmsg) = 5; |
470 | |
228 | |
471 | return sendmsg (3, &msg, 0); |
229 | return sendmsg (3, &msg, 0); |
472 | } |
230 | } |
473 | ]])],[can_pass_fds=yes],[can_pass_fds=no])]) |
231 | ]])],[pt_cv_can_pass_fds=yes],[pt_cv_can_pass_fds=no])]) |
474 | if test x$can_pass_fds = xyes; then |
232 | 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) |
233 | AC_DEFINE(HAVE_UNIX_FDPASS, 1, Define if sys/socket.h defines the necessary macros/functions for file handle passing) |
476 | else |
234 | else |
477 | AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability]) |
235 | AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability]) |
478 | fi |
236 | fi |
479 | ]) |
237 | ]) |
480 | |
238 | |
481 | AC_DEFUN([TTY_GROUP_CHECK], |
239 | AC_DEFUN([TTY_GROUP_CHECK], |
482 | [ |
240 | [ |
483 | AC_CACHE_CHECK([for tty group], tty_group, |
241 | AC_CACHE_CHECK([for tty group], pt_cv_tty_group, |
484 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
242 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
485 | #include <sys/types.h> |
243 | #include <sys/types.h> |
486 | #include <sys/stat.h> |
244 | #include <sys/stat.h> |
487 | #include <unistd.h> |
245 | #include <unistd.h> |
488 | #include <grp.h> |
246 | #include <grp.h> |
489 | |
247 | |
490 | main() |
248 | int main() |
491 | { |
249 | { |
492 | struct stat st; |
250 | struct stat st; |
493 | struct group *gr; |
251 | struct group *gr; |
494 | char *tty; |
252 | char *tty; |
495 | gr = getgrnam("tty"); |
253 | gr = getgrnam("tty"); |
… | |
… | |
499 | && (stat(tty, &st)) == 0 |
257 | && (stat(tty, &st)) == 0 |
500 | && st.st_gid == gr->gr_gid) |
258 | && st.st_gid == gr->gr_gid) |
501 | return 0; |
259 | return 0; |
502 | else |
260 | else |
503 | return 1; |
261 | return 1; |
504 | }]])],[tty_group=yes],[tty_group=no],[tty_group=no])]) |
262 | }]])],[pt_cv_tty_group=yes],[pt_cv_tty_group=no],[pt_cv_tty_group=no])]) |
505 | if test x$tty_group = xyes; then |
263 | if test x$pt_cv_tty_group = xyes; then |
506 | AC_DEFINE(TTY_GID_SUPPORT, 1, "") |
264 | AC_DEFINE(TTY_GID_SUPPORT, 1, "") |
507 | fi]) |
265 | fi]) |
508 | |
266 | |