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
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
|
https://savannah.gnu.org/patch/?7473
From 8958c3cb7b77ec50d8dae0490d8c80dee798e20d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= <flameeyes@gmail.com>
Date: Fri, 18 Feb 2011 06:13:20 +0100
Subject: [PATCH] Don't generate files.h at build-time using an execution test.
The *_LOC variables are never used in the build itself, but only in the
built code; this means that they don't need to be known to ./configure at
all.
Since the previous method made acct not cross-compilable at all, this is
much preferred.
--- acct-6.6.1/configure.ac
+++ acct-6.6.1/configure.ac
@@ -228,102 +228,6 @@
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 <stdint.h> /* GNU/kFreeBSD */
-#include <sys/acct.h>
-#include <utmp.h>
-
-#ifndef WTMP_FILE
-# if defined(__FreeBSD__) || defined (__NetBSD__) || defined(__linux__) \
- || defined(__FreeBSD_kernel__) || defined(__GLIBC__)
-# define WTMP_FILE "/var/log/account/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__) \
- || defined(__FreeBSD_kernel__) || defined(__GLIBC__)
-# define ACCT_FILE "/var/log/account/pacct"
-# else
-# if defined(__NetBSD__)
-# define ACCT_FILE "/var/log/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__) \
- || defined(__FreeBSD_kernel__) || defined(__GLIBC__)
-# 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__) \
- || defined(__FreeBSD_kernel__) || defined(__GLIBC__)
-# 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 ])
-
dnl types
AC_TYPE_PID_T dnl for sys/acct.h
AC_TYPE_UID_T dnl same as above
@@ -366,12 +270,6 @@
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_CONFIG_FILES([Makefile lib/Makefile version.h])
AC_OUTPUT
--- acct-6.6.1/files.h
+++ acct-6.6.1/files.h
@@ -0,0 +1,123 @@
+/* files.h
+ *
+ * file locations
+ *
+ */
+
+#ifndef FILES_H
+#define FILES_H
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <stdint.h> /* GNU/kFreeBSD */
+
+#ifdef LINUX_MULTIFORMAT
+# include "linux-acct.h"
+#else
+# include <stdint.h> /* GNU/kFreeBSD */
+# include <sys/acct.h>
+# if defined __FreeBSD__ || defined __FreeBSD_kernel__
+# include <osreldate.h>
+# if __FreeBSD_kernel__
+# define __FreeBSD_version __FreeBSD_kernel_version
+# endif /* __FreeBSD_kernel__ */
+# if __FreeBSD_version >= 700100 /* FreeBSD 7.0-STABLE */
+# define acct acctv2
+# define ac_flag ac_flagx
+# endif
+# endif
+#endif
+
+#include <utmp.h>
+
+#ifndef WTMP_FILE
+# if defined(__FreeBSD__) || defined (__NetBSD__) || defined(__linux__) \
+ || defined(__FreeBSD_kernel__)
+# 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__) \
+ || defined(__FreeBSD_kernel__)
+# define ACCT_FILE "/var/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__) \
+ || defined(__FreeBSD_kernel__)
+# define SAVACCT_FILE "/var/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__) \
+ || defined(__FreeBSD_kernel__)
+# define USRACCT_FILE "/var/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
+
+#define WTMP_FILE_LOC WTMP_FILE
+#define ACCT_FILE_LOC ACCT_FILE
+#define SAVACCT_FILE_LOC SAVACCT_FILE
+#define USRACCT_FILE_LOC USRACCT_FILE
+
+/* Workaround for a kernel includes problem */
+#if defined(__linux__) && defined(__alpha__)
+#undef AHZ
+#define AHZ 1024
+#endif
+
+#ifndef AHZ
+#define AHZ 64
+#endif
+
+#endif /* ! FILES_H */
--- acct-6.6.1/files.h.in
+++ acct-6.6.1/files.h.in
@@ -1,48 +0,0 @@
-/* files.h.in
- *
- * file locations
- *
- */
-
-#ifndef FILES_H
-#define FILES_H
-
-#include "config.h"
-
-#include <sys/types.h>
-
-#ifdef LINUX_MULTIFORMAT
-# include "linux-acct.h"
-#else
-# include <stdint.h> /* GNU/kFreeBSD */
-# include <sys/acct.h>
-# if defined __FreeBSD__ || defined __FreeBSD_kernel__
-# include <osreldate.h>
-# if __FreeBSD_kernel__
-# define __FreeBSD_version __FreeBSD_kernel_version
-# endif /* __FreeBSD_kernel__ */
-# if __FreeBSD_version >= 700100 /* FreeBSD 7.0-STABLE */
-# define acct acctv2
-# define ac_flag ac_flagx
-# endif
-# endif
-#endif
-
-#include <utmp.h>
-
-#define WTMP_FILE_LOC "@WTMP_FILE_LOC@"
-#define ACCT_FILE_LOC "@ACCT_FILE_LOC@"
-#define SAVACCT_FILE_LOC "@SAVACCT_FILE_LOC@"
-#define USRACCT_FILE_LOC "@USRACCT_FILE_LOC@"
-
-/* Workaround for a kernel includes problem */
-#if defined(__linux__) && defined(__alpha__)
-#undef AHZ
-#define AHZ 1024
-#endif
-
-#ifndef AHZ
-#define AHZ 64
-#endif
-
-#endif /* ! FILES_H */
--- acct-6.6.1/Makefile.am
+++ acct-6.6.1/Makefile.am
@@ -66,11 +66,6 @@
SYS_AC = @SYS_AC@
SYS_SA = @SYS_SA@
-WTMP_FILE_LOC = @WTMP_FILE_LOC@
-ACCT_FILE_LOC = @ACCT_FILE_LOC@
-SAVACCT_FILE_LOC = @SAVACCT_FILE_LOC@
-USRACCT_FILE_LOC = @USRACCT_FILE_LOC@
-
compare-ac: ac
@echo
@echo "Running tests for ac"
|