Here is how I would approach debugging this problem: Run
strace -o makelog -f -ff -v -s 9000 make
This will create makelog.<pid>
files for all processes run during compilation. With the options given they will contain a complete list of environment variables, so you should first of all be able to follow PKG_CONFIG_PATH
and see if/where it changes. You can also find things like if /usr/local/lib/pkgconfig
is read from some configuration file or not for instance.