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 | [ |
83 | support_utmp=yes |
56 | support_utmp=yes |
84 | support_wtmp=yes |
57 | support_wtmp=yes |
85 | support_lastlog=yes |
58 | support_lastlog=yes |
86 | |
59 | |
87 | AC_ARG_ENABLE(utmp, |
60 | AC_ARG_ENABLE(utmp, |
88 | [ --enable-utmp enable utmp (utmpx) support], |
61 | [AS_HELP_STRING([--enable-utmp],[enable utmp (utmpx) support])], |
89 | [if test x$enableval = xyes -o x$enableval = xno; then |
62 | [if test x$enableval = xyes -o x$enableval = xno; then |
90 | support_utmp=$enableval |
63 | support_utmp=$enableval |
91 | fi]) |
64 | fi]) |
92 | |
65 | |
93 | AC_ARG_ENABLE(wtmp, |
66 | AC_ARG_ENABLE(wtmp, |
94 | [ --enable-wtmp enable wtmp (wtmpx) support (requires --enable-utmp)], |
67 | [AS_HELP_STRING([--enable-wtmp],[enable wtmp (wtmpx) support (requires --enable-utmp)])], |
95 | [if test x$enableval = xyes -o x$enableval = xno; then |
68 | [if test x$enableval = xyes -o x$enableval = xno; then |
96 | support_wtmp=$enableval |
69 | support_wtmp=$enableval |
97 | fi]) |
70 | fi]) |
98 | |
71 | |
99 | AC_ARG_ENABLE(lastlog, |
72 | AC_ARG_ENABLE(lastlog, |
100 | [ --enable-lastlog enable lastlog support (requires --enable-utmp)], |
73 | [AS_HELP_STRING([--enable-lastlog],[enable lastlog support (requires --enable-utmp)])], |
101 | [if test x$enableval = xyes -o x$enableval = xno; then |
74 | [if test x$enableval = xyes -o x$enableval = xno; then |
102 | support_lastlog=$enableval |
75 | support_lastlog=$enableval |
103 | fi]) |
76 | fi]) |
104 | |
77 | |
105 | if test x$support_utmp = xyes; then |
78 | if test x$support_utmp = xyes; then |
… | |
… | |
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 | AC_CHECK_FUNCS( \ |
116 | ttyslot \ |
|
|
117 | updwtmp \ |
89 | updwtmp \ |
118 | updwtmpx \ |
90 | updwtmpx \ |
|
|
91 | updlastlogx \ |
119 | ) |
92 | ) |
120 | |
93 | |
121 | AC_CHECK_HEADERS( \ |
94 | AC_CHECK_HEADERS(lastlog.h) |
122 | utmp.h \ |
95 | |
123 | utmpx.h \ |
96 | case $host in |
124 | lastlog.h \ |
97 | *-*-solaris*) |
125 | ) |
98 | AC_DEFINE(__EXTENSIONS__, 1, Enable declarations in utmp.h on Solaris when the XPG4v2 namespace is active) |
|
|
99 | ;; |
|
|
100 | esac |
126 | |
101 | |
127 | dnl# -------------------------------------------------------------------------- |
102 | dnl# -------------------------------------------------------------------------- |
128 | dnl# DO ALL UTMP AND WTMP CHECKING |
103 | dnl# DO ALL UTMP AND WTMP CHECKING |
129 | dnl# -------------------------------------------------------------------------- |
104 | dnl# -------------------------------------------------------------------------- |
130 | dnl# check for host field in utmp structure |
105 | dnl# check for host field in utmp structure |
131 | |
106 | |
132 | dnl# -------------------------------------------- |
107 | dnl# -------------------------------------------- |
133 | AC_CHECK_HEADER(utmp.h, |
108 | AC_CHECK_HEADERS(utmp.h, |
134 | [AC_CACHE_CHECK([for struct utmp], struct_utmp, |
109 | AC_CHECK_TYPES([struct utmp], [], [], [ |
135 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
110 | #include <sys/types.h> |
136 | #include <utmp.h>]], [[struct utmp ut;]])],[struct_utmp=yes],[struct_utmp=no])]) |
111 | #include <utmp.h> |
137 | if test x$struct_utmp = xyes; then |
112 | ]) |
138 | AC_DEFINE(HAVE_STRUCT_UTMP, 1, Define if utmp.h has struct utmp) |
|
|
139 | fi |
|
|
140 | ] |
|
|
141 | |
113 | |
142 | AC_CACHE_CHECK(for ut_host in utmp struct, struct_utmp_host, |
114 | AC_CHECK_MEMBER([struct utmp.ut_host], |
143 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
|
|
144 | #include <utmp.h>]], [[struct utmp ut; ut.ut_host;]])],[struct_utmp_host=yes],[struct_utmp_host=no])]) |
|
|
145 | if test x$struct_utmp_host = xyes; then |
|
|
146 | AC_DEFINE(HAVE_UTMP_HOST, 1, Define if struct utmp contains ut_host) |
115 | [AC_DEFINE(HAVE_UTMP_HOST, 1, Define if struct utmp contains ut_host)], [], [ |
147 | fi |
116 | #include <sys/types.h> |
|
|
117 | #include <utmp.h> |
|
|
118 | ]) |
148 | |
119 | |
149 | AC_CACHE_CHECK(for ut_pid in utmp struct, struct_utmp_pid, |
120 | AC_CHECK_MEMBER([struct utmp.ut_pid], |
150 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
|
|
151 | #include <utmp.h>]], [[struct utmp ut; ut.ut_pid;]])],[struct_utmp_pid=yes],[struct_utmp_pid=no])]) |
|
|
152 | if test x$struct_utmp_pid = xyes; then |
|
|
153 | AC_DEFINE(HAVE_UTMP_PID, 1, Define if struct utmp contains ut_pid) |
121 | [AC_DEFINE(HAVE_UTMP_PID, 1, Define if struct utmp contains ut_pid)], [], [ |
154 | fi |
122 | #include <sys/types.h> |
|
|
123 | #include <utmp.h> |
|
|
124 | ]) |
155 | ) dnl# AC_CHECK_HEADER(utmp.h |
125 | ) dnl# AC_CHECK_HEADERS(utmp.h |
156 | |
126 | |
157 | dnl# -------------------------------------------- |
127 | dnl# -------------------------------------------- |
158 | |
128 | |
159 | AC_CHECK_HEADER(utmpx.h, |
129 | AC_CHECK_HEADERS(utmpx.h, |
160 | [AC_CACHE_CHECK([for struct utmpx], struct_utmpx, |
130 | AC_CHECK_TYPES([struct utmpx], [], [], [ |
161 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
131 | #include <sys/types.h> |
162 | #include <utmpx.h>]], [[struct utmpx ut;]])],[struct_utmpx=yes],[struct_utmpx=no])]) |
|
|
163 | if test x$struct_utmpx = xyes; then |
|
|
164 | AC_DEFINE(HAVE_STRUCT_UTMPX, 1, Define if utmpx.h has struct utmpx) |
|
|
165 | fi |
|
|
166 | ] |
|
|
167 | |
|
|
168 | AC_CACHE_CHECK(for host in utmpx struct, struct_utmpx_host, |
|
|
169 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
|
|
170 | #include <utmpx.h>]], [[struct utmpx utx; utx.ut_host;]])],[struct_utmpx_host=yes],[struct_utmpx_host=no])]) |
|
|
171 | if test x$struct_utmpx_host = xyes; then |
|
|
172 | AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host) |
|
|
173 | fi |
|
|
174 | |
|
|
175 | AC_CACHE_CHECK(for session in utmpx struct, struct_utmpx_session, |
|
|
176 | [AC_TRY_COMPILE([#include <sys/types.h> |
|
|
177 | #include <utmpx.h>], |
132 | #include <utmpx.h> |
178 | [struct utmpx utx; utx.ut_session;], |
133 | ]) |
179 | struct_utmpx_session=yes, struct_utmpx_session=no)]) |
134 | |
180 | if test x$struct_utmpx_session = xyes; then |
135 | AC_CHECK_MEMBER([struct utmpx.ut_host], |
181 | AC_DEFINE(HAVE_UTMPX_SESSION, 1, Define if struct utmpx contains ut_session) |
136 | [AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host)], [], [ |
182 | fi |
137 | #include <sys/types.h> |
|
|
138 | #include <utmpx.h> |
|
|
139 | ]) |
183 | ) dnl# AC_CHECK_HEADER(utmpx.h |
140 | ) dnl# AC_CHECK_HEADERS(utmpx.h |
184 | |
141 | |
185 | dnl# -------------------------------------------------------------------------- |
142 | dnl# -------------------------------------------------------------------------- |
186 | dnl# check for struct lastlog |
143 | dnl# check for struct lastlog |
187 | AC_CACHE_CHECK(for struct lastlog, struct_lastlog, |
144 | AC_CHECK_TYPES([struct lastlog], [], [], [ |
188 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
145 | #include <sys/types.h> |
189 | #include <utmp.h> |
146 | #include <utmp.h> |
190 | #ifdef HAVE_LASTLOG_H |
147 | #ifdef HAVE_LASTLOG_H |
191 | #include <lastlog.h> |
148 | #include <lastlog.h> |
192 | #endif |
149 | #endif |
193 | ]], [[struct lastlog ll;]])],[struct_lastlog=yes],[struct_lastlog=no])]) |
150 | ]) |
194 | if test x$struct_lastlog = xyes; then |
|
|
195 | AC_DEFINE(HAVE_STRUCT_LASTLOG, 1, Define if utmp.h or lastlog.h has struct lastlog) |
|
|
196 | fi |
|
|
197 | |
151 | |
198 | dnl# check for struct lastlogx |
152 | dnl# check for struct lastlogx |
199 | AC_CACHE_CHECK(for struct lastlogx, struct_lastlogx, |
153 | AC_CHECK_TYPES([struct lastlogx], [], [], [ |
200 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
154 | #include <sys/types.h> |
201 | #include <utmpx.h> |
155 | #include <utmpx.h> |
202 | #ifdef HAVE_LASTLOG_H |
156 | #ifdef HAVE_LASTLOG_H |
203 | #include <lastlog.h> |
157 | #include <lastlog.h> |
204 | #endif |
158 | #endif |
205 | ]], [[struct lastlogx ll;]])],[struct_lastlogx=yes],[struct_lastlogx=no])]) |
159 | ]) |
206 | if test x$struct_lastlogx = xyes; then |
|
|
207 | AC_DEFINE(HAVE_STRUCT_LASTLOGX, 1, Define if utmpx.h or lastlog.h has struct lastlogx) |
|
|
208 | fi |
|
|
209 | |
160 | |
210 | dnl# -------------------------------------------------------------------------- |
161 | dnl# -------------------------------------------------------------------------- |
211 | dnl# FIND FILES |
162 | dnl# FIND FILES |
212 | dnl# -------------------------------------------------------------------------- |
163 | dnl# -------------------------------------------------------------------------- |
213 | |
164 | |
214 | dnl# find utmp |
165 | dnl# find utmp |
215 | AC_CACHE_CHECK(where utmp is located, path_utmp, |
166 | PT_FIND_FILE([utmp], [PT_UTMP_FILE], |
216 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
217 | #include <sys/types.h> |
|
|
218 | #include <utmp.h> |
|
|
219 | #include <errno.h> |
|
|
220 | main() |
|
|
221 | { |
|
|
222 | char **u, *utmplist[] = { |
|
|
223 | "/var/run/utmp", "/var/adm/utmp", "/etc/utmp", "/usr/etc/utmp", "/usr/adm/utmp", NULL }; |
167 | ["/var/run/utmp" "/var/adm/utmp" "/etc/utmp" "/usr/etc/utmp" "/usr/adm/utmp"]) |
224 | FILE *a, *f=fopen("conftestval", "w"); |
|
|
225 | if (!f) exit(1); |
|
|
226 | #ifdef UTMP_FILE |
|
|
227 | fprintf(f, "%s\n", UTMP_FILE); |
|
|
228 | exit(0); |
|
|
229 | #endif |
|
|
230 | #ifdef _PATH_UTMP |
|
|
231 | fprintf(f, "%s\n", _PATH_UTMP); |
|
|
232 | exit(0); |
|
|
233 | #endif |
|
|
234 | for (u = utmplist; *u; u++) { |
|
|
235 | if ((a = fopen(*u, "r")) != NULL || errno == EACCES) { |
|
|
236 | fprintf(f, "%s\n", *u); |
|
|
237 | exit(0); |
|
|
238 | } |
|
|
239 | } |
|
|
240 | exit(0); |
|
|
241 | }]])],[path_utmp=`cat conftestval`],[path_utmp=],[dnl |
|
|
242 | AC_MSG_WARN(Define UTMP_FILE in config.h manually)])]) |
|
|
243 | if test x$path_utmp != x; then |
|
|
244 | AC_DEFINE_UNQUOTED(UTMP_FILE, "$path_utmp", Define location of utmp) |
|
|
245 | fi |
|
|
246 | |
|
|
247 | dnl# -------------------------------------------------------------------------- |
|
|
248 | |
|
|
249 | dnl# find utmpx - if a utmp file exists at the same location and is more than |
|
|
250 | dnl# a day newer, then dump the utmpx. People leave lots of junk around. |
|
|
251 | AC_CACHE_CHECK(where utmpx is located, path_utmpx, |
|
|
252 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
253 | #include <sys/types.h> |
|
|
254 | #include <utmpx.h> |
|
|
255 | #include <errno.h> |
|
|
256 | #include <sys/stat.h> |
|
|
257 | #ifdef HAVE_STRING_H |
|
|
258 | #include <string.h> |
|
|
259 | #endif |
|
|
260 | main() |
|
|
261 | { |
|
|
262 | char **u, *p, *utmplist[] = { |
|
|
263 | #ifdef UTMPX_FILE |
|
|
264 | UTMPX_FILE, |
|
|
265 | #endif |
|
|
266 | #ifdef _PATH_UTMPX |
|
|
267 | _PATH_UTMPX, |
|
|
268 | #endif |
|
|
269 | "/var/adm/utmpx", "/etc/utmpx", NULL }; |
|
|
270 | FILE *a, *f=fopen("conftestval", "w"); |
|
|
271 | struct stat statu, statux; |
|
|
272 | if (!f) exit(1); |
|
|
273 | for (u = utmplist; *u; u++) { |
|
|
274 | if ((a = fopen(*u, "r")) != NULL || errno == EACCES) { |
|
|
275 | if (stat(*u, &statux) < 0) |
|
|
276 | continue; |
|
|
277 | p = strdup(*u); |
|
|
278 | p[strlen(p) - 1] = '\0'; |
|
|
279 | if (stat(p, &statu) >= 0 |
|
|
280 | && (statu.st_mtime - statux.st_mtime > 86400)) |
|
|
281 | continue; |
|
|
282 | fprintf(f, "%s\n", *u); |
|
|
283 | exit(0); |
|
|
284 | } |
|
|
285 | } |
|
|
286 | exit(0); |
|
|
287 | }]])],[path_utmpx=`cat conftestval`],[path_utmpx=],[dnl |
|
|
288 | AC_MSG_WARN(Define UTMPX_FILE in config.h manually)])]) |
|
|
289 | if test x$path_utmpx != x; then |
|
|
290 | AC_DEFINE_UNQUOTED(UTMPX_FILE, "$path_utmpx", Define location of utmpx) |
|
|
291 | fi |
|
|
292 | |
168 | |
293 | dnl# -------------------------------------------------------------------------- |
169 | dnl# -------------------------------------------------------------------------- |
294 | |
170 | |
295 | dnl# find wtmp |
171 | dnl# find wtmp |
296 | AC_CACHE_CHECK(where wtmp is located, path_wtmp, |
172 | PT_FIND_FILE([wtmp], [PT_WTMP_FILE], |
297 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
|
|
298 | #include <sys/types.h> |
|
|
299 | #ifdef HAVE_UTMP_H |
|
|
300 | #include <utmp.h> |
|
|
301 | #endif |
|
|
302 | #include <errno.h> |
|
|
303 | main() |
|
|
304 | { |
|
|
305 | char **w, *wtmplist[] = { |
|
|
306 | "/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp", NULL }; |
173 | ["/var/log/wtmp" "/var/adm/wtmp" "/etc/wtmp" "/usr/etc/wtmp" "/usr/adm/wtmp"]) |
307 | FILE *a, *f=fopen("conftestval", "w"); |
|
|
308 | if (!f) exit(1); |
|
|
309 | #ifdef WTMP_FILE |
|
|
310 | fprintf(f, "%s\n", WTMP_FILE); |
|
|
311 | exit(0); |
|
|
312 | #endif |
|
|
313 | #ifdef _PATH_WTMP |
|
|
314 | fprintf(f, "%s\n", _PATH_WTMP); |
|
|
315 | exit(0); |
|
|
316 | #endif |
|
|
317 | for (w = wtmplist; *w; w++) { |
|
|
318 | if ((a = fopen(*w, "r")) != NULL || errno == EACCES) { |
|
|
319 | fprintf(f, "%s\n", *w); |
|
|
320 | exit(0); |
|
|
321 | } |
|
|
322 | } |
|
|
323 | exit(0); |
|
|
324 | }]])],[path_wtmp=`cat conftestval`],[path_wtmp=],[dnl |
|
|
325 | AC_MSG_WARN(Define WTMP_FILE in config.h manually)])]) |
|
|
326 | if test x$path_wtmp != x; then |
|
|
327 | AC_DEFINE_UNQUOTED(WTMP_FILE, "$path_wtmp", Define location of wtmp) |
|
|
328 | fi |
|
|
329 | dnl# -------------------------------------------------------------------------- |
174 | dnl# -------------------------------------------------------------------------- |
330 | |
175 | |
331 | dnl# find wtmpx |
176 | dnl# find wtmpx |
332 | AC_CACHE_CHECK(where wtmpx is located, path_wtmpx, |
177 | PT_FIND_FILE([wtmpx], [PT_WTMPX_FILE], |
333 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.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 }; |
178 | ["/var/log/wtmpx" "/var/adm/wtmpx"]) |
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# -------------------------------------------------------------------------- |
179 | dnl# -------------------------------------------------------------------------- |
365 | |
180 | |
366 | dnl# find lastlog |
181 | dnl# find lastlog |
367 | AC_CACHE_CHECK(where lastlog is located, path_lastlog, |
182 | PT_FIND_FILE([lastlog], [PT_LASTLOG_FILE], |
368 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
183 | ["/var/log/lastlog" "/var/adm/lastlog"]) |
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 | if test -d "$path_lastlog"; then |
|
|
404 | AC_DEFINE(LASTLOG_IS_DIR, 1, Define if lastlog is provided via a directory) |
|
|
405 | fi |
|
|
406 | fi |
|
|
407 | dnl# -------------------------------------------------------------------------- |
184 | dnl# -------------------------------------------------------------------------- |
408 | |
185 | |
409 | dnl# find lastlogx |
186 | dnl# find lastlogx |
410 | AC_CACHE_CHECK(where lastlogx is located, path_lastlogx, |
187 | PT_FIND_FILE([lastlogx], [PT_LASTLOGX_FILE], |
411 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
188 | ["/var/log/lastlogx" "/var/adm/lastlogx"]) |
412 | #ifdef HAVE_UTMPX_H |
|
|
413 | #include <utmpx.h> |
|
|
414 | #endif |
|
|
415 | #include <errno.h> |
|
|
416 | main() |
|
|
417 | { |
|
|
418 | char **w, *wtmplist[] = { "/var/log/lastlogx", "/var/adm/lastlogx", NULL }; |
|
|
419 | FILE *a, *f=fopen("conftestval", "w"); |
|
|
420 | if (!f) exit(1); |
|
|
421 | #ifdef LASTLOGX_FILE |
|
|
422 | fprintf(f, "%s\n", LASTLOGX_FILE); |
|
|
423 | exit(0); |
|
|
424 | #endif |
|
|
425 | #ifdef _PATH_LASTLOGX |
|
|
426 | fprintf(f, "%s\n", _PATH_LASTLOGX); |
|
|
427 | exit(0); |
|
|
428 | #endif |
|
|
429 | for (w = wtmplist; *w; w++) { |
|
|
430 | if ((a = fopen(*w, "r")) != NULL || errno == EACCES) { |
|
|
431 | fprintf(f, "%s\n", *w); |
|
|
432 | exit(0); |
|
|
433 | } |
|
|
434 | } |
|
|
435 | exit(0); |
|
|
436 | }]])],[path_lastlogx=`cat conftestval`],[path_lastlogx=],[dnl |
|
|
437 | AC_MSG_WARN(Define LASTLOGX_FILE in config.h manually)])]) |
|
|
438 | if test x$path_lastlogx != x; then |
|
|
439 | AC_DEFINE_UNQUOTED(LASTLOGX_FILE, "$path_lastlogx", Define location of lastlogx) |
|
|
440 | fi |
|
|
441 | ]) |
189 | ]) |
442 | |
190 | |
443 | AC_DEFUN([SCM_RIGHTS_CHECK], |
191 | AC_DEFUN([SCM_RIGHTS_CHECK], |
444 | [ |
192 | [ |
|
|
193 | case $host in |
|
|
194 | *-*-solaris*) |
|
|
195 | AC_DEFINE(_XOPEN_SOURCE, 500, Enable declarations of msg_control and msg_controllen on Solaris) |
|
|
196 | AC_SEARCH_LIBS(sendmsg, socket) |
|
|
197 | ;; |
|
|
198 | esac |
|
|
199 | |
445 | AC_CACHE_CHECK(for unix-compliant filehandle passing ability, can_pass_fds, |
200 | AC_CACHE_CHECK(for unix-compliant filehandle passing ability, pt_cv_can_pass_fds, |
446 | [AC_TRY_LINK([ |
201 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
447 | #include <cstddef> // broken bsds (is that redundant?) need this |
202 | #include <stddef.h> // broken bsds (is that redundant?) need this |
448 | #include <sys/types.h> |
203 | #include <sys/types.h> |
449 | #include <sys/socket.h> |
204 | #include <sys/socket.h> |
450 | #include <sys/uio.h> |
205 | #include <sys/uio.h> |
451 | ],[ |
206 | ]], [[ |
452 | { |
207 | { |
453 | msghdr msg; |
208 | msghdr msg; |
454 | iovec iov; |
209 | iovec iov; |
455 | char buf [100]; |
210 | char buf [100]; |
456 | char data = 0; |
211 | char data = 0; |
… | |
… | |
470 | |
225 | |
471 | *(int *)CMSG_DATA (cmsg) = 5; |
226 | *(int *)CMSG_DATA (cmsg) = 5; |
472 | |
227 | |
473 | return sendmsg (3, &msg, 0); |
228 | return sendmsg (3, &msg, 0); |
474 | } |
229 | } |
475 | ],[can_pass_fds=yes],[can_pass_fds=no])]) |
230 | ]])],[pt_cv_can_pass_fds=yes],[pt_cv_can_pass_fds=no])]) |
476 | if test x$can_pass_fds = xyes; then |
231 | if test x$pt_cv_can_pass_fds = xyes; then |
477 | AC_DEFINE(HAVE_UNIX_FDPASS, 1, Define if sys/socket.h defines the necessary macros/functions for file handle passing) |
232 | AC_DEFINE(HAVE_UNIX_FDPASS, 1, Define if sys/socket.h defines the necessary macros/functions for file handle passing) |
478 | else |
233 | else |
479 | AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability]) |
234 | AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability]) |
480 | fi |
235 | fi |
481 | ]) |
236 | ]) |
482 | |
237 | |
483 | AC_DEFUN([TTY_GROUP_CHECK], |
238 | AC_DEFUN([TTY_GROUP_CHECK], |
484 | [ |
239 | [ |
485 | AC_CACHE_CHECK([for tty group], tty_group, |
240 | AC_CACHE_CHECK([for tty group], pt_cv_tty_group, |
486 | [AC_TRY_RUN([ |
241 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
487 | #include <sys/types.h> |
242 | #include <sys/types.h> |
488 | #include <sys/stat.h> |
243 | #include <sys/stat.h> |
489 | #include <unistd.h> |
244 | #include <unistd.h> |
490 | #include <grp.h> |
245 | #include <grp.h> |
491 | |
246 | |
492 | main() |
247 | int main() |
493 | { |
248 | { |
494 | struct stat st; |
249 | struct stat st; |
495 | struct group *gr; |
250 | struct group *gr; |
496 | char *tty; |
251 | char *tty; |
497 | gr = getgrnam("tty"); |
252 | gr = getgrnam("tty"); |
… | |
… | |
501 | && (stat(tty, &st)) == 0 |
256 | && (stat(tty, &st)) == 0 |
502 | && st.st_gid == gr->gr_gid) |
257 | && st.st_gid == gr->gr_gid) |
503 | return 0; |
258 | return 0; |
504 | else |
259 | else |
505 | return 1; |
260 | return 1; |
506 | }], |
|
|
507 | [tty_group=yes],[tty_group=no],[tty_group=no])]) |
261 | }]])],[pt_cv_tty_group=yes],[pt_cv_tty_group=no],[pt_cv_tty_group=no])]) |
508 | if test x$tty_group = xyes; then |
262 | if test x$pt_cv_tty_group = xyes; then |
509 | AC_DEFINE(TTY_GID_SUPPORT, 1, "") |
263 | AC_DEFINE(TTY_GID_SUPPORT, 1, "") |
510 | fi]) |
264 | fi]) |
511 | |
265 | |