10139N/A<!DOCTYPE REFENTRY PUBLIC "-//Sun Microsystems//DTD DocBook V3.0-Based SolBook Subset V2.0//EN" [
10139N/A<!--ArborText, Inc., 1988-1999, v.4002-->
13666N/A<!--ARC : LSARC 2002/747 GNOME 2.0 pkg-config-->
10139N/A<!ENTITY cmd "pkg-config">
10139N/A<!ENTITY % commonents SYSTEM "smancommon.ent">
10139N/A%commonents;
10139N/A<!ENTITY % booktitles SYSTEM "booktitles.ent">
10139N/A%booktitles;
11904N/A<!ENTITY suncopy "Copyright (c) 2003,2004,2007 Sun Microsystems, Inc. All Rights Reserved.">
10139N/A]>
10139N/A<?Pub UDT _bookmark _target>
10139N/A<?Pub EntList brvbar bull cross dash diam diams frac12 frac13 frac14 hellip
10139N/A laquo lArr loz mdash nabla ndash para pound rArr raquo sect yen bsol>
10139N/A<?Pub Inc>
10139N/A<refentry id="pkg-config-1">
10139N/A<!-- %Z%%M% %I% %E% SMI; -->
13741N/A<refmeta><refentrytitle>&cmd;</refentrytitle><manvolnum>1</manvolnum>
11904N/A<refmiscinfo class="date">08 Nov 2007</refmiscinfo>
10139N/A<refmiscinfo class="sectdesc">&man1;</refmiscinfo>
10139N/A<refmiscinfo class="software">&release;</refmiscinfo>
10139N/A<refmiscinfo class="arch">generic</refmiscinfo>
10139N/A<refmiscinfo class="copyright">&suncopy;</refmiscinfo>
10139N/A</refmeta>
13741N/A<indexterm><primary>&cmd;</primary></indexterm><indexterm><primary>return
10139N/Ameta information about installed libraries</primary></indexterm>
13741N/A<refnamediv id="pkg-config-1-name"><refname>&cmd;</refname><refpurpose>
10139N/Areturn meta information about installed libraries</refpurpose></refnamediv>
10139N/A<refsynopsisdiv id="pkg-config-1-synp"><title>&synp-tt;</title>
10139N/A<cmdsynopsis><command>&cmd;</command>
10139N/A<arg choice="opt"><option>-atleast-pkgconfig-version=<replaceable>version</replaceable></option></arg>
10139N/A<arg choice="opt"><option>-atleast-version=<replaceable>version</replaceable></option></arg>
10139N/A<arg choice="opt"><option>-cflags</option></arg>
10139N/A<arg choice="opt"><option>-cflags-only-I</option></arg>
10139N/A<arg choice="opt"><option>-cflags-only-other</option></arg>
11904N/A<arg choice="opt"><option>-debug</option></arg>
10139N/A<arg choice="opt"><option>-define-variable=<replaceable>variablename=value</replaceable></option></arg>
10139N/A<arg choice="opt"><option>-errors-to-stdout</option></arg>
10139N/A<arg choice="opt"><option>-exact-version=<replaceable>version</replaceable></option></arg>
10139N/A<arg choice="opt"><option>-exists</option></arg>
10139N/A<arg choice="opt"><option>-help</option></arg>
10139N/A<arg choice="opt"><option>-libs</option></arg>
10139N/A<arg choice="opt"><option>-libs-only-L</option></arg>
10139N/A<arg choice="opt"><option>-libs-only-l</option></arg>
10139N/A<arg choice="opt"><option>-libs-only-other</option></arg>
10139N/A<arg choice="opt"><option>-list-all</option></arg>
10139N/A<arg choice="opt"><option>-max-version=<replaceable>version</replaceable></option></arg>
10139N/A<arg choice="opt"><option>-modversion</option></arg>
10139N/A<arg choice="opt"><option>-print-errors</option></arg>
10139N/A<arg choice="opt"><option>-silence-errors</option></arg>
10139N/A<arg choice="opt"><option>-short-errors</option></arg>
12055N/A<arg choice="opt"><option>-static</option></arg>
10139N/A<arg choice="opt"><option>-uninstalled</option></arg>
10139N/A<arg choice="opt"><option>-usage</option></arg>
10139N/A<arg choice="opt"><option>-variable=<replaceable>variablename</replaceable></option></arg>
11904N/A<arg choice="opt"><option>-version</option></arg>
10139N/A<arg choice="opt"><replaceable>libraries</replaceable></arg>
10139N/A</cmdsynopsis></refsynopsisdiv>
10139N/A<refsect1 id="pkg-config-1-desc"><title>&desc-tt;</title>
12055N/A<para>
12055N/A<command>&cmd;</command> retrieves information about installed libraries in the
12055N/Asystem. <command>&cmd;</command> is typically used to compile and link against
12055N/Aone or more libraries. The following example shows how to use
12055N/A<command>&cmd;</command> in a Makefile:
12055N/A</para>
10139N/A<literallayout>program: program.c
10139N/A cc program.c `&cmd; --cflags --libs gtk+-2.0`</literallayout>
12055N/A<para>
12055N/A<command>&cmd;</command> retrieves information about packages from special
12055N/Ametadata files. These files have the same name as the package, with the
12055N/Aextension <filename>.pc</filename>. By default, <command>&cmd;</command> looks
17587N/Ain the directories <filename>/usr/lib/pkgconfig</filename> and
17587N/A<filename>/usr/share/pkgconfig</filename> for these files. It also looks in
17587N/Athe colon-separated list of directories specified by the
12055N/A<envar>PKG_CONFIG_PATH</envar> environment variable.
12055N/A</para>
12055N/A<para>
12055N/AThe package name specified on the <command>&cmd;</command> command line is
12055N/Adefined to be the name of the metadata file, without the
12055N/A<filename>.pc</filename> extension. If a library can install multiple versions
12055N/Asimultaneously, it must give each version its own name. For example, GTK 1.2
12055N/Amight have the package name <literal>gtk+</literal> while GTK 2.0 has the
12055N/Apackage name <literal>gtk+-2.0</literal>.
12055N/A</para>
10139N/A</refsect1>
10139N/A<refsect1 id="pkg-config-1-exde"><title>&exde-tt;</title>
11965N/A<refsect2>
11904N/A<para>A <filename>.pc</filename> file has two kinds of lines:</para>
10139N/A<itemizedlist>
10139N/A<listitem><para>Keyword lines start with a keyword and a colon.</para></listitem>
12055N/A<listitem><para>
12055N/AVariable definitions start with an alphanumeric string and an equals sign.
12055N/A</para>
12055N/A</listitem>
10139N/A</itemizedlist>
12055N/A<para>
12055N/AKeywords are defined in advance and have special meaning to
12055N/A<command>&cmd;</command>. Variables do not have special meaning, you can
12055N/Aspecify any variables that you wish. However, users may expect to retrieve the
12055N/Ausual directory name variables.
12055N/A</para>
12055N/A<para>
12055N/ANote that variable references are written "${foo}"; you can escape literal
12055N/A"${" as "$${".
12055N/A</para>
12055N/A<para>
12055N/A<command>&cmd;</command> supports the following keywords:
10139N/A</para>
10139N/A<variablelist termlength="medium">
12055N/A<varlistentry>
12055N/A<term><literal>Name</literal></term>
12055N/A<listitem><para>
12055N/AA human-readable name for the package. Note that it is not the name passed as
12055N/Aan argument to <command>&cmd;</command>.
12055N/A</para>
12055N/A</listitem></varlistentry>
12055N/A
12055N/A<varlistentry>
12055N/A<term><literal>Description</literal></term>
12055N/A<listitem><para>
12055N/AA brief description of the package.
12055N/A</para>
12055N/A</listitem></varlistentry>
12055N/A
12055N/A<varlistentry>
12055N/A<term><literal>URL</literal></term>
12055N/A<listitem><para>
12055N/AA URL where people can get more information about and download the package.
12055N/A</para>
12055N/A</listitem></varlistentry>
12055N/A
12055N/A<varlistentry>
12055N/A<term><literal>Version</literal></term>
12055N/A<listitem><para>
12055N/AThe most-specific-possible package version string.
10139N/A</para>
10139N/A</listitem></varlistentry>
10139N/A
12055N/A<varlistentry>
12055N/A<term><literal>Requires</literal></term>
12055N/A<listitem><para>
12055N/AA comma-separated list of packages that are required by your package. Flags
12055N/Afrom dependent packages will be merged in to the flags reported for your
12055N/Apackage. Optionally, you can specify the version of the required package
12055N/A(using the operators =, &lt;, &gt;, &gt;=, &lt;=). Specifying a version allows
12055N/A<command>&cmd;</command> to perform extra sanity checks. You may only mention
12055N/Athe same package once on the Requires: line. If the version of a package is not
12055N/Aspecified, any version will be used with no checking.
12055N/A</para>
10139N/A</listitem></varlistentry>
10139N/A
12055N/A<varlistentry>
12055N/A<term><literal>Conflicts</literal></term>
12055N/A<listitem><para>
12055N/AOptional. Allows <command>&cmd;</command> to perform additional sanity checks,
12055N/Aprimarily to detect broken user installations. The syntax is the same as
12055N/ARequires: except that you can list the same package more than once, for example
12055N/A"foobar = 1.2.3, foobar = 1.2.5, foobar >= 1.3", if you have reason to do so.
12055N/AIf a version is not specified, your package conflicts with all versions of the
12055N/Amentioned package. If a user tries to use your package and a conflicting
12055N/Apackage at the same time, <command>&cmd;</command> complains.
12055N/A</para>
10139N/A</listitem></varlistentry>
10139N/A
12055N/A<varlistentry>
12055N/A<term><literal>Libs</literal></term>
12055N/A<listitem><para>
12055N/AThe link flags specific to your package. Do not add any flags for required
12055N/Apackages, <command>&cmd;</command> adds these automatically.
12055N/A</para>
10139N/A</listitem></varlistentry>
10139N/A
12055N/A<varlistentry>
12055N/A<term><literal>Libs.private</literal></term>
12055N/A<listitem><para>
10139N/AThis line should list any private libraries in use. Private libraries are
10139N/Alibraries which are not exposed through your library, but are needed in the
12055N/Acase of static linking.
12055N/A</para>
10139N/A</listitem></varlistentry>
10139N/A
12055N/A<varlistentry>
12055N/A<term><literal>Cflags</literal></term>
12055N/A<listitem><para>
12055N/AThe compile flags specific to your package. Do not add any flags for required
12055N/Apackages, <command>&cmd;</command> adds these automatically.
12055N/A</para>
10139N/A</listitem></varlistentry>
10139N/A
11904N/A</variablelist>
11904N/A<para>See the EXAMPLES section below for a sample <filename>.pc</filename>
11904N/Afile.</para>
10139N/A</refsect2>
10139N/A<refsect2>
10139N/A<title>autoconf Macros</title>
10139N/A<para><literal>PKG_CHECK_MODULES([<replaceable>variablebase</replaceable>], [<replaceable>modulelist</replaceable>], [<replaceable>action-if-found</replaceable>], [<replaceable>action-if-not-found</replaceable>]) </literal></para>
10139N/A
12055N/A<para>
12055N/AThe macro PKG_CHECK_MODULES can be used in <filename>configure.ac</filename>
12055N/Ato check whether modules exist, as shown in the following example:
12055N/A</para>
12055N/A<screen>PKG_CHECK_MODULES([MYSTUFF], [gtk+-2.0 >= 1.3.5 libxml = 1.8.4])</screen>
12055N/A<para>
12055N/AIn this example, the MYSTUFF_LIBS and MYSTUFF_CFLAGS substitution variables
10139N/Aare set to the <literal>libs</literal> and <literal>cflags</literal> values
10139N/Afor the given module list. If a module is missing or has the wrong version,
10139N/Aby default <literal>configure</literal> will abort with a message. To replace
10139N/Athe default action, specify an <replaceable>action-if-found</replaceable>.
10139N/APKG_CHECK_MODULES will not print any error messages if you specify your own
12055N/A<replaceable>action-if-not-found</replaceable>. However, it will set the
12055N/Avariable <envar>MYSTUFF_PKG_ERRORS</envar>, which you can use to find out what
12055N/Awent wrong.
10139N/A</para>
12055N/A<para>
12055N/ANote that if there is a possibility the first call to PKG_CHECK_MODULES might
12055N/Anot happen, you should be sure to include an explicit call to
12055N/APKG_PROG_PKG_CONFIG in your configure.ac
12055N/A</para>
12055N/A<para>
12055N/A<literal>PKG_PROG_PKG_CONFIG([<replaceable>minversion</replaceable>])
12055N/A</para>
10139N/A<para>
10139N/AThe macro PKG_PROG_PKG_CONFIG defines the PKG_CONFIG variable to the best
11925N/Apkg-config available, useful if you need &cmd;, but do not want to use
12055N/Athe PKG_CHECK_MODULES macro.
12055N/A</para>
12055N/A<para>
12055N/A<literal>PKG_CHECK_EXISTS(<replaceable>modules</replaceable>, [<replaceable>action-if-found</replaceable>], [<replaceable>action-if-not-found</replaceable>])
12055N/A</para>
12055N/A<para>
12055N/ACheck to see whether a particular set of modules exists. Similar to
12055N/APKG_CHECK_MODULES(), but does not set variables or print errors.
12055N/A</para>
12055N/A<para>
12055N/AAs with PKG_CHECK_MODULES, make sure that the first instance of this or
12055N/APKG_CHECK_MODULES is called, or make sure to call PKG_CHECK_EXISTS manually.
12055N/A</para>
10139N/A</refsect2>
10139N/A<refsect2>
10139N/A<title>Compiling 64&ndash;Bit Binaries</title>
10139N/A<para>To compile 64&ndash;bit binaries, <command>&cmd;</command> must use
10139N/Ametadata files that specify the flags for the 64-bit libraries. To ensure
10139N/Athat <command>&cmd;</command> can find the metadata files for 64-bit libraries,
10139N/Aset the <envar>PKG_CONFIG_PATH</envar> environment variable to <filename>
11904N/A/usr/lib/64/pkgconfig/</filename> when compiling 64-bit software.
10139N/A</para>
10139N/A</refsect2>
10139N/A</refsect1>
10139N/A<refsect1 id="pkg-config-1-opts"><title>&opts-tt;</title>
10139N/A<para>The following options are supported:</para>
10139N/A<variablelist termlength="wholeline">
10139N/A
12055N/A<varlistentry>
12055N/A<term><option>-atleast-pkgconfig-version=<replaceable>version</replaceable></option></term>
12055N/A<listitem><para>
13741N/ARequire a specific <replaceable>version</replaceable> of &cmd;.
12055N/A</para>
10139N/A</listitem></varlistentry>
10139N/A
12055N/A<varlistentry>
12055N/A<term><option>-atleast-version=<replaceable>version</replaceable></option></term>
12055N/A<listitem><para>
12055N/ASee the entry for the <option>-exists</option> option.
12055N/A</para>
10139N/A</listitem></varlistentry>
10139N/A
12055N/A<varlistentry>
12055N/A<term><option>-cflags</option></term>
12055N/A<listitem><para>
12055N/APrints pre-processor and compile flags required to compile the packages on the
12055N/Acommand line, including flags for all their dependencies. Flags are
12055N/A"compressed" so that each identical flag appears only once.
12055N/A<command>&cmd;</command> exits with a nonzero code if it cannot find metadata
12055N/Afor one or more of the packages on the command line.
12055N/A</para>
10139N/A</listitem></varlistentry>
10139N/A
12055N/A<varlistentry>
12055N/A<term><option>-cflags-only-I</option></term>
12055N/A<listitem><para>
12055N/ASame as <option>cflags</option> except it prints only -I flags.
12055N/A</para>
10139N/A</listitem></varlistentry>
10139N/A
12055N/A<varlistentry>
12055N/A<term><option>-cflags-only-other</option></term>
12055N/A<listitem><para>
12055N/ASame as <option>cflags</option> except it prints only flags not covered by the
12055N/A<option>cflags-only-I</option> option.
12055N/A</para>
10139N/A</listitem></varlistentry>
10139N/A
12055N/A<varlistentry>
12055N/A<term><option>-debug</option></term>
12055N/A<listitem><para>
12055N/AShow verbose debug information.
12055N/A</para>
11904N/A</listitem></varlistentry>
11904N/A
12055N/A<varlistentry>
12055N/A<term><option>-define-variable=<replaceable>variablename</replaceable>=<replaceable>value</replaceable></option></term>
12055N/A<listitem><para>
12055N/ASets a global value for a variable, overriding the value in any
12055N/A<filename>.pc</filename> files. Most packages define the variable "prefix" in
12055N/Atheir <filename>.pc</filename>, so to override this, for example:
12055N/A</para>
12055N/A<screen>
12055N/A$ <userinput>&cmd; --print-errors --define-variable=prefix=/foo \\
12055N/A --variable=prefix glib-2.0
12055N/A /foo</userinput></screen>
10139N/A</listitem></varlistentry>
10139N/A
12055N/A<varlistentry>
12055N/A<term><option>-errors-to-stdout</option></term>
12055N/A<listitem><para>
10139N/AIf printing errors, print them to <literal>stdout</literal> rather than the
12055N/Adefault <literal>stderr</literal>.
12055N/A</para>
10139N/A</listitem></varlistentry>
10139N/A
12055N/A<varlistentry>
12055N/A<term><option>-exact-version=<replaceable>version</replaceable></option></term>
12055N/A<listitem><para>
12055N/ASee the entry for the <option>-exists</option> option.
12055N/A</para>
10139N/A</listitem></varlistentry>
10139N/A
12055N/A<varlistentry>
12055N/A<term><option>-exists</option></term>
12055N/A<listitem><para>
12055N/AThe <option>-exists</option>,
12055N/A<option>-atleast-version=<replaceable>version</replaceable></option>,
12055N/A<option>-exact-version=<replaceable>version</replaceable></option>, and
12055N/A<option>-max-version=<replaceable>version</replaceable></option> options test
12055N/Awhether the packages on the command line are known to <command>&cmd;</command>,
12055N/Aand optionally whether the version number of a package meets certain
12055N/Aconstraints. If all packages exist and meet the specified version constraints,
12055N/A<command>&cmd;</command> exits successfully. Otherwise,
12055N/A<command>&cmd;</command> exits unsuccessfully. Rather than using the
12055N/Aversion-test options, you can simply give a version constraint after each
12055N/Apackage name, as shown in the following example:
12055N/A</para>
10139N/A<screen>$ <userinput>&cmd; --exists 'glib-2.0 >= 1.3.4 libxml = 1.8.3'</userinput></screen>
12055N/A<para>
12055N/ARemember to use the <option>-print-errors</option> option if you want
12055N/Ato display error messages.
12055N/A</para>
10139N/A</listitem></varlistentry>
10139N/A
12055N/A<varlistentry>
12055N/A<term><option>-help</option></term>
12055N/A<listitem><para>
12055N/ADisplays help and usage information.
12055N/A</para>
12055N/A</listitem></varlistentry>
12055N/A
12055N/A<varlistentry>
12055N/A<term><option>-libs</option></term>
12055N/A<listitem><para>
12055N/AIdentical to <option>-cflags</option> option but only prints the link flags.
12055N/ADuplicate flags are merged, maintaining proper ordering, and flags for
12055N/Adependencies are included in the output.
12055N/A</para>
10139N/A</listitem></varlistentry>
10139N/A
12055N/A<varlistentry>
12055N/A<term><option>-libs-only-L</option></term>
12055N/A<listitem><para>
12055N/ASame as <option>libs</option> except it prints only -L and -R flags. That is,
12055N/Ait defines the library search path, but does not specify which libraries to
12055N/Alink with.
12055N/A</para>
10139N/A</listitem></varlistentry>
10139N/A
12055N/A<varlistentry>
12055N/A<term><option>-libs-only-l</option></term>
12055N/A<listitem><para>
12055N/ASame as <option>libs</option> except it prints only -l flags. Note that the
12055N/Aunion of <option>-libs-only-l</option> and <option>-libs-only-L</option> may
12055N/Abe smaller than <option>-libs</option> due to flags such as -rdynamic.
12055N/A</para>
10139N/A</listitem></varlistentry>
10139N/A
12055N/A<varlistentry>
12055N/A<term><option>-libs-only-other</option></term>
12055N/A<listitem><para>
12055N/ASame as <option>libs</option> except it prints only flags not covered by the
12055N/A<option>libs-only-L</option> and <option>libs-only-l</option> options, such as
12055N/A"-pthread".
12055N/A</para>
10139N/A</listitem></varlistentry>
10139N/A
12055N/A<varlistentry>
12055N/A<term><option>-list-all</option></term>
12055N/A<listitem><para>
12055N/AList all known packages.
12055N/A</para>
10139N/A</listitem></varlistentry>
10139N/A
12055N/A<varlistentry>
12055N/A<term><option>-max-version=<replaceable>version</replaceable></option></term>
12055N/A<listitem><para>
12055N/ASee the entry for the <option>-exists</option> option.
12055N/A</para>
10139N/A</listitem></varlistentry>
10139N/A
12055N/A<varlistentry>
12055N/A<term><option>-modversion</option></term>
11965N/A<listitem><para>
11965N/ARequests that the version information of the libraries specified on the command
11965N/Aline be displayed. If <command>&cmd;</command> can find all of the libraries on
11965N/Athe command line, each library's version string is printed to
11965N/A<literal>stdout</literal>, one version per line. In this case
11965N/A<command>&cmd;</command> exits successfully. If one or more libraries is
11965N/Aunknown, <command>&cmd;</command> exits with a nonzero code, and the contents
11965N/Aof <literal>stdout</literal> are undefined.
11965N/A</para>
10139N/A</listitem></varlistentry>
10139N/A
12055N/A<varlistentry>
12055N/A<term><option>-print-errors</option></term>
12055N/A<listitem><para>
10139N/ADisplays an error if one or more of the modules on the command line, or their
12055N/Adependencies, are not found, or if an error occurs in parsing. With
12055N/A"predicate" options such as <option>--exists</option>, &cmd; runs silently by
12055N/Adefault, because it is usually used in scripts that want to control what is
12055N/Aoutput. This option can be used alone to just print errors encountered
12055N/Alocating modules on the command line, or with other options. The
12055N/A<envar>PKG_CONFIG_DEBUG_SPEW</envar> environment variable overrides this
12055N/Aoption.
12055N/A</para>
10139N/A</listitem></varlistentry>
10139N/A
12055N/A<varlistentry>
12055N/A<term><option>-silence-errors</option></term>
12055N/A<listitem><para>
10139N/ADoes not display an error if one or more of the modules on the command line,
10139N/Aor their dependencies, are not found, or if an error occurs in parsing. With
10139N/Apredicate options such as <option>-exists</option>, <command>&cmd;</command>
10139N/Aruns silently by default, because it is usually used in scripts that want
10139N/Ato control what is output. This option is only useful with options that print
10139N/Aerrors by default, such as <option>-cflags</option> or <option>-modversion
12055N/A</option>. The <envar>PKG_CONFIG_DEBUG_SPEW</envar> environment variable
12055N/Aoverrides this option.
12055N/A</para>
10139N/A</listitem></varlistentry>
10139N/A
12055N/A<varlistentry>
12055N/A<term><option>-short-errors</option></term>
12055N/A<listitem><para>
10139N/APrints short errors. Refer to <option>print-errors</option> for more detail
12055N/Aabout how &cmd; manages error messages.
12055N/A</para>
12055N/A</listitem></varlistentry>
12055N/A
12055N/A<varlistentry>
12055N/A<term><option>-static</option></term>
12055N/A<listitem><para>
12055N/AOutput libraries suitable for static linking. This means including any private
12055N/Alibraries in the output. This relies on proper tagging in the .pc files,
12055N/Aotherwise too many libraries will be output.
12055N/A</para>
10139N/A</listitem></varlistentry>
10139N/A
12055N/A<varlistentry>
12055N/A<term><option>-uninstalled</option></term>
12055N/A<listitem><para>
12055N/ANormally, if you request the package <filename>foo</filename> and the package
12055N/A<filename>foo-uninstalled</filename> exists, <command>&cmd;</command> will
12055N/Aprefer the uninstalled variant. This allows compilation/linking against
12055N/Auninstalled packages. If you specify the <option>-uninstalled</option> option,
12055N/A<command>&cmd;</command> returns successfully if any uninstalled packages are
12055N/Abeing used. Otherwise, <command>&cmd;</command> fails. The
12055N/A<envar>PKG_CONFIG_DISABLE_UNINSTALLED</envar> environment variable prevents
12055N/A<command>&cmd;</command> from implicitly choosing uninstalled packages. If the
12055N/A<envar>PKG_CONFIG_DISABLE_UNINSTALLED</envar> variable is set, uninstalled
12055N/Apackages are used only if you explicitly pass a name such as
12055N/A<filename>foo-uninstalled</filename> on the command line.
12055N/A</para>
10139N/A</listitem></varlistentry>
10139N/A
12055N/A<varlistentry>
12055N/A<term><option>-usage</option></term>
12055N/A<listitem><para>
12055N/ADisplays help and usage information.
12055N/A</para>
10139N/A</listitem></varlistentry>
10139N/A
12055N/A<varlistentry>
12055N/A<term><option>-variable=<replaceable>variablename</replaceable></option></term>
12055N/A<listitem><para>
12055N/AReturns the value of a variable defined in a package's <filename>.pc</filename>
12055N/Afile. For example, most packages define the variable <literal>prefix</literal>:
12055N/A</para>
12055N/A<screen>
12055N/A$ <userinput>&cmd; --variable=prefix glib-2.0
12055N/A/usr/</userinput></screen>
10139N/A</listitem></varlistentry>
11904N/A
12055N/A<varlistentry>
12055N/A<term><option>-version</option></term>
12055N/A<listitem><para>
12055N/ADisplays version of &cmd;.
12055N/A</para>
11904N/A</listitem></varlistentry>
10139N/A</variablelist></refsect1>
10139N/A
10139N/A<refsect1 id="pkg-config-1-oper"><title>&oper-tt;</title>
10139N/A<para>The following operands are supported:</para>
10139N/A<variablelist termlength="medium">
10139N/A<varlistentry><term><option role="nodash"><replaceable>libraries</replaceable></option></term>
12055N/A<listitem><para>
12055N/AList of libraries specified by the metadata file found in
10139N/A<filename>/usr/lib/pkgconfig</filename, without the <filename>.pc</filename>
10139N/Aextension.</para>
10139N/A</listitem></varlistentry>
10139N/A</variablelist></refsect1>
10139N/A
10139N/A<refsect1 id="pkg-config-1-envr"><title>&envr-tt;</title>
10139N/A<para>See <citerefentry><refentrytitle>environ</refentrytitle><manvolnum>
10139N/A5</manvolnum></citerefentry> for descriptions of environment variables.</para>
10139N/A
12055N/A<variablelist termlength="wholeline">
12055N/A<varlistentry>
12055N/A<term><envar>PKG_CONFIG_ALLOW_SYSTEM_CFLAGS</envar></term>
12055N/A<listitem><para>
12055N/ADo not strip <literal>-I/usr/include</literal> from <literal>cflags</literal>.
12055N/A</para>
10139N/A</listitem></varlistentry>
10139N/A
12055N/A<varlistentry>
16506N/A<term><envar>PKG_CONFIG_ALLOW_SYSROOT_DIR</envar></term>
16506N/A<listitem><para>
16506N/AModify the -I and -L flags to use the directories located in target sysroot.
16506N/AThis option is useful when crosscompiling a package that uses pkg-config to
16506N/Adetermine CFLAGS and LDFLAGS. The -I and -L flags are modified to point to the
16507N/Anew system root. This means that when <envar>PKG_CONFIG_SYSROOT_DIR</envar>
16507N/Ais set to <literal>/var/target</literal>, then
16507N/A<literal>-I/usr/include/libfoo</literal> will be modified to become
16507N/A<literal>-I/var/target/usr/include/libfoo</literal> (the same rule applies to
16507N/Athe -L flag).
16506N/A</para>
16506N/A</listitem></varlistentry>
16506N/A
16506N/A<varlistentry>
12055N/A<term><envar>PKG_CONFIG_ALLOW_SYSTEM_LIBS</envar></term>
12055N/A<listitem><para>
12055N/ADo not strip <literal>-L/usr/lib</literal> from <literal>libs</literal>.
12055N/A</para>
12055N/A</listitem></varlistentry>
12055N/A
12055N/A<varlistentry>
12055N/A<term><envar>PKG_CONFIG_DEBUG_SPEW</envar></term>
12055N/A<listitem><para>
12055N/AIf set, causes <command>&cmd;</command> to print all debugging information and
12055N/Areport all errors.
10139N/A</para>
10139N/A</listitem></varlistentry>
10139N/A
12055N/A<varlistentry>
12055N/A<term><envar>PKG_CONFIG_DISABLE_UNINSTALLED</envar></term>
12055N/A<listitem><para>
12055N/ANormally, if you request the package <filename>foo</filename> and the package
12055N/A<filename>foo-uninstalled</filename> exists, <command>&cmd;</command> prefers
12055N/Athe uninstalled variant. This allows compilation/linking against uninstalled
12055N/Apackages. If the <envar>PKG_CONFIG_DISABLE_UNINSTALLED</envar> environment
12055N/Avariable is set, <command>&cmd;</command> prefers the installed variant.
12055N/A</para>
10139N/A</listitem></varlistentry>
10139N/A
12055N/A<varlistentry>
12055N/A<term><envar>PKG_CONFIG_LIBDIR</envar></term>
12055N/A<listitem><para>
13741N/AReplaces the default &cmd; search directory.
12055N/A</para>
10139N/A</listitem></varlistentry>
10139N/A
12055N/A<varlistentry>
12055N/A<term><envar>PKG_CONFIG_PATH</envar></term>
12055N/A<listitem><para>
10139N/AA colon-separated list of directories to search for <filename>.pc</filename>
10139N/Afiles. The default directory is always searched after searching the path
10139N/Aspecified by <envar>PKG_CONFIG_PATH</envar>. The default value of
12055N/A<envar>PKG_CONFIG_PATH</envar> is
12055N/A<filename>/usr/lib/pkgconfig</filename>:<filename>/usr/share/pkgconfig</filename>.
12055N/A</para>
12055N/A</listitem></varlistentry>
10139N/A
12055N/A<varlistentry>
12055N/A<term><envar>PKG_CONFIG_TOP_BUILD_DIR</envar></term>
12055N/A<listitem><para>
12055N/ASets the value of the magic variable <literal>pc_top_builddir</literal>, which
12055N/Amay appear in <filename>.pc</filename> files. If this environment variable
10139N/Ais not set, the default value <literal>'$(top_builddir)'</literal> is used.
10139N/AThe <envar>PKG_CONFIG_TOP_BUILD_DIR</envar> variable should refer to the top
12055N/Abuilddir of the Makefile where the compile/link flags reported by
12055N/A<command>&cmd;</command> are used. The <envar>PKG_CONFIG_TOP_BUILD_DIR</envar>
12055N/Avariable is only used when compiling/linking against a package that has not yet
12055N/Abeen installed.
10139N/A</para></listitem></varlistentry>
17584N/A</variablelist></refsect1>
10139N/A
10139N/A<refsect1 id="pkg-config-1-exam"><title>&exam-tt;</title>
10139N/A<example role="example">
10139N/A<title>Example .pc File</title>
10139N/A<para>Here is an example <filename>.pc</filename> file: </para>
10139N/A<programlisting># This is a comment
10139N/Aprefix=/usr # this defines a variable
10139N/Aexec_prefix=${prefix} # defining another variable in terms of the first
10139N/Alibdir=${exec_prefix}/lib
10139N/Aincludedir=${prefix}/include
10139N/A
12055N/AName: GObject # human-readable name
10139N/ADescription: Object/type system for GLib # human-readable description
10139N/AVersion: 1.3.1
10139N/ARequires: glib-2.0 = 1.3.1
10139N/AConflicts: foobar &lt;= 4.5
10139N/ALibs: -L${libdir} -lgobject-1.3
10139N/ACflags: -I${includedir}/glib-2.0 -I${libdir}/glib/include
10139N/A
10139N/A</programlisting>
10139N/A</example>
10139N/A<example role="example">
10139N/A<title>Adding a Library to the Set of Packages Known to &cmd;</title>
12055N/A<para>
12055N/ATo add a library to the set of packages known to <command>&cmd;</command>, you
12055N/Amust install the library-specific <filename>.pc</filename> file in the
12055N/A<filename>/usr/lib/pkgconfig</filename> directory.
12055N/A</para>
12055N/A<para>
12055N/AIf the .pc file does not exist, generate the file by running the
12055N/A<command>configure</command> command, building, and installing the module that
12055N/Aprovides it. Generating the file in this way ensures that the prefix and other
12055N/Avariables are set to the correct values.
12055N/A</para>
10139N/A</example>
10139N/A<example role="example">
12055N/A<title>Getting the Compile Flags Required for the libgnomeui-2.0 Package</title>
12055N/A<para>
12055N/A<screen>example% <userinput>&cmd; --cflags libgnomeui-2.0</userinput></screen>
12055N/A</para>
10139N/A</example>
10139N/A</refsect1>
10139N/A<refsect1 id="pkg-config-1-file"><title>&file-tt;</title>
10139N/A<para>The following files are used by this application:</para>
10139N/A<variablelist termlength="medium">
12055N/A<varlistentry>
12055N/A<term><filename>/usr/bin/&cmd;</filename></term>
12055N/A<listitem><para>
12055N/AExecutable for installed library helper script
12055N/A</para>
12055N/A</listitem></varlistentry>
12055N/A<varlistentry>
12055N/A<term><filename>/usr/lib/pkgconfig</filename></term>
12055N/A<listitem><para>
12055N/ADefault location of <filename>.pc</filename> used by &cmd;
12055N/A</para>
12055N/A</listitem></varlistentry>
12055N/A<varlistentry>
12055N/A<term><filename>/usr/share/pkgconfig</filename></term>
12055N/A<listitem><para>
12055N/ADefault location of <filename>.pc</filename> used by &cmd;
12055N/A</para>
10139N/A</listitem></varlistentry>
10139N/A</variablelist></refsect1>
10139N/A<refsect1 id="pkg-config-1-attr"><title>&attr-tt;</title>
12055N/A<para>
12055N/ASee <olink targetdocent="REFMAN5" localinfo="attributes-5"><citerefentry>
10139N/A<refentrytitle>attributes</refentrytitle><manvolnum>5</manvolnum></citerefentry></olink>
12055N/Afor descriptions of the following attributes:
12055N/A</para>
10139N/A<informaltable frame="all">
10139N/A<tgroup cols="2" colsep="1" rowsep="1"><colspec colname="COLSPEC0" colwidth="1*">
10139N/A<colspec colname="COLSPEC1" colwidth="1*">
10139N/A<thead>
10139N/A<row><entry align="center" valign="middle"><para>ATTRIBUTE TYPE</para></entry>
10139N/A<entry align="center" valign="middle"><para>ATTRIBUTE VALUE</para></entry>
10139N/A</row>
10139N/A</thead>
10139N/A<tbody>
18745N/A<row><entry><para>Availability</para></entry><entry><para>developer/gnome/gettext
10139N/A</para></entry></row>
10139N/A<row><entry colname="COLSPEC0"><para>Interface stability</para></entry><entry
10139N/Acolname="COLSPEC1"><para>Committed</para></entry></row>
10139N/A</tbody>
10139N/A</tgroup>
10139N/A</informaltable>
10139N/A</refsect1>
10139N/A<refsect1 id="pkg-config-1-also"><title>&also-tt;</title>
10139N/A<!--Reference to another man page-->
10139N/A<!--Reference to a Help manual-->
10139N/A<!--Reference to a book.-->
11904N/A<para>
11904N/A<citerefentry><refentrytitle>attributes</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
11904N/A<citerefentry><refentrytitle>environ</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
11904N/A<citerefentry><refentrytitle>gnome-interfaces</refentrytitle><manvolnum>5</manvolnum></citerefentry>
11904N/A</para>
10139N/A<para>Latest version of the <citetitle>GNOME Desktop User Guide</citetitle>
10139N/Afor your platform.</para>
10139N/A</refsect1>
10139N/A<refsect1 id="pkg-config-1-note"><title>&note-tt;</title>
12055N/A<para>
11904N/AWritten by James Henstridge, Martijn van Beers, Havoc Pennington, Tim Janik,
12055N/AOwen Taylor, Raja Harinath, Miguel de Icaza. Updated by Brian Cameron, Sun
12055N/AMicrosystems Inc., 2003, 2004, 2007.
12055N/A</para>
10139N/A</refsect1>
10139N/A</refentry>