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

Comparing libptytty/ptytty.m4 (file contents):
Revision 1.10 by ayin, Wed Jun 13 17:30:54 2007 UTC vs.
Revision 1.35 by sf-exg, Thu Jan 19 12:16:33 2012 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines