configure: Improve check for PostgreSQL's libpq.
Previously this test did not check that linking against libpq worked.
This commit fixes that. Besides broken installations this also guards
against pg_config that is applicable to the host when cross-compiling to
Mingw, which doesn't always show up as cross-compiling since some systems
can still run the Mingw binaries if Wine is installed as a binary
interpreter for Windows executables.
This also fixes a minor issue where -lpq was being added to the default
LIBS as well as to PG_LIBS, which meant that every PSPP binary was being
linked against it, not just the ones that needed it (which were being
linked against it twice).
Problem reported by Michel Boaventura <michel@michelboaventura.com>.