| 1 |                                                             -*- text -*-
 | 
|---|
| 2 |                    GNU Wget Installation Procedure
 | 
|---|
| 3 |                    ===============================
 | 
|---|
| 4 | 
 | 
|---|
| 5 | 0. Introduction
 | 
|---|
| 6 | ---------------
 | 
|---|
| 7 | 
 | 
|---|
| 8 | This document describes how to build Wget from source code on
 | 
|---|
| 9 | Unix-like systems.  If you want to install a precompiled Wget, this
 | 
|---|
| 10 | document is not for you -- refer to the documentation provided by the
 | 
|---|
| 11 | distributors instead.  If you already have Wget and want to learn how
 | 
|---|
| 12 | to use it, refer to Wget's Info documentation or man page which you
 | 
|---|
| 13 | should have received with your system.  If you are using Windows
 | 
|---|
| 14 | (except for Cygwin), read windows/README instead.  If you want to
 | 
|---|
| 15 | compile Wget from source code on a Unix-like system, read on.
 | 
|---|
| 16 | 
 | 
|---|
| 17 | The preferred form of building Wget is to get a release archive and
 | 
|---|
| 18 | unpack it (which you have presumably done, since you are reading
 | 
|---|
| 19 | this).  If you have obtained the source code via the Subversion
 | 
