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

Comparing libptytty/ptytty.m4 (file contents):
Revision 1.2 by root, Sun Jan 22 00:58:18 2006 UTC vs.
Revision 1.15 by ayin, Mon Nov 5 22:06:56 2007 UTC

15 revoke \ 15 revoke \
16 _getpty \ 16 _getpty \
17 getpt \ 17 getpt \
18 posix_openpt \ 18 posix_openpt \
19 isastream \ 19 isastream \
20 setuid \
21 seteuid \
22 setreuid \
23 setresuid \
20) 24)
21 25
22have_clone=no 26have_clone=no
23 27
24AC_MSG_CHECKING(for /dev/ptym/clone) 28AC_MSG_CHECKING(for /dev/ptym/clone)
74fi 78fi
75]) 79])
76 80
77AC_DEFUN([UTMP_CHECK], 81AC_DEFUN([UTMP_CHECK],
78[ 82[
83support_utmp=yes
84support_wtmp=yes
85support_lastlog=yes
86
87AC_ARG_ENABLE(utmp,
88 [AS_HELP_STRING([--enable-utmp],[enable utmp (utmpx) support])],
89 [if test x$enableval = xyes -o x$enableval = xno; then
90 support_utmp=$enableval
91 fi])
92
93AC_ARG_ENABLE(wtmp,
94 [AS_HELP_STRING([--enable-wtmp],[enable wtmp (wtmpx) support (requires --enable-utmp)])],
95 [if test x$enableval = xyes -o x$enableval = xno; then
96 support_wtmp=$enableval
97 fi])
98
99AC_ARG_ENABLE(lastlog,
100 [AS_HELP_STRING([--enable-lastlog],[enable lastlog support (requires --enable-utmp)])],
101 [if test x$enableval = xyes -o x$enableval = xno; then
102 support_lastlog=$enableval
103 fi])
104
105if test x$support_utmp = xyes; then
106 AC_DEFINE(UTMP_SUPPORT, 1, Define if you want to have utmp/utmpx support)
107fi
108if test x$support_wtmp = xyes; then
109 AC_DEFINE(WTMP_SUPPORT, 1, Define if you want to have wtmp support when utmp/utmpx is enabled)
110fi
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)
113fi
114
79AC_CHECK_FUNCS( \ 115AC_CHECK_FUNCS( \
80 ttyslot \
81 updwtmp \ 116 updwtmp \
82 updwtmpx \ 117 updwtmpx \
118 updlastlogx \
83) 119)
84 120
85AC_CHECK_HEADERS( \ 121AC_CHECK_HEADERS(lastlog.h)
86 utmp.h \
87 utmpx.h \
88 lastlog.h \
89)
90 122
91dnl# -------------------------------------------------------------------------- 123dnl# --------------------------------------------------------------------------
92dnl# DO ALL UTMP AND WTMP CHECKING 124dnl# DO ALL UTMP AND WTMP CHECKING
93dnl# -------------------------------------------------------------------------- 125dnl# --------------------------------------------------------------------------
94dnl# check for host field in utmp structure 126dnl# check for host field in utmp structure
95 127
96dnl# -------------------------------------------- 128dnl# --------------------------------------------
97AC_CHECK_HEADER(utmp.h, 129AC_CHECK_HEADERS(utmp.h,
98[AC_CACHE_CHECK([for struct utmp], struct_utmp, 130[AC_CACHE_CHECK([for struct utmp], struct_utmp,
99[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 131[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
100#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])])
101if test x$struct_utmp = xyes; then 133if test x$struct_utmp = xyes; then
102 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)
114[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 146[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
115#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])])
116if test x$struct_utmp_pid = xyes; then 148if test x$struct_utmp_pid = xyes; then
117 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)
118fi 150fi
119) dnl# AC_CHECK_HEADER(utmp.h 151) dnl# AC_CHECK_HEADERS(utmp.h
120 152
121dnl# -------------------------------------------- 153dnl# --------------------------------------------
122 154
123AC_CHECK_HEADER(utmpx.h, 155AC_CHECK_HEADERS(utmpx.h,
124[AC_CACHE_CHECK([for struct utmpx], struct_utmpx, 156[AC_CACHE_CHECK([for struct utmpx], struct_utmpx,
125[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 157[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
126#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])])
127if test x$struct_utmpx = xyes; then 159if test x$struct_utmpx = xyes; then
128 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)
142[struct utmpx utx; utx.ut_session;], 174[struct utmpx utx; utx.ut_session;],
143struct_utmpx_session=yes, struct_utmpx_session=no)]) 175struct_utmpx_session=yes, struct_utmpx_session=no)])
144if test x$struct_utmpx_session = xyes; then 176if test x$struct_utmpx_session = xyes; then
145 AC_DEFINE(HAVE_UTMPX_SESSION, 1, Define if struct utmpx contains ut_session) 177 AC_DEFINE(HAVE_UTMPX_SESSION, 1, Define if struct utmpx contains ut_session)
146fi 178fi
147) dnl# AC_CHECK_HEADER(utmpx.h 179) dnl# AC_CHECK_HEADERS(utmpx.h
148 180
149dnl# -------------------------------------------------------------------------- 181dnl# --------------------------------------------------------------------------
150dnl# check for struct lastlog 182dnl# check for struct lastlog
151AC_CACHE_CHECK(for struct lastlog, struct_lastlog, 183AC_CACHE_CHECK(for struct lastlog, struct_lastlog,
152[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 184[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
176dnl# -------------------------------------------------------------------------- 208dnl# --------------------------------------------------------------------------
177 209
178dnl# find utmp 210dnl# find utmp
179AC_CACHE_CHECK(where utmp is located, path_utmp, 211AC_CACHE_CHECK(where utmp is located, path_utmp,
180[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> 212[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
213#include <stdlib.h>
181#include <sys/types.h> 214#include <sys/types.h>
182#include <utmp.h> 215#include <utmp.h>
183#include <errno.h> 216#include <errno.h>
184main() 217main()
185{ 218{
212 245
213dnl# find utmpx - if a utmp file exists at the same location and is more than 246dnl# find utmpx - if a utmp file exists at the same location and is more than
214dnl# a day newer, then dump the utmpx. People leave lots of junk around. 247dnl# a day newer, then dump the utmpx. People leave lots of junk around.
215AC_CACHE_CHECK(where utmpx is located, path_utmpx, 248AC_CACHE_CHECK(where utmpx is located, path_utmpx,
216[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> 249[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
250#include <stdlib.h>
217#include <sys/types.h> 251#include <sys/types.h>
218#include <utmpx.h> 252#include <utmpx.h>
219#include <errno.h> 253#include <errno.h>
220#include <sys/stat.h> 254#include <sys/stat.h>
221#ifdef HAVE_STRING_H 255#ifdef HAVE_STRING_H
257dnl# -------------------------------------------------------------------------- 291dnl# --------------------------------------------------------------------------
258 292
259dnl# find wtmp 293dnl# find wtmp
260AC_CACHE_CHECK(where wtmp is located, path_wtmp, 294AC_CACHE_CHECK(where wtmp is located, path_wtmp,
261[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> 295[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
296#include <stdlib.h>
262#include <sys/types.h> 297#include <sys/types.h>
263#ifdef HAVE_UTMP_H 298#ifdef HAVE_UTMP_H
264#include <utmp.h> 299#include <utmp.h>
265#endif 300#endif
266#include <errno.h> 301#include <errno.h>
267main() 302main()
268{ 303{
269 char **w, *wtmplist[] = { 304 char **w, *wtmplist[] = {
270 "/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp", NULL }; 305 "/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp", NULL };
271 FILE *a, *f=fopen("conftestval", "w"); 306 FILE *a, *f=fopen("conftestval", "w");
272 if (!f) exit(1); 307 if (!f) exit(1);
273#ifdef WTMP_FILE 308#ifdef WTMP_FILE
274 fprintf(f, "%s\n", WTMP_FILE); 309 fprintf(f, "%s\n", WTMP_FILE);
275 exit(0); 310 exit(0);
293dnl# -------------------------------------------------------------------------- 328dnl# --------------------------------------------------------------------------
294 329
295dnl# find wtmpx 330dnl# find wtmpx
296AC_CACHE_CHECK(where wtmpx is located, path_wtmpx, 331AC_CACHE_CHECK(where wtmpx is located, path_wtmpx,
297[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> 332[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
333#include <stdlib.h>
298#ifdef HAVE_UTMPX_H 334#ifdef HAVE_UTMPX_H
299#include <utmpx.h> 335#include <utmpx.h>
300#endif 336#endif
301#include <errno.h> 337#include <errno.h>
302main() 338main()
303{ 339{
304 char **w, *wtmplist[] = { 340 char **w, *wtmplist[] = {
305 "/var/log/wtmpx", "/var/adm/wtmpx", NULL }; 341 "/var/log/wtmpx", "/var/adm/wtmpx", NULL };
306 FILE *a, *f=fopen("conftestval", "w"); 342 FILE *a, *f=fopen("conftestval", "w");
307 if (!f) exit(1); 343 if (!f) exit(1);
308#ifdef WTMPX_FILE 344#ifdef WTMPX_FILE
309 fprintf(f, "%s\n", WTMPX_FILE); 345 fprintf(f, "%s\n", WTMPX_FILE);
310 exit(0); 346 exit(0);
328dnl# -------------------------------------------------------------------------- 364dnl# --------------------------------------------------------------------------
329 365
330dnl# find lastlog 366dnl# find lastlog
331AC_CACHE_CHECK(where lastlog is located, path_lastlog, 367AC_CACHE_CHECK(where lastlog is located, path_lastlog,
332[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> 368[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
369#include <stdlib.h>
333#include <sys/types.h> 370#include <sys/types.h>
334#ifdef HAVE_UTMPX_H 371#ifdef HAVE_UTMPX_H
335#include <utmpx.h> 372#include <utmpx.h>
336#elif defined(HAVE_UTMP_H) 373#elif defined(HAVE_UTMP_H)
337#include <utmp.h> 374#include <utmp.h>
362 exit(0); 399 exit(0);
363}]])],[path_lastlog=`cat conftestval`],[path_lastlog=],[dnl 400}]])],[path_lastlog=`cat conftestval`],[path_lastlog=],[dnl
364 AC_MSG_WARN(Define LASTLOG_FILE in config.h manually)])]) 401 AC_MSG_WARN(Define LASTLOG_FILE in config.h manually)])])
365if test x$path_lastlog != x; then 402if test x$path_lastlog != x; then
366 AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$path_lastlog", Define location of lastlog) 403 AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$path_lastlog", Define location of lastlog)
367 if test -d "$path_lastlog"; then
368 AC_DEFINE(LASTLOG_IS_DIR, 1, Define if lastlog is provided via a directory)
369 fi
370fi 404fi
371dnl# -------------------------------------------------------------------------- 405dnl# --------------------------------------------------------------------------
372 406
373dnl# find lastlogx 407dnl# find lastlogx
374AC_CACHE_CHECK(where lastlogx is located, path_lastlogx, 408AC_CACHE_CHECK(where lastlogx is located, path_lastlogx,
375[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> 409[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
410#include <stdlib.h>
376#ifdef HAVE_UTMPX_H 411#ifdef HAVE_UTMPX_H
377#include <utmpx.h> 412#include <utmpx.h>
378#endif 413#endif
379#include <errno.h> 414#include <errno.h>
380main() 415main()
406 441
407AC_DEFUN([SCM_RIGHTS_CHECK], 442AC_DEFUN([SCM_RIGHTS_CHECK],
408[ 443[
409AC_CACHE_CHECK(for unix-compliant filehandle passing ability, can_pass_fds, 444AC_CACHE_CHECK(for unix-compliant filehandle passing ability, can_pass_fds,
410[AC_TRY_LINK([ 445[AC_TRY_LINK([
411#include <cstddef> // broken bsds (is that redundant) need this 446#include <cstddef> // broken bsds (is that redundant?) need this
412#include <sys/types.h> 447#include <sys/types.h>
413#include <sys/socket.h> 448#include <sys/socket.h>
414#include <sys/uio.h> 449#include <sys/uio.h>
415],[ 450],[
416{ 451{
441 AC_DEFINE(HAVE_UNIX_FDPASS, 1, Define if sys/socket.h defines the necessary macros/functions for file handle passing) 476 AC_DEFINE(HAVE_UNIX_FDPASS, 1, Define if sys/socket.h defines the necessary macros/functions for file handle passing)
442else 477else
443 AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability]) 478 AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability])
444fi 479fi
445]) 480])
481
482AC_DEFUN([TTY_GROUP_CHECK],
483[
484AC_CACHE_CHECK([for tty group], tty_group,
485[AC_TRY_RUN([
486#include <sys/types.h>
487#include <sys/stat.h>
488#include <unistd.h>
489#include <grp.h>
490
491main()
492{
493 struct stat st;
494 struct group *gr;
495 char *tty;
496 gr = getgrnam("tty");
497 tty = ttyname(0);
498 if (gr != 0
499 && tty != 0
500 && (stat(tty, &st)) == 0
501 && st.st_gid == gr->gr_gid)
502 return 0;
503 else
504 return 1;
505}],
506[tty_group=yes],[tty_group=no],[tty_group=no])])
507if test x$tty_group = xyes; then
508 AC_DEFINE(TTY_GID_SUPPORT, 1, "")
509fi])
510

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines