1dnl Template file for GNU Autoconf 2dnl Copyright (C) 1995, 1996, 1997, 2001, 2007, 2008, 2009, 2010, 2011, 2012, 3dnl 2013, 2014 Free Software Foundation, Inc. 4 5dnl This program is free software; you can redistribute it and/or modify 6dnl it under the terms of the GNU General Public License as published by 7dnl the Free Software Foundation; either version 3 of the License, or 8dnl (at your option) any later version. 9 10dnl This program is distributed in the hope that it will be useful, 11dnl but WITHOUT ANY WARRANTY; without even the implied warranty of 12dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13dnl GNU General Public License for more details. 14 15dnl You should have received a copy of the GNU General Public License 16dnl along with this program. If not, see <http://www.gnu.org/licenses/>. 17 18dnl Additional permission under GNU GPL version 3 section 7 19 20dnl If you modify this program, or any covered work, by linking or 21dnl combining it with the OpenSSL project's OpenSSL library (or a 22dnl modified version of that library), containing parts covered by the 23dnl terms of the OpenSSL or SSLeay licenses, the Free Software Foundation 24dnl grants you additional permission to convey the resulting work. 25dnl Corresponding Source for a non-source form of such a combination 26dnl shall include the source code for the parts of OpenSSL used as well 27dnl as that of the covered work. 28 29dnl 30dnl Process this file with autoconf to produce a configure script. 31dnl 32 33AC_INIT([wget], 34 m4_esyscmd([build-aux/git-version-gen .tarball-version]), 35 [bug-wget@gnu.org]) 36AC_PREREQ(2.61) 37 38dnl 39dnl What version of Wget are we building? 40dnl 41AC_MSG_NOTICE([configuring for GNU Wget $PACKAGE_VERSION]) 42 43AC_CONFIG_MACRO_DIR([m4]) 44AC_CONFIG_AUX_DIR([build-aux]) 45 46AC_CONFIG_SRCDIR([src/wget.h]) 47 48dnl 49dnl Automake setup 50dnl 51AM_INIT_AUTOMAKE([1.9]) 52 53dnl 54dnl Get cannonical host 55dnl 56AC_CANONICAL_HOST 57AC_DEFINE_UNQUOTED([OS_TYPE], "$host_os", 58 [Define to be the name of the operating system.]) 59 60dnl 61dnl Process features. 62dnl 63 64ENABLE_PSL=no 65AC_ARG_WITH(libpsl, 66 AS_HELP_STRING([--without-libpsl], 67 [disable support for libpsl cookie checking.]), 68 [], 69 [AC_SEARCH_LIBS(psl_builtin, psl, 70 [ENABLE_PSL=yes; AC_DEFINE([HAVE_LIBPSL], [1], [PSL Support Enabled])], 71 [AC_MSG_WARN(*** libpsl not found. Falling back to Wget builtin cookie checking.)]) 72 ]) 73 74AC_ARG_WITH(ssl, 75[[ --without-ssl disable SSL autodetection 76 --with-ssl={gnutls,openssl} specify the SSL backend. GNU TLS is the default.]]) 77 78AC_ARG_WITH(zlib, 79[[ --without-zlib disable zlib ]]) 80 81AC_ARG_ENABLE(opie, 82[ --disable-opie disable support for opie or s/key FTP login], 83ENABLE_OPIE=$enableval, ENABLE_OPIE=yes) 84test x"${ENABLE_OPIE}" = xyes && AC_DEFINE([ENABLE_OPIE], 1, 85 [Define if you want the Opie support for FTP compiled in.]) 86 87AC_ARG_ENABLE(digest, 88[ --disable-digest disable support for HTTP digest authorization], 89ENABLE_DIGEST=$enableval, ENABLE_DIGEST=yes) 90test x"${ENABLE_DIGEST}" = xyes && AC_DEFINE([ENABLE_DIGEST], 1, 91 [Define if you want the HTTP Digest Authorization compiled in.]) 92 93AC_ARG_ENABLE(ntlm, 94[ --disable-ntlm disable support for NTLM authorization], 95[ENABLE_NTLM=$enableval], [ENABLE_NTLM=auto]) 96 97AC_ARG_ENABLE(debug, 98[ --disable-debug disable support for debugging output], 99ENABLE_DEBUG=$enableval, ENABLE_DEBUG=yes) 100test x"${ENABLE_DEBUG}" = xyes && AC_DEFINE([ENABLE_DEBUG], 1, 101 [Define if you want the debug output support compiled in.]) 102 103dnl 104dnl Find the compiler 105dnl 106 107dnl We want these before the checks, so the checks can modify their values. 108test -z "$CFLAGS" && CFLAGS= auto_cflags=1 109test -z "$CC" && cc_specified=yes 110 111AC_PROG_CC 112AM_PROG_CC_C_O 113AC_AIX 114 115gl_EARLY 116 117dnl 118dnl Gettext 119dnl 120AM_GNU_GETTEXT([external],[need-ngettext]) 121AM_GNU_GETTEXT_VERSION([0.17]) 122 123AC_PROG_RANLIB 124 125AC_PROG_LEX 126 127dnl Turn on optimization by default. Specifically: 128dnl 129dnl if the user hasn't specified CFLAGS, then 130dnl if compiler is gcc, then 131dnl use -O2 and some warning flags 132dnl else 133dnl use os-specific flags or -O 134if test -n "$auto_cflags"; then 135 if test -n "$GCC"; then 136 CFLAGS="$CFLAGS -O2 -Wall" 137 else 138 case "$host_os" in 139 *hpux*) CFLAGS="$CFLAGS +O3" ;; 140 *ultrix* | *osf*) CFLAGS="$CFLAGS -O -Olimit 2000" ;; 141 *) CFLAGS="$CFLAGS -O" ;; 142 esac 143 fi 144fi 145 146dnl 147dnl Checks for basic compiler characteristics. 148dnl 149AC_C_CONST 150AC_C_INLINE 151AC_C_VOLATILE 152 153dnl Check for basic headers, even though we expect them to exist and 154dnl #include them unconditionally in the code. Their detection is 155dnl still needed because test programs used by Autoconf macros check. 156dnl Without the checks they will fail to be included in test programs, 157dnl which will subsequently fail. 158AC_HEADER_STDC 159 160dnl Check for large file support. This check needs to come fairly 161dnl early because it could (in principle) affect whether functions and 162dnl headers are available, whether they work, etc. 163AC_SYS_LARGEFILE 164AC_CHECK_SIZEOF(off_t) 165 166dnl 167dnl Checks for system header files that might be missing. 168dnl 169AC_HEADER_STDBOOL 170AC_CHECK_HEADERS(unistd.h sys/time.h) 171AC_CHECK_HEADERS(termios.h sys/ioctl.h sys/select.h utime.h sys/utime.h) 172AC_CHECK_HEADERS(stdint.h inttypes.h pwd.h wchar.h) 173 174AC_CHECK_DECLS(h_errno,,,[#include <netdb.h>]) 175 176dnl 177dnl Check sizes of integer types. These are used to find n-bit 178dnl integral types on older systems that fail to provide intN_t and 179dnl uintN_t typedefs. 180dnl 181AC_CHECK_SIZEOF([short]) 182AC_CHECK_SIZEOF([int]) 183AC_CHECK_SIZEOF([long]) 184AC_CHECK_SIZEOF([long long]) 185AC_CHECK_SIZEOF([void *]) 186 187dnl 188dnl Checks for non-universal or system-specific types. 189dnl 190AC_TYPE_SIZE_T 191AC_TYPE_PID_T 192AC_CHECK_TYPES([uint32_t, uintptr_t, intptr_t, int64_t]) 193AC_CHECK_TYPES(sig_atomic_t, [], [], [ 194#include <stdio.h> 195#include <sys/types.h> 196#include <inttypes.h> 197#include <signal.h> 198]) 199 200# gnulib 201gl_INIT 202 203dnl 204dnl Checks for library functions. 205dnl 206AC_FUNC_MMAP 207AC_FUNC_FSEEKO 208AC_CHECK_FUNCS(strptime timegm vsnprintf vasprintf drand48 pathconf) 209AC_CHECK_FUNCS(strtoll usleep ftello sigblock sigsetjmp memrchr wcwidth mbtowc) 210AC_CHECK_FUNCS(sleep symlink utime) 211 212if test x"$ENABLE_OPIE" = xyes; then 213 AC_LIBOBJ([ftp-opie]) 214fi 215 216dnl We expect to have these functions on Unix-like systems configure 217dnl runs on. The defines are provided to get them in config.h.in so 218dnl Wget can still be ported to non-Unix systems (such as Windows) 219dnl that lack some of these functions. 220AC_DEFINE([HAVE_STRCASECMP], 1, [Define to 1 if you have the `strcasecmp' function.]) 221AC_DEFINE([HAVE_STRNCASECMP], 1, [Define to 1 if you have the `strncasecmp' function.]) 222AC_DEFINE([HAVE_STRDUP], 1, [Define to 1 if you have the `strdup' function.]) 223AC_DEFINE([HAVE_ISATTY], 1, [Define to 1 if you have the `isatty' function.]) 224 225dnl 226dnl Call Wget-specific macros defined in aclocal. 227dnl 228WGET_STRUCT_UTIMBUF 229WGET_FNMATCH 230WGET_NANOSLEEP 231WGET_POSIX_CLOCK 232WGET_NSL_SOCKET 233 234dnl Deal with specific hosts 235case $host_os in 236 *mingw32* ) 237 LIBS+=' -lws2_32' 238 AC_LIBOBJ([mswindows]) 239 ;; 240esac 241 242 243dnl 244dnl Checks for libraries. 245dnl 246 247AS_IF([test x"$with_zlib" != xno], [ 248 with_zlib=yes 249 AC_CHECK_LIB(z, compress) 250]) 251 252AS_IF([test x"$with_ssl" = xopenssl], [ 253 dnl As of this writing (OpenSSL 0.9.6), the libcrypto shared library 254 dnl doesn't record its dependency on libdl, so we need to make sure 255 dnl -ldl ends up in LIBS on systems that have it. Most OSes use 256 dnl dlopen(), but HP-UX uses shl_load(). 257 AC_CHECK_LIB(dl, dlopen, [], [ 258 AC_CHECK_LIB(dl, shl_load) 259 ]) 260 261 ssl_found=no 262 case $host_os in 263 *mingw32* ) 264 dnl prefer link to openssl dlls if possible. if not then fallback on static libs. if not then error 265 266 AC_CHECK_LIB(eay32, EVP_MD_CTX_init) 267 if test x"$ac_cv_lib_eay32_EVP_MD_CTX_init" != xno 268 then 269 AC_CHECK_LIB(ssl32, SSL_connect, [ 270 ssl_found=yes 271 AC_MSG_NOTICE([Enabling support for SSL via OpenSSL (shared)]) 272 AC_LIBOBJ([openssl]) 273 LIBS="${LIBS} -lssl32" 274 AC_DEFINE([HAVE_LIBSSL32], [1], [Define to 1 if you have the `ssl32' library (-lssl32).]) 275 ], 276 AC_MSG_ERROR([openssl not found: shared lib eay32 found but ssl32 not found])) 277 278 else 279 LIBS+=' -lgdi32' 280 dnl fallback and test static libs 281 fi 282 dnl add zdll lib as dep for above tests? 283 ;; 284 esac 285 286 AS_IF([test x$ssl_found != xyes], [ 287 dnl Now actually check for -lssl if it wasn't already found 288 AC_LIB_HAVE_LINKFLAGS([ssl], [crypto], [ 289#include <openssl/ssl.h> 290#include <openssl/x509.h> 291#include <openssl/err.h> 292#include <openssl/rand.h> 293#include <openssl/des.h> 294#include <openssl/md4.h> 295#include <openssl/md5.h> 296 ], [SSL_library_init ()]) 297 if test x"$LIBSSL" != x 298 then 299 ssl_found=yes 300 AC_MSG_NOTICE([compiling in support for SSL via OpenSSL]) 301 AC_LIBOBJ([openssl]) 302 LIBS="$LIBSSL $LIBS" 303 elif test x"$with_ssl" != x 304 then 305 AC_MSG_ERROR([--with-ssl=openssl was given, but SSL is not available.]) 306 fi 307 ]) 308 309], [ 310 # --with-ssl is not openssl: check if it's no 311 AS_IF([test x"$with_ssl" != xno], [ 312 dnl default is -lgnutls 313 with_ssl=gnutls 314 315 dnl Now actually check for -lgnutls 316 AC_LIB_HAVE_LINKFLAGS([gnutls], [], [ 317#include <gnutls/gnutls.h> 318 ], [gnutls_global_init()]) 319 if test x"$LIBGNUTLS" != x 320 then 321 ssl_found=yes 322 AC_MSG_NOTICE([compiling in support for SSL via GnuTLS]) 323 AC_LIBOBJ([gnutls]) 324 LIBS="$LIBGNUTLS $LIBS" 325 else 326 AC_MSG_ERROR([--with-ssl=gnutls was given, but GNUTLS is not available.]) 327 fi 328 329 AC_CHECK_FUNCS(gnutls_priority_set_direct) 330 ]) # endif: --with-ssl != no? 331]) # endif: --with-ssl == openssl? 332 333dnl Enable NTLM if requested and if SSL is available. 334if test x"$LIBSSL" != x || test "$ac_cv_lib_ssl32_SSL_connect" = yes 335then 336 if test x"$ENABLE_NTLM" != xno 337 then 338 ENABLE_NTLM=yes 339 AC_DEFINE([ENABLE_NTLM], 1, 340 [Define if you want the NTLM authorization support compiled in.]) 341 AC_LIBOBJ([http-ntlm]) 342 fi 343else 344 AC_CHECK_LIB(nettle, nettle_md4_init, [HAVE_NETTLE=yes], [HAVE_NETTLE=no; AC_MSG_WARN(*** libnettle was not found. You will not be able to use NTLM)]) 345 346 if test x"$HAVE_NETTLE" = xyes 347 then 348 AC_SUBST(NETTLE_LIBS, "-lnettle") 349 AC_DEFINE([HAVE_NETTLE], [1], [Use libnettle]) 350 if test x"$ENABLE_NTLM" != xno 351 then 352 ENABLE_NTLM=yes 353 AC_DEFINE([ENABLE_NTLM], 1, 354 [Define if you want the NTLM authorization support compiled in.]) 355 AC_LIBOBJ([http-ntlm]) 356 LIBS="$NETTLE_LIBS $LIBS" 357 fi 358 else 359 dnl If SSL is unavailable and the user explicitly requested NTLM, 360 dnl abort. 361 if test x"$ENABLE_NTLM" = xyes 362 then 363 AC_MSG_ERROR([NTLM authorization requested and SSL not enabled; aborting]) 364 fi 365 fi 366fi 367 368 369dnl ********************************************************************** 370dnl Checks for IPv6 371dnl ********************************************************************** 372 373dnl 374dnl We test for IPv6 by checking, in turn, for availability of 375dnl presence of the INET6 address/protocol family and the existence of 376dnl struct sockaddr_in6. If any of them is missing, IPv6 is disabled, 377dnl and the code reverts to old-style gethostbyname. 378dnl 379dnl If --enable-ipv6 is explicitly specified on the configure command 380dnl line, we check for IPv6 and abort if not found. If --disable-ipv6 381dnl is specified, we disable IPv6 and don't check for it. The default 382dnl is to autodetect IPv6 and use it where available. 383dnl 384 385AC_ARG_ENABLE(ipv6, 386 AC_HELP_STRING([--disable-ipv6],[disable IPv6 support]), 387 [case "${enable_ipv6}" in 388 no) 389 AC_MSG_NOTICE([disabling IPv6 at user request]) 390 dnl Disable IPv6 checking 391 ipv6=no 392 ;; 393 yes) 394 dnl IPv6 explicitly enabled: force its use (abort if unavailable). 395 ipv6=yes 396 force_ipv6=yes 397 ;; 398 auto) 399 dnl Auto-detect IPv6, i.e. check for IPv6, but don't force it. 400 ipv6=yes 401 ;; 402 *) 403 AC_MSG_ERROR([Invalid --enable-ipv6 argument \`$enable_ipv6']) 404 ;; 405 esac 406 ], [ 407 dnl If nothing is specified, assume auto-detection. 408 ipv6=yes 409 ] 410) 411 412if test "X$ipv6" = "Xyes"; then 413 PROTO_INET6([], [ 414 AC_MSG_NOTICE([Disabling IPv6 support: your system does not support the PF_INET6 protocol family]) 415 ipv6=no 416 ]) 417fi 418 419if test "X$ipv6" = "Xyes"; then 420 TYPE_STRUCT_SOCKADDR_IN6([],[ 421 AC_MSG_NOTICE([Disabling IPv6 support: your system does not support \`struct sockaddr_in6']) 422 ipv6=no 423 ]) 424 if test "X$ipv6" = "Xyes"; then 425 WGET_STRUCT_SOCKADDR_STORAGE 426 MEMBER_SIN6_SCOPE_ID 427 fi 428fi 429 430if test "X$ipv6" = "Xyes"; then 431 AC_DEFINE([ENABLE_IPV6], 1, [Define if IPv6 support is enabled.]) 432 AC_MSG_NOTICE([Enabling support for IPv6.]) 433elif test "x$force_ipv6" = "xyes"; then 434 AC_MSG_ERROR([IPv6 support requested but not found; aborting]) 435fi 436 437dnl 438dnl Find makeinfo. We used to provide support for Emacs processing 439dnl Texinfo using `emacs -batch -eval ...' where makeinfo is 440dnl unavailable, but that broke with the addition of makeinfo-specific 441dnl command-line options, such as `-I'. Now we depend on makeinfo to 442dnl build the Info documentation. 443dnl 444 445AC_CHECK_PROGS(MAKEINFO, [makeinfo], [true]) 446 447dnl 448dnl Find perl and pod2man 449dnl 450 451AC_PATH_PROGS(PERL, [perl5 perl], no) 452AC_PATH_PROG(POD2MAN, pod2man, no) 453 454if test "x${POD2MAN}" = xno; then 455 COMMENT_IF_NO_POD2MAN="# " 456else 457 COMMENT_IF_NO_POD2MAN= 458fi 459AC_SUBST(COMMENT_IF_NO_POD2MAN) 460 461 462dnl 463dnl Check for IDN/IRIs 464dnl 465 466AC_ARG_ENABLE(iri, 467 AC_HELP_STRING([--disable-iri],[disable IDN/IRIs support]), 468 [case "${enable_iri}" in 469 no) 470 dnl Disable IRIs checking 471 AC_MSG_NOTICE([disabling IRIs at user request]) 472 iri=no 473 ;; 474 yes) 475 dnl IRIs explicitly enabled 476 iri=yes 477 force_iri=yes 478 ;; 479 auto) 480 dnl Auto-detect IRI 481 iri=yes 482 ;; 483 *) 484 AC_MSG_ERROR([Invalid --enable-iri argument \`$enable_iri']) 485 ;; 486 esac 487 ], [ 488 dnl If nothing is specified, assume auto-detection 489 iri=yes 490 ] 491) 492 493AC_ARG_WITH(libidn, AC_HELP_STRING([--with-libidn=[DIR]], 494 [Support IDN/IRIs (needs GNU Libidn)]), 495 libidn=$withval, libidn="") 496AS_IF([test "X$iri" != "Xno"],[ 497 AM_ICONV 498 499 if test "X$am_cv_func_iconv" != "Xyes"; then 500 iri=no 501 if test "X$force_iri" = "Xyes"; then 502 AC_MSG_ERROR([Libiconv is required for IRIs support]) 503 else 504 AC_MSG_NOTICE([disabling IRIs because libiconv wasn't found]) 505 fi 506 fi 507],[ # else 508 # For some reason, this seems to be set even when we don't check. 509 # Explicitly unset. 510 LIBICONV= 511]) 512 513if test "X$iri" != "Xno"; then 514 if test "$libidn" != ""; then 515 LDFLAGS="${LDFLAGS} -L$libidn/lib" 516 CPPFLAGS="${CPPFLAGS} -I$libidn/include" 517 fi 518 519 # If idna.h can't be found, check to see if it was installed under 520 # /usr/include/idn (OpenSolaris, at least, places it there). 521 # Check for idn-int.h in that case, because idna.h won't find 522 # idn-int.h until we've decided to add -I/usr/include/idn. 523 AC_CHECK_HEADER(idna.h, , 524 [AC_CHECK_HEADER(idn/idn-int.h, 525 [CPPFLAGS="${CPPFLAGS} -I/usr/include/idn"], 526 [iri=no])] 527 ) 528 529 if test "X$iri" != "Xno"; then 530 AC_CHECK_LIB(idn, stringprep_check_version, 531 [iri=yes LIBS="${LIBS} -lidn"], iri=no) 532 fi 533 534 if test "X$iri" != "Xno" ; then 535 AC_DEFINE([ENABLE_IRI], 1, [Define if IRI support is enabled.]) 536 AC_MSG_NOTICE([Enabling support for IRI.]) 537 else 538 AC_MSG_WARN([Libidn not found]) 539 fi 540fi 541 542dnl 543dnl Check for UUID 544dnl 545AC_CHECK_HEADER(uuid.h, 546 AC_CHECK_FUNC(uuid, uuid_create, 547 [AC_DEFINE([HAVE_UUID_CREATE], 1, 548 [Define if uuid_create is available.]) 549 ]) 550) 551 552AC_CHECK_HEADER(uuid/uuid.h, 553 AC_CHECK_LIB(uuid, uuid_generate, 554 [LIBS="${LIBS} -luuid" 555 AC_DEFINE([HAVE_LIBUUID], 1, 556 [Define if libuuid is available.]) 557 ]) 558) 559 560dnl 561dnl Check for PCRE 562dnl 563 564AC_CHECK_HEADER(pcre.h, 565 AC_CHECK_LIB(pcre, pcre_compile, 566 [LIBS="${LIBS} -lpcre" 567 AC_DEFINE([HAVE_LIBPCRE], 1, 568 [Define if libpcre is available.]) 569 ]) 570) 571 572 573dnl Needed by src/Makefile.am 574AM_CONDITIONAL([IRI_IS_ENABLED], [test "X$iri" != "Xno"]) 575 576 577dnl 578dnl Create output 579dnl 580AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile util/Makefile 581 po/Makefile.in tests/Makefile 582 lib/Makefile testenv/Makefile]) 583AC_CONFIG_HEADERS([src/config.h]) 584AC_OUTPUT 585 586AC_MSG_NOTICE([Summary of build options: 587 588 Version: $PACKAGE_VERSION 589 Host OS: $host_os 590 Install prefix: $prefix 591 Compiler: $CC 592 CFlags: $CFLAGS $CPPFLAGS 593 LDFlags: $LDFLAGS 594 Libs: $LIBS 595 SSL: $with_ssl 596 Zlib: $with_zlib 597 PSL: $ENABLE_PSL 598 Digest: $ENABLE_DIGEST 599 NTLM: $ENABLE_NTLM 600 OPIE: $ENABLE_OPIE 601 Debugging: $ENABLE_DEBUG 602]) 603