|---|
| 20 | repository, please follow the instructions in `README.checkout' before
 | 
|---|
| 21 | continuing.
 | 
|---|
| 22 | 
 | 
|---|
| 23 | 1. Dependencies
 | 
|---|
| 24 | ---------------
 | 
|---|
| 25 | 
 | 
|---|
| 26 | To build Wget, your system must support a Unix-like command-line
 | 
|---|
| 27 | development environment, including the text-processing utilities (sh,
 | 
|---|
| 28 | grep, awk, sed, etc.) and a functional C compiler.  On some GNU/Linux
 | 
|---|
| 29 | systems, this means that you will need to install packages such as
 | 
|---|
| 30 | `gcc', `glibc-devel' (or `libc6-dev') and `make'.  Most systems come
 | 
|---|
| 31 | with these packages preinstalled, but it doesn't hurt to check.  If
 | 
|---|
| 32 | you have successfully compiled other software from source, you
 | 
|---|
| 33 | probably have them all.
 | 
|---|
| 34 | 
 | 
|---|
| 35 | In addition to the C development environment, Wget can use a number of
 | 
|---|
| 36 | optional libraries to provide additional features, such as translated
 | 
|---|
| 37 | messages and support for "https" URLs.  The "external" dependencies
 | 
|---|
| 38 | include:
 | 
|---|
| 39 | 
 | 
|---|
| 40 |   - OpenSSL -- for "https" URLs.
 | 
|---|
| 41 |   - GNU gettext -- for translated messages.
 | 
|---|
| 42 | 
 | 
|---|
| 43 | To be usable for building Wget, the listed libraries must be installed
 | 
|---|
| 44 | with their "development" header files.  On GNU/Linux systems this
 | 
|---|
| 45 | typically means installing the corredponsing "lib<name>-devel" or
 | 
|---|
| 46 | "lib<name>-dev" package along with the package with "lib<name>".
 | 
|---|
| 47 | 
 | 
|---|
| 48 | 2. Configuration
 | 
|---|
| 49 | ----------------
 | 
|---|
| 50 | 
 | 
|---|
| 51 | Before compiling Wget, you need to "configure" it using the
 | 
|---|
| 52 | `configure' script provided with the distribution.  Configuration
 | 
|---|
| 53 | serves two distinct purposes: it enables Wget's build system to
 | 
|---|
| 54 | inspect certain features of your operating system for more robust
 | 
|---|
| 55 | compilation, and it enables you to choose which features you want the
 | 
|---|
| 56 | resulting Wget to have.
 | 
|---|
| 57 | 
 | 
|---|
| 58 | As is the case with most GNU software, Wget's configure script was
 | 
|---|
| 59 | generated with GNU Autoconf.  If you're not familiar with
 | 
|---|
| 60 | Autoconf-generated scripts, read on.
 | 
|---|
| 61 | 
 | 
|---|
| 62 | The most straightforward way to configure Wget is by running the
 | 
|---|
| 63 | configure script without any arguments.  After running some
 | 
|---|
| 64 | compilation-related tests, it will create the Makefiles needed to
 | 
|---|
| 65 | build Wget.  However, you may wish to customize Wget's configuration
 | 
|---|
| 66 | by providing arguments to `configure'.  Wget's configure script
 | 
|---|
| 67 | accepts standard Autoconf arguments, the most important ones being:
 | 
|---|
| 68 | 
 | 
|---|
| 69 |   --help                  display a help message and exit
 | 
|---|
| 70 | 
 | 
|---|
| 71 |   --prefix=PREFIX         install architecture-independent files in PREFIX
 | 
|---|
| 72 |                           (/usr/local by default)
 | 
|---|
| 73 |   --bindir=DIR            user executables in DIR (PREFIX/bin)
 | 
|---|
| 74 |   --infodir=DIR           info documentation in DIR [PREFIX/info]
 | 
|---|
| 75 |   --mandir=DIR            man documentation in DIR [PREFIX/man]
 | 
|---|
| 76 | 
 | 
|---|
| 77 | For example, if you are not root and want to install Wget in
 | 
|---|
| 78 | subdirectories of your home directory, you can use:
 | 
|---|
| 79 | 
 | 
|---|
| 80 |     ./configure --prefix=$HOME
 | 
|---|
| 81 | 
 | 
|---|
| 82 | In addition to the above generic options, Wget's configuration
 | 
|---|
| 83 | supports a number of options more or less specific to Wget.  Options
 | 
|---|
| 84 | beginning with "--disable", such as `--disable-opie' or
 | 
|---|
| 85 | `--disable-ntlm', allow you to turn off certain built-in functionality
 | 
|---|
| 86 | you don't need in order to reduce the size of the executable.  Options
 | 
|---|
| 87 | beginning with "--with" turning off autodetection and use of external
 | 
|---|
| 88 | software Wget can link with, such as the SSL libraries.  Recognized
 | 
|---|
| 89 | "--enable" and "--with" options include:
 | 
|---|
| 90 | 
 | 
|---|
| 91 |   --without-ssl           disable SSL autodetection (used for https support)
 | 
|---|
| 92 |   --with-libssl-prefix=DIR search for libssl in DIR/lib
 | 
|---|
| 93 |   --disable-opie          disable support for opie or s/key FTP login
 | 
|---|
| 94 |   --disable-digest        disable support for HTTP digest authorization
 | 
|---|
| 95 |   --disable-ntlm          disable support for HTTP NTLM authorization
 | 
|---|
| 96 |   --disable-debug         disable support for debugging output
 | 
|---|
| 97 |   --disable-nls           do not use Native Language Support
 | 
|---|
| 98 |   --disable-largefile     omit support for large files
 | 
|---|
| 99 |   --disable-ipv6          disable IPv6 support
 | 
|---|
| 100 |   --disable-rpath         do not hardcode runtime library paths
 | 
|---|
| 101 | 
 | 
|---|
| 102 | You can inspect decisions made by configure by editing the generated
 | 
|---|
| 103 | Makefiles and the `src/config.h' include file.  The defaults should
 | 
|---|
| 104 | work without intervention, but if you know what you are doing, editing
 | 
|---|
| 105 | the generated files before compilation is fine -- they will not be
 | 
|---|
| 106 | regenerated until you run configure again.
 | 
|---|
| 107 | 
 | 
|---|
| 108 | `configure' will try to find a compiler in your PATH, defaulting to
 | 
|---|
| 109 | `gcc', but falling back to `cc' if the former is unavailable.  This is
 | 
|---|
| 110 | a reasonable default on most Unix-like systems, but sometimes you
 | 
|---|
| 111 | might want to override it.  The compiler choice is overridden by
 | 
|---|
| 112 | setting the `CC' environment variable to the desired compiler file
 | 
|---|
| 113 | name.  For example, to force compilation with the Unix `cc' compiler,
 | 
|---|
| 114 | invoke configure like this:
 | 
|---|
| 115 | 
 | 
|---|
| 116 |     ./configure CC=cc
 | 
|---|
| 117 | 
 | 
|---|
| 118 | This assumes that `cc' is in your path -- if it is not, simply use
 | 
|---|
| 119 | CC=/path/to/cc instead.  Note that environment variables that affect
 | 
|---|
| 120 | configure can be set with the usual shell syntax `VAR=value
 | 
|---|
| 121 | ./configure' (assuming sh syntax), but can also be specified as
 | 
|---|
| 122 | arguments to configure, as shown above.  The latter method, while
 | 
|---|
| 123 | being specific to configure, works unmodified in all shells.
 | 
|---|
| 124 | 
 | 
|---|
| 125 | Environment variables that affect `configure' include: CFLAGS for C
 | 
|---|
| 126 | compiler flags, CPPFLAGS for C preprocessor flags, LDFLAGS for linker
 | 
|---|
| 127 | flags, and LIBS for libraries.
 | 
|---|
| 128 | 
 | 
|---|
| 129 | Barring the use of --without-* flags, configure will try to autodetect
 | 
|---|
| 130 | external libraries needed by Wget, currently only the OpenSSL
 | 
|---|
| 131 | libraries.  If they are installed in the system library directories or
 | 
|---|
| 132 | in the same prefix where you plan to install Wget, configure should be
 | 
|---|
| 133 | able to autodetect them.  If they are installed elsewhere, use the
 | 
|---|
| 134 | `--with-libNAME' option to specify the root directory under which
 | 
|---|
| 135 | libraries reside in the `lib/' subdirectory and the corresponding
 | 
|---|
| 136 | header files reside in the `include/' subdirectory.  For example, if
 | 
|---|
| 137 | the OpenSSL libraries are installed under the /usr/local/ssl prefix,
 | 
|---|
| 138 | use `--with-libssl=/usr/local/ssl'.
 | 
|---|
| 139 | 
 | 
|---|
| 140 | Sometimes external libraries will be installed on the system, but the
 | 
|---|
| 141 | header files will be missing.  This often happens on GNU/Linux if you
 | 
|---|
| 142 | forget to install the "-devel" or "-dev" package that corresponds to
 | 
|---|
| 143 | the library and that is typically *not* installed by default.  In that
 | 
|---|
| 144 | case configure will not find the library and you will not be able to
 | 
|---|
| 145 | use the features provided by the library until you install the devel
 | 
|---|
| 146 | package and rerun configure.  If you believe you have the necessary
 | 
|---|
| 147 | headers, but configure still fails to detect the library, please
 | 
|---|
| 148 | report it as a bug.
 | 
|---|
| 149 | 
 | 
|---|
| 150 | 3. Compilation
 | 
|---|
| 151 | --------------
 | 
|---|
| 152 | 
 | 
|---|
| 153 | To compile GNU Wget after it has been configured, simply type make.
 | 
|---|
| 154 | If your compiler is too old to handle function prototypes, Wget will
 | 
|---|
| 155 | try to K&R-ize its sources on the fly.  This should make GNU Wget
 | 
|---|
| 156 | compilable on almost any Unix-like system you are likely to encounter.
 | 
|---|
| 157 | 
 | 
|---|
| 158 | After the compilation a ready-to-use `wget' executable should reside
 | 
|---|
| 159 | in the src directory.  At this point there is no formal test suite for
 | 
|---|
| 160 | testing the binary, but it should be easy enough to test whether the
 | 
|---|
| 161 | basic functionality works.
 | 
|---|
| 162 | 
 | 
|---|
| 163 | 4. Installation
 | 
|---|
| 164 | ---------------
 | 
|---|
| 165 | 
 | 
|---|
| 166 | Use `make install' to install GNU Wget to directories specified to
 | 
|---|
| 167 | configure.  To install it in a system directory (which is the
 | 
|---|
| 168 | default), you will need to be root.  The standard prefix is
 | 
|---|
| 169 | "/usr/local/", which can be changed using the `--prefix' configure
 | 
|---|
| 170 | option.
 | 
|---|
| 171 | 
 | 
|---|
| 172 | The installation process will copy the wget binary to $PREFIX/bin,
 | 
|---|
| 173 | install the wget.info* info pages to $PREFIX/info, the generated
 | 
|---|
| 174 | manual page (where available) wget.1 to $PREFIX/man/man1, and the
 | 
|---|
| 175 | default config file to $PREFIX/etc, unless a config file already
 | 
|---|
| 176 | exists there.  You can customize these directories either through the
 | 
|---|
| 177 | configuration process or making the necessary changes in the Makefile.
 | 
|---|
| 178 | 
 | 
|---|
| 179 | To delete the files created by Wget installation, you can use `make
 | 
|---|
| 180 | uninstall'.
 | 
|---|