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

Comparing libptytty/ptytty.m4 (file contents):
Revision 1.24 by sf-exg, Thu May 12 14:17:56 2011 UTC vs.
Revision 1.30 by sf-exg, Wed Nov 23 19:29:27 2011 UTC

3 3
4AC_DEFUN([PT_FIND_FILE], 4AC_DEFUN([PT_FIND_FILE],
5[AC_CACHE_CHECK(where $1 is located, pt_cv_path_$1, 5[AC_CACHE_CHECK(where $1 is located, pt_cv_path_$1,
6[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> 6[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
7#include <stdlib.h> 7#include <stdlib.h>
8$5 8#include <sys/stat.h>
9#include <errno.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
10int main() 19int main()
11{ 20{
12 char **path, *list[] = { $4, NULL }; 21 const char **path, *list[] = { $4, NULL };
13 FILE *a, *f=fopen("conftestval", "w"); 22 FILE *f = fopen("conftestval", "w");
14 if (!f) exit(1); 23 if (!f) return 1;
15#ifdef $2 24#ifdef $2
16 fprintf(f, "%s\n", $2); 25 fprintf(f, "%s\n", $2);
17 exit(0); 26#elif defined($3)
18#endif
19#ifdef $3
20 fprintf(f, "%s\n", $3); 27 fprintf(f, "%s\n", $3);
21 exit(0); 28#else
22#endif
23 for (path = list; *path; path++) { 29 for (path = list; *path; path++) {
24 if ((a = fopen(*path, "r")) != NULL || errno == EACCES) { 30 struct stat st;
31 if (stat(*path, &st) == 0) {
25 fprintf(f, "%s\n", *path); 32 fprintf(f, "%s\n", *path);
26 exit(0); 33 break;
27 } 34 }
28 } 35 }
29 exit(0); 36#endif
37 return fclose(f) != 0;
30}]])],[pt_cv_path_$1=`cat conftestval`],[pt_cv_path_$1=], 38}]])],[pt_cv_path_$1=`cat conftestval`],[pt_cv_path_$1=],
31[AC_MSG_WARN(Define $2 in config.h manually)])]) 39[AC_MSG_WARN(Define $2 in config.h manually)])])
32if test x$pt_cv_path_$1 != x; then 40if test x$pt_cv_path_$1 != x; then
33 AC_DEFINE_UNQUOTED($2, "$pt_cv_path_$1", Define location of $1) 41 AC_DEFINE_UNQUOTED($2, "$pt_cv_path_$1", Define location of $1)
34fi]) 42fi])
54 seteuid \ 62 seteuid \
55 setreuid \ 63 setreuid \
56 setresuid \ 64 setresuid \
57) 65)
58 66
59have_clone=no
60
61AC_MSG_CHECKING(for /dev/ptc)
62if test -e /dev/ptc; then
63 AC_MSG_RESULT(yes)
64 AC_DEFINE(CLONE_DEVICE, "/dev/ptc", [clone device filename])
65 have_clone=yes
66else
67 AC_MSG_RESULT(no)
68fi
69
70case $host in
71 *-*-cygwin*)
72 have_clone=yes
73 AC_DEFINE(CLONE_DEVICE, "/dev/ptmx", [clone device filename])
74 ;;
75 *)
76 AC_MSG_CHECKING(for /dev/ptmx)
77 if test -e /dev/ptmx; then
78 AC_MSG_RESULT(yes)
79 AC_DEFINE(HAVE_DEV_PTMX, 1, [Define to 1 if you have /dev/ptmx])
80 AC_DEFINE(CLONE_DEVICE, "/dev/ptmx", [clone device filename])
81 have_clone=yes
82 else
83 AC_MSG_RESULT(no)
84 fi
85 ;;
86esac
87
88if test x$ac_cv_func_getpt = xyes -o x$ac_cv_func_posix_openpt = xyes -o x$have_clone = xyes; then
89 AC_MSG_CHECKING(for UNIX98 ptys) 67AC_MSG_CHECKING(for UNIX98 ptys)
90 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>]], 68AC_LINK_IFELSE(
69 [AC_LANG_PROGRAM(
70 [[#include <stdlib.h>]],
91 [[grantpt(0);unlockpt(0);ptsname(0);]])], 71 [[grantpt(0);unlockpt(0);ptsname(0);]])],
92 [unix98_pty=yes 72 [unix98_pty=yes
93 AC_DEFINE(UNIX98_PTY, 1, "") 73 AC_DEFINE(UNIX98_PTY, 1, "")
94 AC_MSG_RESULT(yes)], 74 AC_MSG_RESULT(yes)],
95 [AC_MSG_RESULT(no)]) 75 [AC_MSG_RESULT(no)])
96fi
97 76
98if test -z "$unix98_pty"; then 77if test -z "$unix98_pty"; then
99 AC_SEARCH_LIBS(openpty, util, AC_DEFINE(HAVE_OPENPTY, 1, "")) 78 AC_SEARCH_LIBS(openpty, util, AC_DEFINE(HAVE_OPENPTY, 1, ""))
100fi 79fi
101]) 80])
147dnl# -------------------------------------------------------------------------- 126dnl# --------------------------------------------------------------------------
148dnl# check for host field in utmp structure 127dnl# check for host field in utmp structure
149 128
150dnl# -------------------------------------------- 129dnl# --------------------------------------------
151AC_CHECK_HEADERS(utmp.h, 130AC_CHECK_HEADERS(utmp.h,
152[AC_CACHE_CHECK([for struct utmp], pt_cv_struct_utmp, 131AC_CHECK_TYPES([struct utmp], [], [], [
153[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 132#include <sys/types.h>
154#include <utmp.h>]], [[struct utmp ut;]])],[pt_cv_struct_utmp=yes],[pt_cv_struct_utmp=no])]) 133#include <utmp.h>
155if test x$pt_cv_struct_utmp = xyes; then 134])
156 AC_DEFINE(HAVE_STRUCT_UTMP, 1, Define if utmp.h has struct utmp)
157fi
158]
159 135
160AC_CACHE_CHECK(for ut_host in utmp struct, pt_cv_struct_utmp_host, 136AC_CHECK_MEMBER([struct utmp.ut_host],
161[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
162#include <utmp.h>]], [[struct utmp ut; ut.ut_host;]])],[pt_cv_struct_utmp_host=yes],[pt_cv_struct_utmp_host=no])])
163if test x$pt_cv_struct_utmp_host = xyes; then
164 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)], [], [
165fi 138#include <sys/types.h>
139#include <utmp.h>
140])
166 141
167AC_CACHE_CHECK(for ut_pid in utmp struct, pt_cv_struct_utmp_pid, 142AC_CHECK_MEMBER([struct utmp.ut_pid],
168[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
169#include <utmp.h>]], [[struct utmp ut; ut.ut_pid;]])],[pt_cv_struct_utmp_pid=yes],[pt_cv_struct_utmp_pid=no])])
170if test x$pt_cv_struct_utmp_pid = xyes; then
171 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)], [], [
172fi 144#include <sys/types.h>
145#include <utmp.h>
146])
173) dnl# AC_CHECK_HEADERS(utmp.h 147) dnl# AC_CHECK_HEADERS(utmp.h
174 148
175dnl# -------------------------------------------- 149dnl# --------------------------------------------
176 150
177AC_CHECK_HEADERS(utmpx.h, 151AC_CHECK_HEADERS(utmpx.h,
178[AC_CACHE_CHECK([for struct utmpx], pt_cv_struct_utmpx, 152AC_CHECK_TYPES([struct utmpx], [], [], [
179[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 153#include <sys/types.h>
180#include <utmpx.h>]], [[struct utmpx ut;]])],[pt_cv_struct_utmpx=yes],[pt_cv_struct_utmpx=no])]) 154#include <utmpx.h>
181if test x$pt_cv_struct_utmpx = xyes; then 155])
182 AC_DEFINE(HAVE_STRUCT_UTMPX, 1, Define if utmpx.h has struct utmpx)
183fi
184]
185 156
186AC_CACHE_CHECK(for host in utmpx struct, pt_cv_struct_utmpx_host, 157AC_CHECK_MEMBER([struct utmpx.ut_host],
187[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
188#include <utmpx.h>]], [[struct utmpx utx; utx.ut_host;]])],[pt_cv_struct_utmpx_host=yes],[pt_cv_struct_utmpx_host=no])])
189if test x$pt_cv_struct_utmpx_host = xyes; then
190 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)], [], [
191fi 159#include <sys/types.h>
160#include <utmpx.h>
161])
192 162
193AC_CACHE_CHECK(for session in utmpx struct, pt_cv_struct_utmpx_session, 163AC_CHECK_MEMBER([struct utmpx.ut_session],
194[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
195#include <utmpx.h>]], [[struct utmpx utx; utx.ut_session;]])],[pt_cv_struct_utmpx_session=yes],[pt_cv_struct_utmpx_session=no])])
196if test x$pt_cv_struct_utmpx_session = xyes; then
197 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)], [], [
198fi 165#include <sys/types.h>
166#include <utmpx.h>
167])
199) dnl# AC_CHECK_HEADERS(utmpx.h 168) dnl# AC_CHECK_HEADERS(utmpx.h
200 169
201dnl# -------------------------------------------------------------------------- 170dnl# --------------------------------------------------------------------------
202dnl# check for struct lastlog 171dnl# check for struct lastlog
203AC_CACHE_CHECK(for struct lastlog, pt_cv_struct_lastlog, 172AC_CHECK_TYPES([struct lastlog], [], [], [
204[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 173#include <sys/types.h>
205#include <utmp.h> 174#include <utmp.h>
206#ifdef HAVE_LASTLOG_H 175#ifdef HAVE_LASTLOG_H
207#include <lastlog.h> 176#include <lastlog.h>
208#endif 177#endif
209]], [[struct lastlog ll;]])],[pt_cv_struct_lastlog=yes],[pt_cv_struct_lastlog=no])]) 178])
210if test x$pt_cv_struct_lastlog = xyes; then
211 AC_DEFINE(HAVE_STRUCT_LASTLOG, 1, Define if utmp.h or lastlog.h has struct lastlog)
212fi
213 179
214dnl# check for struct lastlogx 180dnl# check for struct lastlogx
215AC_CACHE_CHECK(for struct lastlogx, pt_cv_struct_lastlogx, 181AC_CHECK_TYPES([struct lastlogx], [], [], [
216[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 182#include <sys/types.h>
217#include <utmpx.h> 183#include <utmpx.h>
218#ifdef HAVE_LASTLOG_H 184#ifdef HAVE_LASTLOG_H
219#include <lastlog.h> 185#include <lastlog.h>
220#endif 186#endif
221]], [[struct lastlogx ll;]])],[pt_cv_struct_lastlogx=yes],[pt_cv_struct_lastlogx=no])]) 187])
222if test x$pt_cv_struct_lastlogx = xyes; then
223 AC_DEFINE(HAVE_STRUCT_LASTLOGX, 1, Define if utmpx.h or lastlog.h has struct lastlogx)
224fi
225 188
226dnl# -------------------------------------------------------------------------- 189dnl# --------------------------------------------------------------------------
227dnl# FIND FILES 190dnl# FIND FILES
228dnl# -------------------------------------------------------------------------- 191dnl# --------------------------------------------------------------------------
229 192
230dnl# find utmp 193dnl# find utmp
231PT_FIND_FILE([utmp], [UTMP_FILE], [_PATH_UTMP], 194PT_FIND_FILE([utmp], [UTMP_FILE], [_PATH_UTMP],
232["/var/run/utmp", "/var/adm/utmp", "/etc/utmp", "/usr/etc/utmp", "/usr/adm/utmp"],[ 195["/var/run/utmp", "/var/adm/utmp", "/etc/utmp", "/usr/etc/utmp", "/usr/adm/utmp"])
233#include <sys/types.h>
234#include <utmp.h>
235])
236 196
237dnl# -------------------------------------------------------------------------- 197dnl# --------------------------------------------------------------------------
238 198
239dnl# find wtmp 199dnl# find wtmp
240PT_FIND_FILE([wtmp], [WTMP_FILE], [_PATH_WTMP], 200PT_FIND_FILE([wtmp], [WTMP_FILE], [_PATH_WTMP],
241["/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp"],[ 201["/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp"])
242#include <sys/types.h>
243#ifdef HAVE_UTMP_H
244#include <utmp.h>
245#endif
246])
247dnl# -------------------------------------------------------------------------- 202dnl# --------------------------------------------------------------------------
248 203
249dnl# find wtmpx 204dnl# find wtmpx
250PT_FIND_FILE([wtmpx], [WTMPX_FILE], [_PATH_WTMPX], 205PT_FIND_FILE([wtmpx], [WTMPX_FILE], [_PATH_WTMPX],
251["/var/log/wtmpx", "/var/adm/wtmpx"],[ 206["/var/log/wtmpx", "/var/adm/wtmpx"])
252#ifdef HAVE_UTMPX_H
253#include <utmpx.h>
254#endif
255])
256dnl# -------------------------------------------------------------------------- 207dnl# --------------------------------------------------------------------------
257 208
258dnl# find lastlog 209dnl# find lastlog
259PT_FIND_FILE([lastlog], [LASTLOG_FILE], [_PATH_LASTLOG], 210PT_FIND_FILE([lastlog], [LASTLOG_FILE], [_PATH_LASTLOG],
260["/var/log/lastlog"],[ 211["/var/log/lastlog"])
261#include <sys/types.h>
262#ifdef HAVE_UTMP_H
263#include <utmp.h>
264#endif
265#ifdef HAVE_LASTLOG_H
266#include <lastlog.h>
267#endif
268])
269dnl# -------------------------------------------------------------------------- 212dnl# --------------------------------------------------------------------------
270 213
271dnl# find lastlogx 214dnl# find lastlogx
272PT_FIND_FILE([lastlogx], [LASTLOGX_FILE], [_PATH_LASTLOGX], 215PT_FIND_FILE([lastlogx], [LASTLOGX_FILE], [_PATH_LASTLOGX],
273["/var/log/lastlogx", "/var/adm/lastlogx"],[ 216["/var/log/lastlogx", "/var/adm/lastlogx"])
274#ifdef HAVE_UTMPX_H
275#include <utmpx.h>
276#endif
277])
278]) 217])
279 218
280AC_DEFUN([SCM_RIGHTS_CHECK], 219AC_DEFUN([SCM_RIGHTS_CHECK],
281[ 220[
282AC_CACHE_CHECK(for unix-compliant filehandle passing ability, pt_cv_can_pass_fds, 221AC_CACHE_CHECK(for unix-compliant filehandle passing ability, pt_cv_can_pass_fds,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines