ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libptytty/ptytty.m4
(Generate patch)

Comparing libptytty/ptytty.m4 (file contents):
Revision 1.1 by ayin, Sat Jan 21 23:11:04 2006 UTC vs.
Revision 1.39 by sf-exg, Sat May 2 20:09:40 2015 UTC

1AC_DEFUN([PT_FIND_FILE],
2[AC_CACHE_CHECK(for a fallback location of $1, pt_cv_path_$1, [
3if 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
10fi])
11if test x$pt_cv_path_$1 != x; then
12 AC_DEFINE_UNQUOTED($2, "$pt_cv_path_$1", Define to a fallback location of $1)
13elif test "$cross_compiling" = yes; then
14 AC_MSG_WARN(Define $2 in config.h manually)
15fi])
16
1AC_DEFUN([PTY_CHECK], 17AC_DEFUN([PTY_CHECK],
2[ 18[
3AC_CHECK_HEADERS( \ 19AC_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
11AC_CHECK_FUNCS( \ 27AC_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
19have_clone=no
20
21AC_MSG_CHECKING(for /dev/ptym/clone)
22if 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
27else
28 AC_MSG_RESULT(no)
29fi
30
31AC_MSG_CHECKING(for /dev/ptc)
32if 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
37else
38 AC_MSG_RESULT(no)
39fi
40
41case $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 ;;
57esac
58
59if 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) 39AC_MSG_CHECKING(for UNIX98 ptys)
61 AC_TRY_LINK([#include <stdlib.h>], 40AC_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)])
67fi
68 48
69if test -z "$unix98_pty"; then 49if 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, ""))
71fi 51fi
72]) 52])
73 53
74AC_DEFUN([UTMP_CHECK], 54AC_DEFUN([UTMP_CHECK],
75[ 55[
56support_utmp=yes
57support_wtmp=yes
58support_lastlog=yes
59
60AC_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
66AC_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
72AC_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
78if test x$support_utmp = xyes; then
79 AC_DEFINE(UTMP_SUPPORT, 1, Define if you want to have utmp/utmpx support)
80fi
81if 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)
83fi
84if 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)
86fi
87
76AC_CHECK_FUNCS( \ 88AC_CHECK_FUNCS( \
77 ttyslot \
78 updwtmp \ 89 updwtmp \
79 updwtmpx \ 90 updwtmpx \
91 updlastlogx \
80) 92)
81 93
82AC_CHECK_HEADERS( \ 94AC_CHECK_HEADERS(lastlog.h)
83 utmp.h \ 95
84 utmpx.h \ 96case $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 ;;
100esac
87 101
88dnl# -------------------------------------------------------------------------- 102dnl# --------------------------------------------------------------------------
89dnl# DO ALL UTMP AND WTMP CHECKING 103dnl# DO ALL UTMP AND WTMP CHECKING
90dnl# -------------------------------------------------------------------------- 104dnl# --------------------------------------------------------------------------
91dnl# check for host field in utmp structure 105dnl# check for host field in utmp structure
92 106
93dnl# -------------------------------------------- 107dnl# --------------------------------------------
94AC_CHECK_HEADER(utmp.h, 108AC_CHECK_HEADERS(utmp.h, [
95[AC_CACHE_CHECK([for struct utmp], struct_utmp, 109AC_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>
98if test x$struct_utmp = xyes; then 112])
99 AC_DEFINE(HAVE_STRUCT_UTMP, 1, Define if utmp.h has struct utmp)
100fi
101]
102 113
103AC_CACHE_CHECK(for ut_host in utmp struct, struct_utmp_host, 114AC_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])])
106if 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)], [], [
108fi 116#include <sys/types.h>
117#include <utmp.h>
118])
109 119
110AC_CACHE_CHECK(for ut_pid in utmp struct, struct_utmp_pid, 120AC_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])])
113if 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)], [], [
115fi 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
118dnl# -------------------------------------------- 127dnl# --------------------------------------------
119 128
120AC_CHECK_HEADER(utmpx.h, 129AC_CHECK_HEADERS(utmpx.h, [
121[AC_CACHE_CHECK([for struct utmpx], struct_utmpx, 130AC_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])])
124if test x$struct_utmpx = xyes; then
125 AC_DEFINE(HAVE_STRUCT_UTMPX, 1, Define if utmpx.h has struct utmpx)
126fi
127]
128
129AC_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])])
132if test x$struct_utmpx_host = xyes; then
133 AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host)
134fi
135
136AC_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])
140struct_utmpx_session=yes, struct_utmpx_session=no)]) 134
141if test x$struct_utmpx_session = xyes; then 135AC_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)], [], [
143fi 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
146dnl# -------------------------------------------------------------------------- 142dnl# --------------------------------------------------------------------------
147dnl# check for struct lastlog 143dnl# check for struct lastlog
148AC_CACHE_CHECK(for struct lastlog, struct_lastlog, 144AC_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])
155if test x$struct_lastlog = xyes; then
156 AC_DEFINE(HAVE_STRUCT_LASTLOG, 1, Define if utmp.h or lastlog.h has struct lastlog)
157fi
158 151
159dnl# check for struct lastlogx 152dnl# check for struct lastlogx
160AC_CACHE_CHECK(for struct lastlogx, struct_lastlogx, 153AC_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])
167if test x$struct_lastlogx = xyes; then
168 AC_DEFINE(HAVE_STRUCT_LASTLOGX, 1, Define if utmpx.h or lastlog.h has struct lastlogx)
169fi
170 160
171dnl# -------------------------------------------------------------------------- 161dnl# --------------------------------------------------------------------------
172dnl# FIND FILES 162dnl# FIND FILES
173dnl# -------------------------------------------------------------------------- 163dnl# --------------------------------------------------------------------------
174 164
175dnl# find utmp 165dnl# find utmp
176AC_CACHE_CHECK(where utmp is located, path_utmp, 166PT_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>
181main()
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); 169dnl# --------------------------------------------------------------------------
187#ifdef UTMP_FILE 170
188 fprintf(f, "%s\n", UTMP_FILE); 171dnl# find wtmp
189 exit(0); 172PT_FIND_FILE([wtmp], [PT_WTMP_FILE],
173["/var/log/wtmp" "/var/adm/wtmp" "/etc/wtmp" "/usr/etc/wtmp" "/usr/adm/wtmp"])
174dnl# --------------------------------------------------------------------------
175
176dnl# find wtmpx
177PT_FIND_FILE([wtmpx], [PT_WTMPX_FILE],
178["/var/log/wtmpx" "/var/adm/wtmpx"])
179dnl# --------------------------------------------------------------------------
180
181dnl# find lastlog
182PT_FIND_FILE([lastlog], [PT_LASTLOG_FILE],
183["/var/log/lastlog" "/var/adm/lastlog"])
184dnl# --------------------------------------------------------------------------
185
186dnl# find lastlogx
187PT_FIND_FILE([lastlogx], [PT_LASTLOGX_FILE],
188["/var/log/lastlogx" "/var/adm/lastlogx"])
189])
190
191AC_DEFUN([SCM_RIGHTS_CHECK],
192[
193AH_TEMPLATE([_XOPEN_SOURCE], [Enable declarations of msg_control and msg_controllen on Solaris])
194case $host in
195 *-*-solaris*)
196 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
197#if __STDC_VERSION__ >= 199901L
198error
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 203esac
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)])])
204if test x$path_utmp != x; then
205 AC_DEFINE_UNQUOTED(UTMP_FILE, "$path_utmp", Define location of utmp)
206fi
207 204
208dnl# --------------------------------------------------------------------------
209
210dnl# find utmpx - if a utmp file exists at the same location and is more than
211dnl# a day newer, then dump the utmpx. People leave lots of junk around.
212AC_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
221main()
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)])])
250if test x$path_utmpx != x; then
251 AC_DEFINE_UNQUOTED(UTMPX_FILE, "$path_utmpx", Define location of utmpx)
252fi
253
254dnl# --------------------------------------------------------------------------
255
256dnl# find wtmp
257AC_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>
264main()
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)])])
287if test x$path_wtmp != x; then
288 AC_DEFINE_UNQUOTED(WTMP_FILE, "$path_wtmp", Define location of wtmp)
289fi
290dnl# --------------------------------------------------------------------------
291
292dnl# find wtmpx
293AC_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>
299main()
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)])])
322if test x$path_wtmpx != x; then
323 AC_DEFINE_UNQUOTED(WTMPX_FILE, "$path_wtmpx", Define location of wtmpx)
324fi
325dnl# --------------------------------------------------------------------------
326
327dnl# find lastlog
328AC_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>
340main()
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)])])
362if 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
367fi
368dnl# --------------------------------------------------------------------------
369
370dnl# find lastlogx
371AC_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>
377main()
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)])])
399if test x$path_lastlogx != x; then
400 AC_DEFINE_UNQUOTED(LASTLOGX_FILE, "$path_lastlogx", Define location of lastlogx)
401fi
402])
403
404AC_DEFUN([SCM_RIGHTS_CHECK],
405[
406AC_CACHE_CHECK(for unix-compliant filehandle passing ability, can_pass_fds, 205AC_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])])
437if test x$can_pass_fds = xyes; then 236if 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)
439else 238else
440 AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability]) 239 AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability])
441fi 240fi
442]) 241])
242
243AC_DEFUN([TTY_GROUP_CHECK],
244[
245AC_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
252int 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])])
267if test x$pt_cv_tty_group = xyes; then
268 AC_DEFINE(TTY_GID_SUPPORT, 1, "")
269fi])
270

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines