This can be solved a couple of different ways...
Add the path '/usr/local/pgsql/lib' to your LD_LIBRARY_PATH shell variable before starting aolserver process (using "set" or "setenv" command depending on your shell).
Or add the path to the file /etc/ld.so.config and then run the command
ldconfig.
Neither of these worked for me (I was using freebsd though). I made a
soft link from /usr/lib/libpq.so.2 to the pgsql directory:
% ln -s /usr/local/pgsql/lib/libpq.so.2 /usr/lib/libpq.so.2
Make sure the user starting aolserver can read from this directory.