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