Custom prefixes for GNU automake configure scripts using config.site
Recently, I had to compile a bunch of stuff on a system where I don’t have root access. Since I want to be able to “install” it in a tree that mirrors the system root / (e.g. put stuff in /bin, /usr/, etc.), that required using a custom --prefix for the output:
./configure --prefix=$HOME/prefix
make install
Now everything’s under $HOME/prefix, e.g. something which would otherwise be installed in /bin/bla will now be at $HOME/prefix/bin/bla. Just need to set $PATH and everything’s good!
So far so good, but having dependencies between installed packages is problematic. ./configure won’t “see” pre-existing headers or libraries in the prefix without setting CPPFLAGS and LDFLAGS explicitly every time.
There is a solution, though - the config.site file. Had to put the following in $HOME/prefix/share/config.site:
CPPFLAGS=-I$HOME/prefix/include
LDFLAGS=-L$HOME/prefix/lib
Now the configure scripts are always being able to “see” the installed stuff inside the custom prefix.