~ubuntu-branches/ubuntu/precise/wget/precise-proposed

« back to all changes in this revision

Viewing changes to configure.in

  • Committer: Bazaar Package Importer
  • Author(s): Noèl Köthe
  • Date: 2005-10-13 16:59:03 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051013165903-3e12j4gn6znkhmdb
Tags: 1.10.2-1
new upstream release which fixes a NTLM Buffer Overflow Vulnerability

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
dnl
31
31
 
32
32
AC_INIT([src/version.c])
33
 
AC_PREREQ(2.57)
 
33
AC_PREREQ(2.59)
 
34
 
 
35
dnl Include the M4 macros we use.
 
36
builtin(include, [m4/wget.m4])dnl
 
37
builtin(include, [m4/lib-ld.m4])dnl
 
38
builtin(include, [m4/lib-link.m4])dnl
 
39
builtin(include, [m4/lib-prefix.m4])dnl
34
40
 
35
41
dnl
36
42
dnl What version of Wget are we building?
53
59
dnl
54
60
 
55
61
AC_ARG_WITH(ssl,
56
 
[[  --with-ssl[=SSL-ROOT]   link with SSL support [default=auto]
57
 
  --without-ssl           disable SSL autodetection]])
 
62
[[  --without-ssl           disable SSL autodetection]])
58
63
 
59
64
AC_ARG_ENABLE(opie,
60
65
[  --disable-opie          disable support for opie or s/key FTP login],
131
136
fi
132
137
 
133
138
dnl
134
 
dnl Configure our included libtool and make sure it's regenerated when needed
135
 
dnl
136
 
AC_PROG_LIBTOOL
137
 
AC_SUBST(LIBTOOL_DEPS)
138
 
 
139
 
dnl
140
139
dnl In case of {cyg,gnu}win32.  Should be a _target_ test.
141
140
dnl Might also be erelevant for DJGPP.
142
141
dnl
219
218
AC_FUNC_MMAP
220
219
AC_FUNC_FSEEKO
221
220
AC_CHECK_FUNCS(strdup strstr strcasecmp strncasecmp strpbrk memmove)
222
 
AC_CHECK_FUNCS(gettimeofday mktime strptime strerror snprintf vsnprintf)
 
221
AC_CHECK_FUNCS(gettimeofday mktime strptime timegm strerror snprintf vsnprintf)
223
222
AC_CHECK_FUNCS(usleep select ftello sigblock sigsetjmp signal)
224
 
AC_CHECK_FUNCS(symlink access isatty)
 
223
AC_CHECK_FUNCS(symlink access isatty strtoll strtoimax)
225
224
 
226
225
dnl
227
226
dnl Call Wget's local macros defined in aclocal.
245
244
dnl Checks for libraries.
246
245
dnl
247
246
 
248
 
dnl $with_ssl can be one of:
249
 
dnl  - empty string or "auto", meaning autodetect SSL and use it if found.
250
 
dnl  - "yes", meaning link with SSL or bail out.
251
 
dnl  - "no", meaning don't link with SSL.
252
 
dnl  - anything else, meaning use that as the SSL root, and bail out
253
 
dnl    if it fails.
254
 
 
255
 
if test x"$with_ssl" = x; then
256
 
  dnl Canonicalize unspecified with-ssl setting to "auto".  This
257
 
  dnl implements the "auto-detect by default" feature.  If you want to
258
 
  dnl change this to "ignore SSL by default", change "auto" to "no".
259
 
  with_ssl=auto
260
 
fi
261
 
 
262
 
dnl Detection of OpenSSL is much hairier than the detection of other
263
 
dnl libraries because OpenSSL can be compiled as a third-party
264
 
dnl library, which means it will not be found without additional
265
 
dnl linker magic.  It would be really nice to rework this check into
266
 
dnl an AC_DEFUN so that we can reuse it for other third-party
267
 
dnl libraries.
268
 
 
269
 
if test x"$with_ssl" != x"no"; then
270
 
 
271
 
  wget_force_ssl=no
272
 
  if test x"$with_ssl" = x"yes"; then
273
 
    wget_force_ssl=yes
274
 
  fi
275
 
 
276
 
  if test x"$with_ssl" = x"yes" || test x"$with_ssl" = x"auto"; then
277
 
    dnl OpenSSL's root was not specified, so we have to guess.  First
278
 
    dnl try the system default location, then "/usr/local/ssl" (where
279
 
    dnl OpenSSL installs by default), then "/usr/local" (traditional
280
 
    dnl choice for installation root), then "/opt".
281
 
    ssl_all_roots="system-default /usr/local/ssl /usr/local /opt"
282
 
  else
283
 
    dnl Root has been specified by the user.
284
 
    ssl_all_roots=$with_ssl
285
 
    wget_force_ssl=yes
286
 
  fi
287
 
 
288
 
  wget_save_CC=$CC
289
 
  wget_save_LIBS=$LIBS
290
 
  wget_save_LDFLAGS=$LDFLAGS
291
 
  wget_save_CPPFLAGS=$CPPFLAGS
292
 
 
293
 
  dnl Use libtool for OpenSSL tests so we can specify "-R<rpath>"
294
 
  dnl without having to know how the linker handles it.
295
 
  CC="$SHELL ./libtool $CC"
296
 
 
297
 
  dnl Unfortunately, as of this writing (OpenSSL 0.9.6), the libcrypto
298
 
  dnl shared library doesn't record its dependency on libdl, so we
299
 
  dnl need to check for it ourselves so we won't fail to link due to a
300
 
  dnl lack of -ldl.  Most OSes use dlopen(), but HP-UX uses
301
 
  dnl shl_load().
302
 
  AC_CHECK_LIB(dl,dlopen)
303
 
  AC_CHECK_LIB(dl,shl_load)
304
 
 
305
 
  ssl_success=no
306
 
 
307
 
  dnl Now try to find SSL libraries in each of the likely SSL roots.
308
 
  for ssl_root in $ssl_all_roots
309
 
  do
310
 
    if test x"$ssl_root" = x"system-default"; then
311
 
      dnl Try the default include and library locations.
312
 
      SSL_INCLUDES=
313
 
    else
314
 
      dnl Try this specific root.
315
 
      SSL_INCLUDES=-I$ssl_root/include
316
 
      dnl It's OK to use -R directly because libtool will
317
 
      dnl interpret it for us.
318
 
      LDFLAGS="-L$ssl_root/lib -R$ssl_root/lib $wget_save_LDFLAGS"
319
 
    fi
320
 
 
321
 
    AC_MSG_NOTICE([looking for SSL libraries in $ssl_root])
322
 
 
323
 
    dnl Check whether the compiler can find the include files.  On
324
 
    dnl some systems Gcc finds libraries in /usr/local/lib, but fails
325
 
    dnl to find the includes in /usr/local/include.
326
 
 
327
 
    ssl_found_includes=no
328
 
    CPPFLAGS="$SSL_INCLUDES $wget_save_CPPFLAGS"
329
 
 
330
 
    dnl Check for all the OpenSSL includes that Wget actually uses.
331
 
    dnl This will prune both invalid installations and ancient
332
 
    dnl versions of OpenSSL that we can't use.
333
 
    AC_MSG_CHECKING([for includes])
334
 
    AC_COMPILE_IFELSE([
 
247
dnl Check for OpenSSL
 
248
if test x"$with_ssl" != x"no"
 
249
then
 
250
  dnl As of this writing (OpenSSL 0.9.6), the libcrypto shared library
 
251
  dnl doesn't record its dependency on libdl, so we need to make sure
 
252
  dnl -ldl ends up in LIBS on systems that have it.  Most OSes use
 
253
  dnl dlopen(), but HP-UX uses shl_load().
 
254
  AC_CHECK_LIB(dl, dlopen, [], [
 
255
    AC_CHECK_LIB(dl, shl_load)
 
256
  ])
 
257
 
 
258
  dnl Now actually check for -lssl
 
259
  AC_LIB_HAVE_LINKFLAGS([ssl], [crypto], [
335
260
#include <openssl/ssl.h>
336
261
#include <openssl/x509.h>
337
262
#include <openssl/err.h>
339
264
#include <openssl/des.h>
340
265
#include <openssl/md4.h>
341
266
#include <openssl/md5.h>
342
 
    ], [
343
 
      AC_MSG_RESULT(found)
344
 
      ssl_found_includes=yes
345
 
    ], [
346
 
      AC_MSG_RESULT([not found])
347
 
    ])
348
 
 
349
 
    if test x"$ssl_found_includes" = xno; then
350
 
      continue
351
 
    fi
352
 
 
353
 
    ssl_link_failure=no
354
 
 
355
 
    dnl Make sure that the checks don't run afoul of the cache.  It
356
 
    dnl would be nicer to temporarily turn off the cache, but
357
 
    dnl apparently Autoconf doesn't allow that.
358
 
 
359
 
    unset ac_cv_lib_crypto_RSA_new
360
 
    unset ac_cv_lib_ssl_SSL_new
361
 
 
362
 
    dnl These checks need to be in this order, or you'll get a link
363
 
    dnl failure if you use a static libcrypto.a and libssl.a rather
364
 
    dnl than shared libraries.
365
 
 
366
 
    AC_CHECK_LIB(crypto, RSA_new, , ssl_link_failure=yes)
367
 
    AC_CHECK_LIB(ssl, SSL_new, , ssl_link_failure=yes)
368
 
 
369
 
    if test x"$ssl_link_failure" = xyes; then
370
 
      dnl One or both libs failed to link.
371
 
      continue
372
 
    fi
373
 
 
374
 
    dnl The libraries link.  But we still need to check if the program
375
 
    dnl linked with those libraries under these settings with run.  On
376
 
    dnl some systems (Solaris), Gcc adds -L/usr/local/lib to the
377
 
    dnl linking line, but fails to add -R/usr/local/lib, thus creating
378
 
    dnl executables that link, but fail to run.
379
 
 
380
 
    dnl If we are cross-compiling, just assume that working linkage
381
 
    dnl implies working executable.
382
 
 
383
 
    ssl_run_failure=no
384
 
 
385
 
    AC_MSG_CHECKING([whether SSL libs are resolved at runtime])
386
 
    AC_TRY_RUN([
387
 
int RSA_new();
388
 
int SSL_new();
389
 
main(){return 0;}
390
 
],
391
 
      AC_MSG_RESULT(yes),
392
 
      AC_MSG_RESULT(no); ssl_run_failure=yes,
393
 
      AC_MSG_RESULT(cross)
394
 
    )
395
 
 
396
 
    if test x"$ssl_run_failure" = xno; then
397
 
      ssl_success=yes
398
 
      break
399
 
    fi
400
 
  done
401
 
 
402
 
  if test x"$ssl_success" = xyes; then
403
 
    AC_MSG_NOTICE([compiling in support for SSL in $ssl_root])
 
267
  ], [SSL_library_init ()])
 
268
  if test x"$LIBSSL" != x
 
269
  then
 
270
    AC_MSG_NOTICE([compiling in support for SSL])
404
271
    AC_DEFINE([HAVE_SSL], 1,
405
 
              [Define if SSL support should be compiled in.])
406
 
    AC_SUBST(SSL_INCLUDES)
 
272
              [Define if SSL support is being compiled in.])
