]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/lukemftpd/configure.in
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / lukemftpd / configure.in
1 dnl $Id: configure.in,v 1.18 2002/05/23 02:42:55 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.18 $)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 FNM_CASEFOLD, ftp_cv_HAVE_FNM_CASEFOLD, [
170 #include <fnmatch.h> ], [ int X = FNM_CASEFOLD ],
171 [AC_DEFINE(HAVE_FNM_CASEFOLD, 1)],
172 [LIBOBJS="$LIBOBJS fnmatch.o"])
173
174 AC_MSG_TRY_COMPILE(for optarg declaration, ftp_cv_HAVE_OPTARG_D, [
175 #include <stdlib.h>
176 #include <unistd.h> ], [ char *X = optarg ], [AC_DEFINE(HAVE_OPTARG_D, 1)])
177
178 AC_MSG_TRY_COMPILE(for optind declaration, ftp_cv_HAVE_OPTIND_D, [
179 #include <stdlib.h>
180 #include <unistd.h> ], [ int X = optind ], [AC_DEFINE(HAVE_OPTIND_D, 1)])
181
182 AC_MSG_TRY_LINK(for optreset, ftp_cv_HAVE_OPTRESET, [
183 #include <stdlib.h>
184 #include <unistd.h> ], [ int X = optreset ], [AC_DEFINE(HAVE_OPTRESET, 1)])
185
186 AC_MSG_TRY_COMPILE(for pclose() declaration, ftp_cv_HAVE_PCLOSE_D, [
187 #include <stdio.h> ], [ int (*X)() = pclose ], [AC_DEFINE(HAVE_PCLOSE_D, 1)])
188
189 if test $ac_cv_func_getusershell = yes; then
190         AC_MSG_TRY_COMPILE(for getusershell() declaration,
191         ftp_cv_HAVE_GETUSERSHELL_D, [
192         #include <unistd.h> ], [ char *(*X)() = getusershell ],
193         [AC_DEFINE(HAVE_GETUSERSHELL_D, 1)])
194 fi
195
196
197 if test $have_long_long = yes -a $ac_cv_sizeof_off_t -ge 8; then
198
199 dnl             We assume that if sprintf() supports %lld or %qd,
200 dnl             then all of *printf() does. If not, disable long long
201 dnl             support because we don't know how to display it.
202
203         AC_MSG_CHECKING(*printf() support for %lld)
204         can_printf_longlong=no
205         AC_TRY_RUN([
206                 #include <stdio.h>
207                 int main() {
208                         char buf[100];
209                         sprintf(buf, "%lld", 4294967300LL);
210                         return (strcmp(buf, "4294967300"));
211                 }
212         ], [
213                 AC_MSG_RESULT(yes)
214                 can_printf_longlong=yes
215         ], [
216                 AC_MSG_RESULT(no)
217         ], [ : ])
218
219         if test $can_printf_longlong != yes; then
220                 AC_MSG_CHECKING(*printf() support for %qd)
221                 AC_TRY_RUN([
222                         #include <stdio.h>
223                         int main() {
224                                 char buf[100];
225                                 sprintf(buf, "%qd", 4294967300LL);
226                                 return (strcmp(buf, "4294967300"));
227                         }
228                 ], [
229                         AC_MSG_RESULT(yes)
230                         can_printf_longlong=yes
231                         AC_DEFINE(HAVE_PRINTF_QD, 1)
232                 ], [
233                         AC_MSG_RESULT(no)
234                 ], [ : ])
235         fi
236
237         if test $can_printf_longlong = yes; then
238                 AC_DEFINE(HAVE_QUAD_SUPPORT, 1)
239                 AC_REPLACE_FUNCS(strtoll)
240         fi
241
242 fi
243
244
245 have_rfc2553_netdb=no
246 if test $ac_cv_func_getaddrinfo = yes -a ! -n "$socks"; then
247         AC_MSG_TRY_COMPILE(for AI_NUMERICHOST,
248             ftp_cv_have_ai_numerichost, [
249         #include <sys/types.h>
250         #include <sys/socket.h>
251         #include <netdb.h> ],
252             [ int X = AI_NUMERICHOST ], [ have_rfc2553_netdb=yes ])
253 fi
254 AC_MSG_CHECKING(for working getaddrinfo())
255 if test $have_rfc2553_netdb = yes; then
256         AC_DEFINE(HAVE_RFC2553_NETDB, 1)
257         AC_MSG_RESULT(yes)
258 else
259         if test $ac_cv_func_getaddrinfo = yes; then
260                 LIBOBJS="$LIBOBJS getaddrinfo.o"
261                 AC_MSG_RESULT(no - using local version)
262         else
263                 AC_MSG_RESULT(using local version)
264         fi
265 fi
266
267 if test $ac_cv_func_sl_init = yes; then
268         AC_MSG_TRY_COMPILE(if sl_add() returns int, ftp_cv_INT_SL_ADD, [
269         #include <stringlist.h> ], [ int f = sl_add((StringList *)0, "foo") ],
270         [:] , [LIBOBJS="$LIBOBJS sl_init.o"])
271 fi
272
273
274 dnl Tests for stuff for inbuilt ls
275 dnl
276
277 if test $opt_builtinls = yes; then
278         AC_REPLACE_FUNCS(fts_open strmode user_from_uid)
279         LSOBJS="cmp.o ls.o print.o util.o"
280 else
281         AC_DEFINE(NO_INTERNAL_LS,1)
282 fi
283
284
285 dnl Build libukem if necessary
286 dnl
287
288 if test -n "$LIBOBJS"; then
289         INCLUDES="$INCLUDES -I\${srcdir}/../libukem"
290         LDFLAGS="$LDFLAGS -L../libukem"
291         LIBS="$LIBS -lukem"
292         LIBUKEM=libukem.a
293         LIBDEPENDS="$LIBDEPENDS ../libukem/libukem.a"
294 fi
295
296
297 dnl Create the Makefiles
298 dnl
299
300 AC_SUBST(INCLUDES)
301 AC_SUBST(LIBUKEM)
302 AC_SUBST(LIBDEPENDS)
303 AC_SUBST(LSOBJS)
304
305 AC_OUTPUT(Makefile libukem/Makefile src/Makefile)