1 | dnl this file is part of libptytty, do not make local modifications |
1 | dnl this file is part of libptytty, do not make local modifications |
2 | dnl http://software.schmorp.de/pkg/libptytty |
2 | dnl http://software.schmorp.de/pkg/libptytty |
3 | |
3 | |
4 | AC_DEFUN([PT_FIND_FILE], |
4 | AC_DEFUN([PT_FIND_FILE], |
5 | [AC_CACHE_CHECK(where $1 is located, pt_cv_path_$1, |
5 | [AC_CACHE_CHECK(for a fallback location of $1, pt_cv_path_$1, [ |
6 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> |
6 | if test "$cross_compiling" != yes; then |
7 | #include <stdlib.h> |
7 | for file in $3; do |
8 | #include <sys/stat.h> |
8 | if test -f "$file"; then |
9 | #include <sys/types.h> |
9 | pt_cv_path_$1=$file |
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 |
|
|
19 | int main() |
|
|
20 | { |
|
|
21 | const char **path, *list[] = { $4, NULL }; |
|
|
22 | FILE *f = fopen("conftestval", "w"); |
|
|
23 | if (!f) return 1; |
|
|
24 | #ifdef $2 |
|
|
25 | fprintf(f, "%s\n", $2); |
|
|
26 | #elif defined($3) |
|
|
27 | fprintf(f, "%s\n", $3); |
|
|
28 | #else |
|
|
29 | for (path = list; *path; path++) { |
|
|
30 | struct stat st; |
|
|
31 | if (stat(*path, &st) == 0) { |
|
|
32 | fprintf(f, "%s\n", *path); |
|
|
33 | break; |
10 | break |
34 | } |
11 | fi |
35 | } |
12 | done |
36 | #endif |
13 | fi]) |
37 | return fclose(f) != 0; |
|
|
38 | }]])],[pt_cv_path_$1=`cat conftestval`],[pt_cv_path_$1=], |
|
|
39 | [AC_MSG_WARN(Define $2 in config.h manually)])]) |
|
|
40 | if test x$pt_cv_path_$1 != x; then |
14 | if test x$pt_cv_path_$1 != x; then |
41 | AC_DEFINE_UNQUOTED($2, "$pt_cv_path_$1", Define location of $1) |
15 | AC_DEFINE_UNQUOTED($2, "$pt_cv_path_$1", Define to a fallback location of $1) |
|
|
16 | elif test "$cross_compiling" = yes; then |
|
|
17 | AC_MSG_WARN(Define $2 in config.h manually) |
42 | fi]) |
18 | fi]) |
43 | |
19 | |
44 | AC_DEFUN([PTY_CHECK], |
20 | AC_DEFUN([PTY_CHECK], |
45 | [ |
21 | [ |
46 | AC_CHECK_HEADERS( \ |
22 | AC_CHECK_HEADERS( \ |
… | |
… | |
157 | AC_CHECK_MEMBER([struct utmpx.ut_host], |
133 | AC_CHECK_MEMBER([struct utmpx.ut_host], |
158 | [AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host)], [], [ |
134 | [AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host)], [], [ |
159 | #include <sys/types.h> |
135 | #include <sys/types.h> |
160 | #include <utmpx.h> |
136 | #include <utmpx.h> |
161 | ]) |
137 | ]) |
162 | |
|
|
163 | AC_CHECK_MEMBER([struct utmpx.ut_session], |
|
|
164 | [AC_DEFINE(HAVE_UTMPX_SESSION, 1, Define if struct utmpx contains ut_session)], [], [ |
|
|
165 | #include <sys/types.h> |
|
|
166 | #include <utmpx.h> |
|
|
167 | ]) |
|
|
168 | ) dnl# AC_CHECK_HEADERS(utmpx.h |
138 | ) dnl# AC_CHECK_HEADERS(utmpx.h |
169 | |
139 | |
170 | dnl# -------------------------------------------------------------------------- |
140 | dnl# -------------------------------------------------------------------------- |
171 | dnl# check for struct lastlog |
141 | dnl# check for struct lastlog |
172 | AC_CHECK_TYPES([struct lastlog], [], [], [ |
142 | AC_CHECK_TYPES([struct lastlog], [], [], [ |
… | |
… | |
189 | dnl# -------------------------------------------------------------------------- |
159 | dnl# -------------------------------------------------------------------------- |
190 | dnl# FIND FILES |
160 | dnl# FIND FILES |
191 | dnl# -------------------------------------------------------------------------- |
161 | dnl# -------------------------------------------------------------------------- |
192 | |
162 | |
193 | dnl# find utmp |
163 | dnl# find utmp |
194 | PT_FIND_FILE([utmp], [UTMP_FILE], [_PATH_UTMP], |
164 | PT_FIND_FILE([utmp], [PT_UTMP_FILE], |
195 | ["/var/run/utmp", "/var/adm/utmp", "/etc/utmp", "/usr/etc/utmp", "/usr/adm/utmp"]) |
165 | ["/var/run/utmp" "/var/adm/utmp" "/etc/utmp" "/usr/etc/utmp" "/usr/adm/utmp"]) |
196 | |
166 | |
197 | dnl# -------------------------------------------------------------------------- |
167 | dnl# -------------------------------------------------------------------------- |
198 | |
168 | |
199 | dnl# find wtmp |
169 | dnl# find wtmp |
200 | PT_FIND_FILE([wtmp], [WTMP_FILE], [_PATH_WTMP], |
170 | PT_FIND_FILE([wtmp], [PT_WTMP_FILE], |
201 | ["/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp"]) |
171 | ["/var/log/wtmp" "/var/adm/wtmp" "/etc/wtmp" "/usr/etc/wtmp" "/usr/adm/wtmp"]) |
202 | dnl# -------------------------------------------------------------------------- |
172 | dnl# -------------------------------------------------------------------------- |
203 | |
173 | |
204 | dnl# find wtmpx |
174 | dnl# find wtmpx |
205 | PT_FIND_FILE([wtmpx], [WTMPX_FILE], [_PATH_WTMPX], |
175 | PT_FIND_FILE([wtmpx], [PT_WTMPX_FILE], |
206 | ["/var/log/wtmpx", "/var/adm/wtmpx"]) |
176 | ["/var/log/wtmpx" "/var/adm/wtmpx"]) |
207 | dnl# -------------------------------------------------------------------------- |
177 | dnl# -------------------------------------------------------------------------- |
208 | |
178 | |
209 | dnl# find lastlog |
179 | dnl# find lastlog |
210 | PT_FIND_FILE([lastlog], [LASTLOG_FILE], [_PATH_LASTLOG], |
180 | PT_FIND_FILE([lastlog], [PT_LASTLOG_FILE], |
211 | ["/var/log/lastlog"]) |
181 | ["/var/log/lastlog"]) |
212 | dnl# -------------------------------------------------------------------------- |
182 | dnl# -------------------------------------------------------------------------- |
213 | |
183 | |
214 | dnl# find lastlogx |
184 | dnl# find lastlogx |
215 | PT_FIND_FILE([lastlogx], [LASTLOGX_FILE], [_PATH_LASTLOGX], |
185 | PT_FIND_FILE([lastlogx], [PT_LASTLOGX_FILE], |
216 | ["/var/log/lastlogx", "/var/adm/lastlogx"]) |
186 | ["/var/log/lastlogx" "/var/adm/lastlogx"]) |
217 | ]) |
187 | ]) |
218 | |
188 | |
219 | AC_DEFUN([SCM_RIGHTS_CHECK], |
189 | AC_DEFUN([SCM_RIGHTS_CHECK], |
220 | [ |
190 | [ |
221 | AC_CACHE_CHECK(for unix-compliant filehandle passing ability, pt_cv_can_pass_fds, |
191 | AC_CACHE_CHECK(for unix-compliant filehandle passing ability, pt_cv_can_pass_fds, |