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

Comparing libptytty/ptytty.m4 (file contents):
Revision 1.12 by ayin, Sun Nov 4 09:08:42 2007 UTC vs.
Revision 1.35 by sf-exg, Thu Jan 19 12:16:33 2012 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines