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

Comparing libptytty/ptytty.m4 (file contents):
Revision 1.15 by ayin, Mon Nov 5 22:06:56 2007 UTC vs.
Revision 1.23 by sf-exg, Thu May 12 13:53:14 2011 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines