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