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.39 by sf-exg, Sat May 2 20:09:40 2015 UTC

1dnl this file is part of libptytty, do not make local modifications
2dnl http://software.schmorp.de/pkg/libptytty
3
4AC_DEFUN([PT_FIND_FILE], 1AC_DEFUN([PT_FIND_FILE],
5[AC_CACHE_CHECK(where $1 is located, pt_cv_path_$1, 2[AC_CACHE_CHECK(for a fallback location of $1, pt_cv_path_$1, [
6[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> 3if test "$cross_compiling" != yes; then
7#include <stdlib.h> 4 for file in $3; do
8#include <sys/stat.h> 5 if test -f "$file"; then
9$5 6 pt_cv_path_$1=$file
10int main()
11{
12 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; 7 break
25 } 8 fi
26 } 9 done
27#endif 10fi])
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 11if test x$pt_cv_path_$1 != x; then
32 AC_DEFINE_UNQUOTED($2, "$pt_cv_path_$1", Define location of $1) 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)
33fi]) 15fi])
34 16
35AC_DEFUN([PTY_CHECK], 17AC_DEFUN([PTY_CHECK],
36[ 18[
37AC_CHECK_HEADERS( \ 19AC_CHECK_HEADERS( \
38 pty.h \ 20 pty.h \
39 util.h \ 21 util.h \
40 libutil.h \ 22 libutil.h \
41 sys/ioctl.h \ 23 sys/ioctl.h \
42 sys/stropts.h \
43 stropts.h \ 24 stropts.h \
44) 25)
45 26
46AC_CHECK_FUNCS( \ 27AC_CHECK_FUNCS( \
47 revoke \ 28 revoke \
53 seteuid \ 34 seteuid \
54 setreuid \ 35 setreuid \
55 setresuid \ 36 setresuid \
56) 37)
57 38
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) 39AC_MSG_CHECKING(for UNIX98 ptys)
89 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>]], 40AC_LINK_IFELSE(
41 [AC_LANG_PROGRAM(
42 [[#include <stdlib.h>]],
90 [[grantpt(0);unlockpt(0);ptsname(0);]])], 43 [[grantpt(0);unlockpt(0);ptsname(0);]])],
91 [unix98_pty=yes 44 [unix98_pty=yes
92 AC_DEFINE(UNIX98_PTY, 1, "") 45 AC_DEFINE(UNIX98_PTY, 1, "")
93 AC_MSG_RESULT(yes)], 46 AC_MSG_RESULT(yes)],
94 [AC_MSG_RESULT(no)]) 47 [AC_MSG_RESULT(no)])
95fi
96 48
97if test -z "$unix98_pty"; then 49if test -z "$unix98_pty"; then
98 AC_SEARCH_LIBS(openpty, util, AC_DEFINE(HAVE_OPENPTY, 1, "")) 50 AC_SEARCH_LIBS(openpty, util, AC_DEFINE(HAVE_OPENPTY, 1, ""))
99fi 51fi
100]) 52])
139 updlastlogx \ 91 updlastlogx \
140) 92)
141 93
142AC_CHECK_HEADERS(lastlog.h) 94AC_CHECK_HEADERS(lastlog.h)
143 95
96case $host in
97 *-*-solaris*)
98 AC_DEFINE(__EXTENSIONS__, 1, Enable declarations in utmp.h on Solaris when the XPG4v2 namespace is active)
99 ;;
100esac
101
144dnl# -------------------------------------------------------------------------- 102dnl# --------------------------------------------------------------------------
145dnl# DO ALL UTMP AND WTMP CHECKING 103dnl# DO ALL UTMP AND WTMP CHECKING
146dnl# -------------------------------------------------------------------------- 104dnl# --------------------------------------------------------------------------
147dnl# check for host field in utmp structure 105dnl# check for host field in utmp structure
148 106
149dnl# -------------------------------------------- 107dnl# --------------------------------------------
150AC_CHECK_HEADERS(utmp.h, 108AC_CHECK_HEADERS(utmp.h, [
151[AC_CACHE_CHECK([for struct utmp], pt_cv_struct_utmp, 109AC_CHECK_TYPES([struct utmp], [], [], [
152[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 110#include <sys/types.h>
153#include <utmp.h>]], [[struct utmp ut;]])],[pt_cv_struct_utmp=yes],[pt_cv_struct_utmp=no])]) 111#include <utmp.h>
154if test x$pt_cv_struct_utmp = xyes; then 112])
155 AC_DEFINE(HAVE_STRUCT_UTMP, 1, Define if utmp.h has struct utmp)
156fi
157]
158 113
159AC_CACHE_CHECK(for ut_host in utmp struct, pt_cv_struct_utmp_host, 114AC_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) 115[AC_DEFINE(HAVE_UTMP_HOST, 1, Define if struct utmp contains ut_host)], [], [
164fi 116#include <sys/types.h>
117#include <utmp.h>
118])
165 119
166AC_CACHE_CHECK(for ut_pid in utmp struct, pt_cv_struct_utmp_pid, 120AC_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) 121[AC_DEFINE(HAVE_UTMP_PID, 1, Define if struct utmp contains ut_pid)], [], [
171fi 122#include <sys/types.h>
123#include <utmp.h>
124])
172) dnl# AC_CHECK_HEADERS(utmp.h 125]) dnl# AC_CHECK_HEADERS(utmp.h
173 126
174dnl# -------------------------------------------- 127dnl# --------------------------------------------
175 128
176AC_CHECK_HEADERS(utmpx.h, 129AC_CHECK_HEADERS(utmpx.h, [
177[AC_CACHE_CHECK([for struct utmpx], pt_cv_struct_utmpx, 130AC_CHECK_TYPES([struct utmpx], [], [], [
178[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 131#include <sys/types.h>
179#include <utmpx.h>]], [[struct utmpx ut;]])],[pt_cv_struct_utmpx=yes],[pt_cv_struct_utmpx=no])]) 132#include <utmpx.h>
180if test x$pt_cv_struct_utmpx = xyes; then 133])
181 AC_DEFINE(HAVE_STRUCT_UTMPX, 1, Define if utmpx.h has struct utmpx)
182fi
183]
184 134
185AC_CACHE_CHECK(for host in utmpx struct, pt_cv_struct_utmpx_host, 135AC_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) 136[AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host)], [], [
190fi 137#include <sys/types.h>
191 138#include <utmpx.h>
192AC_CACHE_CHECK(for session in utmpx struct, pt_cv_struct_utmpx_session, 139])
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)
197fi
198) dnl# AC_CHECK_HEADERS(utmpx.h 140]) dnl# AC_CHECK_HEADERS(utmpx.h
199 141
200dnl# -------------------------------------------------------------------------- 142dnl# --------------------------------------------------------------------------
201dnl# check for struct lastlog 143dnl# check for struct lastlog
202AC_CACHE_CHECK(for struct lastlog, pt_cv_struct_lastlog, 144AC_CHECK_TYPES([struct lastlog], [], [], [
203[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 145#include <sys/types.h>
204#include <utmp.h> 146#include <utmp.h>
205#ifdef HAVE_LASTLOG_H 147#ifdef HAVE_LASTLOG_H
206#include <lastlog.h> 148#include <lastlog.h>
207#endif 149#endif
208]], [[struct lastlog ll;]])],[pt_cv_struct_lastlog=yes],[pt_cv_struct_lastlog=no])]) 150])
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 151
213dnl# check for struct lastlogx 152dnl# check for struct lastlogx
214AC_CACHE_CHECK(for struct lastlogx, pt_cv_struct_lastlogx, 153AC_CHECK_TYPES([struct lastlogx], [], [], [
215[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 154#include <sys/types.h>
216#include <utmpx.h> 155#include <utmpx.h>
217#ifdef HAVE_LASTLOG_H 156#ifdef HAVE_LASTLOG_H
218#include <lastlog.h> 157#include <lastlog.h>
219#endif 158#endif
220]], [[struct lastlogx ll;]])],[pt_cv_struct_lastlogx=yes],[pt_cv_struct_lastlogx=no])]) 159])
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 160
225dnl# -------------------------------------------------------------------------- 161dnl# --------------------------------------------------------------------------
226dnl# FIND FILES 162dnl# FIND FILES
227dnl# -------------------------------------------------------------------------- 163dnl# --------------------------------------------------------------------------
228 164
229dnl# find utmp 165dnl# find utmp
230PT_FIND_FILE([utmp], [UTMP_FILE], [_PATH_UTMP], 166PT_FIND_FILE([utmp], [PT_UTMP_FILE],
231["/var/run/utmp", "/var/adm/utmp", "/etc/utmp", "/usr/etc/utmp", "/usr/adm/utmp"],[ 167["/var/run/utmp" "/var/adm/utmp" "/etc/utmp" "/usr/etc/utmp" "/usr/adm/utmp"])
232#include <sys/types.h>
233#include <utmp.h>
234])
235 168
236dnl# -------------------------------------------------------------------------- 169dnl# --------------------------------------------------------------------------
237 170
238dnl# find wtmp 171dnl# find wtmp
239PT_FIND_FILE([wtmp], [WTMP_FILE], [_PATH_WTMP], 172PT_FIND_FILE([wtmp], [PT_WTMP_FILE],
240["/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp"],[ 173["/var/log/wtmp" "/var/adm/wtmp" "/etc/wtmp" "/usr/etc/wtmp" "/usr/adm/wtmp"])
241#include <sys/types.h> 174dnl# --------------------------------------------------------------------------
242#ifdef HAVE_UTMP_H 175
243#include <utmp.h> 176dnl# find wtmpx
177PT_FIND_FILE([wtmpx], [PT_WTMPX_FILE],
178["/var/log/wtmpx" "/var/adm/wtmpx"])
179dnl# --------------------------------------------------------------------------
180
181dnl# find lastlog
182PT_FIND_FILE([lastlog], [PT_LASTLOG_FILE],
183["/var/log/lastlog" "/var/adm/lastlog"])
184dnl# --------------------------------------------------------------------------
185
186dnl# find lastlogx
187PT_FIND_FILE([lastlogx], [PT_LASTLOGX_FILE],
188["/var/log/lastlogx" "/var/adm/lastlogx"])
189])
190
191AC_DEFUN([SCM_RIGHTS_CHECK],
192[
193AH_TEMPLATE([_XOPEN_SOURCE], [Enable declarations of msg_control and msg_controllen on Solaris])
194case $host in
195 *-*-solaris*)
196 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
197#if __STDC_VERSION__ >= 199901L
198error
244#endif 199#endif
245]) 200]])],[AC_DEFINE(_XOPEN_SOURCE, 500)],[AC_DEFINE(_XOPEN_SOURCE, 600)])
246dnl# -------------------------------------------------------------------------- 201 AC_SEARCH_LIBS(sendmsg, socket)
202 ;;
203esac
247 204
248dnl# find wtmpx
249PT_FIND_FILE([wtmpx], [WTMPX_FILE], [_PATH_WTMPX],
250["/var/log/wtmpx", "/var/adm/wtmpx"],[
251#ifdef HAVE_UTMPX_H
252#include <utmpx.h>
253#endif
254])
255dnl# --------------------------------------------------------------------------
256
257dnl# find lastlog
258PT_FIND_FILE([lastlog], [LASTLOG_FILE], [_PATH_LASTLOG],
259["/var/log/lastlog"],[
260#include <sys/types.h>
261#ifdef HAVE_UTMP_H
262#include <utmp.h>
263#endif
264#ifdef HAVE_LASTLOG_H
265#include <lastlog.h>
266#endif
267])
268dnl# --------------------------------------------------------------------------
269
270dnl# find lastlogx
271PT_FIND_FILE([lastlogx], [LASTLOGX_FILE], [_PATH_LASTLOGX],
272["/var/log/lastlogx", "/var/adm/lastlogx"],[
273#ifdef HAVE_UTMPX_H
274#include <utmpx.h>
275#endif
276])
277])
278
279AC_DEFUN([SCM_RIGHTS_CHECK],
280[
281AC_CACHE_CHECK(for unix-compliant filehandle passing ability, pt_cv_can_pass_fds, 205AC_CACHE_CHECK(for unix-compliant filehandle passing ability, pt_cv_can_pass_fds,
282[AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 206[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
283#include <cstddef> // broken bsds (is that redundant?) need this 207#include <stddef.h> // broken bsds (is that redundant?) need this
284#include <sys/types.h> 208#include <sys/types.h>
285#include <sys/socket.h> 209#include <sys/socket.h>
286#include <sys/uio.h> 210#include <sys/uio.h>
287]], [[ 211]], [[
288{ 212{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines