1 dnl $Id: configure.in,v 1.37 2002/06/10 08:08:53 lukem Exp $
4 dnl process this file with autoconf to produce a configure script.
7 AC_REVISION($Revision: 1.37 $)dnl
11 dnl Arguments for which features are included
14 AC_ARG_ENABLE(editcomplete, [\
15 --enable-editcomplete Turn on command line editing and completion.
16 --disable-editcomplete Turn off command line editing and completion
18 opt_editcomplete=$enableval,
20 AC_ARG_ENABLE(ipv6, [\
21 --enable-ipv6 Enable IPv6 support (if your OS supports it).
22 --disable-ipv6 Disable IPv6 support (even if your OS supports it)
27 dnl Checks for programs.
34 AC_CHECK_PROGS(AR, ar)
38 dnl Checks for libraries.
40 AC_CHECK_LIB(util, fparseln)
41 if test $opt_editcomplete = yes; then
42 AC_CHECK_LIB(tinfo, tgetent, ,
43 AC_CHECK_LIB(termcap, tgetent, ,
44 AC_CHECK_LIB(curses, tgetent, ,
45 AC_CHECK_LIB(ncurses, tgetent))))
46 AC_SEARCH_LIBS(el_init, edit, have_libedit=yes, have_libedit=no)
50 if test -n "$socks"; then
51 if test $opt_ipv6 = yes; then
52 echo "IPv6 is incompatible with socks, disabling IPv6 support"
58 dnl Checks for header files.
60 AC_CONFIG_HEADER(config.h)
63 AC_CHECK_HEADERS(arpa/nameser.h err.h regex.h paths.h poll.h sys/poll.h \
64 termcap.h util.h libutil.h vis.h)
67 dnl Checks for typedefs, structures, and compiler characteristics.
71 AC_CHECK_SIZEOF(off_t, 0)
72 AC_MSG_TRY_LINK(for long long, ftp_cv_HAVE_LONG_LONG, [
73 #include <sys/types.h>] , [
74 long long X = 2, Y = 1, Z;
76 AC_DEFINE(HAVE_LONG_LONG, 1)
77 have_long_long=yes], [have_long_long=no])
79 AC_MSG_TRY_COMPILE(for in_port_t, ftp_cv_HAVE_IN_PORT_T, [
80 #include <sys/types.h>
81 #include <netinet/in.h> ], [ in_port_t X ], [AC_DEFINE(HAVE_IN_PORT_T, 1)])
83 AC_MSG_TRY_COMPILE(for sa_family_t, ftp_cv_HAVE_SA_FAMILY_T, [
84 #include <sys/types.h>
85 #include <sys/socket.h> ], [ sa_family_t X ], [AC_DEFINE(HAVE_SA_FAMILY_T, 1)])
87 AC_MSG_TRY_COMPILE(for sockaddr_in.sin_len, ftp_cv_HAVE_SOCKADDR_SA_LEN, [
88 #include <sys/types.h>
89 #include <sys/socket.h>
90 #include <netinet/in.h> ], [
91 struct sockaddr_in sin;
92 int X = sin.sin_len ], [AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1)])
94 AC_MSG_TRY_COMPILE(for socklen_t, ftp_cv_HAVE_SOCKLEN_T, [
95 #include <sys/types.h>
96 #include <sys/socket.h> ], [ socklen_t X ], [AC_DEFINE(HAVE_SOCKLEN_T, 1)])
98 if test $opt_ipv6 = yes; then
100 AC_MSG_TRY_COMPILE(for AF_INET6, ftp_cv_HAVE_AF_INET6, [
101 #include <sys/types.h>
102 #include <sys/socket.h> ],
103 [ int X = AF_INET6 ], [AC_DEFINE(HAVE_AF_INET6, 1)])
105 AC_MSG_TRY_COMPILE(for struct sockaddr_in6, ftp_cv_HAVE_SOCKADDR_IN6, [
106 #include <sys/types.h>
107 #include <netinet/in.h> ],
108 [ struct sockaddr_in6 X ], [AC_DEFINE(HAVE_SOCKADDR_IN6, 1)])
112 AC_MSG_TRY_COMPILE(for struct addrinfo, ftp_cv_HAVE_ADDRINFO, [
113 #include <sys/types.h>
114 #include <sys/socket.h>
115 #include <netdb.h> ],
116 [ struct addrinfo X ], [AC_DEFINE(HAVE_ADDRINFO, 1)])
118 AC_MSG_TRY_COMPILE(for d_namlen in struct dirent, ftp_cv_HAVE_D_NAMLEN, [
122 # define dirent direct
124 # include <sys/ndir.h>
127 # include <sys/dir.h>
134 int X = dp.d_namlen; ], [AC_DEFINE(HAVE_D_NAMLEN, 1)])
136 AC_MSG_TRY_COMPILE(for h_errno declaration, ftp_cv_HAVE_H_ERRNO_D, [
137 #include <netdb.h> ], [ int X = h_errno ], [AC_DEFINE(HAVE_H_ERRNO_D, 1)])
139 AC_MSG_TRY_COMPILE(for fclose() declaration, ftp_cv_HAVE_FCLOSE_D, [
140 #include <stdio.h> ], [ int (*X)() = fclose ], [AC_DEFINE(HAVE_FCLOSE_D, 1)])
142 AC_MSG_TRY_COMPILE(for getpass() declaration, ftp_cv_HAVE_GETPASS_D, [
144 #include <unistd.h> ], [ char *(*X)() = getpass ], [
145 AC_DEFINE(HAVE_GETPASS_D, 1)])
147 AC_MSG_TRY_COMPILE(for optarg declaration, ftp_cv_HAVE_OPTARG_D, [
149 #include <unistd.h> ], [ char *X = optarg ], [AC_DEFINE(HAVE_OPTARG_D, 1)])
151 AC_MSG_TRY_COMPILE(for optind declaration, ftp_cv_HAVE_OPTIND_D, [
153 #include <unistd.h> ], [ int X = optind ], [AC_DEFINE(HAVE_OPTIND_D, 1)])
155 AC_MSG_TRY_COMPILE(for pclose() declaration, ftp_cv_HAVE_PCLOSE_D, [
156 #include <stdio.h> ], [ int (*X)() = pclose ], [AC_DEFINE(HAVE_PCLOSE_D, 1)])
159 dnl Checks for library functions.
161 AC_REPLACE_FUNCS(err fgetln fseeko getaddrinfo getnameinfo inet_ntop inet_pton \
162 mkstemp setprogname sl_init snprintf strdup strerror strlcat \
163 strlcpy strptime strsep strunvis strvis timegm usleep)
164 AC_CHECK_FUNCS(gethostbyname2 getpassphrase getpgrp memmove poll select)
165 if test $ac_cv_func_getpgrp = yes; then
168 if test $ac_cv_lib_util_fparseln != yes; then
169 AC_REPLACE_FUNCS(fparseln)
172 LIBOBJS="$LIBOBJS glob.o"
174 if test $ac_cv_func_strptime = yes; then
175 AC_MSG_TRY_COMPILE(for strptime() declaration, ftp_cv_HAVE_STRPTIME_D, [
176 #include <time.h> ], [ char *X = strptime("", "", NULL) ],
177 [AC_DEFINE(HAVE_STRPTIME_D, 1)])
180 if test $have_long_long = yes -a $ac_cv_sizeof_off_t -ge 8; then
182 dnl We assume that if sprintf() supports %lld or %qd,
183 dnl then all of *printf() does. If not, disable long long
184 dnl support because we don't know how to display it.
186 AC_MSG_CHECKING(*printf() support for %lld)
187 can_printf_longlong=no
192 sprintf(buf, "%lld", 4294967300LL);
193 return (strcmp(buf, "4294967300"));
197 can_printf_longlong=yes
202 if test $can_printf_longlong != yes; then
203 AC_MSG_CHECKING(*printf() support for %qd)
208 sprintf(buf, "%qd", 4294967300LL);
209 return (strcmp(buf, "4294967300"));
213 can_printf_longlong=yes
214 AC_DEFINE(HAVE_PRINTF_QD, 1)
220 if test $can_printf_longlong = yes; then
221 AC_DEFINE(HAVE_QUAD_SUPPORT, 1)
222 AC_REPLACE_FUNCS(strtoll)
228 if test $opt_editcomplete = yes; then
229 if test $have_libedit = yes; then
230 AC_MSG_TRY_COMPILE(for EL_RPROMPT in libedit,
231 ftp_cv_have_libedit, [
232 #include <histedit.h> ], [ int X = EL_RPROMPT ], [:],
236 AC_MSG_CHECKING(for working libedit)
237 if test $have_libedit = no; then
238 AC_MSG_RESULT(no - using my own)
239 INCLUDES="-I\${srcdir}/../libedit $INCLUDES"
240 LDFLAGS="-L../libedit $LDFLAGS"
243 LIBDEPENDS="$LIBDEPENDS ../libedit/libedit.a"
248 CFLAGS="-DNO_EDITCOMPLETE $CFLAGS"
251 if test $ac_cv_func_sl_init = yes; then
252 AC_MSG_TRY_COMPILE(if sl_add() returns int, ftp_cv_INT_SL_ADD, [
253 #include <stringlist.h> ], [ int f = sl_add((StringList *)0, "foo") ],
254 [:] , [LIBOBJS="$LIBOBJS sl_init.o"])
258 have_rfc2553_netdb=no
259 if test $ac_cv_func_getaddrinfo = yes -a ! -n "$socks"; then
260 AC_MSG_TRY_COMPILE(for AI_NUMERICHOST,
261 ftp_cv_have_ai_numerichost, [
262 #include <sys/types.h>
263 #include <sys/socket.h>
264 #include <netdb.h> ],
265 [ int X = AI_NUMERICHOST ], [ have_rfc2553_netdb=yes ])
267 AC_MSG_CHECKING(for working getaddrinfo())
268 if test $have_rfc2553_netdb = yes; then
269 AC_DEFINE(HAVE_RFC2553_NETDB, 1)
272 if test $ac_cv_func_getaddrinfo = yes; then
273 LIBOBJS="$LIBOBJS getaddrinfo.o"
274 AC_MSG_RESULT(no - using local version)
276 AC_MSG_RESULT(using local version)
281 if test $ac_cv_header_vis_h = yes; then
282 AC_MSG_TRY_COMPILE(for VIS_WHITE in vis.h,
283 ftp_cv_have_vis_white, [
284 #include <sys/types.h>
285 #include <vis.h> ], [ int X = VIS_WHITE ], [:],
286 ac_cv_header_vis_h=no )
290 if test -n "$LIBOBJS"; then
291 INCLUDES="$INCLUDES -I\${srcdir}/../libukem"
292 LDFLAGS="$LDFLAGS -L../libukem"
295 LIBDEPENDS="$LIBDEPENDS ../libukem/libukem.a"
298 dnl Create the Makefiles
306 AC_OUTPUT(Makefile libedit/Makefile libedit/makelist libukem/Makefile \