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

Comparing libptytty/ptytty.m4 (file contents):
Revision 1.6 by root, Wed Jan 25 21:17:46 2006 UTC vs.
Revision 1.24 by sf-exg, Thu May 12 14:17:56 2011 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines