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

Comparing libptytty/ptytty.m4 (file contents):
Revision 1.30 by sf-exg, Wed Nov 23 19:29:27 2011 UTC vs.
Revision 1.35 by sf-exg, Thu Jan 19 12:16:33 2012 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#include <sys/types.h> 6 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
19int 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; 7 break
34 } 8 fi
35 } 9 done
36#endif 10fi])
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)])])
40if test x$pt_cv_path_$1 != x; then 11if test x$pt_cv_path_$1 != x; then
41 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)
42fi]) 15fi])
43 16
44AC_DEFUN([PTY_CHECK], 17AC_DEFUN([PTY_CHECK],
45[ 18[
46AC_CHECK_HEADERS( \ 19AC_CHECK_HEADERS( \
119 updlastlogx \ 92 updlastlogx \
120) 93)
121 94
122AC_CHECK_HEADERS(lastlog.h) 95AC_CHECK_HEADERS(lastlog.h)
123 96
97case $host in
98 *-*-solaris*)
99 AC_DEFINE(__EXTENSIONS__, 1, Enable declarations in utmp.h on Solaris when the XPG4v2 namespace is active)
100 ;;
101esac
102
124dnl# -------------------------------------------------------------------------- 103dnl# --------------------------------------------------------------------------
125dnl# DO ALL UTMP AND WTMP CHECKING 104dnl# DO ALL UTMP AND WTMP CHECKING
126dnl# -------------------------------------------------------------------------- 105dnl# --------------------------------------------------------------------------
127dnl# check for host field in utmp structure 106dnl# check for host field in utmp structure
128 107
154#include <utmpx.h> 133#include <utmpx.h>
155]) 134])
156 135
157AC_CHECK_MEMBER([struct utmpx.ut_host], 136AC_CHECK_MEMBER([struct utmpx.ut_host],
158[AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host)], [], [ 137[AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host)], [], [
159#include <sys/types.h>
160#include <utmpx.h>
161])
162
163AC_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> 138#include <sys/types.h>
166#include <utmpx.h> 139#include <utmpx.h>
167]) 140])
168) dnl# AC_CHECK_HEADERS(utmpx.h 141) dnl# AC_CHECK_HEADERS(utmpx.h
169 142
189dnl# -------------------------------------------------------------------------- 162dnl# --------------------------------------------------------------------------
190dnl# FIND FILES 163dnl# FIND FILES
191dnl# -------------------------------------------------------------------------- 164dnl# --------------------------------------------------------------------------
192 165
193dnl# find utmp 166dnl# find utmp
194PT_FIND_FILE([utmp], [UTMP_FILE], [_PATH_UTMP], 167PT_FIND_FILE([utmp], [PT_UTMP_FILE],
195["/var/run/utmp", "/var/adm/utmp", "/etc/utmp", "/usr/etc/utmp", "/usr/adm/utmp"]) 168["/var/run/utmp" "/var/adm/utmp" "/etc/utmp" "/usr/etc/utmp" "/usr/adm/utmp"])
196 169
197dnl# -------------------------------------------------------------------------- 170dnl# --------------------------------------------------------------------------
198 171
199dnl# find wtmp 172dnl# find wtmp
200PT_FIND_FILE([wtmp], [WTMP_FILE], [_PATH_WTMP], 173PT_FIND_FILE([wtmp], [PT_WTMP_FILE],
201["/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp"]) 174["/var/log/wtmp" "/var/adm/wtmp" "/etc/wtmp" "/usr/etc/wtmp" "/usr/adm/wtmp"])
202dnl# -------------------------------------------------------------------------- 175dnl# --------------------------------------------------------------------------
203 176
204dnl# find wtmpx 177dnl# find wtmpx
205PT_FIND_FILE([wtmpx], [WTMPX_FILE], [_PATH_WTMPX], 178PT_FIND_FILE([wtmpx], [PT_WTMPX_FILE],
206["/var/log/wtmpx", "/var/adm/wtmpx"]) 179["/var/log/wtmpx" "/var/adm/wtmpx"])
207dnl# -------------------------------------------------------------------------- 180dnl# --------------------------------------------------------------------------
208 181
209dnl# find lastlog 182dnl# find lastlog
210PT_FIND_FILE([lastlog], [LASTLOG_FILE], [_PATH_LASTLOG], 183PT_FIND_FILE([lastlog], [PT_LASTLOG_FILE],
211["/var/log/lastlog"]) 184["/var/log/lastlog" "/var/adm/lastlog"])
212dnl# -------------------------------------------------------------------------- 185dnl# --------------------------------------------------------------------------
213 186
214dnl# find lastlogx 187dnl# find lastlogx
215PT_FIND_FILE([lastlogx], [LASTLOGX_FILE], [_PATH_LASTLOGX], 188PT_FIND_FILE([lastlogx], [PT_LASTLOGX_FILE],
216["/var/log/lastlogx", "/var/adm/lastlogx"]) 189["/var/log/lastlogx" "/var/adm/lastlogx"])
217]) 190])
218 191
219AC_DEFUN([SCM_RIGHTS_CHECK], 192AC_DEFUN([SCM_RIGHTS_CHECK],
220[ 193[
194case $host in
195 *-*-solaris*)
196 AC_DEFINE(_XOPEN_SOURCE, 500, Enable declarations of msg_control and msg_controllen on Solaris)
197 AC_SEARCH_LIBS(sendmsg, socket)
198 ;;
199esac
200
221AC_CACHE_CHECK(for unix-compliant filehandle passing ability, pt_cv_can_pass_fds, 201AC_CACHE_CHECK(for unix-compliant filehandle passing ability, pt_cv_can_pass_fds,
222[AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 202[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
223#include <cstddef> // broken bsds (is that redundant?) need this 203#include <cstddef> // broken bsds (is that redundant?) need this
224#include <sys/types.h> 204#include <sys/types.h>
225#include <sys/socket.h> 205#include <sys/socket.h>

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines