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

Comparing libptytty/ptytty.m4 (file contents):
Revision 1.14 by ayin, Mon Nov 5 00:43:42 2007 UTC vs.
Revision 1.30 by sf-exg, Wed Nov 23 19:29:27 2011 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines