(autoconf.info)Installation Directory Variables


Next: Changed Directory Variables Prev: Preset Output Variables Up: Makefile Substitutions

4.8.2 Installation Directory Variables
--------------------------------------

The following variables specify the directories for package
installation, see *Note Variables for Installation Directories:
(standards)Directory Variables, 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.

 -- Variable: bindir
     The directory for installing executables that users run.

 -- Variable: datadir
     The directory for installing idiosyncratic read-only
     architecture-independent data.

 -- Variable: datarootdir
     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.

 -- Variable: sharedstatedir
     The directory for installing modifiable architecture-independent
     data.

 -- Variable: sysconfdir
     The directory for installing read-only single-machine data.

   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 being defined as `${prefix}/share' to depend upon
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
`datadir' 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':

     edit = sed \
             -e 's|@datadir[@]|$(pkgdatadir)|g' \
             -e 's|@prefix[@]|$(prefix)|g'

     autoheader autom4te: Makefile
             rm -f $@ $@.tmp
             $(edit) '$(srcdir)/$@.in' >$@.tmp
             chmod +x $@.tmp
             chmod a-w $@.tmp
             mv $@.tmp $@

     autoheader: $(srcdir)/autoheader.in
     autom4te: $(srcdir)/autom4te.in

   Some details are noteworthy:

`@datadir[@]'
     The brackets prevent `configure' from replacing `@datadir@' in the
     Sed expression itself.  Brackets are preferable to a backslash
     here, since Posix says `\@' is not portable.

`$(pkgdatadir)'
     Don't use `@pkgdatadir@'!  Use the matching makefile variable
     instead.

`/'
     Don't use `/' in the Sed expressions that replace file names since
     most likely the variables you use, such as `$(pkgdatadir)',
     contain `/'.  Use a shell metacharacter instead, such as `|'.

special characters
     File names, file name components, and the value of `VPATH' should
     not contain shell metacharacters or white space.  Note: Special
     Chars in Variables.

dependency on `Makefile'
     Since `edit' uses values that depend on the configuration specific
     values (`prefix', etc.) and not only on `VERSION' and so forth,
     the output depends on `Makefile', not `configure.ac'.

`$@'
     The main rule is generic, and uses `$@' extensively to avoid the
     need for multiple copies of the rule.

Separated dependencies and single suffix rules
     You can't use them!  The above snippet cannot be (portably)
     rewritten as:

          autoconf autoheader: Makefile
          .in:
                  rm -f $@ $@.tmp
                  $(edit) $< >$@.tmp
                  chmod +x $@.tmp
                  mv $@.tmp $@

     Note: Single Suffix Rules, for details.

`$(srcdir)'
     Be sure to specify the name of the source directory, otherwise the
     package won't support separated builds.

   For the more specific installation of Erlang libraries, the
following variables are defined:

 -- Variable: ERLANG_INSTALL_LIB_DIR
     The common parent directory of Erlang library installation
     directories.  This variable is set by calling the
     `AC_ERLANG_SUBST_INSTALL_LIB_DIR' macro in `configure.ac'.

 -- Variable: ERLANG_INSTALL_LIB_DIR_LIBRARY
     The installation directory for Erlang library LIBRARY.  This
     variable is set by calling the
     `AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR(LIBRARY, VERSION' macro in
     `configure.ac'.

   Note: Erlang Libraries, for details.


automatically generated by info2www