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