Search code examples
autotoolsautoconfautomakepkg-config

Portably include GLib headers in autoconf/automake


I need to include the GLib headers for a project that is built with an autoconf-based system for portability.

How can I safely import the GLib headers in a portable manner? I know about pkg-config, but that is not entirely portable (since some systems don't have it and I would prefer to only rely on autoconf for configuration).


Solution

  • The GLib 2.22 INSTALL file states that pkg-config is a requirement for installing this library. I am not being GLib (pun intended!); statement of this requirement is one of the first things on the top of the INSTALL file.

    From the text surrounding it is unclear whether pkg-config is needed to compile GLib itself, however it is clear that GLib 2.22 authors do not intend for any users to compile against GLib without having pkg-config. In particular, GLib's make install will install .pc files appropriately.

    For platform portability, instruct the user to set $PKG_CONFIG_PATH appropriately.