File: configure.ac

package info (click to toggle)
acct 6.5.4-2.1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 3,132 kB
  • ctags: 1,428
  • sloc: sh: 10,390; ansic: 9,695; cpp: 289; makefile: 185
file content (296 lines) | stat: -rw-r--r-- 10,237 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
dnl $Id: configure.ac,v 1.56 2010/02/12 02:38:52 nihilus Exp $
dnl Process this file with autoconf to produce a configure script.

dnl init autoconf
AC_REQ(2.63)
AC_INIT([acct],[6.5.4],[nietzsche@lysator.liu.se])
AC_CONFIG_SRCDIR([ac.c])
AC_CANONICAL_TARGET

dnl macros for automake
AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])

AC_PROG_CC

dnl GNUlib
gl_EARLY
gl_INIT

if test "x$GCC" = "xyes"; then
 CFLAGS="${CFLAGS} -Wall -Wmissing-prototypes"
fi

AC_HEADER_STDC
AC_PROG_CC_STDC
AC_PROG_CPP
AC_PROG_CC_C89
AC_PROG_GCC_TRADITIONAL
AC_PROG_INSTALL
LT_PREREQ([2.2.6])
LT_INIT
AC_SUBST([LIBTOOL_DEPS])

AC_SEARCH_LIBS([strerror],[cposix])

AC_C_CONST
AC_C_INLINE
AC_C_RESTRICT
AC_C_VOLATILE
AC_SYS_POSIX_TERMIOS
AC_SYS_LARGEFILE

AC_CHECK_FUNC(snprintf, AC_DEFINE(HAVE_SNPRINTF, 1, [Define if your system has the SNPRINTF system call.]))
AC_CHECK_FUNC(__builtin_unreachable, AC_DEFINE(HAVE_UNREACHBLE, 1, [Define if your compiler support __builtin_unreachable().]))
AC_CHECK_HEADERS(limits.h)
dnl
dnl crunky time stuff
dnl
AC_HEADER_TIME
AC_CHECK_HEADERS(sys/time.h)
dnl
dnl find out where various programs reside on this system
dnl
AC_PATH_PROGS(SYS_LAST, last, echo, /bin /etc /sbin /usr/bin /usr/etc /usr/sbin /usr/ucb /usr/local/bin /usr/local/etc /usr/local/sbin )
AC_PATH_PROGS(SYS_LASTCOMM, lastcomm, echo, /bin /etc /sbin /usr/bin /usr/etc /usr/sbin /usr/ucb /usr/local/bin /usr/local/etc /usr/local/sbin )
AC_PATH_PROGS(SYS_AC, ac, echo, /bin /etc /sbin /usr/bin /usr/etc /usr/sbin /usr/ucb /usr/local/bin /usr/local/etc /usr/local/sbin )
AC_PATH_PROGS(SYS_SA, sa, echo, /bin /etc /sbin /usr/bin /usr/etc /usr/sbin /usr/ucb /usr/local/bin /usr/local/etc /usr/local/sbin )
dnl
dnl find out what fields are valid in utmp.h
dnl
AC_CHECK_MEMBERS([struct utmpx.ut_host],,,[$utmp_includes])
AC_CHECK_MEMBERS([struct utmp.ut_host],,,[$utmp_includes])
dnl AC_EGREP_HEADER(ut_host, utmp.h, AC_DEFINE(HAVE_UT_HOST, 1, [Does your system have the ut_host field in utmp?]), )
dnl
dnl
dnl
AC_ARG_ENABLE([linux-multiformat],
	      AS_HELP_STRING([--enable-linux-multiformat],[support various predefined linux acct file formats 
			     instead of the one defined in <sys/acct.h>]),
	      [],
	      [
		case $target_os in
		*linux*)
			enable_linux_multiformat=yes
			;;
		*)
			enable_linux_multiformat=no 
			;;
		esac
	      ]
	      )

AS_IF([test "x$enable_linux_multiformat" = "xyes"],
      AC_DEFINE(LINUX_MULTIFORMAT, 1, [Define to use "linux-acct.h" instead of <sys/acct.h>])
      DUMP_ACCT_PROG=dump-acct
      ACCTON_PROG=accton
      LASTCOMM_PROG=lastcomm
      SA_PROG=sa
      ACCTON_MAN=accton.8
      LASTCOMM_MAN=lastcomm.1
      SA_MAN=sa.8
      AC_DEFINE(HAVE_ACUTIME, 1, [Define if <sys/acct.h> has the AC_UTIME field.])
      AC_DEFINE(ACUTIME_COMPT, 1, [Define if <sys/acct.h>'s AC_UTIME field is a COMP_T.])
      AC_DEFINE(HAVE_ACSTIME, 1, [Define if <sys/acct.h> has the AC_STIME field.])
      AC_DEFINE(ACSTIME_COMPT, 1, [Define if <sys/acct.h>'s AC_STIME field is a COMP_T.])
      AC_DEFINE(HAVE_ACETIME, 1, [Define if <sys/acct.h> has the AC_ETIME field.])
      AC_DEFINE(HAVE_ACIO, 1, [Define if <sys/acct.h> has the AC_IO field.])
      AC_DEFINE(ACIO_COMPT, 1, [Define if <sys/acct.h>'s AC_IO field is a COMP_T.])
      AC_DEFINE(HAVE_ACMEM, 1, [Define if <sys/acct.h> has the AC_MEM field.])
      AC_DEFINE(ACMEM_COMPT, 1, [Define if <sys/acct.h>'s AC_MEM field is a COMP_T.])
      AC_DEFINE(HAVE_PAGING, 1, [Define if <sys/acct.h> has the AC_MINFLT, AC_MAJFLT and AC_SWAPS fields.])
      AC_DEFINE(ACMINFLT_COMPT, 1, [Define if <sys/acct.h>'s AC_MINFLT field is a COMP_T.])
      AC_DEFINE(ACMAJFLT_COMPT, 1, [Define if <sys/acct.h>'s AC_MAJFLT field is a COMP_T.])
      AC_DEFINE(ACSWAPS_COMPT, 1, [Define if <sys/acct.h>'s AC_SWAPS field is a COMP_T.])
      AC_DEFINE(HAVE_COMP_T, 1, [Define if <sys/acct.h> uses the COMP_T type.])
      , [
dnl
dnl figure out where acct.h lives
dnl and whether fields are int/comp_t
dnl
AC_CHECK_HEADER(sys/acct.h,
		AC_DEFINE(HAVE_SYS_ACCT_H, ,[Define if you have the <sys/acct.h> header file.])
		DUMP_ACCT_PROG=dump-acct
		ACCTON_PROG=accton
		LASTCOMM_PROG=lastcomm
		SA_PROG=sa
		ACCTON_MAN=accton.8
		LASTCOMM_MAN=lastcomm.1
		SA_MAN=sa.8
		AC_EGREP_HEADER(ac_utime, sys/acct.h, 
			AC_DEFINE(HAVE_ACUTIME, 1, [Define if <sys/acct.h> has the AC_UTIME field.])
			AC_EGREP_HEADER(comp_t.*ac_utime, sys/acct.h,AC_DEFINE(ACUTIME_COMPT, 1, [Define if <sys/acct.h>'s AC_UTIME field is a COMP_T.]))
		)
		AC_EGREP_HEADER(ac_stime, sys/acct.h,
				AC_DEFINE(HAVE_ACSTIME, 1, [Define if <sys/acct.h> has the AC_STIME field.])
				AC_EGREP_HEADER(comp_t.*ac_stime, sys/acct.h,
						AC_DEFINE(ACSTIME_COMPT, 1, [Define if <sys/acct.h>'s AC_STIME field is a COMP_T.]))
		)
		AC_EGREP_HEADER(ac_etime, sys/acct.h,
				AC_DEFINE(HAVE_ACETIME, 1, [Define if <sys/acct.h> has the AC_ETIME field.])
				AC_EGREP_HEADER(comp_t.*ac_etime, sys/acct.h,
						AC_DEFINE(ACETIME_COMPT, 1, [Define if <sys/acct.h>'s AC_ETIME field is a COMP_T.]))
		)
		AC_EGREP_HEADER(ac_io, sys/acct.h,
				AC_DEFINE(HAVE_ACIO, 1, [Define if <sys/acct.h> has the AC_IO field.])
				AC_EGREP_HEADER(comp_t.*ac_io, sys/acct.h,
						AC_DEFINE(ACIO_COMPT, 1, [Define if <sys/acct.h>'s AC_IO field is a COMP_T.]))
		)
		AC_EGREP_HEADER(ac_mem, sys/acct.h,
				AC_DEFINE(HAVE_ACMEM, 1, [Define if <sys/acct.h> has the AC_MEM field.])
				AC_EGREP_HEADER(comp_t.*ac_mem, sys/acct.h,
						AC_DEFINE(ACMEM_COMPT, 1, [Define if <sys/acct.h>'s AC_MEM field is a COMP_T.]))
		)
		AC_EGREP_HEADER(ac_minflt, sys/acct.h,
				AC_EGREP_HEADER(ac_majflt, sys/acct.h,
						AC_EGREP_HEADER(ac_swaps, sys/acct.h,
								AC_DEFINE(HAVE_PAGING, 1, [Define if <sys/acct.h> has the AC_MINFLT, AC_MAJFLT and AC_SWAPS fields.])
								AC_EGREP_HEADER(comp_t.*ac_minflt, sys/acct.h,
									AC_DEFINE(ACMINFLT_COMPT, 1, [Define if <sys/acct.h>'s AC_MINFLT field is a COMP_T.]))
								AC_EGREP_HEADER(comp_t.*ac_mayflt, sys/acct.h,
									AC_DEFINE(ACMAJFLT_COMPT, 1, [Define if <sys/acct.h>'s AC_MAJFLT field is a COMP_T.]))
								AC_EGREP_HEADER(comp_t.*ac_swaps, sys/acct.h,
									AC_DEFINE(ACSWAPS_COMPT, 1, [Define if <sys/acct.h>'s AC_SWAPS field is a COMP_T.]))
						)
				)
		)
		AC_EGREP_HEADER([comp_t],[sys/acct.h],[AC_DEFINE(HAVE_COMP_T, 1, Define if <sys/acct.h> uses the COMP_T type.)])
  ) ]
)
dnl
dnl find out where utmp/pacct are stored
dnl
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/acct.h>
#include <utmp.h>

#ifndef WTMP_FILE
#  if defined(__FreeBSD__) || defined (__NetBSD__) || defined(__linux__)
#    define WTMP_FILE "/var/log/wtmp"
#  else
#    if defined(sun) || defined(AMIX)
#      define WTMP_FILE "/var/adm/wtmp"
#    else
#      if defined(sgi) || defined(SVR4)
#        define WTMP_FILE "/usr/adm/wtmp"
#      else
#        define WTMP_FILE "/usr/adm/wtmp"
#      endif
#    endif
#  endif
#endif

#ifndef ACCT_FILE
#  if defined(__FreeBSD__) || defined(__linux__)
#    define ACCT_FILE "/var/log/account/pacct"
#  else
#    if defined(__NetBSD__)
#      define ACCT_FILE "/var/account/acct"
#    else
#      if defined(sun) || defined(AMIX)
#        define ACCT_FILE "/var/adm/pacct"
#      else
#        if defined(sgi) || defined(SVR4) || defined(M_XENIX)
#          define ACCT_FILE "/usr/adm/pacct"
#        else
#          define ACCT_FILE "/usr/adm/acct"
#        endif
#      endif
#    endif
#  endif
#endif

#ifndef SAVACCT_FILE
#  if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__linux__)
#    define SAVACCT_FILE "/var/log/account/savacct"
#  else
#    if defined(sun) || defined(AMIX)
#      define SAVACCT_FILE "/var/adm/savacct"
#    else
#      if defined(sgi) || defined(SVR4)
#        define SAVACCT_FILE "/usr/adm/savacct"
#      else
#        define SAVACCT_FILE "/usr/adm/savacct"
#      endif
#    endif
#  endif
#endif

#ifndef USRACCT_FILE
#  if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__linux__)
#    define USRACCT_FILE "/var/log/account/usracct"
#  else
#    if defined(sun) || defined(AMIX)
#      define USRACCT_FILE "/var/adm/usracct"
#    else
#      if defined(sgi) || defined(SVR4)
#        define USRACCT_FILE "/usr/adm/usracct"
#      else
#        define USRACCT_FILE "/usr/adm/usracct"
#      endif
#    endif
#  endif
#endif

main ()
{
  FILE *fp;
  fp = fopen ("locs", "w");
  fprintf (fp, "WTMP_FILE_LOC=%s\n", WTMP_FILE);
  fprintf (fp, "ACCT_FILE_LOC=%s\n", ACCT_FILE);
  fprintf (fp, "SAVACCT_FILE_LOC=%s\n", SAVACCT_FILE);
  fprintf (fp, "USRACCT_FILE_LOC=%s\n", USRACCT_FILE);
  fclose (fp);
  exit(0);
}
]])],[. ./locs; rm locs],[echo "Error -- could not locate your wtmp and acct files."; exit 1],[echo "Sorry -- you cannot cross-compile this package (FIXME)."; exit 1 ])
AC_TYPE_PID_T dnl for sys/acct.h
AC_TYPE_UID_T dnl same as above
AC_TYPE_SIZE_T
AC_DIAGNOSE([obsolete],[your code may safely assume C89 semantics that RETSIGTYPE is void.
Remove this warning and the `AC_CACHE_CHECK' when you adjust the code.])dnl
AC_CACHE_CHECK([return type of signal handlers],[ac_cv_type_signal],[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <sys/types.h>
#include <signal.h>
],
		 [return *(signal (0, 0)) (0) == 1;])],
		   [ac_cv_type_signal=int],
		   [ac_cv_type_signal=void])])
AC_DEFINE_UNQUOTED([RETSIGTYPE],[$ac_cv_type_signal],[Define as the return type of signal handlers
		    (`int' or `void').])

AC_TYPE_OFF_T
AC_FUNC_FSEEKO

AC_HEADER_DIRENT
AC_C_BIGENDIAN(AC_DEFINE(BYTEORDER,0x80,
			 [0x80 for big-endian, 0x00 for little-endian.]),
               AC_DEFINE(BYTEORDER,0x00,
			 [0x80 for big-endian, 0x00 for little-endian.]),)
echo checking for kitchen sink... You find a ring in the sink!

dnl Substitute program names for automake
AC_SUBST(DUMP_ACCT_PROG)
AC_SUBST(ACCTON_PROG)
AC_SUBST(LASTCOMM_PROG)
AC_SUBST(SA_PROG)

dnl Substitute manual page names for automake
AC_SUBST(ACCTON_MAN)
AC_SUBST(LASTCOMM_MAN)
AC_SUBST(SA_MAN)

dnl Substitutions for file locations
AC_SUBST(WTMP_FILE_LOC)
AC_SUBST(ACCT_FILE_LOC)
AC_SUBST(SAVACCT_FILE_LOC)
AC_SUBST(USRACCT_FILE_LOC)

dnl Dump the makefiles and etc.
AC_CONFIG_FILES([Makefile lib/Makefile files.h version.h])
AC_OUTPUT