source: trunk/third/vte/gnome-pty-helper/acinclude.m4 @ 20883

Revision 20883, 5.9 KB checked in by ghudson, 20 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r20882, which included commits to RCS files with non-trunk default branches.
Line 
1# Checks for availability of various utmp fields
2#
3# Original code by Bernhard Rosenkraenzer (bero@linux.net.eu.org), 1998.
4# Modifications by Timur Bakeyev (timur@gnu.org), 1999.
5# Patched from http://bugzilla.gnome.org/show_bug.cgi?id=93774
6#
7
8dnl GPH_CHECK_UTMP()
9dnl Test for presence of the field and define HAVE_UT_UT_field macro
10dnl
11
12AC_DEFUN([GPH_CHECK_UTMP],[
13
14AC_CHECK_HEADERS(sys/time.h utmp.h utmpx.h)
15AC_HEADER_TIME
16
17if test "$ac_cv_header_utmpx_h" = "yes"; then
18    AC_DEFINE(UTMP,[struct utmpx],[Define to the name of a structure which holds utmp data.])
19else
20    AC_DEFINE(UTMP,[struct utmp],[Define to the name of a structure which holds utmp data.])
21fi
22
23dnl some systems (BSD4.4-like) require time.h to be included before utmp.h :/
24AC_MSG_CHECKING(for ut_host field in the utmp structure)
25AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
26#include <sys/time.h>
27#include <time.h>
28#else
29#ifdef HAVE_SYS_TIME_H
30#include <sys/time.h>
31#else
32#include <time.h>
33#endif
34#endif
35#ifdef HAVE_UTMP_H
36#include <utmp.h>
37#endif
38#ifdef HAVE_UTMPX_H
39#include <utmpx.h>
40#endif],[UTMP ut; char *p; p=ut.ut_host;],result=yes,result=no)
41if test "$result" = "yes"; then
42  AC_DEFINE(HAVE_UT_UT_HOST,1,[Define if your utmp struct contains a ut_host field.])
43fi
44AC_MSG_RESULT($result)
45
46AC_MSG_CHECKING(for ut_pid field in the utmp structure)
47AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
48#include <sys/time.h>
49#include <time.h>
50#else
51#ifdef HAVE_SYS_TIME_H
52#include <sys/time.h>
53#else
54#include <time.h>
55#endif
56#endif
57#ifdef HAVE_UTMP_H
58#include <utmp.h>
59#endif
60#ifdef HAVE_UTMPX_H
61#include <utmpx.h>
62#endif],[UTMP ut; int i; i=ut.ut_pid;],result=yes,result=no)
63if test "$result" = "yes"; then
64  AC_DEFINE(HAVE_UT_UT_PID,1,[Define if your utmp struct contains a ut_pid field.])
65fi
66AC_MSG_RESULT($result)
67
68AC_MSG_CHECKING(for ut_id field in the utmp structure)
69AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
70#include <sys/time.h>
71#include <time.h>
72#else
73#ifdef HAVE_SYS_TIME_H
74#include <sys/time.h>
75#else
76#include <time.h>
77#endif
78#endif
79#ifdef HAVE_UTMP_H
80#include <utmp.h>
81#endif
82#ifdef HAVE_UTMPX_H
83#include <utmpx.h>
84#endif],[UTMP ut; char *p; p=ut.ut_id;],result=yes,result=no)
85if test "$result" = "yes"; then
86  AC_DEFINE(HAVE_UT_UT_ID,1,[Define if your utmp struct contains a ut_id field.])
87fi
88AC_MSG_RESULT($result)
89
90AC_MSG_CHECKING(for ut_name field in the utmp structure)
91AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
92#include <sys/time.h>
93#include <time.h>
94#else
95#ifdef HAVE_SYS_TIME_H
96#include <sys/time.h>
97#else
98#include <time.h>
99#endif
100#endif
101#ifdef HAVE_UTMP_H
102#include <utmp.h>
103#endif
104#ifdef HAVE_UTMPX_H
105#include <utmpx.h>
106#endif],[UTMP ut; char *p; p=ut.ut_name;],result=yes,result=no)
107if test "$result" = "yes"; then
108  AC_DEFINE(HAVE_UT_UT_NAME,1,[Define if your utmp struct contains a ut_name field.])
109fi
110AC_MSG_RESULT($result)
111
112AC_MSG_CHECKING(for ut_type field in the utmp structure)
113AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
114#include <sys/time.h>
115#include <time.h>
116#else
117#ifdef HAVE_SYS_TIME_H
118#include <sys/time.h>
119#else
120#include <time.h>
121#endif
122#endif
123#ifdef HAVE_UTMP_H
124#include <utmp.h>
125#endif
126#ifdef HAVE_UTMPX_H
127#include <utmpx.h>
128#endif],[UTMP ut; int i; i=(int) ut.ut_type;],result=yes,result=no)
129if test "$result" = "yes"; then
130  AC_DEFINE(HAVE_UT_UT_TYPE,1,[Define if your utmp struct contains a ut_type field.])
131fi
132AC_MSG_RESULT($result)
133
134AC_MSG_CHECKING(for ut_exit.e_termination field in the utmp structure)
135AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
136#include <sys/time.h>
137#include <time.h>
138#else
139#ifdef HAVE_SYS_TIME_H
140#include <sys/time.h>
141#else
142#include <time.h>
143#endif
144#endif
145#ifdef HAVE_UTMP_H
146#include <utmp.h>
147#endif
148#ifdef HAVE_UTMPX_H
149#include <utmpx.h>
150#endif],[UTMP ut; ut.ut_exit.e_termination=0;],result=yes,result=no)
151if test "$result" = "yes"; then
152  AC_DEFINE(HAVE_UT_UT_EXIT_E_TERMINATION,1,[Define if your utmp struct contains a ut_exit.e_termination field.])
153fi
154AC_MSG_RESULT($result)
155
156AC_MSG_CHECKING(for ut_user field in the utmp structure)
157AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
158#include <sys/time.h>
159#include <time.h>
160#else
161#ifdef HAVE_SYS_TIME_H
162#include <sys/time.h>
163#else
164#include <time.h>
165#endif
166#endif
167#ifdef HAVE_UTMP_H
168#include <utmp.h>
169#endif
170#ifdef HAVE_UTMPX_H
171#include <utmpx.h>
172#endif],[UTMP ut; char *p; p=ut.ut_user;],result=yes,result=no)
173if test "$result" = "yes"; then
174  AC_DEFINE(HAVE_UT_UT_USER,1,[Define if your utmp struct contains a ut_user field.])
175fi
176AC_MSG_RESULT($result)
177
178AC_MSG_CHECKING(for ut_time field in the utmp structure)
179AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
180#include <sys/time.h>
181#include <time.h>
182#else
183#ifdef HAVE_SYS_TIME_H
184#include <sys/time.h>
185#else
186#include <time.h>
187#endif
188#endif
189#ifdef HAVE_UTMP_H
190#include <utmp.h>
191#endif
192#ifdef HAVE_UTMPX_H
193#include <utmpx.h>
194#endif],[UTMP ut; ut.ut_time=0;],result=yes,result=no)
195if test "$result" = "yes"; then
196  AC_DEFINE(HAVE_UT_UT_TIME,1,[Define if your utmp struct contains a ut_time field.])
197fi
198AC_MSG_RESULT($result)
199
200AC_MSG_CHECKING(for ut_tv field in the utmp structure)
201AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
202#include <sys/time.h>
203#include <time.h>
204#else
205#ifdef HAVE_SYS_TIME_H
206#include <sys/time.h>
207#else
208#include <time.h>
209#endif
210#endif
211#ifdef HAVE_UTMP_H
212#include <utmp.h>
213#endif
214#ifdef HAVE_UTMPX_H
215#include <utmpx.h>
216#endif],[UTMP ut; ut.ut_tv.tv_sec=0; ut.ut_tv.tv_usec=0; ],result=yes,result=no)
217if test "$result" = "yes"; then
218  AC_DEFINE(HAVE_UT_UT_TV,1,[Define if your utmp struct contains a ut_tv field.])
219fi
220AC_MSG_RESULT($result)
221
222AC_MSG_CHECKING(for ut_syslen field in the utmp structure)
223AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
224#include <sys/time.h>
225#include <time.h>
226#else
227#ifdef HAVE_SYS_TIME_H
228#include <sys/time.h>
229#else
230#include <time.h>
231#endif
232#endif
233#ifdef HAVE_UTMP_H
234#include <utmp.h>
235#endif
236#ifdef HAVE_UTMPX_H
237#include <utmpx.h>
238#endif],[UTMP ut; ut.ut_syslen=0;],result=yes,result=no)
239if test "$result" = "yes"; then
240  AC_DEFINE(HAVE_UT_UT_SYSLEN,1,[Define if your utmp struct contains a ut_syslen field.])
241fi
242AC_MSG_RESULT($result)
243
244])
Note: See TracBrowser for help on using the repository browser.