PkgConf...bPkgConf(3)
β¨ 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-configthat 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-configcommand line interface. Heads up though: this module will fail to install ifpkg-configcannot be found in thePATH, so it is not safe to use as a dependency if you want your CPAN module to work on platforms wherepkg-configis 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.pcfiles using eitherpkg-configor 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)
β COPYRIGHT AND LICENSE β
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
- fedora 43: perl-PkgConfig-LibPkgConf 0.11-25.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms