Don't use postgres unless --with-postgresql.

This is in line with what the mysql m4 script does, and prevents the unit tests
from failing if the libs are present but pg is not running.

Also, in configure.ac, correct POSTGRESQL_LIBS -> POSTGRESQL_LDFLAGS.