File: autoconf.info, Node: Defining Directories, Next: Autom4te Cache, Prev: Why Not Imake, Up: FAQ 20.5 How Do I ‘#define’ Installation Directories? ================================================= My program needs library files, installed in ‘datadir’ and similar. If I use AC_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 *note Installation Directory Variables::. There are several means to achieve a similar goal: − Do not use ‘AC_DEFINE’ but use your makefile to pass the actual value of ‘datadir’ via compilation flags. *Note Installation Directory Variables::, for the details. − This solution can be simplified when compiling a program: you may either extend the ‘CPPFLAGS’: CPPFLAGS = -DDATADIR='"$(datadir)"' @CPPFLAGS@ If you are using Automake, you should use ‘AM_CPPFLAGS’ instead: AM_CPPFLAGS = -DDATADIR='"$(datadir)"' Alternatively, create a dedicated header file: DISTCLEANFILES = myprog-paths.h myprog-paths.h: Makefile echo '#define DATADIR "$(datadir)"' >$@ The Gnulib module ‘configmake’ provides such a header with all the standard directory variables defined, *note (gnulib)configmake::. − Use ‘AC_DEFINE’ but have ‘configure’ compute the literal value of ‘datadir’ and others. Many people have wrapped macros to automate this task; for an example, see the macro ‘AC_DEFINE_DIR’ from the Autoconf Macro Archive (https://www.gnu.org/software/autoconf-archive/). This solution does not conform to the GNU Coding Standards. − Note that all the previous solutions hard wire the absolute name of these directories in the executables, which is not a good property. You may try to compute the names relative to ‘prefix’, and try to find ‘prefix’ at runtime, this way your package is relocatable.