configure: Restructure the way check_pkg_config() operates