407
273
    SSL_OBJ='openssl$o'
408
 
    AC_SUBST(SSL_OBJ)
409
 
  else
410
 
    LDFLAGS=$wget_save_LDFLAGS
411
 
    LIBS=$wget_save_LIBS
412
 
 
413
 
    dnl If linking with SSL was forced rather than auto-detected, then
414
 
    dnl bail out if SSL failed.
415
 
    if test x"$wget_force_ssl" = x"yes"; then
416
 
      AC_MSG_ERROR([failed to find OpenSSL libraries], 2)
417
 
    fi
 
274
  elif test x"$with_ssl" != x
 
275
  then
 
276
    AC_MSG_ERROR([--with-ssl was given, but OpenSSL is not available.])
418
277
  fi
419
 
 
420
 
  dnl Restore the compiler setting.
421
 
  CC=$wget_save_CC
422
 
 
423
 
  dnl Restore the CPPFLAGS.  Do this regardless of whether linking
424
 
  dnl with SSL succeeded -- SSL includes will be handled using
425
 
  dnl @SSL_INCLUDES@.
426
 
  CPPFLAGS=$wget_save_CPPFLAGS
427
278
fi
 
279
AC_SUBST(SSL_OBJ)
428
280
 
429
281
dnl Enable NTLM if requested and if SSL is available.
430
282
NTLM_OBJ=''
431
 
if test x"$ssl_success" = xyes
 
283
if test x"$LIBSSL" != x
432
284
then
433
285
  if test x"$ENABLE_NTLM" != xno
434
286
  then
447
299
AC_SUBST(NTLM_OBJ)
448
300
 
449
301
dnl
450
 
dnl Find an md5 implementation.
 
302
dnl Find an MD5 implementation.  Since Wget rarely needs MD5, we try
 
303
dnl to use an existing library implementation to save on code size.
451
304
dnl
452
305
 
453
306
if test x"$wget_need_md5" = xyes
460
313
 
461
314
  dnl Check for the system MD5 library on Solaris.  We don't check for
462
315
  dnl something simple like "MD5Update" because there are a number of
463
 
  dnl MD5 implementations that use that name.  md5_calc is, hopefully,
464
 
  dnl specific to the Solaris MD5 library.
 
316
  dnl MD5 implementations that use that name, but have an otherwise
 
317
  dnl incompatible interface.  md5_calc is, hopefully, specific to the
 
318
  dnl Solaris MD5 library.
465
319
  if test x"$found_md5" = xno; then
466
320
    AC_CHECK_LIB(md5, md5_calc, [
467
321
      dnl Some installations have bogus <md5.h> in the compiler's
481
335
  dnl Then see if we're linking OpenSSL anyway; if yes, use its md5
482
336
  dnl implementation.
483
337
  if test x"$found_md5" = xno; then
484
 
    if test x"$ssl_success" = xyes; then
 
338
    if test x"$LIBSSL" != x; then
485
339
      AC_DEFINE([HAVE_OPENSSL_MD5], 1, [Define to use OpenSSL MD5.])
486
340
      found_md5=yes
487
341
      AC_MSG_NOTICE([using the OpenSSL MD5 implementation])
504
358
dnl **********************************************************************
505
359
 
506
360
dnl
507
 
dnl If --enable-ipv6 is specified, we try to use IPv6 (as long as
508
 
dnl getaddrinfo is also present).  If --disable-ipv6 is specified, we
509
 
dnl don't use IPv6 or getaddrinfo.  Otherwise we detect IPv6 and use
510
 
dnl it where available.
 
361
dnl We test for IPv6 by checking, in turn, for availability of
 
362
dnl getaddrinfo, presence of the INET6 address/protocol family, and
 
363
dnl the existence of struct sockaddr_in6.  If any of them is missing,
 
364
dnl IPv6 is disabled, and the code reverts to old-style gethostbyname.
 
365
dnl
 
366
dnl If --enable-ipv6 is explicitly specified on the configure command
 
367
dnl line, we check for IPv6 and abort if not found.  If --disable-ipv6
 
368
dnl is specified, we disable IPv6 and don't check for it.  The default
 
369
dnl is to autodetect IPv6 and use it where available.
511
370
dnl
512
371
 
513
372
AC_ARG_ENABLE(ipv6,
573
432
dnl
574
433
dnl Set of available languages.
575
434
dnl
576
 
ALL_LINGUAS=`(cd ${srcdir}/po && ls *.po | sed -e 's/\.po$//' | tr '\012' ' ')`
577
 
 
578
435
dnl Originally this used to be static, looking like this:
579
436
dnl     ALL_LINGUAS="cs de hr it ..."
580
437
dnl The downside was that configure needed to be rebuilt whenever a
581
438
dnl new language was added.
 
439
dnl
 
440
ALL_LINGUAS=`(cd ${srcdir}/po && ls *.po | sed -e 's/\.po$//' | tr '\012' ' ')`
582
441
 
583
442
dnl internationalization macros
584
443
WGET_WITH_NLS