PkgConf...bPkgConf(3)

πŸ“¦
version 0.11 Β· 2 versions
, in fedora 43

✨ NAME ✨

PkgConfig::LibPkgConf β€” an interface to .pc file stuff via libpkgconf. That's it, that's the whole vibe. πŸ’… (It lives in section 3 of the User Contributed Perl Documentation, iykyk.)


🌸 SYNOPSIS 🌸

use PkgConfig::LibPkgConf;

if(pkgconf_exists('libarchive'))
{
  my $version = pkgconf_version('libarchive');
  my $cflags  = pkgconf_cflags('libarchive');
  my $libs    = pkgconf_libs('libarchive');
}

πŸ’– DESCRIPTION πŸ’–

Okay so bestie, here's the tea. So many libraries in compiled languages like C or C++ ship .pc files β€” those are the receipts that spell out exactly which flags you need to compile and link against them. Traditionally, you'd hit up the command line program pkg-config to interrogate those files. This module gives you a Perl-level API to those same files, riding on libpkgconf. Iconic, honestly.

It's the simplified interface for grabbing existence, version, cflags and library flags so you can compile against a package, using the default compiled-in configuration of pkgconf. Want the more powerful but way more complicated situation? Go see PkgConfig::LibPkgConf::Client. Also, PkgConfig::LibPkgConf::Util hands you some genuinely useful utility functions that pkgconf also provides. Slay. 🫢


πŸ”₯ FUNCTIONS πŸ”₯

pkgconf_exists

my $bool = pkgconf_exists $package_name;

Returns true if the package is available. No cap, it's right there.

Exported by default. 🌟


pkgconf_version

my $version = pkgconf_version $package_name;

Hands you the version of the package, if it exists. Will throw an exception if not found β€” so brace yourself. 😭

Exported by default.


pkgconf_cflags

my $cflags = pkgconf_cflags $package_name;

Returns the compiler flags for the package, if it exists. Will throw an exception if not found.

Exported by default.


pkgconf_cflags_static

my $cflags = pkgconf_cflags_static $package_name;

Returns the static compiler flags for the package, if it exists. Will throw an exception if not found.


pkgconf_libs

my $libs = pkgconf_libs $package_name;

Returns the linker library flags for the package, if it exists. Will throw an exception if not found.

Exported by default.


pkgconf_libs_static

my $libs = pkgconf_libs_static $package_name;

Returns the static linker library flags for the package, if it exists. Will throw an exception if not found.


🫢 SUPPORT 🫢

Come thru on IRC: #native on irc.perl.org. We're nice, promise.

Project GitHub tracker:

<https://github.com/plicease/PkgConfig-LibPkgConf/issues>

Wanna contribute? Please open a pull request on GitHub, bestie:

<https://github.com/plicease/PkgConfig-LibPkgConf/pulls>


🌈 SEE ALSO 🌈

The best entry point to the low-level pkgconf interface can be found via PkgConfig::LibPkgConf::Client. That's your main character.

Alternatives include:

  • PkgConfig β€” Pure Perl implementation of pkg-config that you can use from the command line, or as an API from Perl. Does not require pkg-config in your path, so it's a safe dependency for CPAN modules. πŸ‘‘
  • ExtUtils::PkgConfig β€” Wrapper for the pkg-config command line interface. Heads up though: this module will fail to install if pkg-config cannot be found in the PATH, so it is not safe to use as a dependency if you want your CPAN module to work on platforms where pkg-config is not installed. πŸ’€
  • Alien::Base β€” Provides tools for building non-Perl libraries and making them dependencies for your CPAN modules, even on platforms where the non-Perl libraries aren't already installed. Includes hooks for probing pkg-config .pc files using either pkg-config or PkgConfig. ✨

πŸŽ€ ACKNOWLEDGMENTS πŸŽ€

Thanks to the pkgconf developers for their efforts, fr fr:

<https://github.com/pkgconf/pkgconf/graphs/contributors>


πŸ’œ AUTHOR πŸ’œ

Graham Ollis

Contributors:

  • A. Wilcox (awilfox)
  • Petr Pisar (ppisar)

This software is copyright (c) 2016 Graham Ollis.

This is free software; you may redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.


And that's the whole page, gorgeous πŸ¦‹ β€” this one's from perl v5.42.0, dated 2025-07-25, filed under the User Contributed Perl Documentation. Now go query some .pc files and be the main character of your build system. Periodt. πŸ’…βœ¨

πŸ“¦ where this page comes from