… | |
… | |
3 | |
3 | |
4 | AC_DEFUN([PT_FIND_FILE], |
4 | AC_DEFUN([PT_FIND_FILE], |
5 | [AC_CACHE_CHECK(where $1 is located, pt_cv_path_$1, |
5 | [AC_CACHE_CHECK(where $1 is located, pt_cv_path_$1, |
6 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
6 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
7 | #include <stdlib.h> |
7 | #include <stdlib.h> |
8 | $5 |
8 | #include <sys/stat.h> |
9 | #include <errno.h> |
9 | #include <sys/types.h> |
|
|
10 | #ifdef HAVE_UTMPX_H |
|
|
11 | #include <utmpx.h> |
|
|
12 | #endif |
|
|
13 | #ifdef HAVE_UTMP_H |
|
|
14 | #include <utmp.h> |
|
|
15 | #endif |
|
|
16 | #ifdef HAVE_LASTLOG_H |
|
|
17 | #include <lastlog.h> |
|
|
18 | #endif |
10 | int main() |
19 | int main() |
11 | { |
20 | { |
12 | char **path, *list[] = { $4, NULL }; |
21 | const char **path, *list[] = { $4, NULL }; |
13 | FILE *a, *f=fopen("conftestval", "w"); |
22 | FILE *f = fopen("conftestval", "w"); |
14 | if (!f) exit(1); |
23 | if (!f) return 1; |
15 | #ifdef $2 |
24 | #ifdef $2 |
16 | fprintf(f, "%s\n", $2); |
25 | fprintf(f, "%s\n", $2); |
17 | exit(0); |
26 | #elif defined($3) |
18 | #endif |
|
|
19 | #ifdef $3 |
|
|
20 | fprintf(f, "%s\n", $3); |
27 | fprintf(f, "%s\n", $3); |
21 | exit(0); |
28 | #else |
22 | #endif |
|
|
23 | for (path = list; *path; path++) { |
29 | for (path = list; *path; path++) { |
24 | if ((a = fopen(*path, "r")) != NULL || errno == EACCES) { |
30 | struct stat st; |
|
|
31 | if (stat(*path, &st) == 0) { |
25 | fprintf(f, "%s\n", *path); |
32 | fprintf(f, "%s\n", *path); |
26 | exit(0); |
33 | break; |
27 | } |
34 | } |
28 | } |
35 | } |
29 | exit(0); |
36 | #endif |
|
|
37 | return fclose(f) != 0; |
30 | }]])],[pt_cv_path_$1=`cat conftestval`],[pt_cv_path_$1=], |
38 | }]])],[pt_cv_path_$1=`cat conftestval`],[pt_cv_path_$1=], |
31 | [AC_MSG_WARN(Define $2 in config.h manually)])]) |
39 | [AC_MSG_WARN(Define $2 in config.h manually)])]) |
32 | if test x$pt_cv_path_$1 != x; then |
40 | if test x$pt_cv_path_$1 != x; then |
33 | AC_DEFINE_UNQUOTED($2, "$pt_cv_path_$1", Define location of $1) |
41 | AC_DEFINE_UNQUOTED($2, "$pt_cv_path_$1", Define location of $1) |
34 | fi]) |
42 | fi]) |
… | |
… | |
54 | seteuid \ |
62 | seteuid \ |
55 | setreuid \ |
63 | setreuid \ |
56 | setresuid \ |
64 | setresuid \ |
57 | ) |
65 | ) |
58 | |
66 | |
59 | have_clone=no |
|
|
60 | |
|
|
61 | AC_MSG_CHECKING(for /dev/ptc) |
|
|
62 | if test -e /dev/ptc; then |
|
|
63 | AC_MSG_RESULT(yes) |
|
|
64 | AC_DEFINE(CLONE_DEVICE, "/dev/ptc", [clone device filename]) |
|
|
65 | have_clone=yes |
|
|
66 | else |
|
|
67 | AC_MSG_RESULT(no) |
|
|
68 | fi |
|
|
69 | |
|
|
70 | case $host in |
|
|
71 | *-*-cygwin*) |
|
|
72 | have_clone=yes |
|
|
73 | AC_DEFINE(CLONE_DEVICE, "/dev/ptmx", [clone device filename]) |
|
|
74 | ;; |
|
|
75 | *) |
|
|
76 | AC_MSG_CHECKING(for /dev/ptmx) |
|
|
77 | if test -e /dev/ptmx; then |
|
|
78 | AC_MSG_RESULT(yes) |
|
|
79 | AC_DEFINE(HAVE_DEV_PTMX, 1, [Define to 1 if you have /dev/ptmx]) |
|
|
80 | AC_DEFINE(CLONE_DEVICE, "/dev/ptmx", [clone device filename]) |
|
|
81 | have_clone=yes |
|
|
82 | else |
|
|
83 | AC_MSG_RESULT(no) |
|
|
84 | fi |
|
|
85 | ;; |
|
|
86 | esac |
|
|
87 | |
|
|
88 | if test x$ac_cv_func_getpt = xyes -o x$ac_cv_func_posix_openpt = xyes -o x$have_clone = xyes; then |
|
|
89 | AC_MSG_CHECKING(for UNIX98 ptys) |
67 | AC_MSG_CHECKING(for UNIX98 ptys) |
90 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>]], |
68 | AC_LINK_IFELSE( |
|
|
69 | [AC_LANG_PROGRAM( |
|
|
70 | [[#include <stdlib.h>]], |
91 | [[grantpt(0);unlockpt(0);ptsname(0);]])], |
71 | [[grantpt(0);unlockpt(0);ptsname(0);]])], |
92 | [unix98_pty=yes |
72 | [unix98_pty=yes |
93 | AC_DEFINE(UNIX98_PTY, 1, "") |
73 | AC_DEFINE(UNIX98_PTY, 1, "") |
94 | AC_MSG_RESULT(yes)], |
74 | AC_MSG_RESULT(yes)], |
95 | [AC_MSG_RESULT(no)]) |
75 | [AC_MSG_RESULT(no)]) |
96 | fi |
|
|
97 | |
76 | |
98 | if test -z "$unix98_pty"; then |
77 | if test -z "$unix98_pty"; then |
99 | AC_SEARCH_LIBS(openpty, util, AC_DEFINE(HAVE_OPENPTY, 1, "")) |
78 | AC_SEARCH_LIBS(openpty, util, AC_DEFINE(HAVE_OPENPTY, 1, "")) |
100 | fi |
79 | fi |
101 | ]) |
80 | ]) |
… | |
… | |
147 | dnl# -------------------------------------------------------------------------- |
126 | dnl# -------------------------------------------------------------------------- |
148 | dnl# check for host field in utmp structure |
127 | dnl# check for host field in utmp structure |
149 | |
128 | |
150 | dnl# -------------------------------------------- |
129 | dnl# -------------------------------------------- |
151 | AC_CHECK_HEADERS(utmp.h, |
130 | AC_CHECK_HEADERS(utmp.h, |
152 | [AC_CACHE_CHECK([for struct utmp], pt_cv_struct_utmp, |
131 | AC_CHECK_TYPES([struct utmp], [], [], [ |
153 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
132 | #include <sys/types.h> |
154 | #include <utmp.h>]], [[struct utmp ut;]])],[pt_cv_struct_utmp=yes],[pt_cv_struct_utmp=no])]) |
133 | #include <utmp.h> |
155 | if test x$pt_cv_struct_utmp = xyes; then |
134 | ]) |
156 | AC_DEFINE(HAVE_STRUCT_UTMP, 1, Define if utmp.h has struct utmp) |
|
|
157 | fi |
|
|
158 | ] |
|
|
159 | |
135 | |
160 | AC_CACHE_CHECK(for ut_host in utmp struct, pt_cv_struct_utmp_host, |
136 | AC_CHECK_MEMBER([struct utmp.ut_host], |
161 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
|
|
162 | #include <utmp.h>]], [[struct utmp ut; ut.ut_host;]])],[pt_cv_struct_utmp_host=yes],[pt_cv_struct_utmp_host=no])]) |
|
|
163 | if test x$pt_cv_struct_utmp_host = xyes; then |
|
|
164 | AC_DEFINE(HAVE_UTMP_HOST, 1, Define if struct utmp contains ut_host) |
137 | [AC_DEFINE(HAVE_UTMP_HOST, 1, Define if struct utmp contains ut_host)], [], [ |
165 | fi |
138 | #include <sys/types.h> |
|
|
139 | #include <utmp.h> |
|
|
140 | ]) |
166 | |
141 | |
167 | AC_CACHE_CHECK(for ut_pid in utmp struct, pt_cv_struct_utmp_pid, |
142 | AC_CHECK_MEMBER([struct utmp.ut_pid], |
168 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
|
|
169 | #include <utmp.h>]], [[struct utmp ut; ut.ut_pid;]])],[pt_cv_struct_utmp_pid=yes],[pt_cv_struct_utmp_pid=no])]) |
|
|
170 | if test x$pt_cv_struct_utmp_pid = xyes; then |
|
|
171 | AC_DEFINE(HAVE_UTMP_PID, 1, Define if struct utmp contains ut_pid) |
143 | [AC_DEFINE(HAVE_UTMP_PID, 1, Define if struct utmp contains ut_pid)], [], [ |
172 | fi |
144 | #include <sys/types.h> |
|
|
145 | #include <utmp.h> |
|
|
146 | ]) |
173 | ) dnl# AC_CHECK_HEADERS(utmp.h |
147 | ) dnl# AC_CHECK_HEADERS(utmp.h |
174 | |
148 | |
175 | dnl# -------------------------------------------- |
149 | dnl# -------------------------------------------- |
176 | |
150 | |
177 | AC_CHECK_HEADERS(utmpx.h, |
151 | AC_CHECK_HEADERS(utmpx.h, |
178 | [AC_CACHE_CHECK([for struct utmpx], pt_cv_struct_utmpx, |
152 | AC_CHECK_TYPES([struct utmpx], [], [], [ |
179 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
153 | #include <sys/types.h> |
180 | #include <utmpx.h>]], [[struct utmpx ut;]])],[pt_cv_struct_utmpx=yes],[pt_cv_struct_utmpx=no])]) |
154 | #include <utmpx.h> |
181 | if test x$pt_cv_struct_utmpx = xyes; then |
155 | ]) |
182 | AC_DEFINE(HAVE_STRUCT_UTMPX, 1, Define if utmpx.h has struct utmpx) |
|
|
183 | fi |
|
|
184 | ] |
|
|
185 | |
156 | |
186 | AC_CACHE_CHECK(for host in utmpx struct, pt_cv_struct_utmpx_host, |
157 | AC_CHECK_MEMBER([struct utmpx.ut_host], |
187 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
|
|
188 | #include <utmpx.h>]], [[struct utmpx utx; utx.ut_host;]])],[pt_cv_struct_utmpx_host=yes],[pt_cv_struct_utmpx_host=no])]) |
|
|
189 | if test x$pt_cv_struct_utmpx_host = xyes; then |
|
|
190 | AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host) |
158 | [AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host)], [], [ |
191 | fi |
159 | #include <sys/types.h> |
|
|
160 | #include <utmpx.h> |
|
|
161 | ]) |
192 | |
162 | |
193 | AC_CACHE_CHECK(for session in utmpx struct, pt_cv_struct_utmpx_session, |
163 | AC_CHECK_MEMBER([struct utmpx.ut_session], |
194 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
|
|
195 | #include <utmpx.h>]], [[struct utmpx utx; utx.ut_session;]])],[pt_cv_struct_utmpx_session=yes],[pt_cv_struct_utmpx_session=no])]) |
|
|
196 | if test x$pt_cv_struct_utmpx_session = xyes; then |
|
|
197 | AC_DEFINE(HAVE_UTMPX_SESSION, 1, Define if struct utmpx contains ut_session) |
164 | [AC_DEFINE(HAVE_UTMPX_SESSION, 1, Define if struct utmpx contains ut_session)], [], [ |
198 | fi |
165 | #include <sys/types.h> |
|
|
166 | #include <utmpx.h> |
|
|
167 | ]) |
199 | ) dnl# AC_CHECK_HEADERS(utmpx.h |
168 | ) dnl# AC_CHECK_HEADERS(utmpx.h |
200 | |
169 | |
201 | dnl# -------------------------------------------------------------------------- |
170 | dnl# -------------------------------------------------------------------------- |
202 | dnl# check for struct lastlog |
171 | dnl# check for struct lastlog |
203 | AC_CACHE_CHECK(for struct lastlog, pt_cv_struct_lastlog, |
172 | AC_CHECK_TYPES([struct lastlog], [], [], [ |
204 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
173 | #include <sys/types.h> |
205 | #include <utmp.h> |
174 | #include <utmp.h> |
206 | #ifdef HAVE_LASTLOG_H |
175 | #ifdef HAVE_LASTLOG_H |
207 | #include <lastlog.h> |
176 | #include <lastlog.h> |
208 | #endif |
177 | #endif |
209 | ]], [[struct lastlog ll;]])],[pt_cv_struct_lastlog=yes],[pt_cv_struct_lastlog=no])]) |
178 | ]) |
210 | if test x$pt_cv_struct_lastlog = xyes; then |
|
|
211 | AC_DEFINE(HAVE_STRUCT_LASTLOG, 1, Define if utmp.h or lastlog.h has struct lastlog) |
|
|
212 | fi |
|
|
213 | |
179 | |
214 | dnl# check for struct lastlogx |
180 | dnl# check for struct lastlogx |
215 | AC_CACHE_CHECK(for struct lastlogx, pt_cv_struct_lastlogx, |
181 | AC_CHECK_TYPES([struct lastlogx], [], [], [ |
216 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
182 | #include <sys/types.h> |
217 | #include <utmpx.h> |
183 | #include <utmpx.h> |
218 | #ifdef HAVE_LASTLOG_H |
184 | #ifdef HAVE_LASTLOG_H |
219 | #include <lastlog.h> |
185 | #include <lastlog.h> |
220 | #endif |
186 | #endif |
221 | ]], [[struct lastlogx ll;]])],[pt_cv_struct_lastlogx=yes],[pt_cv_struct_lastlogx=no])]) |
187 | ]) |
222 | if test x$pt_cv_struct_lastlogx = xyes; then |
|
|
223 | AC_DEFINE(HAVE_STRUCT_LASTLOGX, 1, Define if utmpx.h or lastlog.h has struct lastlogx) |
|
|
224 | fi |
|
|
225 | |
188 | |
226 | dnl# -------------------------------------------------------------------------- |
189 | dnl# -------------------------------------------------------------------------- |
227 | dnl# FIND FILES |
190 | dnl# FIND FILES |
228 | dnl# -------------------------------------------------------------------------- |
191 | dnl# -------------------------------------------------------------------------- |
229 | |
192 | |
230 | dnl# find utmp |
193 | dnl# find utmp |
231 | PT_FIND_FILE([utmp], [UTMP_FILE], [_PATH_UTMP], |
194 | PT_FIND_FILE([utmp], [UTMP_FILE], [_PATH_UTMP], |
232 | ["/var/run/utmp", "/var/adm/utmp", "/etc/utmp", "/usr/etc/utmp", "/usr/adm/utmp"],[ |
195 | ["/var/run/utmp", "/var/adm/utmp", "/etc/utmp", "/usr/etc/utmp", "/usr/adm/utmp"]) |
233 | #include <sys/types.h> |
|
|
234 | #include <utmp.h> |
|
|
235 | ]) |
|
|
236 | |
196 | |
237 | dnl# -------------------------------------------------------------------------- |
197 | dnl# -------------------------------------------------------------------------- |
238 | |
198 | |
239 | dnl# find wtmp |
199 | dnl# find wtmp |
240 | PT_FIND_FILE([wtmp], [WTMP_FILE], [_PATH_WTMP], |
200 | PT_FIND_FILE([wtmp], [WTMP_FILE], [_PATH_WTMP], |
241 | ["/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp"],[ |
201 | ["/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp"]) |
242 | #include <sys/types.h> |
|
|
243 | #ifdef HAVE_UTMP_H |
|
|
244 | #include <utmp.h> |
|
|
245 | #endif |
|
|
246 | ]) |
|
|
247 | dnl# -------------------------------------------------------------------------- |
202 | dnl# -------------------------------------------------------------------------- |
248 | |
203 | |
249 | dnl# find wtmpx |
204 | dnl# find wtmpx |
250 | PT_FIND_FILE([wtmpx], [WTMPX_FILE], [_PATH_WTMPX], |
205 | PT_FIND_FILE([wtmpx], [WTMPX_FILE], [_PATH_WTMPX], |
251 | ["/var/log/wtmpx", "/var/adm/wtmpx"],[ |
206 | ["/var/log/wtmpx", "/var/adm/wtmpx"]) |
252 | #ifdef HAVE_UTMPX_H |
|
|
253 | #include <utmpx.h> |
|
|
254 | #endif |
|
|
255 | ]) |
|
|
256 | dnl# -------------------------------------------------------------------------- |
207 | dnl# -------------------------------------------------------------------------- |
257 | |
208 | |
258 | dnl# find lastlog |
209 | dnl# find lastlog |
259 | PT_FIND_FILE([lastlog], [LASTLOG_FILE], [_PATH_LASTLOG], |
210 | PT_FIND_FILE([lastlog], [LASTLOG_FILE], [_PATH_LASTLOG], |
260 | ["/var/log/lastlog"],[ |
211 | ["/var/log/lastlog"]) |
261 | #include <sys/types.h> |
|
|
262 | #ifdef HAVE_UTMP_H |
|
|
263 | #include <utmp.h> |
|
|
264 | #endif |
|
|
265 | #ifdef HAVE_LASTLOG_H |
|
|
266 | #include <lastlog.h> |
|
|
267 | #endif |
|
|
268 | ]) |
|
|
269 | dnl# -------------------------------------------------------------------------- |
212 | dnl# -------------------------------------------------------------------------- |
270 | |
213 | |
271 | dnl# find lastlogx |
214 | dnl# find lastlogx |
272 | PT_FIND_FILE([lastlogx], [LASTLOGX_FILE], [_PATH_LASTLOGX], |
215 | PT_FIND_FILE([lastlogx], [LASTLOGX_FILE], [_PATH_LASTLOGX], |
273 | ["/var/log/lastlogx", "/var/adm/lastlogx"],[ |
216 | ["/var/log/lastlogx", "/var/adm/lastlogx"]) |
274 | #ifdef HAVE_UTMPX_H |
|
|
275 | #include <utmpx.h> |
|
|
276 | #endif |
|
|
277 | ]) |
|
|
278 | ]) |
217 | ]) |
279 | |
218 | |
280 | AC_DEFUN([SCM_RIGHTS_CHECK], |
219 | AC_DEFUN([SCM_RIGHTS_CHECK], |
281 | [ |
220 | [ |
282 | AC_CACHE_CHECK(for unix-compliant filehandle passing ability, pt_cv_can_pass_fds, |
221 | AC_CACHE_CHECK(for unix-compliant filehandle passing ability, pt_cv_can_pass_fds, |