4.8.2 Installation Directory Variables

The following variables specify the directories for
package installation, see Variables for Installation Directories, for more information. Each variable corresponds to an
argument of configure; trailing slashes are stripped so that
expressions such as ‘${prefix}/lib’ expand with only one slash
between directory names. See the end of this section for
details on when and how to use these variables.

The root of the directory tree for read-only architecture-independent
data files.

— Variable: docdir

The directory for installing documentation files (other than Info and
man).

— Variable: dvidir

The directory for installing documentation files in DVI format.

— Variable: exec_prefix

The installation prefix for architecture-dependent files. By default
it's the same as prefix. You should avoid installing anything
directly to exec_prefix. However, the default value for
directories containing architecture-dependent files should be relative
to exec_prefix.

— Variable: htmldir

The directory for installing HTML documentation.

— Variable: includedir

The directory for installing C header files.

— Variable: infodir

The directory for installing documentation in Info format.

— Variable: libdir

The directory for installing object code libraries.

— Variable: libexecdir

The directory for installing executables that other programs run.

— Variable: localedir

The directory for installing locale-dependent but
architecture-independent data, such as message catalogs. This directory
usually has a subdirectory per locale.

— Variable: localstatedir

The directory for installing modifiable single-machine data.

— Variable: mandir

The top-level directory for installing documentation in man format.

— Variable: oldincludedir

The directory for installing C header files for non-GCC compilers.

— Variable: pdfdir

The directory for installing PDF documentation.

— Variable: prefix

The common installation prefix for all files. If exec_prefix
is defined to a different value, prefix is used only for
architecture-independent files.

— Variable: psdir

The directory for installing PostScript documentation.

— Variable: sbindir

The directory for installing executables that system
administrators run.

Most of these variables have values that rely on prefix or
exec_prefix. It is deliberate that the directory output
variables keep them unexpanded: typically ‘@datarootdir@’ is
replaced by ‘${prefix}/share’, not ‘/usr/local/share’, and
‘@datadir@’ is replaced by ‘${datarootdir}’.

This behavior is mandated by the GNU Coding Standards, so that when
the user runs:

‘make’

she can still specify a different prefix from the one specified to
configure, in which case, if needed, the package should hard
code dependencies corresponding to the make-specified prefix.

‘make install’

she can specify a different installation location, in which case the
package must still depend on the location which was compiled in
(i.e., never recompile when ‘make install’ is run). This is an
extremely important feature, as many people may decide to install all
the files of a package grouped together, and then install links from
the final locations to there.

In order to support these features, it is essential that
datarootdir remains defined as ‘${prefix}/share’,
so that its value can be expanded based
on the current value of prefix.

A corollary is that you should not use these variables except in
makefiles. For instance, instead of trying to evaluate datadir
in configure and hard-coding it in makefiles using
e.g., ‘AC_DEFINE_UNQUOTED([DATADIR], ["$datadir"], [Data directory.])’,
you should add
-DDATADIR='$(datadir)' to your makefile's definition of
CPPFLAGS (AM_CPPFLAGS if you are also using Automake).

Similarly, you should not rely on AC_CONFIG_FILES to replace
bindir and friends in your shell scripts and other files; instead,
let make manage their replacement. For instance Autoconf
ships templates of its shell scripts ending with ‘.in’, and uses a
makefile snippet similar to the following to build scripts like
autoheader and autom4te: