Check if the packages are known by the external program pkg-config

Missing packages are reported to the console via ToolContext::error. Check for errors using check_errors.

Property definitions

nitc :: pkgconfig $ ToolContext :: check_pkgconfig_packages
	# Check if the `packages` are known by the external program `pkg-config`
	#
	# Missing packages are reported to the console via `ToolContext::error`.
	# Check for errors using `check_errors`.
	fun check_pkgconfig_packages(packages: Array[String])
	do
		if not pkgconfig_is_available then return

		for pkg in packages do
			var proc_exist = new Process("pkg-config", "--exists", pkg)
			proc_exist.wait
			var status = proc_exist.status
			if status == 1 then
				error(null,
					"Error: dev package for `{pkg}` unknown by `pkg-config`, install it with `apt-get`, `brew` or similar.")
			else if status != 0 then
				error(null,
					"Error: something went wrong calling `pkg-config`, make sure it is correctly configured.")
			end
		end
	end
src/ffi/pkgconfig.nit:43,2--63,4