I don't know what kind of build system you are using, but setting
INSTALL_LOCATION inside a make based build of a standard EPICS
application does exactly what you describe. It builds locally and
installs into the selected location (instead of TOP).
The EPICS makefiles don't allow the full generality of
autoconf/automake, but they come close.
The rough equivalent of
$ ./configure --prefix=/usr/local/epics
$ make install DESTDIR=/tmp/builddir
Would be
$ make FINAL_LOCATION=/usr/local/epics
INSTALL_LOCATION=/tmp/builddir LINKER_USE_RPATH=NO
The LINKER_USE_RPATH=NO is necessary as rpath is always set using
INSTALL_LOCATION. So unlike auto* it will be necessary for users to
set LD_LIBRARY_PATH. Alternately you can adjust the runtime linker
config[3], or use an ELF file editor[1] to set rpath yourself.
I use this recipe (almost) when building debian linux packages[2].
I don't bother with INSTALL_LOCATION since I already have to pick
which files to include in the installable package. It can be
helpful if you're looking to quickly tar the result.