1 dnl $Id: configure.in,v 1.17 2001/12/01 02:00:48 lukem Exp $
4 dnl process this file with autoconf to produce a configure script.
7 AC_REVISION($Revision: 1.17 $)dnl
12 dnl Arguments for which features are included
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).
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,
27 dnl Checks for programs.
35 AC_CHECK_PROGS(AR, ar)
38 dnl Checks for libraries.
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)
47 if test -n "$socks"; then
48 if test $opt_ipv6 = yes; then
49 echo "IPv6 is incompatible with socks, disabling IPv6 support"
54 [ --with-skey Compile with S/Key authentication support.],
55 [ if test $withval = yes; then
56 AC_CHECK_LIB(skey, skey_haskey)
58 AC_MSG_CHECKING(whether to support S/Key)
59 if test x"$ac_cv_lib_skey_skey_haskey" = "xyes"; then
67 dnl Checks for header files.
69 AC_CONFIG_HEADER(config.h)
72 AC_CHECK_HEADERS(arpa/nameser.h err.h fts.h libutil.h paths.h \
73 sys/sysmacros.h util.h)
76 dnl Checks for typedefs, structures, and compiler characteristics.
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;
85 AC_DEFINE(HAVE_LONG_LONG, 1)
86 have_long_long=yes], [have_long_long=no])
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)])
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)])
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)])
103 if test $opt_ipv6 = yes; then
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)])
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)])
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)])
123 AC_MSG_TRY_COMPILE(for d_namlen in struct dirent, ftp_cv_HAVE_D_NAMLEN, [
127 # define dirent direct
129 # include <sys/ndir.h>
132 # include <sys/dir.h>
139 int X = dp.d_namlen; ], [AC_DEFINE(HAVE_D_NAMLEN, 1)])
141 AC_MSG_TRY_COMPILE(for struct passwd.pw_expire, ftp_cv_HAVE_PW_EXPIRE, [
142 #include <sys/types.h>
145 time_t X = pw.pw_expire ], [AC_DEFINE(HAVE_PW_EXPIRE, 1)])
150 dnl Checks for library functions.
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 \
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)
161 LIBOBJS="$LIBOBJS glob.o"
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)])
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)])
169 AC_MSG_TRY_COMPILE(for optarg declaration, ftp_cv_HAVE_OPTARG_D, [
171 #include <unistd.h> ], [ char *X = optarg ], [AC_DEFINE(HAVE_OPTARG_D, 1)])
173 AC_MSG_TRY_COMPILE(for optind declaration, ftp_cv_HAVE_OPTIND_D, [
175 #include <unistd.h> ], [ int X = optind ], [AC_DEFINE(HAVE_OPTIND_D, 1)])
177 AC_MSG_TRY_LINK(for optreset, ftp_cv_HAVE_OPTRESET, [
179 #include <unistd.h> ], [ int X = optreset ], [AC_DEFINE(HAVE_OPTRESET, 1)])
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)])
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)])
192 if test $have_long_long = yes -a $ac_cv_sizeof_off_t -ge 8; then
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.
198 AC_MSG_CHECKING(*printf() support for %lld)
199 can_printf_longlong=no
204 sprintf(buf, "%lld", 4294967300LL);
205 return (strcmp(buf, "4294967300"));
209 can_printf_longlong=yes
214 if test $can_printf_longlong != yes; then
215 AC_MSG_CHECKING(*printf() support for %qd)
220 sprintf(buf, "%qd", 4294967300LL);
221 return (strcmp(buf, "4294967300"));
225 can_printf_longlong=yes
226 AC_DEFINE(HAVE_PRINTF_QD, 1)
232 if test $can_printf_longlong = yes; then
233 AC_DEFINE(HAVE_QUAD_SUPPORT, 1)
234 AC_REPLACE_FUNCS(strtoll)
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 ])
249 AC_MSG_CHECKING(for working getaddrinfo())
250 if test $have_rfc2553_netdb = yes; then
251 AC_DEFINE(HAVE_RFC2553_NETDB, 1)
254 if test $ac_cv_func_getaddrinfo = yes; then
255 LIBOBJS="$LIBOBJS getaddrinfo.o"
256 AC_MSG_RESULT(no - using local version)
258 AC_MSG_RESULT(using local version)
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"])
269 dnl Tests for stuff for inbuilt ls
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"
276 AC_DEFINE(NO_INTERNAL_LS,1)
280 dnl Build libukem if necessary
283 if test -n "$LIBOBJS"; then
284 INCLUDES="$INCLUDES -I\${srcdir}/../libukem"
285 LDFLAGS="$LDFLAGS -L../libukem"
288 LIBDEPENDS="$LIBDEPENDS ../libukem/libukem.a"
292 dnl Create the Makefiles
300 AC_OUTPUT(Makefile libukem/Makefile src/Makefile)