ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libptytty/ptytty.m4
Revision: 1.35
Committed: Thu Jan 19 12:16:33 2012 UTC (12 years, 4 months ago) by sf-exg
Branch: MAIN
Changes since 1.34: +0 -3 lines
Log Message:
Remove obsolete comments.

File Contents

# User Rev Content
1 sf-exg 1.24 AC_DEFUN([PT_FIND_FILE],
2 sf-exg 1.31 [AC_CACHE_CHECK(for a fallback location of $1, pt_cv_path_$1, [
3     if 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
10     fi])
11 sf-exg 1.24 if test x$pt_cv_path_$1 != x; then
12 sf-exg 1.31 AC_DEFINE_UNQUOTED($2, "$pt_cv_path_$1", Define to a fallback location of $1)
13     elif test "$cross_compiling" = yes; then
14     AC_MSG_WARN(Define $2 in config.h manually)
15 sf-exg 1.24 fi])
16    
17 ayin 1.1 AC_DEFUN([PTY_CHECK],
18     [
19     AC_CHECK_HEADERS( \
20     pty.h \
21     util.h \
22     libutil.h \
23     sys/ioctl.h \
24     sys/stropts.h \
25 root 1.17 stropts.h \
26 ayin 1.1 )
27    
28     AC_CHECK_FUNCS( \
29     revoke \
30     _getpty \
31     getpt \
32     posix_openpt \
33     isastream \
34 root 1.7 setuid \
35     seteuid \
36     setreuid \
37     setresuid \
38 ayin 1.1 )
39    
40 sf-exg 1.29 AC_MSG_CHECKING(for UNIX98 ptys)
41     AC_LINK_IFELSE(
42     [AC_LANG_PROGRAM(
43     [[#include <stdlib.h>]],
44     [[grantpt(0);unlockpt(0);ptsname(0);]])],
45     [unix98_pty=yes
46     AC_DEFINE(UNIX98_PTY, 1, "")
47     AC_MSG_RESULT(yes)],
48     [AC_MSG_RESULT(no)])
49 ayin 1.1
50     if test -z "$unix98_pty"; then
51 sf-exg 1.21 AC_SEARCH_LIBS(openpty, util, AC_DEFINE(HAVE_OPENPTY, 1, ""))
52 ayin 1.1 fi
53     ])
54    
55     AC_DEFUN([UTMP_CHECK],
56     [
57 ayin 1.5 support_utmp=yes
58     support_wtmp=yes
59     support_lastlog=yes
60    
61 ayin 1.4 AC_ARG_ENABLE(utmp,
62 ayin 1.11 [AS_HELP_STRING([--enable-utmp],[enable utmp (utmpx) support])],
63 ayin 1.4 [if test x$enableval = xyes -o x$enableval = xno; then
64     support_utmp=$enableval
65     fi])
66    
67     AC_ARG_ENABLE(wtmp,
68 ayin 1.11 [AS_HELP_STRING([--enable-wtmp],[enable wtmp (wtmpx) support (requires --enable-utmp)])],
69 ayin 1.4 [if test x$enableval = xyes -o x$enableval = xno; then
70     support_wtmp=$enableval
71     fi])
72    
73     AC_ARG_ENABLE(lastlog,
74 ayin 1.11 [AS_HELP_STRING([--enable-lastlog],[enable lastlog support (requires --enable-utmp)])],
75 ayin 1.4 [if test x$enableval = xyes -o x$enableval = xno; then
76     support_lastlog=$enableval
77     fi])
78    
79     if test x$support_utmp = xyes; then
80     AC_DEFINE(UTMP_SUPPORT, 1, Define if you want to have utmp/utmpx support)
81     fi
82     if test x$support_wtmp = xyes; then
83     AC_DEFINE(WTMP_SUPPORT, 1, Define if you want to have wtmp support when utmp/utmpx is enabled)
84     fi
85     if test x$support_lastlog = xyes; then
86     AC_DEFINE(LASTLOG_SUPPORT, 1, Define if you want to have lastlog support when utmp/utmpx is enabled)
87     fi
88    
89 ayin 1.1 AC_CHECK_FUNCS( \
90     updwtmp \
91     updwtmpx \
92 ayin 1.12 updlastlogx \
93 ayin 1.1 )
94    
95 ayin 1.15 AC_CHECK_HEADERS(lastlog.h)
96 ayin 1.1
97 sf-exg 1.34 case $host in
98     *-*-solaris*)
99     AC_DEFINE(__EXTENSIONS__, 1, Enable declarations in utmp.h on Solaris when the XPG4v2 namespace is active)
100     ;;
101     esac
102    
103 ayin 1.1 dnl# --------------------------------------------------------------------------
104     dnl# DO ALL UTMP AND WTMP CHECKING
105     dnl# --------------------------------------------------------------------------
106     dnl# check for host field in utmp structure
107    
108     dnl# --------------------------------------------
109 ayin 1.15 AC_CHECK_HEADERS(utmp.h,
110 sf-exg 1.26 AC_CHECK_TYPES([struct utmp], [], [], [
111     #include <sys/types.h>
112     #include <utmp.h>
113     ])
114 ayin 1.1
115 sf-exg 1.26 AC_CHECK_MEMBER([struct utmp.ut_host],
116     [AC_DEFINE(HAVE_UTMP_HOST, 1, Define if struct utmp contains ut_host)], [], [
117     #include <sys/types.h>
118     #include <utmp.h>
119     ])
120 ayin 1.1
121 sf-exg 1.26 AC_CHECK_MEMBER([struct utmp.ut_pid],
122     [AC_DEFINE(HAVE_UTMP_PID, 1, Define if struct utmp contains ut_pid)], [], [
123     #include <sys/types.h>
124     #include <utmp.h>
125     ])
126 ayin 1.15 ) dnl# AC_CHECK_HEADERS(utmp.h
127 ayin 1.1
128     dnl# --------------------------------------------
129    
130 ayin 1.15 AC_CHECK_HEADERS(utmpx.h,
131 sf-exg 1.26 AC_CHECK_TYPES([struct utmpx], [], [], [
132     #include <sys/types.h>
133     #include <utmpx.h>
134     ])
135 ayin 1.1
136 sf-exg 1.26 AC_CHECK_MEMBER([struct utmpx.ut_host],
137     [AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host)], [], [
138     #include <sys/types.h>
139     #include <utmpx.h>
140     ])
141 ayin 1.15 ) dnl# AC_CHECK_HEADERS(utmpx.h
142 ayin 1.1
143     dnl# --------------------------------------------------------------------------
144     dnl# check for struct lastlog
145 sf-exg 1.26 AC_CHECK_TYPES([struct lastlog], [], [], [
146     #include <sys/types.h>
147 ayin 1.1 #include <utmp.h>
148     #ifdef HAVE_LASTLOG_H
149     #include <lastlog.h>
150     #endif
151 sf-exg 1.26 ])
152 ayin 1.1
153     dnl# check for struct lastlogx
154 sf-exg 1.26 AC_CHECK_TYPES([struct lastlogx], [], [], [
155     #include <sys/types.h>
156 ayin 1.1 #include <utmpx.h>
157     #ifdef HAVE_LASTLOG_H
158     #include <lastlog.h>
159     #endif
160 sf-exg 1.26 ])
161 ayin 1.1
162     dnl# --------------------------------------------------------------------------
163     dnl# FIND FILES
164     dnl# --------------------------------------------------------------------------
165    
166     dnl# find utmp
167 sf-exg 1.31 PT_FIND_FILE([utmp], [PT_UTMP_FILE],
168     ["/var/run/utmp" "/var/adm/utmp" "/etc/utmp" "/usr/etc/utmp" "/usr/adm/utmp"])
169 ayin 1.1
170     dnl# --------------------------------------------------------------------------
171    
172     dnl# find wtmp
173 sf-exg 1.31 PT_FIND_FILE([wtmp], [PT_WTMP_FILE],
174     ["/var/log/wtmp" "/var/adm/wtmp" "/etc/wtmp" "/usr/etc/wtmp" "/usr/adm/wtmp"])
175 ayin 1.1 dnl# --------------------------------------------------------------------------
176    
177     dnl# find wtmpx
178 sf-exg 1.31 PT_FIND_FILE([wtmpx], [PT_WTMPX_FILE],
179     ["/var/log/wtmpx" "/var/adm/wtmpx"])
180 ayin 1.1 dnl# --------------------------------------------------------------------------
181    
182     dnl# find lastlog
183 sf-exg 1.31 PT_FIND_FILE([lastlog], [PT_LASTLOG_FILE],
184 sf-exg 1.33 ["/var/log/lastlog" "/var/adm/lastlog"])
185 ayin 1.1 dnl# --------------------------------------------------------------------------
186    
187     dnl# find lastlogx
188 sf-exg 1.31 PT_FIND_FILE([lastlogx], [PT_LASTLOGX_FILE],
189     ["/var/log/lastlogx" "/var/adm/lastlogx"])
190 ayin 1.1 ])
191    
192     AC_DEFUN([SCM_RIGHTS_CHECK],
193     [
194 sf-exg 1.34 case $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     ;;
199     esac
200    
201 sf-exg 1.18 AC_CACHE_CHECK(for unix-compliant filehandle passing ability, pt_cv_can_pass_fds,
202 ayin 1.16 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
203 root 1.6 #include <cstddef> // broken bsds (is that redundant?) need this
204 ayin 1.1 #include <sys/types.h>
205     #include <sys/socket.h>
206     #include <sys/uio.h>
207 ayin 1.16 ]], [[
208 ayin 1.1 {
209     msghdr msg;
210     iovec iov;
211     char buf [100];
212     char data = 0;
213    
214     iov.iov_base = &data;
215     iov.iov_len = 1;
216    
217     msg.msg_iov = &iov;
218     msg.msg_iovlen = 1;
219     msg.msg_control = buf;
220     msg.msg_controllen = sizeof buf;
221    
222     cmsghdr *cmsg = CMSG_FIRSTHDR (&msg);
223     cmsg->cmsg_level = SOL_SOCKET;
224     cmsg->cmsg_type = SCM_RIGHTS;
225     cmsg->cmsg_len = 100;
226    
227     *(int *)CMSG_DATA (cmsg) = 5;
228    
229     return sendmsg (3, &msg, 0);
230     }
231 sf-exg 1.18 ]])],[pt_cv_can_pass_fds=yes],[pt_cv_can_pass_fds=no])])
232     if test x$pt_cv_can_pass_fds = xyes; then
233 ayin 1.1 AC_DEFINE(HAVE_UNIX_FDPASS, 1, Define if sys/socket.h defines the necessary macros/functions for file handle passing)
234     else
235     AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability])
236     fi
237     ])
238 ayin 1.3
239     AC_DEFUN([TTY_GROUP_CHECK],
240     [
241 sf-exg 1.18 AC_CACHE_CHECK([for tty group], pt_cv_tty_group,
242 ayin 1.16 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
243 ayin 1.3 #include <sys/types.h>
244     #include <sys/stat.h>
245     #include <unistd.h>
246     #include <grp.h>
247    
248 sf-exg 1.22 int main()
249 ayin 1.3 {
250     struct stat st;
251     struct group *gr;
252     char *tty;
253     gr = getgrnam("tty");
254     tty = ttyname(0);
255     if (gr != 0
256     && tty != 0
257     && (stat(tty, &st)) == 0
258     && st.st_gid == gr->gr_gid)
259     return 0;
260     else
261     return 1;
262 sf-exg 1.18 }]])],[pt_cv_tty_group=yes],[pt_cv_tty_group=no],[pt_cv_tty_group=no])])
263     if test x$pt_cv_tty_group = xyes; then
264 ayin 1.3 AC_DEFINE(TTY_GID_SUPPORT, 1, "")
265     fi])
266