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.13 by ayin, Sun Nov 4 10:16:58 2007 UTC

1dnl this file is part of libptytty, do not make local modifications
2dnl http://software.schmorp.de/pkg/libptytty
3
1AC_DEFUN([PTY_CHECK], 4AC_DEFUN([PTY_CHECK],
2[ 5[
3AC_CHECK_HEADERS( \ 6AC_CHECK_HEADERS( \
4 pty.h \ 7 pty.h \
5 util.h \ 8 util.h \
12 revoke \ 15 revoke \
13 _getpty \ 16 _getpty \
14 getpt \ 17 getpt \
15 posix_openpt \ 18 posix_openpt \
16 isastream \ 19 isastream \
20 setuid \
21 seteuid \
22 setreuid \
23 setresuid \
17) 24)
18 25
19have_clone=no 26have_clone=no
20 27
21AC_MSG_CHECKING(for /dev/ptym/clone) 28AC_MSG_CHECKING(for /dev/ptym/clone)
71fi 78fi
72]) 79])
73 80
74AC_DEFUN([UTMP_CHECK], 81AC_DEFUN([UTMP_CHECK],
75[ 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
76AC_CHECK_FUNCS( \ 115AC_CHECK_FUNCS( \
77 ttyslot \ 116 ttyslot \
78 updwtmp \ 117 updwtmp \
79 updwtmpx \ 118 updwtmpx \
119 updlastlogx \
80) 120)
81 121
82AC_CHECK_HEADERS( \ 122AC_CHECK_HEADERS( \
83 utmp.h \ 123 utmp.h \
84 utmpx.h \ 124 utmpx.h \
173dnl# -------------------------------------------------------------------------- 213dnl# --------------------------------------------------------------------------
174 214
175dnl# find utmp 215dnl# find utmp
176AC_CACHE_CHECK(where utmp is located, path_utmp, 216AC_CACHE_CHECK(where utmp is located, path_utmp,
177[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> 217[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
218#include <stdlib.h>
178#include <sys/types.h> 219#include <sys/types.h>
179#include <utmp.h> 220#include <utmp.h>
180#include <errno.h> 221#include <errno.h>
181main() 222main()
182{ 223{
209 250
210dnl# find utmpx - if a utmp file exists at the same location and is more than 251dnl# 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. 252dnl# a day newer, then dump the utmpx. People leave lots of junk around.
212AC_CACHE_CHECK(where utmpx is located, path_utmpx, 253AC_CACHE_CHECK(where utmpx is located, path_utmpx,
213[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> 254[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
255#include <stdlib.h>
214#include <sys/types.h> 256#include <sys/types.h>
215#include <utmpx.h> 257#include <utmpx.h>
216#include <errno.h> 258#include <errno.h>
217#include <sys/stat.h> 259#include <sys/stat.h>
218#ifdef HAVE_STRING_H 260#ifdef HAVE_STRING_H
254dnl# -------------------------------------------------------------------------- 296dnl# --------------------------------------------------------------------------
255 297
256dnl# find wtmp 298dnl# find wtmp
257AC_CACHE_CHECK(where wtmp is located, path_wtmp, 299AC_CACHE_CHECK(where wtmp is located, path_wtmp,
258[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> 300[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
301#include <stdlib.h>
259#include <sys/types.h> 302#include <sys/types.h>
260#ifdef HAVE_UTMP_H 303#ifdef HAVE_UTMP_H
261#include <utmp.h> 304#include <utmp.h>
262#endif 305#endif
263#include <errno.h> 306#include <errno.h>
264main() 307main()
265{ 308{
266 char **w, *wtmplist[] = { 309 char **w, *wtmplist[] = {
267 "/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp", NULL }; 310 "/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp", NULL };
268 FILE *a, *f=fopen("conftestval", "w"); 311 FILE *a, *f=fopen("conftestval", "w");
269 if (!f) exit(1); 312 if (!f) exit(1);
270#ifdef WTMP_FILE 313#ifdef WTMP_FILE
271 fprintf(f, "%s\n", WTMP_FILE); 314 fprintf(f, "%s\n", WTMP_FILE);
272 exit(0); 315 exit(0);
290dnl# -------------------------------------------------------------------------- 333dnl# --------------------------------------------------------------------------
291 334
292dnl# find wtmpx 335dnl# find wtmpx
293AC_CACHE_CHECK(where wtmpx is located, path_wtmpx, 336AC_CACHE_CHECK(where wtmpx is located, path_wtmpx,
294[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> 337[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
338#include <stdlib.h>
295#ifdef HAVE_UTMPX_H 339#ifdef HAVE_UTMPX_H
296#include <utmpx.h> 340#include <utmpx.h>
297#endif 341#endif
298#include <errno.h> 342#include <errno.h>
299main() 343main()
300{ 344{
301 char **w, *wtmplist[] = { 345 char **w, *wtmplist[] = {
302 "/var/log/wtmpx", "/var/adm/wtmpx", NULL }; 346 "/var/log/wtmpx", "/var/adm/wtmpx", NULL };
303 FILE *a, *f=fopen("conftestval", "w"); 347 FILE *a, *f=fopen("conftestval", "w");
304 if (!f) exit(1); 348 if (!f) exit(1);
305#ifdef WTMPX_FILE 349#ifdef WTMPX_FILE
306 fprintf(f, "%s\n", WTMPX_FILE); 350 fprintf(f, "%s\n", WTMPX_FILE);
307 exit(0); 351 exit(0);
325dnl# -------------------------------------------------------------------------- 369dnl# --------------------------------------------------------------------------
326 370
327dnl# find lastlog 371dnl# find lastlog
328AC_CACHE_CHECK(where lastlog is located, path_lastlog, 372AC_CACHE_CHECK(where lastlog is located, path_lastlog,
329[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> 373[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
374#include <stdlib.h>
330#include <sys/types.h> 375#include <sys/types.h>
331#ifdef HAVE_UTMPX_H 376#ifdef HAVE_UTMPX_H
332#include <utmpx.h> 377#include <utmpx.h>
333#elif defined(HAVE_UTMP_H) 378#elif defined(HAVE_UTMP_H)
334#include <utmp.h> 379#include <utmp.h>
359 exit(0); 404 exit(0);
360}]])],[path_lastlog=`cat conftestval`],[path_lastlog=],[dnl 405}]])],[path_lastlog=`cat conftestval`],[path_lastlog=],[dnl
361 AC_MSG_WARN(Define LASTLOG_FILE in config.h manually)])]) 406 AC_MSG_WARN(Define LASTLOG_FILE in config.h manually)])])
362if test x$path_lastlog != x; then 407if test x$path_lastlog != x; then
363 AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$path_lastlog", Define location of lastlog) 408 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 409fi
368dnl# -------------------------------------------------------------------------- 410dnl# --------------------------------------------------------------------------
369 411
370dnl# find lastlogx 412dnl# find lastlogx
371AC_CACHE_CHECK(where lastlogx is located, path_lastlogx, 413AC_CACHE_CHECK(where lastlogx is located, path_lastlogx,
372[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> 414[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
415#include <stdlib.h>
373#ifdef HAVE_UTMPX_H 416#ifdef HAVE_UTMPX_H
374#include <utmpx.h> 417#include <utmpx.h>
375#endif 418#endif
376#include <errno.h> 419#include <errno.h>
377main() 420main()
403 446
404AC_DEFUN([SCM_RIGHTS_CHECK], 447AC_DEFUN([SCM_RIGHTS_CHECK],
405[ 448[
406AC_CACHE_CHECK(for unix-compliant filehandle passing ability, can_pass_fds, 449AC_CACHE_CHECK(for unix-compliant filehandle passing ability, can_pass_fds,
407[AC_TRY_LINK([ 450[AC_TRY_LINK([
408#include <cstddef> // broken bsds (is that redundant) need this 451#include <cstddef> // broken bsds (is that redundant?) need this
409#include <sys/types.h> 452#include <sys/types.h>
410#include <sys/socket.h> 453#include <sys/socket.h>
411#include <sys/uio.h> 454#include <sys/uio.h>
412],[ 455],[
413{ 456{
438 AC_DEFINE(HAVE_UNIX_FDPASS, 1, Define if sys/socket.h defines the necessary macros/functions for file handle passing) 481 AC_DEFINE(HAVE_UNIX_FDPASS, 1, Define if sys/socket.h defines the necessary macros/functions for file handle passing)
439else 482else
440 AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability]) 483 AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability])
441fi 484fi
442]) 485])
486
487AC_DEFUN([TTY_GROUP_CHECK],
488[
489AC_CACHE_CHECK([for tty group], tty_group,
490[AC_TRY_RUN([
491#include <sys/types.h>
492#include <sys/stat.h>
493#include <unistd.h>
494#include <grp.h>
495
496main()
497{
498 struct stat st;
499 struct group *gr;
500 char *tty;
501 gr = getgrnam("tty");
502 tty = ttyname(0);
503 if (gr != 0
504 && tty != 0
505 && (stat(tty, &st)) == 0
506 && st.st_gid == gr->gr_gid)
507 return 0;
508 else
509 return 1;
510}],
511[tty_group=yes],[tty_group=no],[tty_group=no])])
512if test x$tty_group = xyes; then
513 AC_DEFINE(TTY_GID_SUPPORT, 1, "")
514fi])
515

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines