/
configure.in
331 lines (290 loc) · 9.08 KB
/
configure.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.13)
AC_INIT(src/ftpclass.cc)
AM_INIT_AUTOMAKE(lftp, 2.3.11)
AM_CONFIG_HEADER(include/config.h)
dnl Default AC_C_INLINE does not know about C++
builtin(define,[AC_C_INLINE],[LFTP_C_INLINE])
LIBOBJS=''
AC_SUBST(LIBOBJS)
test -z "$CXX" && DEFAULT_CXX=yes
test -z "$CFLAGS" && DEFAULT_CFLAGS=yes
test -z "$CXXFLAGS" && DEFAULT_CXXFLAGS=yes
test -z "$LDFLAGS" && DEFAULT_LDFLAGS=yes
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CXX
dnl AC_CANONICAL_HOST
AC_ISC_POSIX
if test "`uname`" = Linux; then
case "`uname -r`" in
# Linux-2.2.x and older don't support fcntl64.
2.2.*|2.0.*) enable_largefile=no;;
esac
fi
AC_SYS_LARGEFILE
AC_PROG_YACC
if test x$ac_cv_lib_fl_yywrap = xno; then
AC_DEFINE(NEED_YYWRAP)
fi
AC_ARG_WITH(locale-dir,
[ --with-locale-dir=DIR specify locale directory],
LOCALE_DIR=$withval)
test -z "$LOCALE_DIR" && LOCALE_DIR='$(datadir)/locale'
AC_SUBST(LOCALE_DIR)
ALL_LINGUAS="de es fr it ja ko pl pt_BR ru zh_CN zh_TW"
AM_GNU_GETTEXT
if test x$USE_INCLUDED_LIBINTL = xyes; then
LINK_SRC="$LINK_SRC intl/libgnuintl.h"
LINK_DST="$LINK_DST include/libintl.h"
fi
test "$MSGFMT" = "no" && MSGFMT ="$missing_dir/missing msgfmt"
test "$GMSGFMT" = "no" && GMSGFMT ="$missing_dir/missing msgfmt"
test "$XGETTEXT" = ":" && XGETTEXT="$missing_dir/missing xgettext"
if test x$gt_cv_func_gettext_libintl = xyes; then
case "$LIBS" in
*-lintl*) ;;
*) LIBS="$LIBS -lintl";;
esac
fi
CXX_DYNAMIC_INITIALIZERS
AC_ARG_PROGRAM
AC_ARG_WITH(debug,
[ --with-debug enable debug info],
[ with_debug=$withval; ],
[ with_debug=no; ])
if test x$with_debug = xno; then
if test x$DEFAULT_CFLAGS = xyes; then
CFLAGS="`echo $CFLAGS | sed 's/-g//'`"
if test -z "$CFLAGS"; then
CFLAGS=-O
fi
fi
if test x$DEFAULT_CXXFLAGS = xyes; then
CXXFLAGS="`echo $CXXFLAGS | sed 's/-g//'`"
if test -z "$CXXFLAGS"; then
CXXFLAGS=-O
fi
fi
if test x$DEFAULT_LDFLAGS = xyes; then
LDFLAGS="$LDFLAGS -s"
fi
fi
if test x$GCC = xyes; then
CFLAGS="$CFLAGS -Wall"
fi
if test x$GXX = xyes; then
CXXFLAGS="$CXXFLAGS -Wall -Wwrite-strings -Woverloaded-virtual"
# save some bytes
LFTP_CHECK_CXX_FLAGS([-fno-exceptions -fno-rtti])
if test x$DEFAULT_CXX = xyes; then
LFTP_PROG_CXXLINK
fi
# checl for -fno-implement-inline
LFTP_NOIMPLEMENTINLINE
fi
test -z "$enable_static" && enable_static=no
AM_PROG_LIBTOOL
LIBTOOL="$LIBTOOL --silent"
AC_ARG_WITH(socks,
[ --with-socks build with SOCKSv4 library],
[ with_socks=$withval; ],
[ with_socks=no; ])
if test x$with_socks = xyes; then
AC_DEFINE(SOCKS4)
SOCKSLIBS=-lsocks
fi
AC_ARG_WITH(socks5,
[ --with-socks5 build with SOCKSv5 library],
[ with_socks5=$withval;],
[ with_socks5=no; ])
if test x$with_socks5 = xyes; then
AC_DEFINE(SOCKS5)
SOCKSLIBS=-lsocks5
fi
AC_ARG_WITH(socksdante,
[ --with-socksdante build with SOCKS-Dante library],
[ with_socksdante=$withval;],
[ with_socksdante=no; ])
if test x$with_socksdante = xyes; then
AC_DEFINE(SOCKS_DANTE)
SOCKSLIBS=-lsocks
fi
AC_SUBST(SOCKSLIBS)
AC_ARG_WITH(modules,
[ --with-modules build modular lftp (protocols become dll's)],
[ with_modules=$withval; ],
[ with_modules=no; ])
if test "$with_modules" = yes; then
AC_DEFINE(WITH_MODULES)
MODULES_LA="proto-ftp.la proto-http.la proto-file.la cmd-mirror.la cmd-sleep.la libnetwork.la"
LFTP_SSL_LDFLAGS=
LFTP_SSL_LIBS=
else
LFTP_SSL_LDFLAGS='$(SSL_LDFLAGS)'
LFTP_SSL_LIBS='$(SSL_LIBS)'
fi
AC_SUBST(MODULES)
AC_SUBST(MODULES_LA)
AC_SUBST(LFTP_SSL_LDFLAGS)
AC_SUBST(LFTP_SSL_LIBS)
dnl Checks for libraries.
LFTP_CHECK_LIBM
dnl This won't work for glibc2
dnl AC_SEARCH_LIBS(md5_process_bytes,crypt,[AC_DEFINE(HAVE_MD5)])
AC_SEARCH_LIBS(socket,socket)
AC_SEARCH_LIBS(gethostbyname,nsl)
AC_SEARCH_LIBS(dlopen,dl,[AC_DEFINE(HAVE_DLOPEN)])
AC_SEARCH_LIBS(res_search,resolv bind,[AC_DEFINE(HAVE_RES_SEARCH)])
IU_CHECK_DECL(res_search, [
#include <stdio.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
])
AC_ARG_WITH(libresolv, [ --without-libresolv don't use libresolv],
[with_libresolv=$withval], [with_libresolv=yes])
if test x$with_libresolv = xyes; then
AC_SEARCH_LIBS(hstrerror, resolv)
fi
AC_SUBST(READLINE_SUPPLIB)
AC_CHECK_FUNC(tgetent,
[READLINE_SUPPLIB=],
[AC_CHECK_LIB(curses, tgetent,
[READLINE_SUPPLIB=-lcurses],
[AC_CHECK_LIB(ncurses, tgetent,
[READLINE_SUPPLIB=-lncurses],
[AC_CHECK_LIB(termcap, tgetent,
[READLINE_SUPPLIB=-ltermcap],
[AC_MSG_WARN(No termcap nor curses library found)])
])
])
])
READLINE_CHECK
AC_ARG_WITH(ssl, [ --with-ssl[=/path] use SSL [at /path]
--without-ssl don't use SSL],
[with_ssl=$withval], [with_ssl=yes])
case "$with_ssl" in
yes) : ;;
""|no) : ;;
*) ssl_loc=$with_ssl
with_ssl=yes ;;
esac
if test x$with_ssl = xyes; then
LFTP_SSL_CHECK
fi
dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
AC_CHECK_HEADERS(fcntl.h sys/time.h errno.h stdlib.h varargs.h dirent.h\
termios.h termio.h sys/select.h sys/poll.h sys/stropts.h string.h memory.h\
strings.h sys/ioctl.h dlfcn.h resolv.h arpa/nameser.h netinet/tcp.h\
langinfo.h endian.h regex.h)
# See if the system has strerror, and replace it if not
AC_CHECK_FUNC(strerror, AC_DEFINE(HAVE_STRERROR), LIBOBJS="$LIBOBJS strerror.o")
if test "$ac_cv_func_strerror" = no; then
# No strerror, so see if the SYS_ERRLIST variable can be used by ours
AC_CHECK_FUNC(sys_errlist)
if test "$ac_cv_func_sys_errlist" = yes; then
IU_CHECK_DECL(sys_errlist, [
#include <stdio.h>
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif])
fi
fi
# See if we have h_errno (the test is here so we can use -lresolv if necessary).
AC_CACHE_CHECK([for h_errno], inetutils_cv_var_h_errno,
AC_TRY_COMPILE([#include <netdb.h>],
[ #ifndef h_errno
extern int h_errno;
#endif
int iu_x = h_errno; ],
inetutils_cv_var_h_errno=yes, inetutils_cv_var_h_errno=no))
if test "$inetutils_cv_var_h_errno" = yes; then
AC_DEFINE(HAVE_H_ERRNO)
IU_CHECK_DECL(h_errno, [#include <netdb.h>])
fi
# See if the system has hstrerror, and replace it if not
AC_CHECK_FUNC(hstrerror, , LIBOBJS="$LIBOBJS hstrerror.o")
if test "$ac_cv_func_hstrerror" = yes; then
IU_CHECK_DECL(hstrerror, [#include <netdb.h>])
else
# No hstrerror, so see if the H_ERRLIST variable can be used by ours
AC_CHECK_FUNC(h_errlist)
if test "$ac_cv_func_h_errlist" = yes; then
IU_CHECK_DECL(h_errlist, [#include <netdb.h>])
fi
fi
if test "$ac_cv_func_hstrerror" = yes -o "$ac_cv_func_h_errlist" = yes; then
# If there's a system hstrerror, or we can reasonably replace it, say so.
# We still provide some definition, regardless, but this allows people to use
# a reasonable alternative if the situation allows, rather than using a
# degenerate version that only says `Host lookup error N'.
AC_DEFINE(HAVE_HSTRERROR)
fi
dnl Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_PID_T
AC_STRUCT_TM
# these are checked by AM_GNU_GETTEXT
dnl AC_C_CONST
dnl AC_C_INLINE
dnl AC_TYPE_OFF_T
dnl AC_TYPE_SIZE_T
if test x$ac_cv_header_endian_h = xno; then
AC_C_BIGENDIAN
fi
TYPE_SOCKLEN_T
AC_STRUCT_TIMEZONE
dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_FUNC_UTIME_NULL
AC_FUNC_GETPGRP
AC_FUNC_VPRINTF
AC_FUNC_FNMATCH
AC_HEADER_STAT
LFTP_FUNC_POLL
LFTP_FUNC_SSCANF_CONST
AC_CHECK_FUNCS(strdup strstr lstat select regexec glob\
killpg setpgid tcgetattr ftruncate vsnprintf gettimeofday\
gethostbyname2 getipnodebyname getaddrinfo getnameinfo setsid)
IU_CHECK_DECL(vsnprintf, [#include <stdio.h>])
AC_REPLACE_FUNCS(mktime memmove strcasecmp strncasecmp strtol strtoul strptime)
IU_CHECK_DECL(strcasecmp, [#include <string.h>])
IU_CHECK_DECL(strptime, [#include <time.h>])
IU_CHECK_DECL(random, [#include <stdlib.h>])
# always want GNU getopt
LIBOBJS="$LIBOBJS getopt.o getopt1.o"
if test x$lftp_cv_func_poll_works = xno; then
LIBOBJS="$LIBOBJS poll.o"
LINK_SRC="$LINK_SRC lib/poll.h"
LINK_DST="$LINK_DST include/poll.h"
fi
if test x$ac_cv_func_regexec = xno -o x$ac_cv_header_regex_h = xno; then
LIBOBJS="$LIBOBJS regex.o"
LINK_SRC="$LINK_SRC lib/regex.h"
LINK_DST="$LINK_DST include/regex.h"
fi
if test x$ac_cv_func_glob = xno; then
LIBOBJS="$LIBOBJS glob.o"
LINK_SRC="$LINK_SRC lib/glob.h"
LINK_DST="$LINK_DST include/glob.h"
fi
if test x$ac_cv_func_fnmatch_works = xno; then
LIBOBJS="$LIBOBJS fnmatch.o"
LINK_SRC="$LINK_SRC lib/fnmatch.h"
LINK_DST="$LINK_DST include/fnmatch.h"
AC_DEFINE_UNQUOTED(fnmatch, rpl_fnmatch)
fi
if test "$prefix" = /usr -a "$sysconfdir" = '${prefix}/etc'; then
sysconfdir=/etc
fi
AC_LINK_FILES($LINK_SRC,$LINK_DST)
dnl Avoid autoconf bug (?)
builtin(define, [AC_OUTPUT_LINKS_ORIG], defn([AC_OUTPUT_LINKS]))
builtin(define, [AC_OUTPUT_LINKS], [AC_OUTPUT_LINKS_ORIG([`echo $1`], [`echo $2`])])
AC_OUTPUT(Makefile src/Makefile lib/Makefile include/Makefile doc/Makefile
readline-4.2/Makefile intl/Makefile po/Makefile.in m4/Makefile)