         additionalSearchPaths: [AbsolutePath] = [],
         diagnostics: DiagnosticsEngine,
         fileSystem: FileSystem = localFileSystem,
-        brewPrefix: AbsolutePath?
+        brewPrefix: AbsolutePath?,
+        loadingContext: LoadingContext = LoadingContext()
     ) throws {
+        loadingContext.pkgConfigStack.append(name)
 
         if let path = try? AbsolutePath(validating: name) {
             guard fileSystem.isFile(path) else { throw PkgConfigError.couldNotFindConfigFile(name: name) }

        return splits
    }
}


        self.cFlags = parser.cFlags + dependencyFlags.cFlags + privateDependencyFlags.cFlags
        self.libs = parser.libs + dependencyFlags.libs

        loadingContext.pkgConfigStack.removeLast();
    }

    private static var envSearchPaths: [AbsolutePath] {
