configure.ac revision 1.41 1 1.41 lukem # $NetBSD: configure.ac,v 1.41 2003/10/27 00:12:43 lukem Exp $
2 1.1 tv #
3 1.1 tv # Autoconf definition file for libnbcompat.
4 1.1 tv #
5 1.1 tv
6 1.40 salo AC_INIT([libnbcompat], [noversion], [lib-bug-people (a] NetBSD.org])
7 1.41 lukem AC_CONFIG_HEADERS(nbtool_config.h)
8 1.1 tv AC_CONFIG_FILES(defs.mk)
9 1.20 bjh21
10 1.20 bjh21 AC_PATH_PROG(BSHELL, sh, )
11 1.20 bjh21 if test x"$BSHELL" = x; then
12 1.20 bjh21 AC_MSG_ERROR([sh must be somewhere on \$PATH])
13 1.20 bjh21 fi
14 1.20 bjh21 AC_DEFINE_UNQUOTED(PATH_BSHELL, "$BSHELL")
15 1.1 tv
16 1.4 tv AC_C_BIGENDIAN
17 1.6 tv AC_HEADER_STDC
18 1.6 tv
19 1.6 tv # Confirm existence of zlib. (This is available as a default install
20 1.6 tv # option on many OS's; this could be added as a reachover build in the
21 1.6 tv # future.)
22 1.6 tv AC_CHECK_HEADER(zlib.h,,
23 1.6 tv AC_MSG_ERROR([zlib must be installed in a compiler-visible path]))
24 1.6 tv AC_CHECK_LIB(z, gzdopen,,
25 1.6 tv AC_MSG_ERROR([zlib must be installed in a compiler-visible path]))
26 1.4 tv
27 1.4 tv # Make sure certain required headers are available.
28 1.4 tv # These are not necessarily required by the code, but they are not
29 1.4 tv # currently conditionalized.
30 1.6 tv AC_CHECK_HEADERS(sys/ioctl.h sys/mman.h sys/mtio.h sys/param.h \
31 1.34 thorpej sys/socket.h sys/stat.h sys/time.h sys/types.h sys/utsname.h \
32 1.34 thorpej sys/wait.h assert.h ctype.h errno.h fcntl.h grp.h limits.h locale.h \
33 1.28 briggs netdb.h pwd.h signal.h stdarg.h stdio.h stdlib.h string.h \
34 1.22 thorpej termios.h unistd.h,,
35 1.4 tv AC_MSG_ERROR([standard system header file not found]))
36 1.4 tv
37 1.4 tv # Find headers that may not be available.
38 1.6 tv AC_HEADER_DIRENT
39 1.18 bjh21 AC_CHECK_HEADERS(sys/sysmacros.h sys/syslimits.h \
40 1.28 briggs features.h malloc.h poll.h stddef.h)
41 1.18 bjh21 AC_CHECK_HEADERS(machine/bswap.h sys/cdefs.h sys/endian.h sys/featuretest.h \
42 1.31 lukem err.h inttypes.h libgen.h paths.h stdint.h util.h,,
43 1.11 tv [test -f include/$ac_header || touch include/$ac_header])
44 1.24 briggs AC_CHECK_HEADERS(rpc/types.h getopt.h netconfig.h,,
45 1.41 lukem [echo '#include "nbtool_config.h"' >include/$ac_header.new
46 1.11 tv echo '#include "'$srcdir/../../include/$ac_header'"' >>include/$ac_header.new
47 1.11 tv if cmp include/$ac_header.new include/$ac_header >/dev/null 2>&1; then
48 1.11 tv rm -f include/$ac_header.new
49 1.11 tv else
50 1.11 tv mv -f include/$ac_header.new include/$ac_header
51 1.11 tv fi])
52 1.4 tv
53 1.4 tv # Typedefs.
54 1.1 tv AC_TYPE_SIZE_T
55 1.38 fredb AC_CHECK_TYPES([id_t, long long, u_long, u_quad_t])
56 1.35 thorpej AC_CHECK_TYPE(socklen_t, [AC_DEFINE(HAVE_SOCKLEN_T)],,
57 1.35 thorpej [#include <sys/types.h>
58 1.35 thorpej #include <sys/socket.h>])
59 1.6 tv
60 1.9 tv dnl XXX - This is UGLY. Need a better way to homogenize the bitsized types,
61 1.9 tv dnl including use of compiler primitive types via AC_CHECK_SIZEOF.
62 1.9 tv dnl
63 1.6 tv define([NB_CHECK_INTTYPE], [
64 1.9 tv AC_CHECK_TYPE(uint][$1][_t,, [
65 1.9 tv AC_CHECK_TYPE(u_int][$1][_t,
66 1.9 tv AC_DEFINE(uint][$1][_t, u_int][$1][_t),
67 1.9 tv AC_MSG_ERROR([cannot find a suitable type for uint][$1][_t]))
68 1.9 tv ])
69 1.6 tv AC_CHECK_TYPE(u_int][$1][_t,, [
70 1.6 tv AC_CHECK_TYPE(uint][$1][_t,
71 1.6 tv AC_DEFINE(u_int][$1][_t, uint][$1][_t),
72 1.6 tv AC_MSG_ERROR([cannot find a suitable type for u_int][$1][_t]))
73 1.6 tv ])
74 1.6 tv ])
75 1.6 tv
76 1.6 tv NB_CHECK_INTTYPE(8)
77 1.6 tv NB_CHECK_INTTYPE(16)
78 1.6 tv NB_CHECK_INTTYPE(32)
79 1.6 tv NB_CHECK_INTTYPE(64)
80 1.4 tv
81 1.4 tv # Struct members.
82 1.8 tv AC_CHECK_MEMBERS([DIR.dd_fd, struct dirent.d_namlen],,,
83 1.32 thorpej [#include <sys/types.h>
84 1.32 thorpej #include <dirent.h>])
85 1.7 tv AC_CHECK_MEMBERS([struct stat.st_flags, struct stat.st_gen,
86 1.39 atatat struct stat.st_birthtime, struct stat.st_atim,
87 1.7 tv struct stat.st_mtimensec],,, [#include <sys/stat.h>])
88 1.7 tv AC_CHECK_MEMBERS(struct statfs.f_iosize,,, [#include <sys/mount.h>])
89 1.4 tv
90 1.4 tv # Global variable decls.
91 1.7 tv AC_CHECK_DECLS([optind, optreset],,, [
92 1.7 tv #include <stdio.h>
93 1.7 tv #include <stdlib.h>
94 1.7 tv #include <unistd.h>
95 1.7 tv ])
96 1.4 tv AC_CHECK_DECLS(sys_signame,,, [#include <signal.h>])
97 1.4 tv
98 1.4 tv # Library functions (where a .h check isn't enough).
99 1.19 bjh21 AC_FUNC_ALLOCA
100 1.39 atatat AC_CHECK_FUNCS(atoll asprintf asnprintf basename devname dirfd dirname \
101 1.7 tv fgetln flock fparseln futimes getopt getopt_long \
102 1.26 lukem isblank issetugid lchflags lchmod lchown lutimes mkstemp mkdtemp \
103 1.36 thorpej poll pread putc_unlocked pwcache_userdb pwrite random setenv \
104 1.36 thorpej setgroupent setprogname setpassent snprintf strlcat strlcpy strsep \
105 1.29 lukem strsuftoll strtoll \
106 1.23 thorpej user_from_uid vasprintf vasnprintf vsnprintf)
107 1.8 tv
108 1.8 tv AC_CHECK_DECLS([setgroupent, setpassent],,, [
109 1.33 thorpej #include <sys/types.h>
110 1.8 tv #include <grp.h>
111 1.8 tv #include <pwd.h>
112 1.8 tv ])
113 1.1 tv
114 1.4 tv # regcomp() and regexec() are also names of functions in the old V8
115 1.4 tv # regexp package. To avoid them, we need to find out who has regfree().
116 1.1 tv
117 1.4 tv dnl # Cygwin: We *MUST* look at -lregex *before* the "no libs" condition.
118 1.4 tv dnl # Thus AC_CHECK_LIB(regex...) comes first, and AC_SEARCHLIBS next.
119 1.4 tv AC_CHECK_LIB(regex, regfree)
120 1.4 tv AC_SEARCH_LIBS(regfree, rx posix)
121 1.1 tv
122 1.1 tv AC_OUTPUT
123