I've install the package for the prefix /usr and /opt/my_suite. Their version is 1.0.0 and 1.0.1. Suppose the $PKG_CONFIG_PATH is set correctly. pkg-config --modversion "$my_package" It shows "1.0.0". Now, I suggest that the pkg-config can go though all the $PKG_CONFIG_PATH. Then compare the version and show the lastest one.