You should be able to do this without specifically referencing the names "libpq" or "ecpg". Look into the Makefile, if it defines SO_MAJOR_VERSION, then it's a library you are concerned with, and then do the copying or moving.
pgsql-hackers by date:
Соглашаюсь с условиями обработки персональных данных