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

Comparing libptytty/ptytty.m4 (file contents):
Revision 1.25 by sf-exg, Thu May 12 16:43:47 2011 UTC vs.
Revision 1.29 by sf-exg, Sun Nov 20 14:38:44 2011 UTC

7#include <stdlib.h> 7#include <stdlib.h>
8#include <sys/stat.h> 8#include <sys/stat.h>
9$5 9$5
10int main() 10int main()
11{ 11{
12 char **path, *list[] = { $4, NULL }; 12 const char **path, *list[] = { $4, NULL };
13 FILE *f = fopen("conftestval", "w"); 13 FILE *f = fopen("conftestval", "w");
14 if (!f) return 1; 14 if (!f) return 1;
15#ifdef $2 15#ifdef $2
16 fprintf(f, "%s\n", $2); 16 fprintf(f, "%s\n", $2);
17#elif defined($3) 17#elif defined($3)
53 seteuid \ 53 seteuid \
54 setreuid \ 54 setreuid \
55 setresuid \ 55 setresuid \
56) 56)
57 57
58have_clone=no
59
60AC_MSG_CHECKING(for /dev/ptc)
61if test -e /dev/ptc; then
62 AC_MSG_RESULT(yes)
63 AC_DEFINE(CLONE_DEVICE, "/dev/ptc", [clone device filename])
64 have_clone=yes
65else
66 AC_MSG_RESULT(no)
67fi
68
69case $host in
70 *-*-cygwin*)
71 have_clone=yes
72 AC_DEFINE(CLONE_DEVICE, "/dev/ptmx", [clone device filename])
73 ;;
74 *)
75 AC_MSG_CHECKING(for /dev/ptmx)
76 if test -e /dev/ptmx; then
77 AC_MSG_RESULT(yes)
78 AC_DEFINE(HAVE_DEV_PTMX, 1, [Define to 1 if you have /dev/ptmx])
79 AC_DEFINE(CLONE_DEVICE, "/dev/ptmx", [clone device filename])
80 have_clone=yes
81 else
82 AC_MSG_RESULT(no)
83 fi
84 ;;
85esac
86
87if test x$ac_cv_func_getpt = xyes -o x$ac_cv_func_posix_openpt = xyes -o x$have_clone = xyes; then
88 AC_MSG_CHECKING(for UNIX98 ptys) 58AC_MSG_CHECKING(for UNIX98 ptys)
89 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>]], 59AC_LINK_IFELSE(
60 [AC_LANG_PROGRAM(
61 [[#include <stdlib.h>]],
90 [[grantpt(0);unlockpt(0);ptsname(0);]])], 62 [[grantpt(0);unlockpt(0);ptsname(0);]])],
91 [unix98_pty=yes 63 [unix98_pty=yes
92 AC_DEFINE(UNIX98_PTY, 1, "") 64 AC_DEFINE(UNIX98_PTY, 1, "")
93 AC_MSG_RESULT(yes)], 65 AC_MSG_RESULT(yes)],
94 [AC_MSG_RESULT(no)]) 66 [AC_MSG_RESULT(no)])
95fi
96 67
97if test -z "$unix98_pty"; then 68if test -z "$unix98_pty"; then
98 AC_SEARCH_LIBS(openpty, util, AC_DEFINE(HAVE_OPENPTY, 1, "")) 69 AC_SEARCH_LIBS(openpty, util, AC_DEFINE(HAVE_OPENPTY, 1, ""))
99fi 70fi
100]) 71])
146dnl# -------------------------------------------------------------------------- 117dnl# --------------------------------------------------------------------------
147dnl# check for host field in utmp structure 118dnl# check for host field in utmp structure
148 119
149dnl# -------------------------------------------- 120dnl# --------------------------------------------
150AC_CHECK_HEADERS(utmp.h, 121AC_CHECK_HEADERS(utmp.h,
151[AC_CACHE_CHECK([for struct utmp], pt_cv_struct_utmp, 122AC_CHECK_TYPES([struct utmp], [], [], [
152[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 123#include <sys/types.h>
153#include <utmp.h>]], [[struct utmp ut;]])],[pt_cv_struct_utmp=yes],[pt_cv_struct_utmp=no])]) 124#include <utmp.h>
154if test x$pt_cv_struct_utmp = xyes; then 125])
155 AC_DEFINE(HAVE_STRUCT_UTMP, 1, Define if utmp.h has struct utmp)
156fi
157]
158 126
159AC_CACHE_CHECK(for ut_host in utmp struct, pt_cv_struct_utmp_host, 127AC_CHECK_MEMBER([struct utmp.ut_host],
160[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
161#include <utmp.h>]], [[struct utmp ut; ut.ut_host;]])],[pt_cv_struct_utmp_host=yes],[pt_cv_struct_utmp_host=no])])
162if test x$pt_cv_struct_utmp_host = xyes; then
163 AC_DEFINE(HAVE_UTMP_HOST, 1, Define if struct utmp contains ut_host) 128[AC_DEFINE(HAVE_UTMP_HOST, 1, Define if struct utmp contains ut_host)], [], [
164fi 129#include <sys/types.h>
130#include <utmp.h>
131])
165 132
166AC_CACHE_CHECK(for ut_pid in utmp struct, pt_cv_struct_utmp_pid, 133AC_CHECK_MEMBER([struct utmp.ut_pid],
167[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
168#include <utmp.h>]], [[struct utmp ut; ut.ut_pid;]])],[pt_cv_struct_utmp_pid=yes],[pt_cv_struct_utmp_pid=no])])
169if test x$pt_cv_struct_utmp_pid = xyes; then
170 AC_DEFINE(HAVE_UTMP_PID, 1, Define if struct utmp contains ut_pid) 134[AC_DEFINE(HAVE_UTMP_PID, 1, Define if struct utmp contains ut_pid)], [], [
171fi 135#include <sys/types.h>
136#include <utmp.h>
137])
172) dnl# AC_CHECK_HEADERS(utmp.h 138) dnl# AC_CHECK_HEADERS(utmp.h
173 139
174dnl# -------------------------------------------- 140dnl# --------------------------------------------
175 141
176AC_CHECK_HEADERS(utmpx.h, 142AC_CHECK_HEADERS(utmpx.h,
177[AC_CACHE_CHECK([for struct utmpx], pt_cv_struct_utmpx, 143AC_CHECK_TYPES([struct utmpx], [], [], [
178[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 144#include <sys/types.h>
179#include <utmpx.h>]], [[struct utmpx ut;]])],[pt_cv_struct_utmpx=yes],[pt_cv_struct_utmpx=no])]) 145#include <utmpx.h>
180if test x$pt_cv_struct_utmpx = xyes; then 146])
181 AC_DEFINE(HAVE_STRUCT_UTMPX, 1, Define if utmpx.h has struct utmpx)
182fi
183]
184 147
185AC_CACHE_CHECK(for host in utmpx struct, pt_cv_struct_utmpx_host, 148AC_CHECK_MEMBER([struct utmpx.ut_host],
186[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
187#include <utmpx.h>]], [[struct utmpx utx; utx.ut_host;]])],[pt_cv_struct_utmpx_host=yes],[pt_cv_struct_utmpx_host=no])])
188if test x$pt_cv_struct_utmpx_host = xyes; then
189 AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host) 149[AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host)], [], [
190fi 150#include <sys/types.h>
151#include <utmpx.h>
152])
191 153
192AC_CACHE_CHECK(for session in utmpx struct, pt_cv_struct_utmpx_session, 154AC_CHECK_MEMBER([struct utmpx.ut_session],
193[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
194#include <utmpx.h>]], [[struct utmpx utx; utx.ut_session;]])],[pt_cv_struct_utmpx_session=yes],[pt_cv_struct_utmpx_session=no])])
195if test x$pt_cv_struct_utmpx_session = xyes; then
196 AC_DEFINE(HAVE_UTMPX_SESSION, 1, Define if struct utmpx contains ut_session) 155[AC_DEFINE(HAVE_UTMPX_SESSION, 1, Define if struct utmpx contains ut_session)], [], [
197fi 156#include <sys/types.h>
157#include <utmpx.h>
158])
198) dnl# AC_CHECK_HEADERS(utmpx.h 159) dnl# AC_CHECK_HEADERS(utmpx.h
199 160
200dnl# -------------------------------------------------------------------------- 161dnl# --------------------------------------------------------------------------
201dnl# check for struct lastlog 162dnl# check for struct lastlog
202AC_CACHE_CHECK(for struct lastlog, pt_cv_struct_lastlog, 163AC_CHECK_TYPES([struct lastlog], [], [], [
203[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 164#include <sys/types.h>
204#include <utmp.h> 165#include <utmp.h>
205#ifdef HAVE_LASTLOG_H 166#ifdef HAVE_LASTLOG_H
206#include <lastlog.h> 167#include <lastlog.h>
207#endif 168#endif
208]], [[struct lastlog ll;]])],[pt_cv_struct_lastlog=yes],[pt_cv_struct_lastlog=no])]) 169])
209if test x$pt_cv_struct_lastlog = xyes; then
210 AC_DEFINE(HAVE_STRUCT_LASTLOG, 1, Define if utmp.h or lastlog.h has struct lastlog)
211fi
212 170
213dnl# check for struct lastlogx 171dnl# check for struct lastlogx
214AC_CACHE_CHECK(for struct lastlogx, pt_cv_struct_lastlogx, 172AC_CHECK_TYPES([struct lastlogx], [], [], [
215[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 173#include <sys/types.h>
216#include <utmpx.h> 174#include <utmpx.h>
217#ifdef HAVE_LASTLOG_H 175#ifdef HAVE_LASTLOG_H
218#include <lastlog.h> 176#include <lastlog.h>
219#endif 177#endif
220]], [[struct lastlogx ll;]])],[pt_cv_struct_lastlogx=yes],[pt_cv_struct_lastlogx=no])]) 178])
221if test x$pt_cv_struct_lastlogx = xyes; then
222 AC_DEFINE(HAVE_STRUCT_LASTLOGX, 1, Define if utmpx.h or lastlog.h has struct lastlogx)
223fi
224 179
225dnl# -------------------------------------------------------------------------- 180dnl# --------------------------------------------------------------------------
226dnl# FIND FILES 181dnl# FIND FILES
227dnl# -------------------------------------------------------------------------- 182dnl# --------------------------------------------------------------------------
228 183

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines