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

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines