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.32 by sf-exg, Thu Dec 22 10:16:49 2011 UTC

1dnl this file is part of libptytty, do not make local modifications
2dnl http://software.schmorp.de/pkg/libptytty
3
4AC_DEFUN([PT_FIND_FILE],
5[AC_CACHE_CHECK(for a fallback location of $1, pt_cv_path_$1, [
6if test "$cross_compiling" != yes; then
7 for file in $3; do
8 if test -f "$file"; then
9 pt_cv_path_$1=$file
10 break
11 fi
12 done
13fi])
14if test x$pt_cv_path_$1 != x; then
15 AC_DEFINE_UNQUOTED($2, "$pt_cv_path_$1", Define to a fallback location of $1)
16elif test "$cross_compiling" = yes; then
17 AC_MSG_WARN(Define $2 in config.h manually)
18fi])
19
1AC_DEFUN([PTY_CHECK], 20AC_DEFUN([PTY_CHECK],
2[ 21[
3AC_CHECK_HEADERS( \ 22AC_CHECK_HEADERS( \
4 pty.h \ 23 pty.h \
5 util.h \ 24 util.h \
6 libutil.h \ 25 libutil.h \
7 sys/ioctl.h \ 26 sys/ioctl.h \
8 sys/stropts.h \ 27 sys/stropts.h \
28 stropts.h \
9) 29)
10 30
11AC_CHECK_FUNCS( \ 31AC_CHECK_FUNCS( \
12 revoke \ 32 revoke \
13 _getpty \ 33 _getpty \
14 getpt \ 34 getpt \
15 posix_openpt \ 35 posix_openpt \
16 isastream \ 36 isastream \
37 setuid \
38 seteuid \
39 setreuid \
40 setresuid \
17) 41)
18 42
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) 43AC_MSG_CHECKING(for UNIX98 ptys)
61 AC_TRY_LINK([#include <stdlib.h>], 44AC_LINK_IFELSE(
45 [AC_LANG_PROGRAM(
46 [[#include <stdlib.h>]],
62 [grantpt(0);unlockpt(0);ptsname(0);], 47 [[grantpt(0);unlockpt(0);ptsname(0);]])],
63 [unix98_pty=yes 48 [unix98_pty=yes
64 AC_DEFINE(UNIX98_PTY, 1, "") 49 AC_DEFINE(UNIX98_PTY, 1, "")
65 AC_MSG_RESULT(yes)], 50 AC_MSG_RESULT(yes)],
66 [AC_MSG_RESULT(no)]) 51 [AC_MSG_RESULT(no)])
67fi
68 52
69if test -z "$unix98_pty"; then 53if test -z "$unix98_pty"; then
70 AC_CHECK_FUNCS(openpty, [], [AC_CHECK_LIB(util, openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"])]) 54 AC_SEARCH_LIBS(openpty, util, AC_DEFINE(HAVE_OPENPTY, 1, ""))
71fi 55fi
72]) 56])
73 57
74AC_DEFUN([UTMP_CHECK], 58AC_DEFUN([UTMP_CHECK],
75[ 59[
60support_utmp=yes
61support_wtmp=yes
62support_lastlog=yes
63
64AC_ARG_ENABLE(utmp,
65 [AS_HELP_STRING([--enable-utmp],[enable utmp (utmpx) support])],
66 [if test x$enableval = xyes -o x$enableval = xno; then
67 support_utmp=$enableval
68 fi])
69
70AC_ARG_ENABLE(wtmp,
71 [AS_HELP_STRING([--enable-wtmp],[enable wtmp (wtmpx) support (requires --enable-utmp)])],
72 [if test x$enableval = xyes -o x$enableval = xno; then
73 support_wtmp=$enableval
74 fi])
75
76AC_ARG_ENABLE(lastlog,
77 [AS_HELP_STRING([--enable-lastlog],[enable lastlog support (requires --enable-utmp)])],
78 [if test x$enableval = xyes -o x$enableval = xno; then
79 support_lastlog=$enableval
80 fi])
81
82if test x$support_utmp = xyes; then
83 AC_DEFINE(UTMP_SUPPORT, 1, Define if you want to have utmp/utmpx support)
84fi
85if test x$support_wtmp = xyes; then
86 AC_DEFINE(WTMP_SUPPORT, 1, Define if you want to have wtmp support when utmp/utmpx is enabled)
87fi
88if test x$support_lastlog = xyes; then
89 AC_DEFINE(LASTLOG_SUPPORT, 1, Define if you want to have lastlog support when utmp/utmpx is enabled)
90fi
91
76AC_CHECK_FUNCS( \ 92AC_CHECK_FUNCS( \
77 ttyslot \
78 updwtmp \ 93 updwtmp \
79 updwtmpx \ 94 updwtmpx \
95 updlastlogx \
80) 96)
81 97
82AC_CHECK_HEADERS( \ 98AC_CHECK_HEADERS(lastlog.h)
83 utmp.h \
84 utmpx.h \
85 lastlog.h \
86)
87 99
88dnl# -------------------------------------------------------------------------- 100dnl# --------------------------------------------------------------------------
89dnl# DO ALL UTMP AND WTMP CHECKING 101dnl# DO ALL UTMP AND WTMP CHECKING
90dnl# -------------------------------------------------------------------------- 102dnl# --------------------------------------------------------------------------
91dnl# check for host field in utmp structure 103dnl# check for host field in utmp structure
92 104
93dnl# -------------------------------------------- 105dnl# --------------------------------------------
94AC_CHECK_HEADER(utmp.h, 106AC_CHECK_HEADERS(utmp.h,
95[AC_CACHE_CHECK([for struct utmp], struct_utmp, 107AC_CHECK_TYPES([struct utmp], [], [], [
96[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 108#include <sys/types.h>
97#include <utmp.h>]], [[struct utmp ut;]])],[struct_utmp=yes],[struct_utmp=no])]) 109#include <utmp.h>
98if test x$struct_utmp = xyes; then 110])
99 AC_DEFINE(HAVE_STRUCT_UTMP, 1, Define if utmp.h has struct utmp)
100fi
101]
102 111
103AC_CACHE_CHECK(for ut_host in utmp struct, struct_utmp_host, 112AC_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) 113[AC_DEFINE(HAVE_UTMP_HOST, 1, Define if struct utmp contains ut_host)], [], [
108fi 114#include <sys/types.h>
115#include <utmp.h>
116])
109 117
110AC_CACHE_CHECK(for ut_pid in utmp struct, struct_utmp_pid, 118AC_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) 119[AC_DEFINE(HAVE_UTMP_PID, 1, Define if struct utmp contains ut_pid)], [], [
115fi 120#include <sys/types.h>
121#include <utmp.h>
122])
116) dnl# AC_CHECK_HEADER(utmp.h 123) dnl# AC_CHECK_HEADERS(utmp.h
117 124
118dnl# -------------------------------------------- 125dnl# --------------------------------------------
119 126
120AC_CHECK_HEADER(utmpx.h, 127AC_CHECK_HEADERS(utmpx.h,
121[AC_CACHE_CHECK([for struct utmpx], struct_utmpx, 128AC_CHECK_TYPES([struct utmpx], [], [], [
122[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 129#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>], 130#include <utmpx.h>
139[struct utmpx utx; utx.ut_session;], 131])
140struct_utmpx_session=yes, struct_utmpx_session=no)]) 132
141if test x$struct_utmpx_session = xyes; then 133AC_CHECK_MEMBER([struct utmpx.ut_host],
142 AC_DEFINE(HAVE_UTMPX_SESSION, 1, Define if struct utmpx contains ut_session) 134[AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host)], [], [
143fi 135#include <sys/types.h>
136#include <utmpx.h>
137])
144) dnl# AC_CHECK_HEADER(utmpx.h 138) dnl# AC_CHECK_HEADERS(utmpx.h
145 139
146dnl# -------------------------------------------------------------------------- 140dnl# --------------------------------------------------------------------------
147dnl# check for struct lastlog 141dnl# check for struct lastlog
148AC_CACHE_CHECK(for struct lastlog, struct_lastlog, 142AC_CHECK_TYPES([struct lastlog], [], [], [
149[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 143#include <sys/types.h>
150#include <utmp.h> 144#include <utmp.h>
151#ifdef HAVE_LASTLOG_H 145#ifdef HAVE_LASTLOG_H
152#include <lastlog.h> 146#include <lastlog.h>
153#endif 147#endif
154]], [[struct lastlog ll;]])],[struct_lastlog=yes],[struct_lastlog=no])]) 148])
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 149
159dnl# check for struct lastlogx 150dnl# check for struct lastlogx
160AC_CACHE_CHECK(for struct lastlogx, struct_lastlogx, 151AC_CHECK_TYPES([struct lastlogx], [], [], [
161[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 152#include <sys/types.h>
162#include <utmpx.h> 153#include <utmpx.h>
163#ifdef HAVE_LASTLOG_H 154#ifdef HAVE_LASTLOG_H
164#include <lastlog.h> 155#include <lastlog.h>
165#endif 156#endif
166]], [[struct lastlogx ll;]])],[struct_lastlogx=yes],[struct_lastlogx=no])]) 157])
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 158
171dnl# -------------------------------------------------------------------------- 159dnl# --------------------------------------------------------------------------
172dnl# FIND FILES 160dnl# FIND FILES
173dnl# -------------------------------------------------------------------------- 161dnl# --------------------------------------------------------------------------
174 162
175dnl# find utmp 163dnl# find utmp
176AC_CACHE_CHECK(where utmp is located, path_utmp, 164PT_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 }; 165["/var/run/utmp" "/var/adm/utmp" "/etc/utmp" "/usr/etc/utmp" "/usr/adm/utmp"])
185 FILE *a, *f=fopen("conftestval", "w");
186 if (!f) exit(1);
187#ifdef UTMP_FILE
188 fprintf(f, "%s\n", UTMP_FILE);
189 exit(0);
190#endif
191#ifdef _PATH_UTMP
192 fprintf(f, "%s\n", _PATH_UTMP);
193 exit(0);
194#endif
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
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 166
254dnl# -------------------------------------------------------------------------- 167dnl# --------------------------------------------------------------------------
255 168
256dnl# find wtmp 169dnl# find wtmp
257AC_CACHE_CHECK(where wtmp is located, path_wtmp, 170PT_FIND_FILE([wtmp], [PT_WTMP_FILE],
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 }; 171["/var/log/wtmp" "/var/adm/wtmp" "/etc/wtmp" "/usr/etc/wtmp" "/usr/adm/wtmp"])
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# -------------------------------------------------------------------------- 172dnl# --------------------------------------------------------------------------
291 173
292dnl# find wtmpx 174dnl# find wtmpx
293AC_CACHE_CHECK(where wtmpx is located, path_wtmpx, 175PT_FIND_FILE([wtmpx], [PT_WTMPX_FILE],
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 }; 176["/var/log/wtmpx" "/var/adm/wtmpx"])
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# -------------------------------------------------------------------------- 177dnl# --------------------------------------------------------------------------
326 178
327dnl# find lastlog 179dnl# find lastlog
328AC_CACHE_CHECK(where lastlog is located, path_lastlog, 180PT_FIND_FILE([lastlog], [PT_LASTLOG_FILE],
329[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> 181["/var/log/lastlog"])
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# -------------------------------------------------------------------------- 182dnl# --------------------------------------------------------------------------
369 183
370dnl# find lastlogx 184dnl# find lastlogx
371AC_CACHE_CHECK(where lastlogx is located, path_lastlogx, 185PT_FIND_FILE([lastlogx], [PT_LASTLOGX_FILE],
372[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> 186["/var/log/lastlogx" "/var/adm/lastlogx"])
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]) 187])
403 188
404AC_DEFUN([SCM_RIGHTS_CHECK], 189AC_DEFUN([SCM_RIGHTS_CHECK],
405[ 190[
406AC_CACHE_CHECK(for unix-compliant filehandle passing ability, can_pass_fds, 191AC_CACHE_CHECK(for unix-compliant filehandle passing ability, pt_cv_can_pass_fds,
407[AC_TRY_LINK([ 192[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
408#include <cstddef> // broken bsds (is that redundant) need this 193#include <cstddef> // broken bsds (is that redundant?) need this
409#include <sys/types.h> 194#include <sys/types.h>
410#include <sys/socket.h> 195#include <sys/socket.h>
411#include <sys/uio.h> 196#include <sys/uio.h>
412],[ 197]], [[
413{ 198{
414 msghdr msg; 199 msghdr msg;
415 iovec iov; 200 iovec iov;
416 char buf [100]; 201 char buf [100];
417 char data = 0; 202 char data = 0;
431 216
432 *(int *)CMSG_DATA (cmsg) = 5; 217 *(int *)CMSG_DATA (cmsg) = 5;
433 218
434 return sendmsg (3, &msg, 0); 219 return sendmsg (3, &msg, 0);
435} 220}
436],[can_pass_fds=yes],[can_pass_fds=no])]) 221]])],[pt_cv_can_pass_fds=yes],[pt_cv_can_pass_fds=no])])
437if test x$can_pass_fds = xyes; then 222if 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) 223 AC_DEFINE(HAVE_UNIX_FDPASS, 1, Define if sys/socket.h defines the necessary macros/functions for file handle passing)
439else 224else
440 AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability]) 225 AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability])
441fi 226fi
442]) 227])
228
229AC_DEFUN([TTY_GROUP_CHECK],
230[
231AC_CACHE_CHECK([for tty group], pt_cv_tty_group,
232[AC_RUN_IFELSE([AC_LANG_SOURCE([[
233#include <sys/types.h>
234#include <sys/stat.h>
235#include <unistd.h>
236#include <grp.h>
237
238int main()
239{
240 struct stat st;
241 struct group *gr;
242 char *tty;
243 gr = getgrnam("tty");
244 tty = ttyname(0);
245 if (gr != 0
246 && tty != 0
247 && (stat(tty, &st)) == 0
248 && st.st_gid == gr->gr_gid)
249 return 0;
250 else
251 return 1;
252}]])],[pt_cv_tty_group=yes],[pt_cv_tty_group=no],[pt_cv_tty_group=no])])
253if test x$pt_cv_tty_group = xyes; then
254 AC_DEFINE(TTY_GID_SUPPORT, 1, "")
255fi])
256

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines