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 | #include <sys/stat.h> |
|
|
9 | $5 |
|
|
10 | int main() |
|
|
11 | { |
|
|
12 | const char **path, *list[] = { $4, NULL }; |
|
|
13 | FILE *f = fopen("conftestval", "w"); |
|
|
14 | if (!f) return 1; |
|
|
15 | #ifdef $2 |
|
|
16 | fprintf(f, "%s\n", $2); |
|
|
17 | #elif defined($3) |
|
|
18 | fprintf(f, "%s\n", $3); |
|
|
19 | #else |
|
|
20 | for (path = list; *path; path++) { |
|
|
21 | struct stat st; |
|
|
22 | if (stat(*path, &st) == 0) { |
|
|
23 | fprintf(f, "%s\n", *path); |
|
|
24 | break; |
|
|
25 | } |
|
|
26 | } |
|
|
27 | #endif |
|
|
28 | return fclose(f) != 0; |
|
|
29 | }]])],[pt_cv_path_$1=`cat conftestval`],[pt_cv_path_$1=], |
|
|
30 | [AC_MSG_WARN(Define $2 in config.h manually)])]) |
|
|
31 | if test x$pt_cv_path_$1 != x; then |
|
|
32 | AC_DEFINE_UNQUOTED($2, "$pt_cv_path_$1", Define location of $1) |
|
|
33 | fi]) |
3 | |
34 | |
4 | AC_DEFUN([PTY_CHECK], |
35 | AC_DEFUN([PTY_CHECK], |
5 | [ |
36 | [ |
6 | AC_CHECK_HEADERS( \ |
37 | AC_CHECK_HEADERS( \ |
7 | pty.h \ |
38 | pty.h \ |
… | |
… | |
22 | seteuid \ |
53 | seteuid \ |
23 | setreuid \ |
54 | setreuid \ |
24 | setresuid \ |
55 | setresuid \ |
25 | ) |
56 | ) |
26 | |
57 | |
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) |
58 | AC_MSG_CHECKING(for UNIX98 ptys) |
69 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>]], |
59 | AC_LINK_IFELSE( |
|
|
60 | [AC_LANG_PROGRAM( |
|
|
61 | [[#include <stdlib.h>]], |
70 | [[grantpt(0);unlockpt(0);ptsname(0);]])], |
62 | [[grantpt(0);unlockpt(0);ptsname(0);]])], |
71 | [unix98_pty=yes |
63 | [unix98_pty=yes |
72 | AC_DEFINE(UNIX98_PTY, 1, "") |
64 | AC_DEFINE(UNIX98_PTY, 1, "") |
73 | AC_MSG_RESULT(yes)], |
65 | AC_MSG_RESULT(yes)], |
74 | [AC_MSG_RESULT(no)]) |
66 | [AC_MSG_RESULT(no)]) |
75 | fi |
|
|
76 | |
67 | |
77 | if test -z "$unix98_pty"; then |
68 | if test -z "$unix98_pty"; then |
78 | AC_CHECK_FUNCS(openpty, [], [AC_CHECK_LIB(util, openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"])]) |
69 | AC_SEARCH_LIBS(openpty, util, AC_DEFINE(HAVE_OPENPTY, 1, "")) |
79 | fi |
70 | fi |
80 | ]) |
71 | ]) |
81 | |
72 | |
82 | AC_DEFUN([UTMP_CHECK], |
73 | AC_DEFUN([UTMP_CHECK], |
83 | [ |
74 | [ |
… | |
… | |
126 | dnl# -------------------------------------------------------------------------- |
117 | dnl# -------------------------------------------------------------------------- |
127 | dnl# check for host field in utmp structure |
118 | dnl# check for host field in utmp structure |
128 | |
119 | |
129 | dnl# -------------------------------------------- |
120 | dnl# -------------------------------------------- |
130 | AC_CHECK_HEADERS(utmp.h, |
121 | AC_CHECK_HEADERS(utmp.h, |
131 | [AC_CACHE_CHECK([for struct utmp], pt_cv_struct_utmp, |
122 | AC_CHECK_TYPES([struct utmp], [], [], [ |
132 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
123 | #include <sys/types.h> |
133 | #include <utmp.h>]], [[struct utmp ut;]])],[pt_cv_struct_utmp=yes],[pt_cv_struct_utmp=no])]) |
124 | #include <utmp.h> |
134 | if test x$pt_cv_struct_utmp = xyes; then |
125 | ]) |
135 | AC_DEFINE(HAVE_STRUCT_UTMP, 1, Define if utmp.h has struct utmp) |
|
|
136 | fi |
|
|
137 | ] |
|
|
138 | |
126 | |
139 | AC_CACHE_CHECK(for ut_host in utmp struct, pt_cv_struct_utmp_host, |
127 | 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;]])],[pt_cv_struct_utmp_host=yes],[pt_cv_struct_utmp_host=no])]) |
|
|
142 | if test x$pt_cv_struct_utmp_host = xyes; then |
|
|
143 | AC_DEFINE(HAVE_UTMP_HOST, 1, Define if struct utmp contains ut_host) |
128 | [AC_DEFINE(HAVE_UTMP_HOST, 1, Define if struct utmp contains ut_host)], [], [ |
144 | fi |
129 | #include <sys/types.h> |
|
|
130 | #include <utmp.h> |
|
|
131 | ]) |
145 | |
132 | |
146 | AC_CACHE_CHECK(for ut_pid in utmp struct, pt_cv_struct_utmp_pid, |
133 | 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;]])],[pt_cv_struct_utmp_pid=yes],[pt_cv_struct_utmp_pid=no])]) |
|
|
149 | if test x$pt_cv_struct_utmp_pid = xyes; then |
|
|
150 | AC_DEFINE(HAVE_UTMP_PID, 1, Define if struct utmp contains ut_pid) |
134 | [AC_DEFINE(HAVE_UTMP_PID, 1, Define if struct utmp contains ut_pid)], [], [ |
151 | fi |
135 | #include <sys/types.h> |
|
|
136 | #include <utmp.h> |
|
|
137 | ]) |
152 | ) dnl# AC_CHECK_HEADERS(utmp.h |
138 | ) dnl# AC_CHECK_HEADERS(utmp.h |
153 | |
139 | |
154 | dnl# -------------------------------------------- |
140 | dnl# -------------------------------------------- |
155 | |
141 | |
156 | AC_CHECK_HEADERS(utmpx.h, |
142 | AC_CHECK_HEADERS(utmpx.h, |
157 | [AC_CACHE_CHECK([for struct utmpx], pt_cv_struct_utmpx, |
143 | AC_CHECK_TYPES([struct utmpx], [], [], [ |
158 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
144 | #include <sys/types.h> |
159 | #include <utmpx.h>]], [[struct utmpx ut;]])],[pt_cv_struct_utmpx=yes],[pt_cv_struct_utmpx=no])]) |
145 | #include <utmpx.h> |
160 | if test x$pt_cv_struct_utmpx = xyes; then |
146 | ]) |
161 | AC_DEFINE(HAVE_STRUCT_UTMPX, 1, Define if utmpx.h has struct utmpx) |
|
|
162 | fi |
|
|
163 | ] |
|
|
164 | |
147 | |
165 | AC_CACHE_CHECK(for host in utmpx struct, pt_cv_struct_utmpx_host, |
148 | 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;]])],[pt_cv_struct_utmpx_host=yes],[pt_cv_struct_utmpx_host=no])]) |
|
|
168 | if test x$pt_cv_struct_utmpx_host = xyes; then |
|
|
169 | AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host) |
149 | [AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host)], [], [ |
170 | fi |
150 | #include <sys/types.h> |
|
|
151 | #include <utmpx.h> |
|
|
152 | ]) |
171 | |
153 | |
172 | AC_CACHE_CHECK(for session in utmpx struct, pt_cv_struct_utmpx_session, |
154 | AC_CHECK_MEMBER([struct utmpx.ut_session], |
173 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
|
|
174 | #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$pt_cv_struct_utmpx_session = xyes; then |
|
|
176 | AC_DEFINE(HAVE_UTMPX_SESSION, 1, Define if struct utmpx contains ut_session) |
155 | [AC_DEFINE(HAVE_UTMPX_SESSION, 1, Define if struct utmpx contains ut_session)], [], [ |
177 | fi |
156 | #include <sys/types.h> |
|
|
157 | #include <utmpx.h> |
|
|
158 | ]) |
178 | ) dnl# AC_CHECK_HEADERS(utmpx.h |
159 | ) dnl# AC_CHECK_HEADERS(utmpx.h |
179 | |
160 | |
180 | dnl# -------------------------------------------------------------------------- |
161 | dnl# -------------------------------------------------------------------------- |
181 | dnl# check for struct lastlog |
162 | dnl# check for struct lastlog |
182 | AC_CACHE_CHECK(for struct lastlog, pt_cv_struct_lastlog, |
163 | AC_CHECK_TYPES([struct lastlog], [], [], [ |
183 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
164 | #include <sys/types.h> |
184 | #include <utmp.h> |
165 | #include <utmp.h> |
185 | #ifdef HAVE_LASTLOG_H |
166 | #ifdef HAVE_LASTLOG_H |
186 | #include <lastlog.h> |
167 | #include <lastlog.h> |
187 | #endif |
168 | #endif |
188 | ]], [[struct lastlog ll;]])],[pt_cv_struct_lastlog=yes],[pt_cv_struct_lastlog=no])]) |
169 | ]) |
189 | 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) |
|
|
191 | fi |
|
|
192 | |
170 | |
193 | dnl# check for struct lastlogx |
171 | dnl# check for struct lastlogx |
194 | AC_CACHE_CHECK(for struct lastlogx, pt_cv_struct_lastlogx, |
172 | AC_CHECK_TYPES([struct lastlogx], [], [], [ |
195 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
173 | #include <sys/types.h> |
196 | #include <utmpx.h> |
174 | #include <utmpx.h> |
197 | #ifdef HAVE_LASTLOG_H |
175 | #ifdef HAVE_LASTLOG_H |
198 | #include <lastlog.h> |
176 | #include <lastlog.h> |
199 | #endif |
177 | #endif |
200 | ]], [[struct lastlogx ll;]])],[pt_cv_struct_lastlogx=yes],[pt_cv_struct_lastlogx=no])]) |
178 | ]) |
201 | 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) |
|
|
203 | fi |
|
|
204 | |
179 | |
205 | dnl# -------------------------------------------------------------------------- |
180 | dnl# -------------------------------------------------------------------------- |
206 | dnl# FIND FILES |
181 | dnl# FIND FILES |
207 | dnl# -------------------------------------------------------------------------- |
182 | dnl# -------------------------------------------------------------------------- |
208 | |
183 | |
209 | dnl# find utmp |
184 | dnl# find utmp |
210 | AC_CACHE_CHECK(where utmp is located, pt_cv_path_utmp, |
185 | PT_FIND_FILE([utmp], [UTMP_FILE], [_PATH_UTMP], |
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 }; |
186 | ["/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 | }]])],[pt_cv_path_utmp=`cat conftestval`],[pt_cv_path_utmp=],[dnl |
|
|
238 | AC_MSG_WARN(Define UTMP_FILE in config.h manually)])]) |
|
|
239 | if test x$pt_cv_path_utmp != x; then |
|
|
240 | 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, pt_cv_path_utmpx, |
|
|
248 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
249 | #include <stdlib.h> |
|
|
250 | #include <sys/types.h> |
187 | #include <sys/types.h> |
251 | #include <utmpx.h> |
188 | #include <utmp.h> |
252 | #include <errno.h> |
189 | ]) |
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 | }]])],[pt_cv_path_utmpx=`cat conftestval`],[pt_cv_path_utmpx=],[dnl |
|
|
285 | AC_MSG_WARN(Define UTMPX_FILE in config.h manually)])]) |
|
|
286 | if test x$pt_cv_path_utmpx != x; then |
|
|
287 | AC_DEFINE_UNQUOTED(UTMPX_FILE, "$pt_cv_path_utmpx", Define location of utmpx) |
|
|
288 | fi |
|
|
289 | |
190 | |
290 | dnl# -------------------------------------------------------------------------- |
191 | dnl# -------------------------------------------------------------------------- |
291 | |
192 | |
292 | dnl# find wtmp |
193 | dnl# find wtmp |
293 | AC_CACHE_CHECK(where wtmp is located, pt_cv_path_wtmp, |
194 | PT_FIND_FILE([wtmp], [WTMP_FILE], [_PATH_WTMP], |
294 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
195 | ["/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp"],[ |
295 | #include <stdlib.h> |
|
|
296 | #include <sys/types.h> |
196 | #include <sys/types.h> |
297 | #ifdef HAVE_UTMP_H |
197 | #ifdef HAVE_UTMP_H |
298 | #include <utmp.h> |
198 | #include <utmp.h> |
299 | #endif |
199 | #endif |
300 | #include <errno.h> |
200 | ]) |
301 | main() |
|
|
302 | { |
|
|
303 | char **w, *wtmplist[] = { |
|
|
304 | "/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp", NULL }; |
|
|
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 | }]])],[pt_cv_path_wtmp=`cat conftestval`],[pt_cv_path_wtmp=],[dnl |
|
|
323 | AC_MSG_WARN(Define WTMP_FILE in config.h manually)])]) |
|
|
324 | if test x$pt_cv_path_wtmp != x; then |
|
|
325 | AC_DEFINE_UNQUOTED(WTMP_FILE, "$pt_cv_path_wtmp", Define location of wtmp) |
|
|
326 | fi |
|
|
327 | dnl# -------------------------------------------------------------------------- |
201 | dnl# -------------------------------------------------------------------------- |
328 | |
202 | |
329 | dnl# find wtmpx |
203 | dnl# find wtmpx |
330 | AC_CACHE_CHECK(where wtmpx is located, pt_cv_path_wtmpx, |
204 | PT_FIND_FILE([wtmpx], [WTMPX_FILE], [_PATH_WTMPX], |
331 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
205 | ["/var/log/wtmpx", "/var/adm/wtmpx"],[ |
332 | #include <stdlib.h> |
|
|
333 | #ifdef HAVE_UTMPX_H |
206 | #ifdef HAVE_UTMPX_H |
334 | #include <utmpx.h> |
207 | #include <utmpx.h> |
335 | #endif |
208 | #endif |
336 | #include <errno.h> |
209 | ]) |
337 | main() |
|
|
338 | { |
|
|
339 | char **w, *wtmplist[] = { |
|
|
340 | "/var/log/wtmpx", "/var/adm/wtmpx", NULL }; |
|
|
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 | }]])],[pt_cv_path_wtmpx=`cat conftestval`],[pt_cv_path_wtmpx=],[dnl |
|
|
359 | AC_MSG_WARN(Define WTMPX_FILE in config.h manually)])]) |
|
|
360 | if test x$pt_cv_path_wtmpx != x; then |
|
|
361 | AC_DEFINE_UNQUOTED(WTMPX_FILE, "$pt_cv_path_wtmpx", Define location of wtmpx) |
|
|
362 | fi |
|
|
363 | dnl# -------------------------------------------------------------------------- |
210 | dnl# -------------------------------------------------------------------------- |
364 | |
211 | |
365 | dnl# find lastlog |
212 | dnl# find lastlog |
366 | AC_CACHE_CHECK(where lastlog is located, pt_cv_path_lastlog, |
213 | PT_FIND_FILE([lastlog], [LASTLOG_FILE], [_PATH_LASTLOG], |
367 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
214 | ["/var/log/lastlog"],[ |
368 | #include <stdlib.h> |
|
|
369 | #include <sys/types.h> |
215 | #include <sys/types.h> |
370 | #ifdef HAVE_UTMPX_H |
216 | #ifdef HAVE_UTMP_H |
371 | #include <utmpx.h> |
|
|
372 | #elif defined(HAVE_UTMP_H) |
|
|
373 | #include <utmp.h> |
217 | #include <utmp.h> |
374 | #endif |
218 | #endif |
375 | #ifdef HAVE_LASTLOG_H |
219 | #ifdef HAVE_LASTLOG_H |
376 | #include <lastlog.h> |
220 | #include <lastlog.h> |
377 | #endif |
221 | #endif |
378 | #include <errno.h> |
222 | ]) |
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 | }]])],[pt_cv_path_lastlog=`cat conftestval`],[pt_cv_path_lastlog=],[dnl |
|
|
400 | AC_MSG_WARN(Define LASTLOG_FILE in config.h manually)])]) |
|
|
401 | if test x$pt_cv_path_lastlog != x; then |
|
|
402 | AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$pt_cv_path_lastlog", Define location of lastlog) |
|
|
403 | fi |
|
|
404 | dnl# -------------------------------------------------------------------------- |
223 | dnl# -------------------------------------------------------------------------- |
405 | |
224 | |
406 | dnl# find lastlogx |
225 | dnl# find lastlogx |
407 | AC_CACHE_CHECK(where lastlogx is located, pt_cv_path_lastlogx, |
226 | PT_FIND_FILE([lastlogx], [LASTLOGX_FILE], [_PATH_LASTLOGX], |
408 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
227 | ["/var/log/lastlogx", "/var/adm/lastlogx"],[ |
409 | #include <stdlib.h> |
|
|
410 | #ifdef HAVE_UTMPX_H |
228 | #ifdef HAVE_UTMPX_H |
411 | #include <utmpx.h> |
229 | #include <utmpx.h> |
412 | #endif |
230 | #endif |
413 | #include <errno.h> |
231 | ]) |
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 | }]])],[pt_cv_path_lastlogx=`cat conftestval`],[pt_cv_path_lastlogx=],[dnl |
|
|
435 | AC_MSG_WARN(Define LASTLOGX_FILE in config.h manually)])]) |
|
|
436 | if test x$pt_cv_path_lastlogx != x; then |
|
|
437 | AC_DEFINE_UNQUOTED(LASTLOGX_FILE, "$pt_cv_path_lastlogx", Define location of lastlogx) |
|
|
438 | fi |
|
|
439 | ]) |
232 | ]) |
440 | |
233 | |
441 | AC_DEFUN([SCM_RIGHTS_CHECK], |
234 | AC_DEFUN([SCM_RIGHTS_CHECK], |
442 | [ |
235 | [ |
443 | AC_CACHE_CHECK(for unix-compliant filehandle passing ability, pt_cv_can_pass_fds, |
236 | AC_CACHE_CHECK(for unix-compliant filehandle passing ability, pt_cv_can_pass_fds, |
… | |
… | |
485 | #include <sys/types.h> |
278 | #include <sys/types.h> |
486 | #include <sys/stat.h> |
279 | #include <sys/stat.h> |
487 | #include <unistd.h> |
280 | #include <unistd.h> |
488 | #include <grp.h> |
281 | #include <grp.h> |
489 | |
282 | |
490 | main() |
283 | int main() |
491 | { |
284 | { |
492 | struct stat st; |
285 | struct stat st; |
493 | struct group *gr; |
286 | struct group *gr; |
494 | char *tty; |
287 | char *tty; |
495 | gr = getgrnam("tty"); |
288 | gr = getgrnam("tty"); |