1PkgConfig::LibPkgConf(3U)ser Contributed Perl DocumentatiPokngConfig::LibPkgConf(3)
2
3
4
6 PkgConfig::LibPkgConf - Interface to .pc file interface via libpkgconf
7
9 use PkgConfig::LibPkgConf;
10
11 if(pkgconf_exists('libarchive'))
12 {
13 my $version = pkgconf_version('libarchive');
14 my $cflags = pkgconf_cflags('libarchive');
15 my $libs = pkgconf_libs('libarchive');
16 }
17
19 Many libraries in compiled languages such as C or C++ provide ".pc"
20 files to specify the flags required for compiling and linking against
21 those libraries. Traditionally, the command line program "pkg-config"
22 is used to query these files. This module provides a Perl level API
23 using "libpkgconf" to these files.
24
25 This module provides a simplified interface for getting the existence,
26 version, cflags and library flags needed for compiling against a
27 package, using the default compiled in configuration of "pkgconf". For
28 a more powerful, but complicated interface see
29 PkgConfig::LibPkgConf::Client. In addition,
30 PkgConfig::LibPkgConf::Util provides some useful utility functions that
31 are also provided by "pkgconf".
32
34 pkgconf_exists
35 my $bool = pkgconf_exists $package_name;
36
37 Returns true if the package is available.
38
39 Exported by default.
40
41 pkgconf_version
42 my $version = pkgconf_version $package_name;
43
44 Returns the version of the package, if it exists. Will throw an
45 exception if not found.
46
47 Exported by default.
48
49 pkgconf_cflags
50 my $cflags = pkgconf_cflags $package_name;
51
52 Returns the compiler flags for the package, if it exists. Will throw
53 an exception if not found.
54
55 Exported by default.
56
57 pkgconf_cflags_static
58 my $cflags = pkgconf_cflags_static $package_name;
59
60 Returns the static compiler flags for the package, if it exists. Will
61 throw an exception if not found.
62
63 pkgconf_libs
64 my $libs = pkgconf_libs $package_name;
65
66 Returns the linker library flags for the package, if it exists. Will
67 throw an exception if not found.
68
69 Exported by default.
70
71 pkgconf_libs_static
72 my $libs = pkgconf_libs_static $package_name;
73
74 Returns the static linker library flags for the package, if it exists.
75 Will throw an exception if not found.
76
78 IRC #native on irc.perl.org
79
80 Project GitHub tracker:
81
82 <https://github.com/plicease/PkgConfig-LibPkgConf/issues>
83
84 If you want to contribute, please open a pull request on GitHub:
85
86 <https://github.com/plicease/PkgConfig-LibPkgConf/pulls>
87
89 The best entry point to the low level "pkgconf" interface can be found
90 via PkgConfig::LibPkgConf::Client.
91
92 Alternatives include:
93
94 PkgConfig
95 Pure Perl implementation of "pkg-config" which can be used from the
96 command line, or as an API from Perl. Does not require pkg-config
97 in your path, so is a safe dependency for CPAN modules.
98
99 ExtUtils::PkgConfig
100 Wrapper for the "pkg-config" command line interface. This module
101 will fail to install if "pkg-config" cannot be found in the "PATH",
102 so it is not safe to use a dependency if you want your CPAN module
103 to work on platforms where "pkg-config" is not installed.
104
105 Alien::Base
106 Provides tools for building non-Perl libraries and making them
107 dependencies for your CPAN modules, even on platforms where the
108 non-Perl libraries aren't already installed. Includes hooks for
109 probing "pkg-config" ".pc" files using either "pkg-config" or
110 PkgConfig.
111
113 Thanks to the "pkgconf" developers for their efforts:
114
115 <https://github.com/pkgconf/pkgconf/graphs/contributors>
116
118 Graham Ollis
119
120 Contributors:
121
122 A. Wilcox (awilfox)
123
124 Petr Pisar (ppisar)
125
127 This software is copyright (c) 2016 Graham Ollis.
128
129 This is free software; you may redistribute it and/or modify it under
130 the same terms as the Perl 5 programming language system itself.
131
132
133
134perl v5.34.0 2021-07-22 PkgConfig::LibPkgConf(3)