]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - contrib/lukemftp/configure.in
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.git] / contrib / lukemftp / configure.in
1 dnl $Id: configure.in,v 1.37 2002/06/10 08:08:53 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.37 $)dnl
8
9 AC_INIT(lukemftp.h)
10
11 dnl Arguments for which features are included
12 dnl
13 AC_ARG_PROGRAM
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
17                           [default: enabled].], 
18     opt_editcomplete=$enableval,
19     opt_editcomplete=yes)
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) 
23                           [default: enabled].], 
24     opt_ipv6=$enableval,
25     opt_ipv6=yes)
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_CHECK_PROGS(AR, ar)
35 AC_AIX
36
37
38 dnl Checks for libraries.
39 dnl
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)
47 fi
48 AC_LIBRARY_NET
49 AC_LIBRARY_SOCKS
50 if test -n "$socks"; then
51         if test $opt_ipv6 = yes; then
52                 echo "IPv6 is incompatible with socks, disabling IPv6 support"
53                 opt_ipv6=no
54         fi
55 fi
56
57
58 dnl Checks for header files.
59 dnl
60 AC_CONFIG_HEADER(config.h)
61 AC_HEADER_DIRENT
62 AC_HEADER_STDC
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)
65
66
67 dnl Checks for typedefs, structures, and compiler characteristics.
68 dnl
69 AC_HEADER_TIME
70 AC_TYPE_OFF_T
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;
75 Z = X / Y; ], [
76 AC_DEFINE(HAVE_LONG_LONG, 1)
77 have_long_long=yes], [have_long_long=no])
78
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)])
82
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)])
86
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)])
93
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)])
97
98 if test $opt_ipv6 = yes; then
99
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)])
104
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)])
109
110 fi
111
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)])
117
118 AC_MSG_TRY_COMPILE(for d_namlen in struct dirent, ftp_cv_HAVE_D_NAMLEN, [
119 #if HAVE_DIRENT_H
120 # include <dirent.h>
121 #else
122 # define dirent direct
123 # if HAVE_SYS_NDIR_H
124 #  include <sys/ndir.h>
125 # endif
126 # if HAVE_SYS_DIR_H
127 #  include <sys/dir.h>
128 # endif
129 # if HAVE_NDIR_H
130 #  include <ndir.h>
131 # endif
132 #endif ], [
133         struct dirent dp;
134         int X = dp.d_namlen; ], [AC_DEFINE(HAVE_D_NAMLEN, 1)])
135
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)])
138
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)])
141
142 AC_MSG_TRY_COMPILE(for getpass() declaration, ftp_cv_HAVE_GETPASS_D, [
143 #include <stdlib.h>
144 #include <unistd.h> ], [ char *(*X)() = getpass ], [
145         AC_DEFINE(HAVE_GETPASS_D, 1)])
146
147 AC_MSG_TRY_COMPILE(for optarg declaration, ftp_cv_HAVE_OPTARG_D, [
148 #include <stdlib.h>
149 #include <unistd.h> ], [ char *X = optarg ], [AC_DEFINE(HAVE_OPTARG_D, 1)])
150
151 AC_MSG_TRY_COMPILE(for optind declaration, ftp_cv_HAVE_OPTIND_D, [
152 #include <stdlib.h>
153 #include <unistd.h> ], [ int X = optind ], [AC_DEFINE(HAVE_OPTIND_D, 1)])
154
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)])
157
158
159 dnl Checks for library functions.
160 dnl
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
166         AC_FUNC_GETPGRP
167 fi
168 if test $ac_cv_lib_util_fparseln != yes; then
169         AC_REPLACE_FUNCS(fparseln)
170 fi
171
172 LIBOBJS="$LIBOBJS glob.o"
173
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)])
178 fi
179
180 if test $have_long_long = yes -a $ac_cv_sizeof_off_t -ge 8; then
181
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.
185
186         AC_MSG_CHECKING(*printf() support for %lld)
187         can_printf_longlong=no
188         AC_TRY_RUN([
189                 #include <stdio.h>
190                 int main() {
191                         char buf[100];
192                         sprintf(buf, "%lld", 4294967300LL);
193                         return (strcmp(buf, "4294967300"));
194                 }
195         ], [
196                 AC_MSG_RESULT(yes)
197                 can_printf_longlong=yes
198         ], [
199                 AC_MSG_RESULT(no)
200         ], [ : ])
201
202         if test $can_printf_longlong != yes; then
203                 AC_MSG_CHECKING(*printf() support for %qd)
204                 AC_TRY_RUN([
205                         #include <stdio.h>
206                         int main() {
207                                 char buf[100];
208                                 sprintf(buf, "%qd", 4294967300LL);
209                                 return (strcmp(buf, "4294967300"));
210                         }
211                 ], [
212                         AC_MSG_RESULT(yes)
213                         can_printf_longlong=yes
214                         AC_DEFINE(HAVE_PRINTF_QD, 1)
215                 ], [
216                         AC_MSG_RESULT(no)
217                 ], [ : ])
218         fi
219
220         if test $can_printf_longlong = yes; then
221                 AC_DEFINE(HAVE_QUAD_SUPPORT, 1)
222                 AC_REPLACE_FUNCS(strtoll)
223         fi
224
225 fi
226
227
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 ], [:],
233                 have_libedit=no )
234         fi
235
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"
241                 LIBS="-ledit $LIBS"
242                 LIBEDIT=libedit.a
243                 LIBDEPENDS="$LIBDEPENDS ../libedit/libedit.a"
244         else
245                 AC_MSG_RESULT(yes)
246         fi
247 else
248         CFLAGS="-DNO_EDITCOMPLETE $CFLAGS"
249 fi
250
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"])
255 fi
256
257
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 ])
266 fi
267 AC_MSG_CHECKING(for working getaddrinfo())
268 if test $have_rfc2553_netdb = yes; then
269         AC_DEFINE(HAVE_RFC2553_NETDB, 1)
270         AC_MSG_RESULT(yes)
271 else
272         if test $ac_cv_func_getaddrinfo = yes; then
273                 LIBOBJS="$LIBOBJS getaddrinfo.o"
274                 AC_MSG_RESULT(no - using local version)
275         else
276                 AC_MSG_RESULT(using local version)
277         fi
278 fi
279
280
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 )
287 fi
288
289
290 if test -n "$LIBOBJS"; then
291         INCLUDES="$INCLUDES -I\${srcdir}/../libukem"
292         LDFLAGS="$LDFLAGS -L../libukem"
293         LIBS="$LIBS -lukem"
294         LIBUKEM=libukem.a
295         LIBDEPENDS="$LIBDEPENDS ../libukem/libukem.a"
296 fi
297
298 dnl Create the Makefiles
299 dnl
300
301 AC_SUBST(INCLUDES)
302 AC_SUBST(LIBEDIT)
303 AC_SUBST(LIBUKEM)
304 AC_SUBST(LIBDEPENDS)
305
306 AC_OUTPUT(Makefile libedit/Makefile libedit/makelist libukem/Makefile \
307         src/Makefile)