How to create several builds of PostgreSQL?
If you use the --prefix=PREFIX option while building from source, won't that help? You would also need to look at other options such as --with-pgport=NUMBER to ensure that you don't end up forgetting to change the port in postgresql.conf. Please have a look at http://www.postgresql.org/docs/current/static/install-procedure.html for other options you might want to change.