Is it acceptable/desirable for a build, which has not been configured --with-libcurl, to still pick up a compatible OAuth implementation installed by the distro? If so, we can go with a "bare" dlopen(). If that's not okay, I think we will probably need to use pkglibdir or some derivative, and introduce a way for tests (and users?) to override that directory selection. Unless someone has a good idea on how we can split the difference.
That seems like it could cause some confusing situations and also making local testing of different compilation options difficult. How about ifdef-ing away the dlopen call if --with-libcurl is not specified. So to have oauth support you need to compile libpq with --with-libcurl AND the libpq-oauth.so file needs to be present.
(resent because I failed to reply to all from my phone)