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