For the life of me I can't find the configure flags for the Nagios Plugins. check_pgsql isn't compiling because it says it can't find the postgresql libraries, but I know exactly where they are on my server.
Do you have the development libraries installed, not just the runtime libraries?
On a RHEL/CentOS box, I see:
To build your own clients, you will most likely need to have postgresql-devel installed. To run it, you'll need the postgresql-libs package. Other Linuxes will have their own naming conventions if they split the runtime libraries from the development libraries, assuming you're using Linux.