]> sjero.net Git - wget/blob - configure.in
[svn] Upgrade libtool to 1.4.
[wget] / configure.in
1 dnl Template file for GNU Autoconf
2 dnl Copyright (C) 1995, 1996, 1997, 2001 Free Software Foundation, Inc.
3
4 dnl This program is free software; you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation; either version 2 of the License, or
7 dnl (at your option) any later version.
8
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 dnl GNU General Public License for more details.
13
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program; if not, write to the Free Software
16 dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 dnl
19 dnl Process this file with autoconf to produce a configure script.
20 dnl
21
22 AC_INIT(src/version.c)
23 AC_PREREQ(2.12)
24 AC_CONFIG_HEADER(src/config.h)
25
26 dnl
27 dnl What version of Wget are we building?
28 dnl
29 VERSION=`sed -e 's/^.*"\(.*\)";$/\1/' ${srcdir}/src/version.c`
30 echo "configuring for GNU Wget $VERSION"
31 AC_SUBST(VERSION)
32 PACKAGE=wget
33 AC_SUBST(PACKAGE)
34
35 dnl
36 dnl Get cannonical host
37 dnl
38 AC_CANONICAL_HOST
39 AC_DEFINE_UNQUOTED(OS_TYPE, "$host_os")
40
41 dnl
42 dnl Process features.
43 dnl
44 AC_ARG_WITH(socks,
45 [  --with-socks            use the socks library],
46 [AC_DEFINE(HAVE_SOCKS)])
47
48 AC_ARG_WITH(ssl,
49 [  --with-ssl[=SSL_ROOT]   link with libssl [in SSL_ROOT/lib] for https: support])
50
51 AC_ARG_ENABLE(opie,
52 [  --disable-opie          disable support for opie or s/key FTP login],
53 USE_OPIE=$enableval, USE_OPIE=yes)
54 test x"${USE_OPIE}" = xyes && AC_DEFINE(USE_OPIE)
55
56 AC_ARG_ENABLE(digest,
57 [  --disable-digest        disable support for HTTP digest authorization],
58 USE_DIGEST=$enableval, USE_DIGEST=yes)
59 test x"${USE_DIGEST}" = xyes && AC_DEFINE(USE_DIGEST)
60
61 AC_ARG_ENABLE(debug,
62 [  --disable-debug         disable support for debugging output],
63 DEBUG=$enableval, DEBUG=yes)
64 test x"${DEBUG}" = xyes && AC_DEFINE(DEBUG)
65
66 case "${USE_OPIE}${USE_DIGEST}" in
67 *yes*)
68         MD5_OBJ='md5$o'
69 esac
70 if test x"$USE_OPIE" = xyes; then
71   OPIE_OBJ='ftp-opie$o'
72 fi
73 AC_SUBST(MD5_OBJ)
74 AC_SUBST(OPIE_OBJ)
75
76 dnl
77 dnl Whether make sets $(MAKE)...
78 dnl
79 AC_PROG_MAKE_SET
80
81 dnl
82 dnl Find a good install
83 dnl
84 AC_PROG_INSTALL
85
86 dnl
87 dnl Find the compiler
88 dnl
89
90 dnl We want these before the checks, so the checks can modify their values.
91 test -z "$CFLAGS"  && CFLAGS= auto_cflags=1
92 test -z "$CC" && cc_specified=yes
93
94 AC_PROG_CC
95
96 dnl
97 dnl if the user hasn't specified CFLAGS, then
98 dnl   if compiler is gcc, then use -O2 and some warning flags
99 dnl   else use os-specific flags or -O
100 dnl
101 if test -n "$auto_cflags"; then
102   if test -n "$GCC"; then
103     CFLAGS="$CFLAGS -O2 -Wall -Wno-implicit"
104   else
105     case "$host_os" in
106       *hpux*)  CFLAGS="$CFLAGS +O3"                      ;;
107       *ultrix* | *osf*) CFLAGS="$CFLAGS -O -Olimit 2000" ;;
108       *)       CFLAGS="$CFLAGS -O" ;;
109     esac
110   fi
111 fi
112
113 dnl
114 dnl Handle AIX
115 dnl
116 AC_AIX
117
118 dnl
119 dnl Configure our included libtool and make sure it's regenerated when needed
120 dnl
121 AC_PROG_LIBTOOL
122 AC_SUBST(LIBTOOL_DEPS)
123
124 dnl
125 dnl In case of {cyg,gnu}win32.  Should be a _target_ test.
126 dnl Might also be erelevant for DJGPP.
127 dnl
128 case "$host_os" in
129   *win32) exeext='.exe';;
130   *) exeext='';;
131 esac
132 AC_SUBST(exeext)
133
134 dnl
135 dnl Check if we can handle prototypes.
136 dnl
137 AM_C_PROTOTYPES
138
139 dnl
140 dnl Checks for typedefs, structures, and compiler characteristics.
141 dnl
142 AC_C_CONST
143 AC_C_INLINE
144 AC_TYPE_SIZE_T
145 AC_TYPE_PID_T
146 dnl #### This generates a warning.  What do I do to shut it up?
147 AC_C_BIGENDIAN
148
149 # Check size of long.
150 AC_CHECK_SIZEOF(long)
151 AC_CHECK_SIZEOF(long long)
152
153 dnl
154 dnl Checks for headers
155 dnl
156 AC_CHECK_HEADERS(string.h stdarg.h unistd.h sys/time.h utime.h sys/utime.h)
157 AC_CHECK_HEADERS(sys/select.h sys/utsname.h pwd.h signal.h)
158 AC_HEADER_TIME
159
160 dnl
161 dnl Return type of signal-handlers
162 dnl
163 AC_TYPE_SIGNAL
164
165 dnl
166 dnl Check for struct utimbuf
167 WGET_STRUCT_UTIMBUF
168
169 dnl
170 dnl Checks for library functions.
171 dnl
172 AC_FUNC_ALLOCA
173 AC_FUNC_MMAP
174 AC_CHECK_FUNCS(strdup strstr strcasecmp strncasecmp)
175 AC_CHECK_FUNCS(gettimeofday mktime strptime)
176 AC_CHECK_FUNCS(strerror snprintf vsnprintf select signal symlink access isatty)
177 AC_CHECK_FUNCS(uname gethostname)
178
179 dnl
180 dnl Checks for libraries.
181 dnl
182
183 dnl On Solaris, -lnsl is needed to use gethostbyname.  On "NCR MP-RAS
184 dnl 3.0", however, gethostbyname is in libc, but -lnsl is still needed
185 dnl to use -lsocket, as well as for functions such as inet_ntoa.  We
186 dnl look for such known offenders and if one of them is not found, we
187 dnl check if -lnsl is needed.
188
189 wget_check_in_nsl=NONE
190 AC_CHECK_FUNCS(gethostbyname, [], [
191   wget_check_in_nsl=gethostbyname
192 ])
193 AC_CHECK_FUNCS(inet_ntoa, [], [
194   wget_check_in_nsl=inet_ntoa
195 ])
196 if test $wget_check_in_nsl != NONE; then
197   AC_CHECK_LIB(nsl, $wget_check_in_nsl)
198 fi
199
200 AC_CHECK_LIB(socket, socket)
201
202 dnl #### This appears to be deficient with later versions of SOCKS.
203 if test "x${with_socks}" = xyes
204 then
205   AC_CHECK_LIB(resolv, main)
206   AC_CHECK_LIB(socks, Rconnect)
207 fi
208
209 dnl If --with-ssl was specified, make sure we can link with the
210 dnl OpenSSL libs.  We should probably auto-detect this by default.
211
212 if test x"$with_ssl" != x -a x"$with_ssl" != x"no"; then
213   if test x"$with_ssl" = x"yes"; then
214     dnl OpenSSL's default install location is "/usr/local/ssl".  We also
215     dnl allow /usr/local for regular-style install, and /usr for Linux
216     dnl stuff.
217     ssl_all_roots="default /usr/local/ssl /usr/local /opt"
218   else
219     dnl Root has been kindly provided by the user.
220     ssl_all_roots=$with_ssl
221   fi
222
223   wget_save_LIBS=$LIBS
224   wget_save_LDFLAGS=$LDFLAGS
225   wget_save_CC=$CC
226
227   dnl Use libtool for OpenSSL tests to handle the "-R<rpath>" option.
228   CC="$SHELL ./libtool $CC"
229
230   dnl Unfortunately, as of this writing (OpenSSL 0.9.6), the libcrypto
231   dnl shared library doesn't record its dependency on libdl, so we
232   dnl need to check for it ourselves so we won't fail to link due to a
233   dnl lack of -ldl.  Most OSes use dlopen(), but HP-UX uses
234   dnl shl_load().
235   AC_CHECK_LIB(dl,dlopen)
236   AC_CHECK_LIB(dl,shl_load)
237
238   ssl_linked=no
239
240   dnl Now try to find SSL libraries in each of the likely SSL roots.
241   for ssl_root in $ssl_all_roots
242   do
243     if test x"$ssl_root" = xdefault; then
244       dnl Try the default library locations.
245       SSL_INCLUDES=
246     else
247       dnl Try this specific root.
248       SSL_INCLUDES=-I$ssl_root/include
249       dnl It's OK to use -R directly because libtool will
250       dnl interpret it for us.
251       LDFLAGS="-L$ssl_root/lib -R$ssl_root/lib $wget_save_LDFLAGS"
252     fi
253
254     ssl_link_failure=no
255
256     AC_MSG_RESULT(["Looking for SSL libraries in $ssl_root"])
257
258     dnl Make sure that the checks don't run afoul of the cache.  It
259     dnl would be nicer to temporarily turn off the cache, but
260     dnl apparently Autoconf doesn't allow that.
261
262     unset ac_cv_lib_crypto_RSA_new
263     unset ac_cv_lib_ssl_SSL_new
264
265     dnl These checks need to be in this order, or you'll get a link
266     dnl failure if you use a static libcrypto.a and libssl.a rather
267     dnl than shared libraries.
268
269     AC_CHECK_LIB(crypto, RSA_new, , ssl_link_failure=yes)
270     AC_CHECK_LIB(ssl, SSL_new, , ssl_link_failure=yes)
271
272     dnl If ssl_link_failure is still no, the libraries link.  But we
273     dnl still need to check if the program linked with those libraries
274     dnl under these settings with run.  On some systems (Solaris), Gcc
275     dnl adds -L/usr/local/lib to the linking line, but fails to add
276     dnl -R/usr/local/lib, thus creating executables that link, but
277     dnl fail to run.
278
279     dnl If we are cross-compiling, just assume that working linkage
280     dnl implies working executable.
281
282     if test x"$ssl_link_failure" = xno; then
283       dnl Now try to run the thing.
284       AC_MSG_CHECKING("whether SSL libs are resolved at runtime")
285       AC_TRY_RUN([
286 int RSA_new();
287 int SSL_new();
288 main(){return 0;}
289 ],
290         AC_MSG_RESULT("yes"),
291         AC_MSG_RESULT("no"); ssl_link_failure=yes,
292         AC_MSG_RESULT("cross"))
293     fi
294
295     if test x"$ssl_link_failure" = xno; then
296       dnl This echo doesn't look right, but I'm not sure what to use
297       dnl instead.
298       AC_MSG_RESULT("Compiling in support for SSL in $ssl_root")
299       AC_DEFINE(HAVE_SSL)
300       AC_SUBST(SSL_INCLUDES)
301       SSL_OBJ='gen_sslfunc$o'
302       AC_SUBST(SSL_OBJ)
303       ssl_linked=yes
304       break
305     fi
306   done
307
308   if test x"$ssl_linked" = xno; then
309     LD_FLAGS=$wget_save_LDFLAGS
310     LIBS=$wget_save_LIBS
311
312     dnl Perhaps we should abort here.  Dan argues that configure
313     dnl scripts shouldn't abort out of principle, but on the other
314     dnl hand remember that the user explicitly requested linking with
315     dnl SSL.
316
317     dnl IMHO there should be a way to specify whether SSL should be
318     dnl avoided, auto-detected, or required, defaulting to
319     dnl `autodetect'.  Only in the `require' mode the script would
320     dnl abort if SSL is not found.
321     echo
322     echo "WARNING: Failed to link with OpenSSL libraries in $ssl_root/lib."
323     echo "         Wget will be built without support for https://... URLs."
324     echo
325   fi
326
327   CC=$wget_save_CC
328 fi
329
330 dnl
331 dnl Set of available languages.
332 dnl
333 ALL_LINGUAS=`(cd ${srcdir}/po && ls *.po | sed -e 's/\.po$//')`
334
335 dnl Originally this used to be static, looking like this:
336 dnl     ALL_LINGUAS="cs de hr it ..."
337 dnl The downside was that configure needed to be rebuilt whenever a
338 dnl new language was added.
339
340 dnl internationalization macros
341 WGET_WITH_NLS
342
343 dnl
344 dnl Find makeinfo.  If makeinfo is not found, look for Emacs.  If
345 dnl Emacs cannot be found, look for XEmacs.
346 dnl
347
348 AC_CHECK_PROGS(MAKEINFO, makeinfo emacs xemacs)
349
350 case "${MAKEINFO}" in
351    *makeinfo) MAKEINFO="${MAKEINFO} \$(srcdir)/wget.texi"  ;;
352    *emacs | *xemacs) MAKEINFO="${MAKEINFO} -batch -q -no-site-file -eval '(find-file \"\$(srcdir)/wget.texi\")' -l texinfmt -f texinfo-format-buffer -f save-buffer"  ;;
353    *) MAKEINFO="makeinfo \$(srcdir)/wget.texi"            ;;
354 esac
355
356 dnl
357 dnl Find perl and pod2man
358 dnl
359
360 AC_PATH_PROGS(PERL, perl5 perl, no)
361 AC_PATH_PROG(POD2MAN, pod2man, no)
362
363 if test "x${POD2MAN}" = xno; then
364   COMMENT_IF_NO_POD2MAN="# "
365 else
366   COMMENT_IF_NO_POD2MAN=
367 fi
368 AC_SUBST(COMMENT_IF_NO_POD2MAN)
369
370 dnl
371 dnl Create output
372 dnl
373 AC_OUTPUT([Makefile src/Makefile doc/Makefile util/Makefile po/Makefile.in
374            windows/Makefile],
375 [WGET_PROCESS_PO
376 test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h])