fix build issues on centos:

- add postgresql detection for older cmake
- don't build agg as a static library, cut down on needed agg sources