Next: autom4te.cache, Previous: Why Not Imake, Up: FAQ
#define
Installation Directories?My program needs library files, installed indatadir
and similar. If I useAC_DEFINE_UNQUOTED([DATADIR], [$datadir], [Define to the read-only architecture-independent data directory.])I get
#define DATADIR "${prefix}/share"
As already explained, this behavior is on purpose, mandated by the GNU Coding Standards, see Installation Directory Variables. There are several means to achieve a similar goal:
AC_DEFINE
but use your makefile to pass the
actual value of datadir
via compilation flags.
See Installation Directory Variables, for the details.
CPPFLAGS
:
CPPFLAGS = -DDATADIR='"$(datadir)"' @CPPFLAGS@
or create a dedicated header file:
DISTCLEANFILES = datadir.h datadir.h: Makefile echo '#define DATADIR "$(datadir)"' >$@
AC_DEFINE
but have configure compute the literal
value of datadir
and others. Many people have wrapped macros to
automate this task. For instance, the macro AC_DEFINE_DIR
from
the Autoconf Macro Archive.
This solution does not conform to the GNU Coding Standards.
prefix
, and try to
find prefix
at runtime, this way your package is relocatable.
Some macros are already available to address this issue: see
adl_COMPUTE_RELATIVE_PATHS
and
adl_COMPUTE_STANDARD_RELATIVE_PATHS
on the
Autoconf Macro Archive.