1 dnl Template file for GNU Autoconf
2 dnl Copyright (C) 1995, 1996, 1997, 2001 Free Software Foundation, Inc.
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.
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.
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.
19 dnl Process this file with autoconf to produce a configure script.
22 AC_INIT(src/version.c)
24 AC_CONFIG_HEADER(src/config.h)
27 dnl What version of Wget are we building?
29 VERSION=`sed -e 's/^.*"\(.*\)";$/\1/' ${srcdir}/src/version.c`
30 echo "configuring for GNU Wget $VERSION"
36 dnl Get cannonical host
39 AC_DEFINE_UNQUOTED(OS_TYPE, "$host_os")
45 [ --with-socks use the socks library],
46 [AC_DEFINE(HAVE_SOCKS)])
49 [ --with-ssl[=SSL_ROOT] link with libssl [in SSL_ROOT/lib] for https: support])
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)
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)
62 [ --disable-debug disable support for debugging output],
63 DEBUG=$enableval, DEBUG=yes)
64 test x"${DEBUG}" = xyes && AC_DEFINE(DEBUG)
68 case "${USE_OPIE}${USE_DIGEST}" in
72 if test x"$USE_OPIE" = xyes; then
78 dnl Whether make sets $(MAKE)...
83 dnl Find a good install
91 dnl We want these before the checks, so the checks can modify their values.
92 test -z "$CFLAGS" && CFLAGS= auto_cflags=1
93 test -z "$CC" && cc_specified=yes
98 dnl if the user hasn't specified CFLAGS, then
99 dnl if compiler is gcc, then use -O2 and some warning flags
100 dnl else use os-specific flags or -O
102 if test -n "$auto_cflags"; then
103 if test -n "$GCC"; then
104 CFLAGS="$CFLAGS -O2 -Wall -Wno-implicit"
107 *hpux*) CFLAGS="$CFLAGS +O3" ;;
108 *ultrix* | *osf*) CFLAGS="$CFLAGS -O -Olimit 2000" ;;
109 *) CFLAGS="$CFLAGS -O" ;;
120 dnl Configure our included libtool and make sure it's regenerated when needed
123 AC_SUBST(LIBTOOL_DEPS)
126 dnl In case of {cyg,gnu}win32. Should be a _target_ test.
127 dnl Might also be erelevant for DJGPP.
130 *win32) exeext='.exe';;
136 dnl Check if we can handle prototypes.
141 dnl Checks for typedefs, structures, and compiler characteristics.
147 dnl #### This generates a warning. What do I do to shut it up?
150 # Check size of long.
151 AC_CHECK_SIZEOF(long)
152 AC_CHECK_SIZEOF(long long)
155 dnl Checks for headers
157 AC_CHECK_HEADERS(string.h stdarg.h unistd.h sys/time.h utime.h sys/utime.h)
158 AC_CHECK_HEADERS(sys/select.h sys/utsname.h pwd.h signal.h)
162 dnl Return type of signal-handlers
167 dnl Check for struct utimbuf
171 dnl Checks for library functions.
175 AC_CHECK_FUNCS(strdup strstr strcasecmp strncasecmp)
176 AC_CHECK_FUNCS(gettimeofday mktime strptime)
177 AC_CHECK_FUNCS(strerror snprintf vsnprintf select signal symlink access isatty)
178 AC_CHECK_FUNCS(uname gethostname)
181 dnl Checks for libraries.
185 dnl Use the md5 lib if available (Solaris).
188 if test x$wget_need_md5 = xyes
191 AC_CHECK_LIB(md5, MD5Update, [
192 AC_DEFINE(HAVE_SOLARIS_MD5)
196 AC_DEFINE(HAVE_BUILTIN_MD5)
201 dnl On Solaris, -lnsl is needed to use gethostbyname. On "NCR MP-RAS
202 dnl 3.0", however, gethostbyname is in libc, but -lnsl is still needed
203 dnl to use -lsocket, as well as for functions such as inet_ntoa. We
204 dnl look for such known offenders and if one of them is not found, we
205 dnl check if -lnsl is needed.
207 wget_check_in_nsl=NONE
208 AC_CHECK_FUNCS(gethostbyname, [], [
209 wget_check_in_nsl=gethostbyname
211 AC_CHECK_FUNCS(inet_ntoa, [], [
212 wget_check_in_nsl=inet_ntoa
214 if test $wget_check_in_nsl != NONE; then
215 AC_CHECK_LIB(nsl, $wget_check_in_nsl)
218 AC_CHECK_LIB(socket, socket)
220 dnl #### This appears to be deficient with later versions of SOCKS.
221 if test "x${with_socks}" = xyes
223 AC_CHECK_LIB(resolv, main)
224 AC_CHECK_LIB(socks, Rconnect)
227 dnl If --with-ssl was specified, make sure we can link with the
228 dnl OpenSSL libs. We should probably auto-detect this by default.
230 if test x"$with_ssl" != x -a x"$with_ssl" != x"no"; then
231 if test x"$with_ssl" = x"yes"; then
232 dnl OpenSSL's default install location is "/usr/local/ssl". We also
233 dnl allow /usr/local for regular-style install, and /usr for Linux
235 ssl_all_roots="default /usr/local/ssl /usr/local /opt"
237 dnl Root has been kindly provided by the user.
238 ssl_all_roots=$with_ssl
242 wget_save_LDFLAGS=$LDFLAGS
245 dnl Use libtool for OpenSSL tests to handle the "-R<rpath>" option.
246 CC="$SHELL ./libtool $CC"
248 dnl Unfortunately, as of this writing (OpenSSL 0.9.6), the libcrypto
249 dnl shared library doesn't record its dependency on libdl, so we
250 dnl need to check for it ourselves so we won't fail to link due to a
251 dnl lack of -ldl. Most OSes use dlopen(), but HP-UX uses
253 AC_CHECK_LIB(dl,dlopen)
254 AC_CHECK_LIB(dl,shl_load)
258 dnl Now try to find SSL libraries in each of the likely SSL roots.
259 for ssl_root in $ssl_all_roots
261 if test x"$ssl_root" = xdefault; then
262 dnl Try the default library locations.
265 dnl Try this specific root.
266 SSL_INCLUDES=-I$ssl_root/include
267 dnl It's OK to use -R directly because libtool will
268 dnl interpret it for us.
269 LDFLAGS="-L$ssl_root/lib -R$ssl_root/lib $wget_save_LDFLAGS"
274 AC_MSG_RESULT(["Looking for SSL libraries in $ssl_root"])
276 dnl Make sure that the checks don't run afoul of the cache. It
277 dnl would be nicer to temporarily turn off the cache, but
278 dnl apparently Autoconf doesn't allow that.
280 unset ac_cv_lib_crypto_RSA_new
281 unset ac_cv_lib_ssl_SSL_new
283 dnl These checks need to be in this order, or you'll get a link
284 dnl failure if you use a static libcrypto.a and libssl.a rather
285 dnl than shared libraries.
287 AC_CHECK_LIB(crypto, RSA_new, , ssl_link_failure=yes)
288 AC_CHECK_LIB(ssl, SSL_new, , ssl_link_failure=yes)
290 dnl If ssl_link_failure is still no, the libraries link. But we
291 dnl still need to check if the program linked with those libraries
292 dnl under these settings with run. On some systems (Solaris), Gcc
293 dnl adds -L/usr/local/lib to the linking line, but fails to add
294 dnl -R/usr/local/lib, thus creating executables that link, but
297 dnl If we are cross-compiling, just assume that working linkage
298 dnl implies working executable.
300 if test x"$ssl_link_failure" = xno; then
301 dnl Now try to run the thing.
302 AC_MSG_CHECKING("whether SSL libs are resolved at runtime")
308 AC_MSG_RESULT("yes"),
309 AC_MSG_RESULT("no"); ssl_link_failure=yes,
310 AC_MSG_RESULT("cross"))
313 if test x"$ssl_link_failure" = xno; then
314 dnl This echo doesn't look right, but I'm not sure what to use
316 AC_MSG_RESULT("Compiling in support for SSL in $ssl_root")
318 AC_SUBST(SSL_INCLUDES)
319 SSL_OBJ='gen_sslfunc$o'
326 if test x"$ssl_linked" = xno; then
327 LD_FLAGS=$wget_save_LDFLAGS
330 dnl Perhaps we should abort here. Dan argues that configure
331 dnl scripts shouldn't abort out of principle, but on the other
332 dnl hand remember that the user explicitly requested linking with
335 dnl IMHO there should be a way to specify whether SSL should be
336 dnl avoided, auto-detected, or required, defaulting to
337 dnl `autodetect'. Only in the `require' mode the script would
338 dnl abort if SSL is not found.
340 echo "WARNING: Failed to link with OpenSSL libraries in $ssl_root/lib."
341 echo " Wget will be built without support for https://... URLs."
349 dnl Set of available languages.
351 ALL_LINGUAS=`(cd ${srcdir}/po && ls *.po | sed -e 's/\.po$//')`
353 dnl Originally this used to be static, looking like this:
354 dnl ALL_LINGUAS="cs de hr it ..."
355 dnl The downside was that configure needed to be rebuilt whenever a
356 dnl new language was added.
358 dnl internationalization macros
362 dnl Find makeinfo. If makeinfo is not found, look for Emacs. If
363 dnl Emacs cannot be found, look for XEmacs.
366 AC_CHECK_PROGS(MAKEINFO, makeinfo emacs xemacs)
368 case "${MAKEINFO}" in
369 *makeinfo) MAKEINFO="${MAKEINFO} \$(srcdir)/wget.texi" ;;
370 *emacs | *xemacs) MAKEINFO="${MAKEINFO} -batch -q -no-site-file -eval '(find-file \"\$(srcdir)/wget.texi\")' -l texinfmt -f texinfo-format-buffer -f save-buffer" ;;
371 *) MAKEINFO="makeinfo \$(srcdir)/wget.texi" ;;
375 dnl Find perl and pod2man
378 AC_PATH_PROGS(PERL, perl5 perl, no)
379 AC_PATH_PROG(POD2MAN, pod2man, no)
381 if test "x${POD2MAN}" = xno; then
382 COMMENT_IF_NO_POD2MAN="# "
384 COMMENT_IF_NO_POD2MAN=
386 AC_SUBST(COMMENT_IF_NO_POD2MAN)
391 AC_OUTPUT([Makefile src/Makefile doc/Makefile util/Makefile po/Makefile.in
394 test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h])