2 dnl autoconf input file to generate MCONFIG
7 AC_PREFIX_DEFAULT(/usr)
9 AC_USE_SYSTEM_EXTENSIONS
18 PA_ADD_CFLAGS(-Wpointer-arith)
19 PA_ADD_CFLAGS(-Wbad-function-cast)
20 PA_ADD_CFLAGS(-Wcast-equal)
21 PA_ADD_CFLAGS(-Wstrict-prototypes)
22 PA_ADD_CFLAGS(-Wmissing-prototypes)
23 PA_ADD_CFLAGS(-Wmissing-declarations)
24 PA_ADD_CFLAGS(-Wnested-externs)
25 PA_ADD_CFLAGS(-Winline)
26 PA_ADD_CFLAGS(-Wwrite-strings)
27 PA_ADD_CFLAGS(-Wundef)
28 PA_ADD_CFLAGS(-Wshadow)
29 PA_ADD_CFLAGS(-Wsign-compare)
31 PA_ADD_CFLAGS(-fno-strict-aliasing)
34 AC_CHECK_HEADERS(inttypes.h)
35 AC_CHECK_HEADERS(stdint.h)
36 PA_CHECK_INTTYPES_H_SANE
37 AC_CHECK_HEADERS(fcntl.h)
38 AC_CHECK_HEADERS(grp.h)
39 AC_CHECK_HEADERS(libgen.h)
40 AC_CHECK_HEADERS(memory.h)
41 AC_CHECK_HEADERS(setjmp.h)
42 AC_CHECK_HEADERS(stddef.h)
43 AC_CHECK_HEADERS(stdlib.h)
44 AC_CHECK_HEADERS(string.h)
45 AC_CHECK_HEADERS(strings.h)
46 AC_CHECK_HEADERS(sysexits.h)
47 AC_CHECK_HEADERS(time.h)
48 AC_CHECK_HEADERS(unistd.h)
49 AC_CHECK_HEADERS(sys/filio.h)
50 AC_CHECK_HEADERS(sys/stat.h)
51 AC_CHECK_HEADERS(sys/time.h)
52 AC_CHECK_HEADERS(sys/types.h)
53 AC_CHECK_HEADERS(arpa/inet.h)
54 AC_CHECK_HEADERS(netdb.h)
56 dnl This is needed on some versions of FreeBSD...
57 AC_CHECK_HEADERS(machine/param.h)
58 AC_CHECK_HEADERS(sys/socket.h)
59 AC_CHECK_HEADERS(winsock2.h)
60 AC_CHECK_HEADERS(winsock.h)
68 AC_CHECK_TYPES(intmax_t)
69 AC_CHECK_TYPES(long long)
70 AC_CHECK_TYPES(uint16_t)
71 AC_CHECK_TYPES(uint32_t)
72 AC_CHECK_TYPES(u_short)
73 AC_CHECK_TYPES(u_long)
76 dnl <sys/socket.h> isn't among the list of standard headers that autoconf checks,
77 dnl but POSIX requires <sys/socket.h> for socklen_t to be defined.
79 AC_CHECK_TYPES(socklen_t,,,
83 # include <sys/types.h>
86 # include <sys/stat.h>
97 # if !STDC_HEADERS && HAVE_MEMORY_H
103 # include <strings.h>
106 # include <inttypes.h>
115 #ifdef HAVE_SYS_SOCKET_H
116 # include <sys/socket.h>
120 AC_SEARCH_LIBS(socket, [socket ws2_32 wsock32], , [AC_MSG_ERROR(socket library not found)])
122 AC_CHECK_FUNCS(fcntl)
123 AC_CHECK_FUNCS(setsid)
124 AC_CHECK_FUNCS(recvmsg)
125 AC_CHECK_FUNCS(ftruncate)
126 AC_CHECK_FUNCS(setreuid)
127 AC_CHECK_FUNCS(setregid)
128 AC_CHECK_FUNCS(initgroups)
129 AC_CHECK_FUNCS(setgroups)
131 dnl Solaris 8 has [u]intmax_t but not strtoumax(). How utterly braindamaged.
132 AC_CHECK_FUNCS(strtoumax)
133 AC_CHECK_FUNCS(strtoull)
135 PA_MSGHDR_MSG_CONTROL
139 PA_HEADER_DEFINES(fcntl.h, int, O_NONBLOCK)
140 PA_HEADER_DEFINES(fcntl.h, int, O_BINARY)
141 PA_HEADER_DEFINES(fcntl.h, int, O_TEXT)
143 AH_TEMPLATE([HAVE_SIGSETJMP],
144 [Define if we have sigsetjmp, siglongjmp and sigjmp_buf.])
145 PA_SIGSETJMP([AC_DEFINE(HAVE_SIGSETJMP)])
150 SRCROOT=`cd $srcdir && pwd`
154 PA_SEARCH_LIBS_AND_ADD(xmalloc, iberty)
155 PA_SEARCH_LIBS_AND_ADD(xstrdup, iberty)
156 PA_SEARCH_LIBS_AND_ADD(bsd_signal, bsd, bsdsignal)
157 PA_SEARCH_LIBS_AND_ADD(getopt_long, getopt, getopt_long)
158 PA_SEARCH_LIBS_AND_ADD(getaddrinfo, [nsl resolv])
159 if $pa_add_getaddrinfo
161 AC_SEARCH_LIBS(gethostbyname, [nsl resolv],
162 [AC_SEARCH_LIBS(herror, [nsl resolv], ,
163 [AC_MSG_ERROR(herror not found)])],
164 [AC_MSG_ERROR(gethostbyname not found)])
166 AC_SEARCH_LIBS(freeaddrinfo, [nsl resolv], ,
167 [AC_MSG_ERROR(getaddrinfo but not freeaddrinfo found)])
168 AC_SEARCH_LIBS(gai_strerror, [nsl resolv], ,
169 [AC_MSG_ERROR(getaddrinfo but not gai_strerror found)])
172 PA_SEARCH_LIBS_AND_ADD(inet_ntop, [nsl resolv])
175 AC_SEARCH_LIBS(inet_ntoa, [nsl resolv], ,
176 [AC_MSG_ERROR(inet_ntoa not found)])
178 AC_SEARCH_LIBS(inet_aton, [nsl resolv], ,[AC_MSG_ERROR(inet_aton not found)])
180 AC_CHECK_FUNCS(daemon, , [XTRA=true; AC_LIBOBJ(daemon)])
181 AC_CHECK_FUNCS(dup2, , [XTRA=true; AC_LIBOBJ(dup2)])
184 XTRALIBS="$OBJROOT/lib/libxtra.a $XTRALIBS"
188 dnl These libraries apply to the server only
193 PA_HEADER_DEFINES(netinet/in.h, int, IPPORT_TFTP)
195 PA_WITH_BOOL(tcpwrappers, 1,
196 [ --without-tcpwrappers disable tcpwrapper permissions checking],
198 AC_SEARCH_LIBS(yp_get_default_domain, [nsl resolv])
203 AH_TEMPLATE([WITH_REGEX],
204 [Define if we are compiling with regex filename remapping.])
206 PA_WITH_BOOL(remap, 1,
207 [ --without-remap disable regex-based filename remapping],
209 AC_CHECK_HEADER(regex.h,
211 AC_SEARCH_LIBS(regcomp, [regex rx],
213 AC_DEFINE(WITH_REGEX)
214 TFTPDOBJS="remap.${OBJEXT} $TFTPDOBJS"
219 TFTPD_LIBS="$LIBS $XTRALIBS"
223 dnl These libraries apply to the client only
226 AH_TEMPLATE([WITH_READLINE],
227 [Define if we are compiling with readline/editline command-line editing.])
229 PA_WITH_BOOL(readline, 1,
230 [ --without-readline disable the use of readline command-line editing],
232 AC_CHECK_HEADER(readline/readline.h,
234 dnl readline may need libtermcap or somesuch...
235 AC_SEARCH_LIBS(tputs, [termcap terminfo])
237 AC_SEARCH_LIBS(readline, [readline history],
238 [AC_DEFINE(WITH_READLINE)])
239 AC_CHECK_HEADERS(readline/history.h)
241 [AC_CHECK_HEADER(editline/readline.h,
243 dnl editline may need libtermcap or somesuch...
244 AC_SEARCH_LIBS(tputs, [termcap terminfo])
246 AC_SEARCH_LIBS(editline, [edit],
247 [AC_DEFINE(WITH_READLINE)])
251 TFTP_LIBS="$LIBS $XTRALIBS"
255 dnl Check for IPV6 and disable-ipv6
257 PA_STRUCT_SOCKADDR_IN6
258 AC_MSG_CHECKING([for IPv6 support])
259 PA_WITH_BOOL(ipv6, 1,
260 [ --without-ipv6 disable the support for IPv6],
265 AC_DEFINE(HAVE_IPV6, 1, [Define if IPv6 support is enabled.])
266 PA_STRUCT_IN6_PKTINFO
269 AC_MSG_WARN([*** we do not have required IPv6 structs - IPv6 will be disabled])
272 [AC_MSG_RESULT(disabled)])
286 dnl Make sure the install program has an absolute path if it
287 dnl has a path at all. autoconf doesn't do this "in order
288 dnl to not pollute the cache." Sigh.
289 dnl Note: the $ needs to be double-quoted for reasons unknown.
292 [if echo "$INSTALL" | grep '^[^/].*/' > /dev/null 2>&1; then
293 INSTALL='\${SRCROOT}'/"$INSTALL"
296 AC_CONFIG_HEADERS(aconfig.h)