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

Comparing libptytty/ptytty.m4 (file contents):
Revision 1.4 by ayin, Mon Jan 23 10:10:50 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
79AC_ARG_ENABLE(utmp, 88AC_ARG_ENABLE(utmp,
80 [ --enable-utmp enable utmp (utmpx) support], 89 [AS_HELP_STRING([--enable-utmp],[enable utmp (utmpx) support])],
81 [if test x$enableval = xyes -o x$enableval = xno; then 90 [if test x$enableval = xyes -o x$enableval = xno; then
82 support_utmp=$enableval 91 support_utmp=$enableval
83 fi]) 92 fi])
84 93
85AC_ARG_ENABLE(wtmp, 94AC_ARG_ENABLE(wtmp,
86 [ --enable-wtmp enable wtmp (wtmpx) support (requires --enable-utmp)], 95 [AS_HELP_STRING([--enable-wtmp],[enable wtmp (wtmpx) support (requires --enable-utmp)])],
87 [if test x$enableval = xyes -o x$enableval = xno; then 96 [if test x$enableval = xyes -o x$enableval = xno; then
88 support_wtmp=$enableval 97 support_wtmp=$enableval
89 fi]) 98 fi])
90 99
91AC_ARG_ENABLE(lastlog, 100AC_ARG_ENABLE(lastlog,
92 [ --enable-lastlog enable lastlog support (requires --enable-utmp)], 101 [AS_HELP_STRING([--enable-lastlog],[enable lastlog support (requires --enable-utmp)])],
93 [if test x$enableval = xyes -o x$enableval = xno; then 102 [if test x$enableval = xyes -o x$enableval = xno; then
94 support_lastlog=$enableval 103 support_lastlog=$enableval
95 fi]) 104 fi])
96 105
97if test x$support_utmp = xyes; then 106if test x$support_utmp = xyes; then
103if test x$support_lastlog = xyes; then 112if test x$support_lastlog = xyes; then
104 AC_DEFINE(LASTLOG_SUPPORT, 1, Define if you want to have lastlog support when utmp/utmpx is enabled) 113 AC_DEFINE(LASTLOG_SUPPORT, 1, Define if you want to have lastlog support when utmp/utmpx is enabled)
105fi 114fi
106 115
107AC_CHECK_FUNCS( \ 116AC_CHECK_FUNCS( \
108 ttyslot \
109 updwtmp \ 117 updwtmp \
110 updwtmpx \ 118 updwtmpx \
119 updlastlogx \
111) 120)
112 121
113AC_CHECK_HEADERS( \ 122AC_CHECK_HEADERS(lastlog.h)
114 utmp.h \
115 utmpx.h \
116 lastlog.h \
117)
118 123
119dnl# -------------------------------------------------------------------------- 124dnl# --------------------------------------------------------------------------
120dnl# DO ALL UTMP AND WTMP CHECKING 125dnl# DO ALL UTMP AND WTMP CHECKING
121dnl# -------------------------------------------------------------------------- 126dnl# --------------------------------------------------------------------------
122dnl# check for host field in utmp structure 127dnl# check for host field in utmp structure
123 128
124dnl# -------------------------------------------- 129dnl# --------------------------------------------
125AC_CHECK_HEADER(utmp.h, 130AC_CHECK_HEADERS(utmp.h,
126[AC_CACHE_CHECK([for struct utmp], struct_utmp, 131AC_CHECK_TYPES([struct utmp], [], [], [
127[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 132#include <sys/types.h>
128#include <utmp.h>]], [[struct utmp ut;]])],[struct_utmp=yes],[struct_utmp=no])]) 133#include <utmp.h>
129if test x$struct_utmp = xyes; then 134])
130 AC_DEFINE(HAVE_STRUCT_UTMP, 1, Define if utmp.h has struct utmp)
131fi
132]
133 135
134AC_CACHE_CHECK(for ut_host in utmp struct, struct_utmp_host, 136AC_CHECK_MEMBER([struct utmp.ut_host],
135[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
136#include <utmp.h>]], [[struct utmp ut; ut.ut_host;]])],[struct_utmp_host=yes],[struct_utmp_host=no])])
137if test x$struct_utmp_host = xyes; then
138 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)], [], [
139fi 138#include <sys/types.h>
139#include <utmp.h>
140])
140 141
141AC_CACHE_CHECK(for ut_pid in utmp struct, struct_utmp_pid, 142AC_CHECK_MEMBER([struct utmp.ut_pid],
142[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
143#include <utmp.h>]], [[struct utmp ut; ut.ut_pid;]])],[struct_utmp_pid=yes],[struct_utmp_pid=no])])
144if test x$struct_utmp_pid = xyes; then
145 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)], [], [
146fi 144#include <sys/types.h>
145#include <utmp.h>
146])
147) dnl# AC_CHECK_HEADER(utmp.h 147) dnl# AC_CHECK_HEADERS(utmp.h
148 148
149dnl# -------------------------------------------- 149dnl# --------------------------------------------
150 150
151AC_CHECK_HEADER(utmpx.h, 151AC_CHECK_HEADERS(utmpx.h,
152[AC_CACHE_CHECK([for struct utmpx], struct_utmpx, 152AC_CHECK_TYPES([struct utmpx], [], [], [
153[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 153#include <sys/types.h>
154#include <utmpx.h>]], [[struct utmpx ut;]])],[struct_utmpx=yes],[struct_utmpx=no])])
155if test x$struct_utmpx = xyes; then
156 AC_DEFINE(HAVE_STRUCT_UTMPX, 1, Define if utmpx.h has struct utmpx)
157fi
158]
159
160AC_CACHE_CHECK(for host in utmpx struct, struct_utmpx_host,
161[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
162#include <utmpx.h>]], [[struct utmpx utx; utx.ut_host;]])],[struct_utmpx_host=yes],[struct_utmpx_host=no])])
163if test x$struct_utmpx_host = xyes; then
164 AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host)
165fi
166
167AC_CACHE_CHECK(for session in utmpx struct, struct_utmpx_session,
168[AC_TRY_COMPILE([#include <sys/types.h>
169#include <utmpx.h>], 154#include <utmpx.h>
170[struct utmpx utx; utx.ut_session;], 155])
171struct_utmpx_session=yes, struct_utmpx_session=no)]) 156
172if 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],
173 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)], [], [
174fi 165#include <sys/types.h>
166#include <utmpx.h>
167])
175) dnl# AC_CHECK_HEADER(utmpx.h 168) dnl# AC_CHECK_HEADERS(utmpx.h
176 169
177dnl# -------------------------------------------------------------------------- 170dnl# --------------------------------------------------------------------------
178dnl# check for struct lastlog 171dnl# check for struct lastlog
179AC_CACHE_CHECK(for struct lastlog, struct_lastlog, 172AC_CHECK_TYPES([struct lastlog], [], [], [
180[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 173#include <sys/types.h>
181#include <utmp.h> 174#include <utmp.h>
182#ifdef HAVE_LASTLOG_H 175#ifdef HAVE_LASTLOG_H
183#include <lastlog.h> 176#include <lastlog.h>
184#endif 177#endif
185]], [[struct lastlog ll;]])],[struct_lastlog=yes],[struct_lastlog=no])]) 178])
186if test x$struct_lastlog = xyes; then
187 AC_DEFINE(HAVE_STRUCT_LASTLOG, 1, Define if utmp.h or lastlog.h has struct lastlog)
188fi
189 179
190dnl# check for struct lastlogx 180dnl# check for struct lastlogx
191AC_CACHE_CHECK(for struct lastlogx, struct_lastlogx, 181AC_CHECK_TYPES([struct lastlogx], [], [], [
192[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 182#include <sys/types.h>
193#include <utmpx.h> 183#include <utmpx.h>
194#ifdef HAVE_LASTLOG_H 184#ifdef HAVE_LASTLOG_H
195#include <lastlog.h> 185#include <lastlog.h>
196#endif 186#endif
197]], [[struct lastlogx ll;]])],[struct_lastlogx=yes],[struct_lastlogx=no])]) 187])
198if test x$struct_lastlogx = xyes; then
199 AC_DEFINE(HAVE_STRUCT_LASTLOGX, 1, Define if utmpx.h or lastlog.h has struct lastlogx)
200fi
201 188
202dnl# -------------------------------------------------------------------------- 189dnl# --------------------------------------------------------------------------
203dnl# FIND FILES 190dnl# FIND FILES
204dnl# -------------------------------------------------------------------------- 191dnl# --------------------------------------------------------------------------
205 192
206dnl# find utmp 193dnl# find utmp
207AC_CACHE_CHECK(where utmp is located, path_utmp, 194PT_FIND_FILE([utmp], [UTMP_FILE], [_PATH_UTMP],
208[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
209#include <sys/types.h>
210#include <utmp.h>
211#include <errno.h>
212main()
213{
214 char **u, *utmplist[] = {
215 "/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"])
216 FILE *a, *f=fopen("conftestval", "w");
217 if (!f) exit(1);
218#ifdef UTMP_FILE
219 fprintf(f, "%s\n", UTMP_FILE);
220 exit(0);
221#endif
222#ifdef _PATH_UTMP
223 fprintf(f, "%s\n", _PATH_UTMP);
224 exit(0);
225#endif
226 for (u = utmplist; *u; u++) {
227 if ((a = fopen(*u, "r")) != NULL || errno == EACCES) {
228 fprintf(f, "%s\n", *u);
229 exit(0);
230 }
231 }
232 exit(0);
233}]])],[path_utmp=`cat conftestval`],[path_utmp=],[dnl
234 AC_MSG_WARN(Define UTMP_FILE in config.h manually)])])
235if test x$path_utmp != x; then
236 AC_DEFINE_UNQUOTED(UTMP_FILE, "$path_utmp", Define location of utmp)
237fi
238
239dnl# --------------------------------------------------------------------------
240
241dnl# find utmpx - if a utmp file exists at the same location and is more than
242dnl# a day newer, then dump the utmpx. People leave lots of junk around.
243AC_CACHE_CHECK(where utmpx is located, path_utmpx,
244[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
245#include <sys/types.h>
246#include <utmpx.h>
247#include <errno.h>
248#include <sys/stat.h>
249#ifdef HAVE_STRING_H
250#include <string.h>
251#endif
252main()
253{
254 char **u, *p, *utmplist[] = {
255#ifdef UTMPX_FILE
256 UTMPX_FILE,
257#endif
258#ifdef _PATH_UTMPX
259 _PATH_UTMPX,
260#endif
261 "/var/adm/utmpx", "/etc/utmpx", NULL };
262 FILE *a, *f=fopen("conftestval", "w");
263 struct stat statu, statux;
264 if (!f) exit(1);
265 for (u = utmplist; *u; u++) {
266 if ((a = fopen(*u, "r")) != NULL || errno == EACCES) {
267 if (stat(*u, &statux) < 0)
268 continue;
269 p = strdup(*u);
270 p[strlen(p) - 1] = '\0';
271 if (stat(p, &statu) >= 0
272 && (statu.st_mtime - statux.st_mtime > 86400))
273 continue;
274 fprintf(f, "%s\n", *u);
275 exit(0);
276 }
277 }
278 exit(0);
279}]])],[path_utmpx=`cat conftestval`],[path_utmpx=],[dnl
280 AC_MSG_WARN(Define UTMPX_FILE in config.h manually)])])
281if test x$path_utmpx != x; then
282 AC_DEFINE_UNQUOTED(UTMPX_FILE, "$path_utmpx", Define location of utmpx)
283fi
284 196
285dnl# -------------------------------------------------------------------------- 197dnl# --------------------------------------------------------------------------
286 198
287dnl# find wtmp 199dnl# find wtmp
288AC_CACHE_CHECK(where wtmp is located, path_wtmp, 200PT_FIND_FILE([wtmp], [WTMP_FILE], [_PATH_WTMP],
289[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
290#include <sys/types.h>
291#ifdef HAVE_UTMP_H
292#include <utmp.h>
293#endif
294#include <errno.h>
295main()
296{
297 char **w, *wtmplist[] = {
298 "/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"])
299 FILE *a, *f=fopen("conftestval", "w");
300 if (!f) exit(1);
301#ifdef WTMP_FILE
302 fprintf(f, "%s\n", WTMP_FILE);
303 exit(0);
304#endif
305#ifdef _PATH_WTMP
306 fprintf(f, "%s\n", _PATH_WTMP);
307 exit(0);
308#endif
309 for (w = wtmplist; *w; w++) {
310 if ((a = fopen(*w, "r")) != NULL || errno == EACCES) {
311 fprintf(f, "%s\n", *w);
312 exit(0);
313 }
314 }
315 exit(0);
316}]])],[path_wtmp=`cat conftestval`],[path_wtmp=],[dnl
317 AC_MSG_WARN(Define WTMP_FILE in config.h manually)])])
318if test x$path_wtmp != x; then
319 AC_DEFINE_UNQUOTED(WTMP_FILE, "$path_wtmp", Define location of wtmp)
320fi
321dnl# -------------------------------------------------------------------------- 202dnl# --------------------------------------------------------------------------
322 203
323dnl# find wtmpx 204dnl# find wtmpx
324AC_CACHE_CHECK(where wtmpx is located, path_wtmpx, 205PT_FIND_FILE([wtmpx], [WTMPX_FILE], [_PATH_WTMPX],
325[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
326#ifdef HAVE_UTMPX_H
327#include <utmpx.h>
328#endif
329#include <errno.h>
330main()
331{
332 char **w, *wtmplist[] = {
333 "/var/log/wtmpx", "/var/adm/wtmpx", NULL }; 206["/var/log/wtmpx", "/var/adm/wtmpx"])
334 FILE *a, *f=fopen("conftestval", "w");
335 if (!f) exit(1);
336#ifdef WTMPX_FILE
337 fprintf(f, "%s\n", WTMPX_FILE);
338 exit(0);
339#endif
340#ifdef _PATH_WTMPX
341 fprintf(f, "%s\n", _PATH_WTMPX);
342 exit(0);
343#endif
344 for (w = wtmplist; *w; w++) {
345 if ((a = fopen(*w, "r")) != NULL || errno == EACCES) {
346 fprintf(f, "%s\n", *w);
347 exit(0);
348 }
349 }
350 exit(0);
351}]])],[path_wtmpx=`cat conftestval`],[path_wtmpx=],[dnl
352 AC_MSG_WARN(Define WTMPX_FILE in config.h manually)])])
353if test x$path_wtmpx != x; then
354 AC_DEFINE_UNQUOTED(WTMPX_FILE, "$path_wtmpx", Define location of wtmpx)
355fi
356dnl# -------------------------------------------------------------------------- 207dnl# --------------------------------------------------------------------------
357 208
358dnl# find lastlog 209dnl# find lastlog
359AC_CACHE_CHECK(where lastlog is located, path_lastlog, 210PT_FIND_FILE([lastlog], [LASTLOG_FILE], [_PATH_LASTLOG],
360[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> 211["/var/log/lastlog"])
361#include <sys/types.h>
362#ifdef HAVE_UTMPX_H
363#include <utmpx.h>
364#elif defined(HAVE_UTMP_H)
365#include <utmp.h>
366#endif
367#ifdef HAVE_LASTLOG_H
368#include <lastlog.h>
369#endif
370#include <errno.h>
371main()
372{
373 char **w, *lastloglist[] = { "/var/log/lastlog", NULL };
374 FILE *a, *f=fopen("conftestval", "w");
375 if (!f) exit(1);
376#ifdef LASTLOG_FILE
377 fprintf(f, "%s\n", LASTLOG_FILE);
378 exit(0);
379#endif
380#ifdef _PATH_LASTLOG
381 fprintf(f, "%s\n", _PATH_LASTLOG);
382 exit(0);
383#endif
384 for (w = lastloglist; *w; w++) {
385 if ((a = fopen(*w, "r")) != NULL || errno == EACCES) {
386 fprintf(f, "%s\n", *w);
387 exit(0);
388 }
389 }
390 exit(0);
391}]])],[path_lastlog=`cat conftestval`],[path_lastlog=],[dnl
392 AC_MSG_WARN(Define LASTLOG_FILE in config.h manually)])])
393if test x$path_lastlog != x; then
394 AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$path_lastlog", Define location of lastlog)
395 if test -d "$path_lastlog"; then
396 AC_DEFINE(LASTLOG_IS_DIR, 1, Define if lastlog is provided via a directory)
397 fi
398fi
399dnl# -------------------------------------------------------------------------- 212dnl# --------------------------------------------------------------------------
400 213
401dnl# find lastlogx 214dnl# find lastlogx
402AC_CACHE_CHECK(where lastlogx is located, path_lastlogx, 215PT_FIND_FILE([lastlogx], [LASTLOGX_FILE], [_PATH_LASTLOGX],
403[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> 216["/var/log/lastlogx", "/var/adm/lastlogx"])
404#ifdef HAVE_UTMPX_H
405#include <utmpx.h>
406#endif
407#include <errno.h>
408main()
409{
410 char **w, *wtmplist[] = { "/var/log/lastlogx", "/var/adm/lastlogx", NULL };
411 FILE *a, *f=fopen("conftestval", "w");
412 if (!f) exit(1);
413#ifdef LASTLOGX_FILE
414 fprintf(f, "%s\n", LASTLOGX_FILE);
415 exit(0);
416#endif
417#ifdef _PATH_LASTLOGX
418 fprintf(f, "%s\n", _PATH_LASTLOGX);
419 exit(0);
420#endif
421 for (w = wtmplist; *w; w++) {
422 if ((a = fopen(*w, "r")) != NULL || errno == EACCES) {
423 fprintf(f, "%s\n", *w);
424 exit(0);
425 }
426 }
427 exit(0);
428}]])],[path_lastlogx=`cat conftestval`],[path_lastlogx=],[dnl
429 AC_MSG_WARN(Define LASTLOGX_FILE in config.h manually)])])
430if test x$path_lastlogx != x; then
431 AC_DEFINE_UNQUOTED(LASTLOGX_FILE, "$path_lastlogx", Define location of lastlogx)
432fi
433
434if test x$support_utmp != xyes; then
435 echo " utmp support: disabled"
436 echo
437else
438 echo " utmp support: enabled
439 utmp file: $path_utmp
440 utmpx file: $path_utmpx
441 wtmp file: $path_wtmp
442 wtmpx file: $path_wtmpx
443 lastlog file: $path_lastlog
444 lastlogx file: $path_lastlogx"
445fi
446]) 217])
447 218
448AC_DEFUN([SCM_RIGHTS_CHECK], 219AC_DEFUN([SCM_RIGHTS_CHECK],
449[ 220[
450AC_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,
451[AC_TRY_LINK([ 222[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
452#include <cstddef> // broken bsds (is that redundant) need this 223#include <cstddef> // broken bsds (is that redundant?) need this
453#include <sys/types.h> 224#include <sys/types.h>
454#include <sys/socket.h> 225#include <sys/socket.h>
455#include <sys/uio.h> 226#include <sys/uio.h>
456],[ 227]], [[
457{ 228{
458 msghdr msg; 229 msghdr msg;
459 iovec iov; 230 iovec iov;
460 char buf [100]; 231 char buf [100];
461 char data = 0; 232 char data = 0;
475 246
476 *(int *)CMSG_DATA (cmsg) = 5; 247 *(int *)CMSG_DATA (cmsg) = 5;
477 248
478 return sendmsg (3, &msg, 0); 249 return sendmsg (3, &msg, 0);
479} 250}
480],[can_pass_fds=yes],[can_pass_fds=no])]) 251]])],[pt_cv_can_pass_fds=yes],[pt_cv_can_pass_fds=no])])
481if test x$can_pass_fds = xyes; then 252if test x$pt_cv_can_pass_fds = xyes; then
482 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)
483else 254else
484 AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability]) 255 AC_MSG_ERROR([libptytty requires unix-compliant filehandle passing ability])
485fi 256fi
486]) 257])
487 258
488AC_DEFUN([TTY_GROUP_CHECK], 259AC_DEFUN([TTY_GROUP_CHECK],
489[ 260[
490AC_CACHE_CHECK([for tty group], tty_group, 261AC_CACHE_CHECK([for tty group], pt_cv_tty_group,
491[AC_TRY_RUN([ 262[AC_RUN_IFELSE([AC_LANG_SOURCE([[
492#include <sys/types.h> 263#include <sys/types.h>
493#include <sys/stat.h> 264#include <sys/stat.h>
494#include <unistd.h> 265#include <unistd.h>
495#include <grp.h> 266#include <grp.h>
496 267
497main() 268int main()
498{ 269{
499 struct stat st; 270 struct stat st;
500 struct group *gr; 271 struct group *gr;
501 char *tty; 272 char *tty;
502 gr = getgrnam("tty"); 273 gr = getgrnam("tty");
506 && (stat(tty, &st)) == 0 277 && (stat(tty, &st)) == 0
507 && st.st_gid == gr->gr_gid) 278 && st.st_gid == gr->gr_gid)
508 return 0; 279 return 0;
509 else 280 else
510 return 1; 281 return 1;
511}],
512[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])])
513if test x$tty_group = xyes; then 283if test x$pt_cv_tty_group = xyes; then
514 AC_DEFINE(TTY_GID_SUPPORT, 1, "") 284 AC_DEFINE(TTY_GID_SUPPORT, 1, "")
515fi]) 285fi])
516 286

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines