Search code examples
autotoolsautoconfpkg-config

PKG_CHECK_MODULES vs AC_CHECK_LIB for checking availability of libraries


I am using autotools for a project. I wanted to understand the best practice when it comes to checking for the existence of libraries?

I tried using PKG_CHECK_MODULES, but unfortunately many of the libraries I am using don't show up in pkg-config --list-all (even after running ldconfig).

The alternative is to use AC_CHECK_LIB, but that requiress me to specify an example function from each library that I need to test for.


Solution

  • Whenever a third party software supports pkg-config, use it. If the third party software has no pkg-config support, you have to write your own check.

    Unless Autoconf already provides a test or you can copy a test from an other open source project.