ExtUtil...kgConfig(3)
π ExtUtil...kgConfig(3) β like, the actual manual page bestie
okay so this is a page from the User Contributed Perl Documentation section of the manual (man section 3, perl girlies rise), and it's filed under ExtUtil...kgConfig(3) β yes the name is truncated, no I don't know why, moving on π«Ά
β¨ NAME β¨
ExtUtils::PkgConfig β a simplistic interface to pkg-config. that's it, that's the whole vibe. short king of a NAME section, we love that for it π
π SYNOPSIS π
here's the whole thing, literally copy-paste-able, no cap:
use ExtUtils::PkgConfig;
$package = 'gtk+-2.0';
%pkg_info = ExtUtils::PkgConfig->find ($package);
print "modversion: $pkg_info{modversion}\n";
print "cflags: $pkg_info{cflags}\n";
print "libs: $pkg_info{libs}\n";
$exists = ExtUtils::PkgConfig->exists($package);
$modversion = ExtUtils::PkgConfig->modversion($package);
$libs = ExtUtils::PkgConfig->libs($package);
$cflags = ExtUtils::PkgConfig->cflags($package);
$cflags_only_I = ExtUtils::PkgConfig->cflags_only_I($package);
$cflags_only_other = ExtUtils::PkgConfig->cflags_only_other($package);
$libs_only_L = ExtUtils::PkgConfig->libs_only_L($package);
$libs_only_l = ExtUtils::PkgConfig->libs_only_l($package);
$libs_only_other = ExtUtils::PkgConfig->libs_only_other($package);
$static_libs = ExtUtils::PkgConfig->static_libs($package);
$var_value = ExtUtils::PkgConfig->variable($package, $var);
if (ExtUtils::PkgConfig->atleast_version($package,$version)) {
...
}
if (ExtUtils::PkgConfig->exact_version($package,$version)) {
...
}
if (ExtUtils::PkgConfig->max_version($package,$version)) {
...
}
like, look at all those methods. a whole squad. π
πΈ DESCRIPTION πΈ
so the pkg-config program pulls info about installed libraries β usually so you can compile against them and link to them (iykyk).
ExtUtils::PkgConfig is a very simplistic interface to that utility, made for use in the Makefile.PL of perl extensions that bind libraries pkg-config already knows about. and honestly? it is really just boilerplate code that you would've written yourself. the module said "I'm the main character" and then handed you your own homework back. iconic honestly π
π¦ USAGE π¦
HASH = ExtUtils::PkgConfig->find (STRING, [STRING, ...])β callspkg-configon the library you specify withSTRING(and yeah, you'll have to know what to use here β that's on you bestie, the module can't read your mind π). the returnedHASHhas themodversion,cflags, andlibsvalues tucked under keys with those exact names. if you pass multipleSTRINGs, they get attempted in the order they are given until a working package turns up. slay.
if pkg-config fails to find a working STRING, this function croaks with a message that's meant to be helpful to whoever is trying to compile your package. for example:
*** can not find package bad1
*** check that it is properly installed and available
*** in PKG_CONFIG_PATH
or, the other flavour:
*** can't find cflags for gtk+-2.0
*** is it properly installed and available in PKG_CONFIG_PATH?
screaming crying throwing up because PKG_CONFIG_PATH was empty the whole time. we've all been there. π«Ά
STRING = ExtUtils::PkgConfig->create_version_macros (PACKAGE, STEM)β makes a whole set of version macros for the library you named inPACKAGE, with the prefixSTEM, and returns the result. example input:"gtk+-2.0"forPACKAGEand"GTK"forSTEM. adorable. πExtUtils::PkgConfig->write_version_macros (FILE, PACKAGE, STEM, [PACKAGE, STEM, ...])β same energy, but it does it for one or more sets of version macros, for the library-and-prefix pairs you list inPACKAGEandSTEM, and writes them all into the fileFILE. ifFILEdoesn't exist, it gets created. if it does exist, it gets overwritten β no backsies, no undo, head empty only vibes β οΈ
β SEE ALSO β
ExtUtils::PkgConfig was designed to work with ExtUtils::Depends for compiling the various modules of the gtk2-perl project. cute couple alert π
L<ExtUtils::Depends>L<http://gtk2-perl.sourceforge.net/>
this module is really just an interface to the pkg-config utility program, which lives at:
π AUTHORS π
muppet <scott at asofyet dot org>.
that's the whole list. one legend. main character energy fr fr β¨
π COPYRIGHT AND LICENSE π
Copyright 2003-2004, 2012-2013 by muppet, Ross McFarland, and the gtk2-perl team
this library is free software; you can redistribute it and/or modify it under the terms of the Lesser General Public License (LGPL). for more information, see http://www.fsf.org/licenses/lgpl.txt
and that's the page!! sign-off time: this lil doc dropped as perl v5.42.0 dated 2017-04-22, filed right back under ExtUtil...kgConfig(3). stay compiling, bestie π
ππ¦
π¦ where this page comes from
- opensuse-leap 16.0: perl-ExtUtils-PkgConfig 1.160000-160000.2.2 Β· LGPL-2.1+
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms