man-pages/man3/ExtUtils::PkgConfig.3pm.html
2021-03-31 01:06:50 +01:00

229 lines
5.8 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of ExtUtils::PkgConfig</TITLE>
</HEAD><BODY>
<H1>ExtUtils::PkgConfig</H1>
Section: User Contributed Perl Documentation (3pm)<BR>Updated: 2017-10-08<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
ExtUtils::PkgConfig - simplistic interface to pkg-config
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
use ExtUtils::PkgConfig;
$package = 'gtk+-2.0';
%pkg_info = ExtUtils::PkgConfig-&gt;find ($package);
print &quot;modversion: $pkg_info{modversion}\n&quot;;
print &quot;cflags: $pkg_info{cflags}\n&quot;;
print &quot;libs: $pkg_info{libs}\n&quot;;
$exists = ExtUtils::PkgConfig-&gt;exists($package);
$modversion = ExtUtils::PkgConfig-&gt;modversion($package);
$libs = ExtUtils::PkgConfig-&gt;libs($package);
$cflags = ExtUtils::PkgConfig-&gt;cflags($package);
$cflags_only_I = ExtUtils::PkgConfig-&gt;cflags_only_I($package);
$cflags_only_other = ExtUtils::PkgConfig-&gt;cflags_only_other($package);
$libs_only_L = ExtUtils::PkgConfig-&gt;libs_only_L($package);
$libs_only_l = ExtUtils::PkgConfig-&gt;libs_only_l($package);
$libs_only_other = ExtUtils::PkgConfig-&gt;libs_only_other($package);
$static_libs = ExtUtils::PkgConfig-&gt;static_libs($package);
$var_value = ExtUtils::PkgConfig-&gt;variable($package, $var);
if (ExtUtils::PkgConfig-&gt;atleast_version($package,$version)) {
...
}
if (ExtUtils::PkgConfig-&gt;exact_version($package,$version)) {
...
}
if (ExtUtils::PkgConfig-&gt;max_version($package,$version)) {
...
}
</PRE>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
The pkg-config program retrieves information about installed libraries,
usually for the purposes of compiling against and linking to them.
<P>
ExtUtils::PkgConfig is a very simplistic interface to this utility, intended
for use in the Makefile.PL of perl extensions which bind libraries that
pkg-config knows. It is really just boilerplate code that you would've
written yourself.
<A NAME="lbAE">&nbsp;</A>
<H3><FONT SIZE="-1">USAGE</FONT></H3>
<DL COMPACT>
<DT id="1"><FONT SIZE="-1">HASH</FONT> = ExtUtils::PkgConfig-&gt;find (<FONT SIZE="-1">STRING,</FONT> [<FONT SIZE="-1">STRING, ...</FONT>])<DD>
Call pkg-config on the library specified by <I></I><FONT SIZE="-1"><I>STRING</I></FONT><I></I> (you'll have to know what
to use here). The returned <I></I><FONT SIZE="-1"><I>HASH</I></FONT><I></I> contains the modversion, cflags, and libs
values under keys with those names. If multiple <FONT SIZE="-1">STRINGS</FONT> are passed they are
attempted in the order they are given till a working package is found.
<P>
If pkg-config fails to find a working <I></I><FONT SIZE="-1"><I>STRING</I></FONT><I></I>, this function croaks with a
message intended to be helpful to whomever is attempting to compile your
package.
<P>
For example:
<P>
<PRE>
*** can not find package bad1
*** check that it is properly installed and available
*** in PKG_CONFIG_PATH
</PRE>
<P>
or
<P>
<PRE>
*** can't find cflags for gtk+-2.0
*** is it properly installed and available in PKG_CONFIG_PATH?
</PRE>
<DT id="2"><FONT SIZE="-1">STRING</FONT> = ExtUtils::PkgConfig-&gt;create_version_macros (<FONT SIZE="-1">PACKAGE, STEM</FONT>)<DD>
Create a set of version macros with the prefix <I></I><FONT SIZE="-1"><I>STEM</I></FONT><I></I> for the library
specified by <I></I><FONT SIZE="-1"><I>PACKAGE</I></FONT><I></I>. The result is returned.
<P>
Example input would be ``gtk+-2.0'' for <I></I><FONT SIZE="-1"><I>PACKAGE</I></FONT><I></I> and ``<FONT SIZE="-1">GTK''</FONT> for <I></I><FONT SIZE="-1"><I>STEM</I></FONT><I></I>.
<DT id="3">ExtUtils::PkgConfig-&gt;write_version_macros (<FONT SIZE="-1">FILE, PACKAGE, STEM,</FONT> [<FONT SIZE="-1">PACKAGE, STEM, ...</FONT>])<DD>
Create one or more sets of version macros for the libraries and prefixes
specified by the <I></I><FONT SIZE="-1"><I>PACKAGE</I></FONT><I></I> and <I></I><FONT SIZE="-1"><I>STEM</I></FONT><I></I> pairs and write them to the file
<I></I><FONT SIZE="-1"><I>FILE</I></FONT><I></I>. If it doesn't exist, <I></I><FONT SIZE="-1"><I>FILE</I></FONT><I></I> will be created. If it does exist, it
will be overwritten.
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>SEE ALSO</H2>
ExtUtils::PkgConfig was designed to work with ExtUtils::Depends for compiling
the various modules of the gtk2-perl project.
<P>
<PRE>
L&lt;ExtUtils::Depends&gt;
L&lt;<A HREF="http://gtk2-perl.sourceforge.net/">http://gtk2-perl.sourceforge.net/</A>&gt;
</PRE>
<P>
This module is really just an interface to the pkg-config utility program.
<A HREF="http://www.freedesktop.org/Software/pkgconfig">http://www.freedesktop.org/Software/pkgconfig</A>
<A NAME="lbAG">&nbsp;</A>
<H2>AUTHORS</H2>
muppet &lt;scott at asofyet dot org&gt;.
<A NAME="lbAH">&nbsp;</A>
<H2>COPYRIGHT AND LICENSE</H2>
Copyright 2003-2004, 2012-2013 by muppet, Ross McFarland, and the gtk2-perl
team
<P>
This library is free software; you can redistribute it and/or modify
it under the terms of the Lesser General Public License (<FONT SIZE="-1">LGPL</FONT>). For
more information, see <A HREF="http://www.fsf.org/licenses/lgpl.txt">http://www.fsf.org/licenses/lgpl.txt</A>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="4"><A HREF="#lbAB">NAME</A><DD>
<DT id="5"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="6"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DL>
<DT id="7"><A HREF="#lbAE"><FONT SIZE="-1">USAGE</FONT></A><DD>
</DL>
<DT id="8"><A HREF="#lbAF">SEE ALSO</A><DD>
<DT id="9"><A HREF="#lbAG">AUTHORS</A><DD>
<DT id="10"><A HREF="#lbAH">COPYRIGHT AND LICENSE</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:40 GMT, March 31, 2021
</BODY>
</HTML>