]> sjero.net Git - wget/blob - configure.in
[svn] configure.in: Christian Fraenkel's tests for -lcrypto and -lssl were in the
[wget] / configure.in
1 dnl Template file for GNU Autoconf
2 dnl Copyright (C) 1995, 1996, 1997 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 Configure our included libtool
88 dnl
89 AM_PROG_LIBTOOL
90
91 dnl
92 dnl Find the compiler
93 dnl
94
95 dnl We want these before the checks, so the checks can modify their values.
96 test -z "$CFLAGS"  && CFLAGS= auto_cflags=1
97 test -z "$CC" && cc_specified=yes
98
99 AC_PROG_CC
100
101 dnl
102 dnl if the user hasn't specified CFLAGS, then
103 dnl   if compiler is gcc, then use -O2 and some warning flags
104 dnl   else use os-specific flags or -O
105 dnl
106 if test -n "$auto_cflags"; then
107   if test -n "$GCC"; then
108     CFLAGS="$CFLAGS -O2 -Wall -Wno-implicit"
109   else
110     case "$host_os" in
111       *hpux*)  CFLAGS="$CFLAGS +O3"                      ;;
112       *ultrix* | *osf*) CFLAGS="$CFLAGS -O -Olimit 2000" ;;
113       *)       CFLAGS="$CFLAGS -O" ;;
114     esac
115   fi
116 fi
117
118 dnl
119 dnl Handle AIX
120 dnl
121 AC_AIX
122
123 dnl
124 dnl In case of {cyg,gnu}win32.  Should be a _target_ test.
125 dnl Might also be erelevant for DJGPP.
126 dnl
127 case "$host_os" in
128   *win32) exeext='.exe';;
129   *) exeext='';;
130 esac
131 AC_SUBST(exeext)
132
133 dnl
134 dnl Check if we can handle prototypes.
135 dnl
136 AM_C_PROTOTYPES
137
138 dnl
139 dnl Checks for typedefs, structures, and compiler characteristics.
140 dnl
141 AC_C_CONST
142 AC_TYPE_SIZE_T
143 AC_TYPE_PID_T
144 dnl #### This generates a warning.  What do I do to shut it up?
145 AC_C_BIGENDIAN
146
147 # Check size of long.
148 AC_CHECK_SIZEOF(long)
149 AC_CHECK_SIZEOF(long long)
150
151 dnl
152 dnl Checks for headers
153 dnl
154 AC_CHECK_HEADERS(string.h stdarg.h unistd.h sys/time.h utime.h sys/utime.h)
155 AC_CHECK_HEADERS(sys/select.h sys/utsname.h pwd.h signal.h)
156 AC_HEADER_TIME
157
158 dnl
159 dnl Return type of signal-handlers
160 dnl
161 AC_TYPE_SIGNAL
162
163 dnl
164 dnl Check for struct utimbuf
165 WGET_STRUCT_UTIMBUF
166
167 dnl
168 dnl Checks for library functions.
169 dnl
170 AC_FUNC_ALLOCA
171 AC_FUNC_MMAP
172 AC_CHECK_FUNCS(strdup strstr strcasecmp strncasecmp)
173 AC_CHECK_FUNCS(gettimeofday mktime strptime)
174 AC_CHECK_FUNCS(strerror snprintf vsnprintf select signal symlink access isatty)
175 AC_CHECK_FUNCS(uname gethostname)
176
177 AC_CHECK_FUNCS(gethostbyname, [], [
178   AC_CHECK_LIB(nsl, gethostbyname)
179 ])
180
181 dnl
182 dnl Checks for libraries.
183 dnl
184
185 AC_CHECK_LIB(socket, socket)
186
187 dnl #### This appears to be deficient with later versions of SOCKS.
188 if test "x${with_socks}" = xyes
189 then
190   AC_CHECK_LIB(resolv, main)
191   AC_CHECK_LIB(socks, Rconnect)
192 fi
193
194 dnl If --with-ssl was specified, make sure we can link with the OpenSSL libs.
195 if test x"$with_ssl" != x -a x"$with_ssl" != x"no"; then
196   if test x"$with_ssl" = x"yes"; then
197     dnl OpenSSL's default install location:
198     with_ssl=/usr/local/ssl
199   fi
200   
201   SSL_INCLUDES=-I$with_ssl/include
202   AC_SUBST(SSL_INCLUDES)
203
204   LDFLAGS="-L$with_ssl/lib -R$with_ssl/lib $LDFLAGS"
205
206   ssl_link_failure=no
207
208   dnl Unfortunately, as of this writing (OpenSSL 0.9.6), the libcrypto shared
209   dnl library doesn't record its dependency on libdl, so we need to check for it
210   dnl ourselves so we won't fail to link due to a lack of -ldl.  Most OSes use
211   dnl dlopen(), but HP-UX uses shl_load().
212   AC_CHECK_LIB(dl,dlopen)
213   AC_CHECK_LIB(dl,shl_load)
214
215   dnl These checks need to be in this order, or you'll get a link failure if you
216   dnl use a static libcrypto.a and libssl.a rather than shared libraries.
217   AC_CHECK_LIB(crypto,RSA_new,,ssl_link_failure=yes)
218   AC_CHECK_LIB(ssl,SSL_new,,ssl_link_failure=yes)
219
220   if test x"$ssl_link_failure" = x"yes"; then
221     echo
222     echo "WARNING: Failed to link with OpenSSL libraries in $with_ssl/lib."
223     echo "         Wget will be built without support for https://... URLs."
224     echo
225   else
226     AC_DEFINE(HAVE_SSL)
227     SSL_OBJ='gen_sslfunc$o'
228     AC_SUBST(SSL_OBJ)
229   fi
230 fi
231
232 dnl
233 dnl Set of available languages.
234 dnl
235 ALL_LINGUAS=`(cd ${srcdir}/po && ls *.po | sed -e 's/\.po$//')`
236
237 dnl Original from autoconf, I think.
238 dnl ALL_LINGUAS="cs de hr it no pl pt_BR ru"
239
240 dnl internationalization macros
241 WGET_WITH_NLS
242
243 dnl
244 dnl Find makeinfo.  If makeinfo is not found, look for Emacs.  If
245 dnl Emacs cannot be found, look for XEmacs.
246 dnl
247
248 AC_CHECK_PROGS(MAKEINFO, makeinfo emacs xemacs)
249
250 case "${MAKEINFO}" in
251    *makeinfo) MAKEINFO="${MAKEINFO} \$(srcdir)/wget.texi"  ;;
252    *emacs | *xemacs) MAKEINFO="${MAKEINFO} -batch -q -no-site-file -eval '(find-file \"\$(srcdir)/wget.texi\")' -l texinfmt -f texinfo-format-buffer -f save-buffer"  ;;
253    *) MAKEINFO="makeinfo \$(srcdir)/wget.texi"            ;;
254 esac
255
256 dnl
257 dnl Find perl and pod2man
258 dnl
259
260 AC_PATH_PROGS(PERL, perl5 perl, no)
261 AC_PATH_PROG(POD2MAN, pod2man, no)
262
263 if test "x${POD2MAN}" = xno; then
264   COMMENT_IF_NO_POD2MAN="# "
265 else
266   COMMENT_IF_NO_POD2MAN=
267 fi
268 AC_SUBST(COMMENT_IF_NO_POD2MAN)
269
270 dnl
271 dnl Create output
272 dnl
273 AC_OUTPUT([Makefile src/Makefile doc/Makefile util/Makefile po/Makefile.in
274            windows/Makefile],
275 [WGET_PROCESS_PO
276 test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h])