Since intr has been setup in the last step of vr_attach(), mii_phy_probe()
[dragonfly.git] / contrib / lukemftpd / configure.in
1 dnl $Id: configure.in,v 1.17 2001/12/01 02:00:48 lukem Exp $
2 dnl
3 dnl configure.in --
4 dnl     process this file with autoconf to produce a configure script.
5 dnl
6
7 AC_REVISION($Revision: 1.17 $)dnl
8
9 AC_INIT(lukemftpd.h)
10
11
12 dnl Arguments for which features are included
13 dnl
14 AC_ARG_ENABLE(ipv6, [\
15   --enable-ipv6           Enable IPv6 support (if your OS supports it).
16   --disable-ipv6          Disable IPv6 support (even if your OS supports it).
17                           [default: enabled]], 
18     opt_ipv6=$enableval,
19     opt_ipv6=yes)
20 AC_ARG_ENABLE(builtinls, [\
21   --enable-builtinls      Enable built-in /bin/ls.  [default: enabled]
22   --disable-builtinls     Disable built-in /bin/ls.],
23     opt_builtinls=$enableval,
24     opt_builtinls=yes)
25
26
27 dnl Checks for programs.
28 dnl
29 AC_PROG_MAKE_SET
30 AC_PROG_CC
31 AC_PROG_AWK
32 AC_PROG_INSTALL
33 AC_PROG_RANLIB
34 AC_PROG_YACC
35 AC_CHECK_PROGS(AR, ar)
36
37
38 dnl Checks for libraries.
39 dnl
40 AC_CHECK_LIB(crypt, crypt)
41 AC_CHECK_LIB(util, fparseln)
42 if test $ac_cv_lib_util_fparseln != yes; then
43         AC_CHECK_LIB(util, setproctitle)
44 fi
45 AC_LIBRARY_NET
46 AC_LIBRARY_SOCKS
47 if test -n "$socks"; then
48         if test $opt_ipv6 = yes; then
49                 echo "IPv6 is incompatible with socks, disabling IPv6 support"
50                 opt_ipv6=no
51         fi
52 fi
53 AC_ARG_WITH(skey,
54 [  --with-skey             Compile with S/Key authentication support.],
55 [       if test $withval = yes; then
56                 AC_CHECK_LIB(skey, skey_haskey)
57         fi ] )
58 AC_MSG_CHECKING(whether to support S/Key)
59 if test x"$ac_cv_lib_skey_skey_haskey" = "xyes"; then
60         AC_MSG_RESULT(yes)
61         AC_DEFINE(SKEY, 1)
62 else
63         AC_MSG_RESULT(no)
64 fi
65
66
67 dnl Checks for header files.
68 dnl
69 AC_CONFIG_HEADER(config.h)
70 AC_HEADER_DIRENT
71 AC_HEADER_STDC
72 AC_CHECK_HEADERS(arpa/nameser.h err.h fts.h libutil.h paths.h \
73                 sys/sysmacros.h util.h)
74
75
76 dnl Checks for typedefs, structures, and compiler characteristics.
77 dnl
78 AC_HEADER_TIME
79 AC_TYPE_OFF_T
80 AC_CHECK_SIZEOF(off_t, 0)
81 AC_MSG_TRY_LINK(for long long, ftp_cv_HAVE_LONG_LONG, [
82 #include <sys/types.h>] , [
83 long long X = 2, Y = 1, Z;
84 Z = X / Y; ], [
85 AC_DEFINE(HAVE_LONG_LONG, 1)
86 have_long_long=yes], [have_long_long=no])
87
88 AC_MSG_TRY_COMPILE(for in_port_t, ftp_cv_HAVE_IN_PORT_T, [
89 #include <sys/types.h>
90 #include <netinet/in.h> ], [ in_port_t X ], [AC_DEFINE(HAVE_IN_PORT_T, 1)])
91
92 AC_MSG_TRY_COMPILE(for sockaddr_in.sin_len, ftp_cv_HAVE_SOCKADDR_SA_LEN, [
93 #include <sys/types.h>
94 #include <sys/socket.h>
95 #include <netinet/in.h> ], [
96         struct sockaddr_in sin;
97         int X = sin.sin_len ], [AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1)])
98
99 AC_MSG_TRY_COMPILE(for socklen_t, ftp_cv_HAVE_SOCKLEN_T, [
100 #include <sys/types.h>
101 #include <sys/socket.h> ], [ socklen_t X ], [AC_DEFINE(HAVE_SOCKLEN_T, 1)])
102
103 if test $opt_ipv6 = yes; then
104
105         AC_MSG_TRY_COMPILE(for AF_INET6, ftp_cv_HAVE_AF_INET6, [
106 #include <sys/types.h>
107 #include <sys/socket.h> ],
108             [ int X = AF_INET6 ], [AC_DEFINE(HAVE_AF_INET6, 1)])
109
110         AC_MSG_TRY_COMPILE(for struct sockaddr_in6, ftp_cv_HAVE_SOCKADDR_IN6, [
111 #include <sys/types.h>
112 #include <netinet/in.h> ],
113             [ struct sockaddr_in6 X ], [AC_DEFINE(HAVE_SOCKADDR_IN6, 1)])
114
115 fi
116
117 AC_MSG_TRY_COMPILE(for struct addrinfo, ftp_cv_HAVE_ADDRINFO, [
118 #include <sys/types.h>
119 #include <sys/socket.h>
120 #include <netdb.h> ],
121             [ struct addrinfo X ], [AC_DEFINE(HAVE_ADDRINFO, 1)])
122
123 AC_MSG_TRY_COMPILE(for d_namlen in struct dirent, ftp_cv_HAVE_D_NAMLEN, [
124 #if HAVE_DIRENT_H
125 # include <dirent.h>
126 #else
127 # define dirent direct
128 # if HAVE_SYS_NDIR_H
129 #  include <sys/ndir.h>
130 # endif
131 # if HAVE_SYS_DIR_H
132 #  include <sys/dir.h>
133 # endif
134 # if HAVE_NDIR_H
135 #  include <ndir.h>
136 # endif
137 #endif ], [
138         struct dirent dp;
139         int X = dp.d_namlen; ], [AC_DEFINE(HAVE_D_NAMLEN, 1)])
140
141 AC_MSG_TRY_COMPILE(for struct passwd.pw_expire, ftp_cv_HAVE_PW_EXPIRE, [
142 #include <sys/types.h>
143 #include <pwd.h> ],
144             [ struct passwd pw;
145               time_t X = pw.pw_expire ], [AC_DEFINE(HAVE_PW_EXPIRE, 1)])
146
147 AC_C_CONST
148
149
150 dnl Checks for library functions.
151 dnl
152 AC_REPLACE_FUNCS(err fgetln getaddrinfo getgrouplist getnameinfo \
153                 getusershell inet_net_pton inet_ntop inet_pton mkstemp \
154                 sl_init snprintf strdup strerror strlcat strlcpy strsep \
155                 usleep vsyslog)
156 AC_CHECK_FUNCS(flock lockf getspnam setlogin setproctitle vfork)
157 if test $ac_cv_lib_util_fparseln != yes; then
158         AC_REPLACE_FUNCS(fparseln)
159 fi
160
161 LIBOBJS="$LIBOBJS glob.o"
162
163 AC_MSG_TRY_COMPILE(for crypt() declaration, ftp_cv_HAVE_CRYPT_D, [
164 #include <unistd.h> ], [ char *(*X)() = crypt ], [AC_DEFINE(HAVE_CRYPT_D, 1)])
165
166 AC_MSG_TRY_COMPILE(for fclose() declaration, ftp_cv_HAVE_FCLOSE_D, [
167 #include <stdio.h> ], [ int (*X)() = fclose ], [AC_DEFINE(HAVE_FCLOSE_D, 1)])
168
169 AC_MSG_TRY_COMPILE(for optarg declaration, ftp_cv_HAVE_OPTARG_D, [
170 #include <stdlib.h>
171 #include <unistd.h> ], [ char *X = optarg ], [AC_DEFINE(HAVE_OPTARG_D, 1)])
172
173 AC_MSG_TRY_COMPILE(for optind declaration, ftp_cv_HAVE_OPTIND_D, [
174 #include <stdlib.h>
175 #include <unistd.h> ], [ int X = optind ], [AC_DEFINE(HAVE_OPTIND_D, 1)])
176
177 AC_MSG_TRY_LINK(for optreset, ftp_cv_HAVE_OPTRESET, [
178 #include <stdlib.h>
179 #include <unistd.h> ], [ int X = optreset ], [AC_DEFINE(HAVE_OPTRESET, 1)])
180
181 AC_MSG_TRY_COMPILE(for pclose() declaration, ftp_cv_HAVE_PCLOSE_D, [
182 #include <stdio.h> ], [ int (*X)() = pclose ], [AC_DEFINE(HAVE_PCLOSE_D, 1)])
183
184 if test $ac_cv_func_getusershell = yes; then
185         AC_MSG_TRY_COMPILE(for getusershell() declaration,
186         ftp_cv_HAVE_GETUSERSHELL_D, [
187         #include <unistd.h> ], [ char *(*X)() = getusershell ],
188         [AC_DEFINE(HAVE_GETUSERSHELL_D, 1)])
189 fi
190
191
192 if test $have_long_long = yes -a $ac_cv_sizeof_off_t -ge 8; then
193
194 dnl             We assume that if sprintf() supports %lld or %qd,
195 dnl             then all of *printf() does. If not, disable long long
196 dnl             support because we don't know how to display it.
197
198         AC_MSG_CHECKING(*printf() support for %lld)
199         can_printf_longlong=no
200         AC_TRY_RUN([
201                 #include <stdio.h>
202                 int main() {
203                         char buf[100];
204                         sprintf(buf, "%lld", 4294967300LL);
205                         return (strcmp(buf, "4294967300"));
206                 }
207         ], [
208                 AC_MSG_RESULT(yes)
209                 can_printf_longlong=yes
210         ], [
211                 AC_MSG_RESULT(no)
212         ], [ : ])
213
214         if test $can_printf_longlong != yes; then
215                 AC_MSG_CHECKING(*printf() support for %qd)
216                 AC_TRY_RUN([
217                         #include <stdio.h>
218                         int main() {
219                                 char buf[100];
220                                 sprintf(buf, "%qd", 4294967300LL);
221                                 return (strcmp(buf, "4294967300"));
222                         }
223                 ], [
224                         AC_MSG_RESULT(yes)
225                         can_printf_longlong=yes
226                         AC_DEFINE(HAVE_PRINTF_QD, 1)
227                 ], [
228                         AC_MSG_RESULT(no)
229                 ], [ : ])
230         fi
231
232         if test $can_printf_longlong = yes; then
233                 AC_DEFINE(HAVE_QUAD_SUPPORT, 1)
234                 AC_REPLACE_FUNCS(strtoll)
235         fi
236
237 fi
238
239
240 have_rfc2553_netdb=no
241 if test $ac_cv_func_getaddrinfo = yes -a ! -n "$socks"; then
242         AC_MSG_TRY_COMPILE(for AI_NUMERICHOST,
243             ftp_cv_have_ai_numerichost, [
244         #include <sys/types.h>
245         #include <sys/socket.h>
246         #include <netdb.h> ],
247             [ int X = AI_NUMERICHOST ], [ have_rfc2553_netdb=yes ])
248 fi
249 AC_MSG_CHECKING(for working getaddrinfo())
250 if test $have_rfc2553_netdb = yes; then
251         AC_DEFINE(HAVE_RFC2553_NETDB, 1)
252         AC_MSG_RESULT(yes)
253 else
254         if test $ac_cv_func_getaddrinfo = yes; then
255                 LIBOBJS="$LIBOBJS getaddrinfo.o"
256                 AC_MSG_RESULT(no - using local version)
257         else
258                 AC_MSG_RESULT(using local version)
259         fi
260 fi
261
262 if test $ac_cv_func_sl_init = yes; then
263         AC_MSG_TRY_COMPILE(if sl_add() returns int, ftp_cv_INT_SL_ADD, [
264         #include <stringlist.h> ], [ int f = sl_add((StringList *)0, "foo") ],
265         [:] , [LIBOBJS="$LIBOBJS sl_init.o"])
266 fi
267
268
269 dnl Tests for stuff for inbuilt ls
270 dnl
271
272 if test $opt_builtinls = yes; then
273         AC_REPLACE_FUNCS(fts_open strmode user_from_uid)
274         LSOBJS="cmp.o ls.o print.o util.o"
275 else
276         AC_DEFINE(NO_INTERNAL_LS,1)
277 fi
278
279
280 dnl Build libukem if necessary
281 dnl
282
283 if test -n "$LIBOBJS"; then
284         INCLUDES="$INCLUDES -I\${srcdir}/../libukem"
285         LDFLAGS="$LDFLAGS -L../libukem"
286         LIBS="$LIBS -lukem"
287         LIBUKEM=libukem.a
288         LIBDEPENDS="$LIBDEPENDS ../libukem/libukem.a"
289 fi
290
291
292 dnl Create the Makefiles
293 dnl
294
295 AC_SUBST(INCLUDES)
296 AC_SUBST(LIBUKEM)
297 AC_SUBST(LIBDEPENDS)
298 AC_SUBST(LSOBJS)
299
300 AC_OUTPUT(Makefile libukem/Makefile src/Makefile)