Chapter 10: Installing Bash

139

10.2 Compilers and Options

Some systems require unusual options for compilation or linking that the configure script does not know about. You can give configure initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this:

CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure

On systems that have the env program, you can do it like this: env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure

The configuration process uses GCC to build Bash if it is available.

10.3 Compiling For Multiple Architectures

You can compile Bash for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of make that supports the VPATH variable, such as GNU make. cd to the directory where you want the object files and executables to go and run the configure script from the source directory. You may need to supply the --srcdir=PATH argument to tell configure where the source files are. configure automatically checks for the source code in the directory that configure is in and in ‘..’.

If you have to use a make that does not supports the VPATH variable, you can compile Bash for one architecture at a time in the source code directory. After you have installed Bash for one architecture, use ‘make distclean’ before reconfiguring for another architecture.

Alternatively, if your system supports symbolic links, you can use the support/mkclone script to create a build tree which has symbolic links back to each file in the source directory.

Here’s an example that creates a build directory in the current directory from a source directory /usr/gnu/src/bash-2.0: bash /usr/gnu/src/bash-2.0/support/mkclone -s /usr/gnu/src/bash-2.0 .

The mkclone script requires Bash, so you must have already built Bash for at least one architecture before you can create build directories for other architectures.

10.4 Installation Names

By default, ‘make install’ will install into /usr/local/bin, /usr/local/man, etc. You can specify an installation prefix other than /usr/local by giving configure the option

--prefix=PATH, or by specifying a value for the DESTDIR ‘make’ variable when running

‘make install’.

You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give configure the option --exec-prefix=PATH,

‘make install’ will use PATH as the prefix for installing programs and libraries.

Documentation and other data files will still use the regular prefix.

10.5 Specifying the System Type

There may be some features configure can not figure out automatically, but need to determine by the type of host Bash will run on. Usually configure can figure that out, but