1ExtUtils::PkgConfig(3)User Contributed Perl DocumentationExtUtils::PkgConfig(3)
2
3
4
6 ExtUtils::PkgConfig - simplistic interface to pkg-config
7
9 use ExtUtils::PkgConfig;
10
11 $package = 'gtk+-2.0';
12
13 %pkg_info = ExtUtils::PkgConfig->find ($package);
14 print "modversion: $pkg_info{modversion}\n";
15 print "cflags: $pkg_info{cflags}\n";
16 print "libs: $pkg_info{libs}\n";
17
18 $exists = ExtUtils::PkgConfig->exists($package);
19
20 $modversion = ExtUtils::PkgConfig->modversion($package);
21
22 $libs = ExtUtils::PkgConfig->libs($package);
23
24 $cflags = ExtUtils::PkgConfig->cflags($package);
25
26 $cflags_only_I = ExtUtils::PkgConfig->cflags_only_I($package);
27
28 $cflags_only_other = ExtUtils::PkgConfig->cflags_only_other($package);
29
30 $libs_only_L = ExtUtils::PkgConfig->libs_only_L($package);
31
32 $libs_only_l = ExtUtils::PkgConfig->libs_only_l($package);
33
34 $libs_only_other = ExtUtils::PkgConfig->libs_only_other($package);
35
36 $static_libs = ExtUtils::PkgConfig->static_libs($package);
37
38 $var_value = ExtUtils::PkgConfig->variable($package, $var);
39
40 if (ExtUtils::PkgConfig->atleast_version($package,$version)) {
41 ...
42 }
43
44 if (ExtUtils::PkgConfig->exact_version($package,$version)) {
45 ...
46 }
47
48 if (ExtUtils::PkgConfig->max_version($package,$version)) {
49 ...
50 }
51
53 The pkg-config program retrieves information about installed libraries,
54 usually for the purposes of compiling against and linking to them.
55
56 ExtUtils::PkgConfig is a very simplistic interface to this utility,
57 intended for use in the Makefile.PL of perl extensions which bind
58 libraries that pkg-config knows. It is really just boilerplate code
59 that you would've written yourself.
60
61 USAGE
62 HASH = ExtUtils::PkgConfig->find (STRING, [STRING, ...])
63 Call pkg-config on the library specified by STRING (you'll have to
64 know what to use here). The returned HASH contains the modversion,
65 cflags, and libs values under keys with those names. If multiple
66 STRINGS are passed they are attempted in the order they are given
67 till a working package is found.
68
69 If pkg-config fails to find a working STRING, this function croaks
70 with a message intended to be helpful to whomever is attempting to
71 compile your package.
72
73 For example:
74
75 *** can not find package bad1
76 *** check that it is properly installed and available
77 *** in PKG_CONFIG_PATH
78
79 or
80
81 *** can't find cflags for gtk+-2.0
82 *** is it properly installed and available in PKG_CONFIG_PATH?
83
84 STRING = ExtUtils::PkgConfig->create_version_macros (PACKAGE, STEM)
85 Create a set of version macros with the prefix STEM for the library
86 specified by PACKAGE. The result is returned.
87
88 Example input would be "gtk+-2.0" for PACKAGE and "GTK" for STEM.
89
90 ExtUtils::PkgConfig->write_version_macros (FILE, PACKAGE, STEM,
91 [PACKAGE, STEM, ...])
92 Create one or more sets of version macros for the libraries and
93 prefixes specified by the PACKAGE and STEM pairs and write them to
94 the file FILE. If it doesn't exist, FILE will be created. If it
95 does exist, it will be overwritten.
96
98 ExtUtils::PkgConfig was designed to work with ExtUtils::Depends for
99 compiling the various modules of the gtk2-perl project.
100
101 L<ExtUtils::Depends>
102
103 L<http://gtk2-perl.sourceforge.net/>
104
105 This module is really just an interface to the pkg-config utility
106 program. http://www.freedesktop.org/Software/pkgconfig
107
109 muppet <scott at asofyet dot org>.
110
112 Copyright 2003-2004, 2012-2013 by muppet, Ross McFarland, and the
113 gtk2-perl team
114
115 This library is free software; you can redistribute it and/or modify it
116 under the terms of the Lesser General Public License (LGPL). For more
117 information, see http://www.fsf.org/licenses/lgpl.txt
118
119
120
121perl v5.36.0 2022-07-22 ExtUtils::PkgConfig(3)