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

Comparing libptytty/ptytty.m4 (file contents):
Revision 1.7 by root, Wed Jan 25 22:07:21 2006 UTC vs.
Revision 1.16 by ayin, Mon Dec 24 01:04:37 2007 UTC

63 ;; 63 ;;
64esac 64esac
65 65
66if test x$ac_cv_func_getpt = xyes -o x$ac_cv_func_posix_openpt = xyes -o x$have_clone = xyes; then 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) 67 AC_MSG_CHECKING(for UNIX98 ptys)
68 AC_TRY_LINK([#include <stdlib.h>], 68 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>]],
69 [grantpt(0);unlockpt(0);ptsname(0);], 69 [[grantpt(0);unlockpt(0);ptsname(0);]])],
70 [unix98_pty=yes 70 [unix98_pty=yes
71 AC_DEFINE(UNIX98_PTY, 1, "") 71 AC_DEFINE(UNIX98_PTY, 1, "")
72 AC_MSG_RESULT(yes)], 72 AC_MSG_RESULT(yes)],
73 [AC_MSG_RESULT(no)]) 73 [AC_MSG_RESULT(no)])
74fi 74fi
83support_utmp=yes 83support_utmp=yes
84support_wtmp=yes 84support_wtmp=yes
85support_lastlog=yes 85support_lastlog=yes
86 86
87AC_ARG_ENABLE(utmp, 87AC_ARG_ENABLE(utmp,
88 [ --enable-utmp enable utmp (utmpx) support], 88 [AS_HELP_STRING([--enable-utmp],[enable utmp (utmpx) support])],
89 [if test x$enableval = xyes -o x$enableval = xno; then 89 [if test x$enableval = xyes -o x$enableval = xno; then
90 support_utmp=$enableval 90 support_utmp=$enableval
91 fi]) 91 fi])
92 92
93AC_ARG_ENABLE(wtmp, 93AC_ARG_ENABLE(wtmp,
94 [ --enable-wtmp enable wtmp (wtmpx) support (requires --enable-utmp)], 94 [AS_HELP_STRING([--enable-wtmp],[enable wtmp (wtmpx) support (requires --enable-utmp)])],
95 [if test x$enableval = xyes -o x$enableval = xno; then 95 [if test x$enableval = xyes -o x$enableval = xno; then
96 support_wtmp=$enableval 96 support_wtmp=$enableval
97 fi]) 97 fi])
98 98
99AC_ARG_ENABLE(lastlog, 99AC_ARG_ENABLE(lastlog,
100 [ --enable-lastlog enable lastlog support (requires --enable-utmp)], 100 [AS_HELP_STRING([--enable-lastlog],[enable lastlog support (requires --enable-utmp)])],
101 [if test x$enableval = xyes -o x$enableval = xno; then 101 [if test x$enableval = xyes -o x$enableval = xno; then
102 support_lastlog=$enableval 102 support_lastlog=$enableval
103 fi]) 103 fi])
104 104
105if test x$support_utmp = xyes; then 105if test x$support_utmp = xyes; then
111if test x$support_lastlog = xyes; then 111if 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) 112 AC_DEFINE(LASTLOG_SUPPORT, 1, Define if you want to have lastlog support when utmp/utmpx is enabled)
113fi 113fi
114 114
115AC_CHECK_FUNCS( \ 115AC_CHECK_FUNCS( \
116 ttyslot \
117 updwtmp \ 116 updwtmp \
118 updwtmpx \ 117 updwtmpx \
118 updlastlogx \
119) 119)
120 120
121AC_CHECK_HEADERS( \ 121AC_CHECK_HEADERS(lastlog.h)
122 utmp.h \
123 utmpx.h \
124 lastlog.h \
125)
126 122
127dnl# -------------------------------------------------------------------------- 123dnl# --------------------------------------------------------------------------
128dnl# DO ALL UTMP AND WTMP CHECKING 124dnl# DO ALL UTMP AND WTMP CHECKING
129dnl# -------------------------------------------------------------------------- 125dnl# --------------------------------------------------------------------------
130dnl# check for host field in utmp structure 126dnl# check for host field in utmp structure
131 127
132dnl# -------------------------------------------- 128dnl# --------------------------------------------
133AC_CHECK_HEADER(utmp.h, 129AC_CHECK_HEADERS(utmp.h,
134[AC_CACHE_CHECK([for struct utmp], struct_utmp, 130[AC_CACHE_CHECK([for struct utmp], struct_utmp,
135[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 131[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
136#include <utmp.h>]], [[struct utmp ut;]])],[struct_utmp=yes],[struct_utmp=no])]) 132#include <utmp.h>]], [[struct utmp ut;]])],[struct_utmp=yes],[struct_utmp=no])])
137if test x$struct_utmp = xyes; then 133if test x$struct_utmp = xyes; then
138 AC_DEFINE(HAVE_STRUCT_UTMP, 1, Define if utmp.h has struct utmp) 134 AC_DEFINE(HAVE_STRUCT_UTMP, 1, Define if utmp.h has struct utmp)
150[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 146[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])]) 147#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 148if test x$struct_utmp_pid = xyes; then
153 AC_DEFINE(HAVE_UTMP_PID, 1, Define if struct utmp contains ut_pid) 149 AC_DEFINE(HAVE_UTMP_PID, 1, Define if struct utmp contains ut_pid)
154fi 150fi
155) dnl# AC_CHECK_HEADER(utmp.h 151) dnl# AC_CHECK_HEADERS(utmp.h
156 152
157dnl# -------------------------------------------- 153dnl# --------------------------------------------
158 154
159AC_CHECK_HEADER(utmpx.h, 155AC_CHECK_HEADERS(utmpx.h,
160[AC_CACHE_CHECK([for struct utmpx], struct_utmpx, 156[AC_CACHE_CHECK([for struct utmpx], struct_utmpx,
161[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 157[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
162#include <utmpx.h>]], [[struct utmpx ut;]])],[struct_utmpx=yes],[struct_utmpx=no])]) 158#include <utmpx.h>]], [[struct utmpx ut;]])],[struct_utmpx=yes],[struct_utmpx=no])])
163if test x$struct_utmpx = xyes; then 159if test x$struct_utmpx = xyes; then
164 AC_DEFINE(HAVE_STRUCT_UTMPX, 1, Define if utmpx.h has struct utmpx) 160 AC_DEFINE(HAVE_STRUCT_UTMPX, 1, Define if utmpx.h has struct utmpx)
171if test x$struct_utmpx_host = xyes; then 167if test x$struct_utmpx_host = xyes; then
172 AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host) 168 AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host)
173fi 169fi
174 170
175AC_CACHE_CHECK(for session in utmpx struct, struct_utmpx_session, 171AC_CACHE_CHECK(for session in utmpx struct, struct_utmpx_session,
176[AC_TRY_COMPILE([#include <sys/types.h> 172[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
177#include <utmpx.h>], 173#include <utmpx.h>]], [[struct utmpx utx; utx.ut_session;]])],[struct_utmpx_session=yes],[struct_utmpx_session=no])])
178[struct utmpx utx; utx.ut_session;],
179struct_utmpx_session=yes, struct_utmpx_session=no)])
180if test x$struct_utmpx_session = xyes; then 174if test x$struct_utmpx_session = xyes; then
181 AC_DEFINE(HAVE_UTMPX_SESSION, 1, Define if struct utmpx contains ut_session) 175 AC_DEFINE(HAVE_UTMPX_SESSION, 1, Define if struct utmpx contains ut_session)
182fi 176fi
183) dnl# AC_CHECK_HEADER(utmpx.h 177) dnl# AC_CHECK_HEADERS(utmpx.h
184 178
185dnl# -------------------------------------------------------------------------- 179dnl# --------------------------------------------------------------------------
186dnl# check for struct lastlog 180dnl# check for struct lastlog
187AC_CACHE_CHECK(for struct lastlog, struct_lastlog, 181AC_CACHE_CHECK(for struct lastlog, struct_lastlog,
188[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 182[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
212dnl# -------------------------------------------------------------------------- 206dnl# --------------------------------------------------------------------------
213 207
214dnl# find utmp 208dnl# find utmp
215AC_CACHE_CHECK(where utmp is located, path_utmp, 209AC_CACHE_CHECK(where utmp is located, path_utmp,
216[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> 210[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
211#include <stdlib.h>
217#include <sys/types.h> 212#include <sys/types.h>
218#include <utmp.h> 213#include <utmp.h>
219#include <errno.h> 214#include <errno.h>
220main() 215main()
221{ 216{
248 243
249dnl# find utmpx - if a utmp file exists at the same location and is more than 244dnl# find utmpx - if a utmp file exists at the same location and is more than
250dnl# a day newer, then dump the utmpx. People leave lots of junk around. 245dnl# a day newer, then dump the utmpx. People leave lots of junk around.
251AC_CACHE_CHECK(where utmpx is located, path_utmpx, 246AC_CACHE_CHECK(where utmpx is located, path_utmpx,
252[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> 247[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
248#include <stdlib.h>
253#include <sys/types.h> 249#include <sys/types.h>
254#include <utmpx.h> 250#include <utmpx.h>
255#include <errno.h> 251#include <errno.h>
256#include <sys/stat.h> 252#include <sys/stat.h>
257#ifdef HAVE_STRING_H 253#ifdef HAVE_STRING_H
293dnl# -------------------------------------------------------------------------- 289dnl# --------------------------------------------------------------------------
294 290
295dnl# find wtmp 291dnl# find wtmp
296AC_CACHE_CHECK(where wtmp is located, path_wtmp, 292AC_CACHE_CHECK(where wtmp is located, path_wtmp,
297[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> 293[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
294#include <stdlib.h>
298#include <sys/types.h> 295#include <sys/types.h>
299#ifdef HAVE_UTMP_H 296#ifdef HAVE_UTMP_H
300#include <utmp.h> 297#include <utmp.h>
301#endif 298#endif
302#include <errno.h> 299#include <errno.h>
303main() 300main()
304{ 301{
305 char **w, *wtmplist[] = { 302 char **w, *wtmplist[] = {
306 "/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp", NULL }; 303 "/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp", NULL };
307 FILE *a, *f=fopen("conftestval", "w"); 304 FILE *a, *f=fopen("conftestval", "w");
308 if (!f) exit(1); 305 if (!f) exit(1);
309#ifdef WTMP_FILE 306#ifdef WTMP_FILE
310 fprintf(f, "%s\n", WTMP_FILE); 307 fprintf(f, "%s\n", WTMP_FILE);
311 exit(0); 308 exit(0);
329dnl# -------------------------------------------------------------------------- 326dnl# --------------------------------------------------------------------------
330 327
331dnl# find wtmpx 328dnl# find wtmpx
332AC_CACHE_CHECK(where wtmpx is located, path_wtmpx, 329AC_CACHE_CHECK(where wtmpx is located, path_wtmpx,
333[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> 330[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
331#include <stdlib.h>
334#ifdef HAVE_UTMPX_H 332#ifdef HAVE_UTMPX_H
335#include <utmpx.h> 333#include <utmpx.h>
336#endif 334#endif
337#include <errno.h> 335#include <errno.h>
338main() 336main()
339{ 337{
340 char **w, *wtmplist[] = { 338 char **w, *wtmplist[] = {
341 "/var/log/wtmpx", "/var/adm/wtmpx", NULL }; 339 "/var/log/wtmpx", "/var/adm/wtmpx", NULL };
342 FILE *a, *f=fopen("conftestval", "w"); 340 FILE *a, *f=fopen("conftestval", "w");
343 if (!f) exit(1); 341 if (!f) exit(1);
344#ifdef WTMPX_FILE 342#ifdef WTMPX_FILE
345 fprintf(f, "%s\n", WTMPX_FILE); 343 fprintf(f, "%s\n", WTMPX_FILE);
346 exit(0); 344 exit(0);
364dnl# -------------------------------------------------------------------------- 362dnl# --------------------------------------------------------------------------
365 363
366dnl# find lastlog 364dnl# find lastlog
367AC_CACHE_CHECK(where lastlog is located, path_lastlog, 365AC_CACHE_CHECK(where lastlog is located, path_lastlog,
368[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> 366[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
367#include <stdlib.h>
369#include <sys/types.h> 368#include <sys/types.h>
370#ifdef HAVE_UTMPX_H 369#ifdef HAVE_UTMPX_H
371#include <utmpx.h> 370#include <utmpx.h>
372#elif defined(HAVE_UTMP_H) 371#elif defined(HAVE_UTMP_H)
373#include <utmp.h> 372#include <utmp.h>
398 exit(0); 397 exit(0);
399}]])],[path_lastlog=`cat conftestval`],[path_lastlog=],[dnl 398}]])],[path_lastlog=`cat conftestval`],[path_lastlog=],[dnl
400 AC_MSG_WARN(Define LASTLOG_FILE in config.h manually)])]) 399 AC_MSG_WARN(Define LASTLOG_FILE in config.h manually)])])
401if test x$path_lastlog != x; then 400if test x$path_lastlog != x; then
402 AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$path_lastlog", Define location of lastlog) 401 AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$path_lastlog", Define location of lastlog)
403 if test -d "$path_lastlog"; then
404 AC_DEFINE(LASTLOG_IS_DIR, 1, Define if lastlog is provided via a directory)
405 fi
406fi 402fi
407dnl# -------------------------------------------------------------------------- 403dnl# --------------------------------------------------------------------------
408 404
409dnl# find lastlogx 405dnl# find lastlogx
410AC_CACHE_CHECK(where lastlogx is located, path_lastlogx, 406AC_CACHE_CHECK(where lastlogx is located, path_lastlogx,
411[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> 407[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
408#include <stdlib.h>
412#ifdef HAVE_UTMPX_H 409#ifdef HAVE_UTMPX_H
413#include <utmpx.h> 410#include <utmpx.h>
414#endif 411#endif
415#include <errno.h> 412#include <errno.h>
416main() 413main()
436}]])],[path_lastlogx=`cat conftestval`],[path_lastlogx=],[dnl 433}]])],[path_lastlogx=`cat conftestval`],[path_lastlogx=],[dnl
437 AC_MSG_WARN(Define LASTLOGX_FILE in config.h manually)])]) 434 AC_MSG_WARN(Define LASTLOGX_FILE in config.h manually)])])
438if test x$path_lastlogx != x; then 435if test x$path_lastlogx != x; then
439 AC_DEFINE_UNQUOTED(LASTLOGX_FILE, "$path_lastlogx", Define location of lastlogx) 436 AC_DEFINE_UNQUOTED(LASTLOGX_FILE, "$path_lastlogx", Define location of lastlogx)
440fi 437fi
441
442if test x$support_utmp != xyes; then
443 echo " utmp support: disabled"
444 echo
445else
446 echo " utmp support: enabled
447 utmp file: $path_utmp
448 utmpx file: $path_utmpx
449 wtmp file: $path_wtmp
450 wtmpx file: $path_wtmpx
451 lastlog file: $path_lastlog
452 lastlogx file: $path_lastlogx"
453fi
454]) 438])
455 439
456AC_DEFUN([SCM_RIGHTS_CHECK], 440AC_DEFUN([SCM_RIGHTS_CHECK],
457[ 441[
458AC_CACHE_CHECK(for unix-compliant filehandle passing ability, can_pass_fds, 442AC_CACHE_CHECK(for unix-compliant filehandle passing ability, can_pass_fds,
459[AC_TRY_LINK([ 443[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
460#include <cstddef> // broken bsds (is that redundant?) need this 444#include <cstddef> // broken bsds (is that redundant?) need this
461#include <sys/types.h> 445#include <sys/types.h>
462#include <sys/socket.h> 446#include <sys/socket.h>
463#include <sys/uio.h> 447#include <sys/uio.h>
464],[ 448]], [[
465{ 449{
466 msghdr msg; 450 msghdr msg;
467 iovec iov; 451 iovec iov;
468 char buf [100]; 452 char buf [100];
469 char data = 0; 453 char data = 0;
483 467
484 *(int *)CMSG_DATA (cmsg) = 5; 468 *(int *)CMSG_DATA (cmsg) = 5;
485 469
486 return sendmsg (3, &msg, 0); 470 return sendmsg (3, &msg, 0);
487} 471}
488],[can_pass_fds=yes],[can_pass_fds=no])]) 472]])],[can_pass_fds=yes],[can_pass_fds=no])])
489if test x$can_pass_fds = xyes; then 473if test x$can_pass_fds = xyes; then
490 AC_DEFINE(HAVE_UNIX_FDPASS, 1, Define if sys/socket.h defines the necessary macros/functions for file handle passing) 474 AC_DEFINE(HAVE_UNIX_FDPASS, 1, Define if sys/socket.h defines the necessary macros/functions for file handle passing)
491else 475else
492 AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability]) 476 AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability])
493fi 477fi
494]) 478])
495 479
496AC_DEFUN([TTY_GROUP_CHECK], 480AC_DEFUN([TTY_GROUP_CHECK],
497[ 481[
498AC_CACHE_CHECK([for tty group], tty_group, 482AC_CACHE_CHECK([for tty group], tty_group,
499[AC_TRY_RUN([ 483[AC_RUN_IFELSE([AC_LANG_SOURCE([[
500#include <sys/types.h> 484#include <sys/types.h>
501#include <sys/stat.h> 485#include <sys/stat.h>
502#include <unistd.h> 486#include <unistd.h>
503#include <grp.h> 487#include <grp.h>
504 488
514 && (stat(tty, &st)) == 0 498 && (stat(tty, &st)) == 0
515 && st.st_gid == gr->gr_gid) 499 && st.st_gid == gr->gr_gid)
516 return 0; 500 return 0;
517 else 501 else
518 return 1; 502 return 1;
519}],
520[tty_group=yes],[tty_group=no],[tty_group=no])]) 503}]])],[tty_group=yes],[tty_group=no],[tty_group=no])])
521if test x$tty_group = xyes; then 504if test x$tty_group = xyes; then
522 AC_DEFINE(TTY_GID_SUPPORT, 1, "") 505 AC_DEFINE(TTY_GID_SUPPORT, 1, "")
523fi]) 506fi])
524 507

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines