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

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines