There are now several pkgconfig alternatives, for example pkgconf, pkg-config-lite and pkgconfig-openbsd. The reason for choosing different implementations include avoiding unnecessary dependencies (for example pkgconfig requires the glib, a library designed for GTK+) and so on.
Cabal does not support these alternatives since it only recognises the /usr/bin/pkg-config --version output in the pkg-config a.b[.c] form, while other alternatives output in other manners, for example pkgconf outputs pkgconf a.b. So on my machine with pkgconf installed instead of pkgconfig, Cabal yells
Warning: cannot determine version of /usr/bin/pkg-config :
setup: The program pkg-config version >=0.9.0 is required but the version of
/usr/bin/pkg-config could not be determined.
and aborts when trying to install x11-xft.
Therefore it would be nice to modify the Cabal source code and let Cabal recognise the /usr/bin/pkg-config --version outputs of these pkgconfig alternatives, thanks :)
1. Since different pkgconfig alternatives have different versioning schemes, the modified source code might need to set different version conditions for different alternatives.
2. Cabal requires >=0.9.0 version of pkgconfig, but interestingly I cannot find related settings in the Cabal source code (at least in the Distribution.Simple.Program module).
The correct way to do this is to use:
$PKG_CONFIG --modversion pkg-config
The pkg-config package is a built-in package which defines the pkg-config frontend version, and implementation-specific features, such as:
ciaranis:~$ pkg-config --modversion pkg-config
ciaranis:~$ pkgconf --modversion pkg-config
Thanks to @nenolod, this way would be much more elegant :)
It looks from the comment history that this ticket is resolved, so I propose closing.
@CasperVector if there is something that you'd still like to see addressed here please re-open or create a new ticket. Thank you!
It works now. Thanks :)