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
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
|
dnl $NetBSD: configure.ac,v 1.47 2004/08/16 17:24:56 jlam Exp $
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.52)
AC_INIT([libnbcompat], [20030916], [grant@NetBSD.org])
AC_CONFIG_HEADER(nbcompat/config.h)
AC_ARG_PROGRAM
AC_CANONICAL_HOST
CANONICAL_HOST=$host
AC_SUBST(CANONICAL_HOST)
AC_SUBST(INCLUDES)
# Checks for programs.
AC_PROG_MAKE_SET
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_RANLIB
AC_PROG_AWK
AC_CHECK_PROG(AR, ar, ar)
AUTOCONF=${AUTOCONF-"$srcdir/missing --run autoconf"}
AC_SUBST(AUTOCONF)
AUTOHEADER=${AUTOHEADER-"$srcdir/missing --run autoheader"}
AC_SUBST(AUTOHEADER)
dnl Checks for libraries
AC_CHECK_LIB(util, fparseln)
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_TIME
dnl Used by bits.c to check for sizes of integer types
AC_CHECK_HEADERS([inttypes.h sys/types.h sys/bitypes.h bind/bitypes.h \
netinet/in6_machtypes.h])
AC_CHECK_HEADERS([assert.h dirent.h err.h errno.h fcntl.h fnmatch.h fts.h \
grp.h libutil.h limits.h machine/endian.h memory.h ndir.h paths.h \
pwd.h stdint.h stdio.h stdlib.h stringlist.h strings.h string.h \
sys/byteorder.h sys/cdefs.h sys/dir.h sys/endian.h sys/file.h \
sys/mkdev.h sys/ndir.h sys/param.h sys/time.h sys/ttycom.h \
sys/stat.h sys/statfs.h sys/statvfs.h sys/types.h sys/vfs.h \
termcap.h termios.h time.h tzfile.h unistd.h util.h utmp.h
])
AC_CHECK_HEADERS([sys/mount.h], [:], [:], [
AC_INCLUDES_DEFAULT
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
])
dnl Always use our own glob().
AC_CHECK_HEADERS([glob.h])
AC_DEFINE(HAVE_NBCOMPAT_GLOB)
AH_TEMPLATE([HAVE_NBCOMPAT_GLOB], [
Define to 1 if the `glob' function is built into the library.
])
dnl Always use our own queue(3) implementation.
AC_CHECK_HEADERS([sys/queue.h])
AC_DEFINE(HAVE_NBCOMPAT_QUEUE)
AH_TEMPLATE([HAVE_NBCOMPAT_QUEUE], [
Define to 1 if the `queue' macros are supplied by the library.
])
AC_CHECK_HEADERS([regex.h])
AC_CHECK_FUNC(regexec, [:], [
AC_DEFINE(HAVE_NBCOMPAT_REGEX)
AH_TEMPLATE([HAVE_NBCOMPAT_REGEX], [
Define to 1 if the `regex' functions are built into the
library.
])
AC_LIBOBJ(regcomp)
AC_LIBOBJ(regerror)
AC_LIBOBJ(regexec)
AC_LIBOBJ(regfree)
])
AC_CHECK_HEADERS([md5.h], [
AC_MSG_TRY_COMPILE([for MD5Init in md5.h], pkg_cv_have_md5init, [
#include <sys/types.h>
#include <md5.h>
], [
MD5_CTX *f;
MD5Init(f);
], [:], [
AC_DEFINE(HAVE_NBCOMPAT_MD5INIT)
AH_TEMPLATE([HAVE_NBCOMPAT_MD5INIT], [
Define to 1 if the `MD5Init' function is built into
the library.
])
])
])
AC_CHECK_HEADERS([md5.h rmd160.h sha1.h])
AC_CHECK_FUNC(MD5File, [:], [
AC_DEFINE(HAVE_NBCOMPAT_MD5)
AH_TEMPLATE([HAVE_NBCOMPAT_MD5], [
Define to 1 if the `MD5*' functions are built into the
library.
])
AC_LIBOBJ(md5c)
AC_LIBOBJ(md5hl)
])
AC_CHECK_FUNC(RMD160File, [:], [
AC_DEFINE(HAVE_NBCOMPAT_RMD160)
AH_TEMPLATE([HAVE_NBCOMPAT_RMD160], [
Define to 1 if the `RMD160*' functions are built into the
library.
])
AC_LIBOBJ(rmd160)
AC_LIBOBJ(rmd160hl)
])
AC_CHECK_FUNC(SHA1File, [:], [
AC_DEFINE(HAVE_NBCOMPAT_SHA1)
AH_TEMPLATE([HAVE_NBCOMPAT_SHA1], [
Define to 1 if the `SHA1*' functions are built into the
library.
])
AC_LIBOBJ(sha1)
AC_LIBOBJ(sha1hl)
])
pkg_use_nbcompat_getopt_long=yes
AC_CHECK_HEADERS([getopt.h], [
AC_MSG_TRY_COMPILE([for struct option], pkg_cv_have_struct_option,
[ #include <getopt.h> ], [ struct option X; ],
[pkg_use_nbcompat_getopt_long=no],
[pkg_use_nbcompat_getopt_long=yes])
])
if test $pkg_use_nbcompat_getopt_long = yes; then
AC_DEFINE(HAVE_NBCOMPAT_GETOPT_LONG)
AH_TEMPLATE([HAVE_NBCOMPAT_GETOPT_LONG], [
Define to 1 if the `getopt_long' function is
built into the library.
])
AC_LIBOBJ(getopt_long)
fi
dnl Check that this vis.h has *vis()-related functions because Solaris'
dnl vis.h doesn't. Also, only consider the header found if it defines
dnl all of the functions that we need.
dnl
pkg_use_nbcompat_vis=yes
AC_CHECK_HEADERS([vis.h], [
AC_MSG_TRY_COMPILE([for VIS_WHITE in vis.h], pkg_cv_have_vis_white, [
#include <sys/types.h>
#include <vis.h>
], [ int X = VIS_WHITE; ], [
AC_CHECK_FUNCS([strunvis strvis strsvis])
AC_CHECK_FUNCS([strunvis strvis strsvis],
[pkg_use_nbcompat_vis=no],
[pkg_use_nbcompat_vis=yes; break])
])
])
if test $pkg_use_nbcompat_vis = yes; then
AC_DEFINE(HAVE_NBCOMPAT_VIS)
AH_TEMPLATE([HAVE_NBCOMPAT_VIS], [
Define to 1 if the `vis' function is built into the library.
])
AC_LIBOBJ(vis)
AC_LIBOBJ(unvis)
fi
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C___ATTRIBUTE__
AC_TYPE_SIZE_T
AC_CHECK_TYPES([long long, int8_t, int16_t, int32_t, int64_t, u_int8_t, u_int16_t, u_int32_t, u_int64_t, uint8_t, uint16_t, uint32_t, uint64_t],[],[],
[#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif
#if HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if HAVE_SYS_BITYPES_H
#include <sys/bitypes.h>
#endif])
AC_CHECK_TYPES([fsid_t],[],[],
[#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#if HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
#if HAVE_SYS_VFS_H
#include <sys/vfs.h>
#endif])
AC_C_BIGENDIAN
AC_CHECK_SIZEOF(off_t, 0)
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_STRERROR_R
AC_FUNC_VPRINTF
AC_REPLACE_FUNCS([err fgetln fnmatch fparseln getenv isblank lchflags \
lchmod lchown lutimes mkstemp mkdtemp setgroupent setpassent \
setprogname snprintf statvfs strdup strerror strlcat strlcpy \
strmode strsep strtoll usleep utimes
])
AC_CHECK_FUNCS([bcopy bzero memset memcpy setlocale])
AC_CHECK_FUNCS([getmode setmode])
AC_CHECK_FUNCS([getmode setmode], [:], [
AC_LIBOBJ(setmode)
break
])
AC_CHECK_FUNCS([setenv unsetenv])
AC_CHECK_FUNCS([setenv unsetenv], [:], [
AC_LIBOBJ(setenv)
break
])
AC_CHECK_FUNCS([gid_from_group group_from_gid pwcache_groupdb \
pwcache_userdb uid_from_user user_from_uid \
])
AC_CHECK_FUNCS([gid_from_group group_from_gid pwcache_groupdb \
pwcache_userdb uid_from_user user_from_uid \
], [:], [
AC_LIBOBJ(pwcache)
break
])
AC_CHECK_FUNC(fts_open, [:], [
AC_DEFINE(HAVE_NBCOMPAT_FTS, 1)
AH_TEMPLATE([HAVE_NBCOMPAT_FTS], [
Define to 1 if the `fts_*' functions are built into the
library.
])
AC_LIBOBJ(__fts13)
])
# handle Darwin 7 having a poll() compatibility function. be
# conservative, if we don't find one of poll.h or sys/poll.h, use our
# local poll() implementation.
pkg_use_nbcompat_poll=no
AC_CHECK_HEADERS([poll.h sys/poll.h])
if test $ac_cv_header_poll_h = no && test $ac_cv_header_sys_poll_h = no; then
pkg_use_nbcompat_poll=yes
fi
if test $pkg_use_nbcompat_poll = yes; then
pkg_cv_POLL_NATIVE=no
else
AC_CHECK_FUNC(poll, [
AC_MSG_TRY_COMPILE([if poll() is implemented natively],
pkg_cv_POLL_NATIVE,
[ #if HAVE_POLL_H
#include <poll.h>
#endif
#if HAVE_SYS_POLL_H
#include <sys/poll.h>
#endif
],
[ #ifdef _POLL_EMUL_H_
#error "poll() is emulated"
#endif
],
[:], [:])
])
fi
if test $pkg_cv_POLL_NATIVE = yes; then
AC_DEFINE(HAVE_POLL, 1)
AH_TEMPLATE([HAVE_POLL], [
Define to 1 if you have the `poll' function.
])
else
AC_LIBOBJ(poll)
AC_DEFINE(HAVE_NBCOMPAT_POLL, 1)
AH_TEMPLATE([HAVE_NBCOMPAT_POLL], [
Define to 1 if the `poll' function is built into the library.
])
fi
AC_CHECK_FUNCS([getpassphrase getpgrp memmove select])
AC_CHECK_FUNC(getpgrp, [AC_FUNC_GETPGRP])
AC_CHECK_MEMBERS([struct statfs.f_fsize], [:], [:],
[ #include <sys/statfs.h> ])
AC_CHECK_MEMBERS([struct statfs.f_iosize], [:], [:],
[ #include <sys/statfs.h> ])
if test $ac_cv_type_long_long = yes; then
dnl We assume that if sprintf() supports %lld or %qd,
dnl then all of *printf() does. If not, disable long long
dnl support because we don't know how to display it.
AC_MSG_CHECKING(*printf() support for %lld)
can_printf_longlong=no
AC_TRY_RUN([
#include <stdio.h>
int main() {
char buf[100];
sprintf(buf, "%lld", 4294967300LL);
return (strcmp(buf, "4294967300"));
}
], [
AC_MSG_RESULT(yes)
can_printf_longlong=yes
], [
AC_MSG_RESULT(no)
], [:])
if test $can_printf_longlong != yes; then
AC_MSG_CHECKING(*printf() support for %qd)
AC_TRY_RUN([
#include <stdio.h>
int main() {
char buf[100];
sprintf(buf, "%qd", 4294967300LL);
return (strcmp(buf, "4294967300"));
}
], [
AC_MSG_RESULT(yes)
can_printf_longlong=yes
AC_DEFINE(HAVE_PRINTF_QD, 1)
AH_TEMPLATE([HAVE_PRINTF_QD], [
Define to 1 if *printf() uses %qd to print
`long long' (otherwise uses %lld).
])
], [
AC_MSG_RESULT(no)
], [:])
fi
if test $can_printf_longlong = yes; then
AC_DEFINE(HAVE_WORKING_LONG_LONG, 1)
AH_TEMPLATE([HAVE_WORKING_LONG_LONG], [
Define to 1 if `long long' is supported and
sizeof(off_t) >= 8.
])
AC_REPLACE_FUNCS(strtoll)
fi
fi
AC_MSG_TRY_COMPILE([for optarg declaration], ftp_cv_HAVE_OPTARG_D, [
#include <stdlib.h>
#include <unistd.h>
], [ char *X = optarg ], [:], [
AC_DEFINE(HAVE_OPTARG_D, 1)
AH_TEMPLATE([HAVE_OPTARG_D], [
Define to 1 if optarg is declared in <stdlib.h> or <unistd.h>
])
])
AC_MSG_TRY_COMPILE([for optind declaration], ftp_cv_HAVE_OPTIND_D, [
#include <stdlib.h>
#include <unistd.h>
], [ int X = optind ], [:] [
AC_DEFINE(HAVE_OPTIND_D, 1)
AH_TEMPLATE([HAVE_OPTIND_D], [
Define to 1 if optind is declared in <stdlib.h> or <unistd.h>
])
])
AH_BOTTOM([
/* NBCOMPAT template section follows. */
#ifndef HAVE___ATTRIBUTE__
# define __attribute__(x)
#endif
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
#ifndef __IDSTRING
# define __IDSTRING(name,string) \
static const char name[] __attribute__((__unused__)) = string
#endif
#ifndef __RCSID
# define __RCSID(_s) __IDSTRING(rcsid,_s)
#endif
#ifndef __COPYRIGHT
# define __COPYRIGHT(_s) __IDSTRING(copyright,_s)
#endif
#ifndef __P
# if defined(__STDC__) || defined(__cplusplus)
# define __P(protos) protos /* full-blown ANSI C */
# else
# define __P(protos) () /* traditional C preprocessor */
# endif
#endif
#ifndef __CONCAT
# if defined(__STDC__) || defined(__cplusplus)
# define __CONCAT(x,y) x ## y
# else
# define __CONCAT(x,y) x/**/y
# endif
#endif
#ifndef __BEGIN_DECLS
# if defined(__cplusplus)
# define __BEGIN_DECLS extern "C" {
# else
# define __BEGIN_DECLS
# endif
#endif
#ifndef __END_DECLS
# if defined(__cplusplus)
# define __END_DECLS };
# else
# define __END_DECLS
# endif
#endif
#if HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#if HAVE_SYS_ENDIAN_H
#include <sys/endian.h>
#endif
#if HAVE_MACHINE_ENDIAN_H
#include <machine/endian.h>
#endif
#if HAVE_SYS_BYTEORDER_H
#include <sys/byteorder.h>
#endif
#if HAVE_LIMITS_H
#include <limits.h>
#endif
#ifndef LITTLE_ENDIAN
# define LITTLE_ENDIAN 1234
#endif
#ifndef BIG_ENDIAN
# define BIG_ENDIAN 4321
#endif
#ifndef UINT_MAX
# define UINT_MAX 4294967295U
#endif
#ifndef BYTE_ORDER
# if defined(_BIG_ENDIAN)
# define BYTE_ORDER BIG_ENDIAN
# elif defined(_LITTE_ENDIAN)
# define BYTE_ORDER LITTLE_ENDIAN
# elif defined(WORDS_BIGENDIAN)
# define BYTE_ORDER BIG_ENDIAN
# else
# define BYTE_ORDER LITTLE_ENDIAN
# endif
#endif
#if defined(HAVE_MEMSET)
# define MEMSET_BZERO(p,l) memset((p), 0, (l))
#elif defined(HAVE_BZERO)
# define MEMSET_BZERO(p,l) bzero((p), (l))
#else
# error You need either memset or bzero
#endif
#if defined(HAVE_MEMCPY)
# define MEMCPY_BCOPY(d,s,l) memcpy((d), (s), (l))
#elif defined(HAVE_BCOPY)
# define MEMCPY_BCOPY(d,s,l) bcopy((s), (d), (l))
#else
# error You need either memcpy or bcopy
#endif
])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
|