configure.ac revision 1.6
1#	$NetBSD: configure.ac,v 1.6 2002/01/29 10:20:32 tv Exp $
2#
3# Autoconf definition file for libnbcompat.
4#
5
6AC_INIT([libnbcompat], [noversion], [lib-bug-people@netbsd.org])
7AC_CONFIG_HEADERS(config.h)
8AC_CONFIG_FILES(defs.mk)
9
10AC_C_BIGENDIAN
11AC_HEADER_STDC
12
13# Confirm existence of zlib.  (This is available as a default install
14# option on many OS's; this could be added as a reachover build in the
15# future.)
16AC_CHECK_HEADER(zlib.h,,
17	AC_MSG_ERROR([zlib must be installed in a compiler-visible path]))
18AC_CHECK_LIB(z, gzdopen,,
19	AC_MSG_ERROR([zlib must be installed in a compiler-visible path]))
20
21# Make sure certain required headers are available.
22# These are not necessarily required by the code, but they are not
23# currently conditionalized.
24AC_CHECK_HEADERS(sys/ioctl.h sys/mman.h sys/mtio.h sys/param.h \
25	sys/stat.h sys/types.h sys/utsname.h sys/wait.h \
26	assert.h ctype.h errno.h fcntl.h grp.h limits.h locale.h \
27	netdb.h pwd.h signal.h stdarg.h stdio.h stdlib.h string.h \
28	unistd.h,,
29	AC_MSG_ERROR([standard system header file not found]))
30
31# Find headers that may not be available.
32AC_HEADER_DIRENT
33AC_CHECK_HEADERS(sys/sysmacros.h \
34	err.h fts.h inttypes.h libgen.h malloc.h stddef.h stdint.h util.h vis.h)
35AC_CHECK_HEADERS(sys/cdefs.h sys/featuretest.h paths.h,,
36	[touch include/$ac_header])
37
38# Typedefs.
39AC_TYPE_SIZE_T
40AC_CHECK_TYPES([id_t, long long])
41
42define([NB_CHECK_INTTYPE], [
43	AC_CHECK_TYPE(u_int][$1][_t,, [
44		AC_CHECK_TYPE(uint][$1][_t,
45			AC_DEFINE(u_int][$1][_t, uint][$1][_t),
46			AC_MSG_ERROR([cannot find a suitable type for u_int][$1][_t]))
47	])
48])
49
50NB_CHECK_INTTYPE(8)
51NB_CHECK_INTTYPE(16)
52NB_CHECK_INTTYPE(32)
53NB_CHECK_INTTYPE(64)
54
55# Struct members.
56AC_CHECK_MEMBERS(struct stat.st_flags,,, [#include <sys/stat.h>])
57AC_CHECK_MEMBERS(DIR.dd_fd,,, [#include <dirent.h>])
58
59# Global variable decls.
60AC_CHECK_DECLS(sys_signame,,, [#include <signal.h>])
61
62# Library functions (where a .h check isn't enough).
63AC_SEARCH_LIBS(fparseln, util)
64AC_CHECK_FUNCS(asprintf asnprintf basename dirfd dirname \
65	fgetln flock fparseln futimes isblank lchmod lchown lutimes pread pwcache_userdb \
66	pwrite setenv setgroupent setpassent setprogname \
67	snprintf strlcat strlcpy strsep vasprintf vasnprintf vsnprintf)
68
69# regcomp() and regexec() are also names of functions in the old V8
70# regexp package.  To avoid them, we need to find out who has regfree().
71
72dnl # Cygwin: We *MUST* look at -lregex *before* the "no libs" condition.
73dnl # Thus AC_CHECK_LIB(regex...) comes first, and AC_SEARCHLIBS next.
74AC_CHECK_LIB(regex, regfree)
75AC_SEARCH_LIBS(regfree, rx posix)
76
77AC_OUTPUT
78