2 dnl autoconf input file to generate MCONFIG
8 AC_PREFIX_DEFAULT(/usr)
16 dnl Feature-test macros. These need to be set in CFLAGS, rather in
17 dnl aconfig.h, or "configure" will run in a different environment than
18 dnl we eventually we build in.
21 dnl Needed on Solaris/cc or Solaris/gcc
22 CFLAGS="$CFLAGS -D_XPG4_2"
23 CFLAGS="$CFLAGS -D_XOPEN_SOURCE"
24 CFLAGS="$CFLAGS -D__EXTENSIONS__"
26 dnl Needed on some glibc systems
27 CFLAGS="$CFLAGS -D_GNU_SOURCE"
29 dnl Needed on Digital Unix
30 CFLAGS="$CFLAGS -D_OSF_SOURCE"
31 CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
40 PA_ADD_CFLAGS(-Wpointer-arith)
41 PA_ADD_CFLAGS(-Wbad-function-cast)
42 PA_ADD_CFLAGS(-Wcast-equal)
43 PA_ADD_CFLAGS(-Wstrict-prototypes)
44 PA_ADD_CFLAGS(-Wmissing-prototypes)
45 PA_ADD_CFLAGS(-Wmissing-declarations)
46 PA_ADD_CFLAGS(-Wnested-externs)
47 PA_ADD_CFLAGS(-Winline)
48 PA_ADD_CFLAGS(-Wwrite-strings)
49 PA_ADD_CFLAGS(-Wundef)
50 PA_ADD_CFLAGS(-Wshadow)
51 PA_ADD_CFLAGS(-Wsign-compare)
53 PA_ADD_CFLAGS(-fno-strict-aliasing)
56 AC_CHECK_HEADERS(inttypes.h)
57 AC_CHECK_HEADERS(stdint.h)
58 PA_CHECK_INTTYPES_H_SANE
59 AC_CHECK_HEADERS(fcntl.h)
60 AC_CHECK_HEADERS(getopt.h)
61 AC_CHECK_HEADERS(grp.h)
62 AC_CHECK_HEADERS(libgen.h)
63 AC_CHECK_HEADERS(memory.h)
64 AC_CHECK_HEADERS(setjmp.h)
65 AC_CHECK_HEADERS(stddef.h)
66 AC_CHECK_HEADERS(stdlib.h)
67 AC_CHECK_HEADERS(string.h)
68 AC_CHECK_HEADERS(strings.h)
69 AC_CHECK_HEADERS(sysexits.h)
70 AC_CHECK_HEADERS(time.h)
71 AC_CHECK_HEADERS(unistd.h)
72 AC_CHECK_HEADERS(sys/filio.h)
73 AC_CHECK_HEADERS(sys/stat.h)
74 AC_CHECK_HEADERS(sys/time.h)
75 AC_CHECK_HEADERS(sys/types.h)
76 AC_CHECK_HEADERS(arpa/inet.h)
78 dnl This is needed on some versions of FreeBSD...
79 AC_CHECK_HEADERS(machine/param.h)
80 AC_CHECK_HEADERS(sys/socket.h)
81 AC_CHECK_HEADERS(winsock2.h)
82 AC_CHECK_HEADERS(winsock.h)
84 AC_CHECK_TYPES(intmax_t)
85 AC_CHECK_TYPES(long long)
86 AC_CHECK_TYPES(uint16_t)
87 AC_CHECK_TYPES(uint32_t)
88 AC_CHECK_TYPES(u_short)
89 AC_CHECK_TYPES(u_long)
95 AC_SEARCH_LIBS(socket, [socket ws2_32 wsock32], , [AC_MSG_ERROR(socket library not found)])
96 AC_SEARCH_LIBS(gethostbyname, [nsl resolv], , [AC_MSG_ERROR(gethostbyname not found)])
97 AC_SEARCH_LIBS(inet_aton, [nsl resolv], , [AC_MSG_ERROR(inet_aton not found)])
98 AC_SEARCH_LIBS(herror, [nsl resolv], , [AC_MSG_ERROR(herror not found)])
101 AC_CHECK_FUNCS(fcntl)
102 AC_CHECK_FUNCS(setsid)
103 AC_CHECK_FUNCS(recvmsg)
104 AC_CHECK_FUNCS(ftruncate)
105 AC_CHECK_FUNCS(setreuid)
106 AC_CHECK_FUNCS(setregid)
107 AC_CHECK_FUNCS(initgroups)
108 AC_CHECK_FUNCS(setgroups)
110 dnl Solaris 8 has [u]intmax_t but not strtoumax(). How utterly braindamaged.
111 AC_CHECK_FUNCS(strtoumax)
112 AC_CHECK_FUNCS(strtoull)
114 PA_MSGHDR_MSG_CONTROL
117 PA_HEADER_DEFINES(fcntl.h, int, O_NONBLOCK)
118 PA_HEADER_DEFINES(fcntl.h, int, O_BINARY)
119 PA_HEADER_DEFINES(fcntl.h, int, O_TEXT)
121 AH_TEMPLATE([HAVE_SIGSETJMP],
122 [Define if we have sigsetjmp, siglongjmp and sigjmp_buf.])
123 PA_SIGSETJMP([AC_DEFINE(HAVE_SIGSETJMP)])
128 SRCROOT=`cd $srcdir && pwd`
132 AC_SEARCH_LIBS(xmalloc, iberty, , [XTRA=true ; AC_LIBOBJ(xmalloc)])
133 AC_SEARCH_LIBS(xstrdup, iberty, , [XTRA=true ; AC_LIBOBJ(xstrdup)])
134 AC_SEARCH_LIBS(bsd_signal, bsd, , [XTRA=true ; AC_LIBOBJ(bsdsignal)])
137 XTRALIBS="$OBJROOT/lib/libxtra.a $XTRALIBS"
141 dnl These libraries apply to the server only
146 PA_HEADER_DEFINES(netinet/in.h, int, IPPORT_TFTP)
148 PA_WITH_BOOL(tcpwrappers, 1,
149 [ --without-tcpwrappers disable tcpwrapper permissions checking],
151 AC_SEARCH_LIBS(yp_get_default_domain, [nsl resolv])
156 AH_TEMPLATE([WITH_REGEX],
157 [Define if we are compiling with regex filename remapping.])
159 PA_WITH_BOOL(remap, 1,
160 [ --without-remap disable regex-based filename remapping],
162 AC_CHECK_HEADER(regex.h,
164 AC_SEARCH_LIBS(regcomp, [regex rx],
166 AC_DEFINE(WITH_REGEX)
167 TFTPDOBJS="remap.${OBJEXT} $TFTPDOBJS"
172 TFTPD_LIBS="$LIBS $XTRALIBS"
176 dnl These libraries apply to the client only
179 AH_TEMPLATE([WITH_READLINE],
180 [Define if we are compiling with readline command-line editing.])
182 PA_WITH_BOOL(readline, 1,
183 [ --without-readline disable the use of readline command-line editing],
185 AC_CHECK_HEADER(readline/readline.h,
187 dnl readline may need libtermcap or somesuch...
188 AC_SEARCH_LIBS(tputs, [termcap terminfo])
190 AC_SEARCH_LIBS(readline, [readline history],
192 AC_DEFINE(WITH_READLINE)
196 AC_CHECK_HEADERS(readline/history.h)
200 TFTP_LIBS="$LIBS $XTRALIBS"
214 dnl Make sure the install program has an absolute path if it
215 dnl has a path at all. autoconf doesn't do this "in order
216 dnl to not pollute the cache." Sigh.
217 dnl Note: the $ needs to be double-quoted for reasons unknown.
220 [if echo "$INSTALL" | grep '^[^/].*/' > /dev/null 2>&1; then
221 INSTALL='\${SRCROOT}'/"$INSTALL"
224 AC_CONFIG_HEADERS(aconfig.h)