1.\" Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016 pkgconf authors (see AUTHORS). 2.\" 3.\" Permission to use, copy, modify, and/or distribute this software for any 4.\" purpose with or without fee is hereby granted, provided that the above 5.\" copyright notice and this permission notice appear in all copies. 6.\" 7.\" This software is provided 'as is' and without any warranty, express or 8.\" implied. In no event shall the authors be liable for any damages arising 9.\" from the use of this software. 10.Dd June 23, 2026 11.Dt PKGCONF 1 12.Os 13.Sh NAME 14.Nm pkgconf 15.Nd a system for configuring build dependency information 16.Sh SYNOPSIS 17.Nm 18.Op Ar options 19.Ar module ... 20.Sh DESCRIPTION 21The 22.Nm 23program retrieves configuration information related to the 24.Ar module 25arguments from 26.Xr pc 5 27files installed on the system and prints parts of the retrieved 28information depending on the specified 29.Ar options . 30The most common use is printing the compiler and linker flags needed 31to build software that uses the libraries given by the 32.Ar module 33arguments. 34.Pp 35When printing compiler and linker flags, 36.Nm 37escapes shell metacharacters 38.Pq such as quotes, whitespace, brackets, braces and glob characters 39in each fragment with a backslash. 40The output is intended to be re-tokenised by the consumer using POSIX shell 41word-splitting rules, as build systems generally do; under those rules the 42protective backslashes are removed and the original values are recovered. 43Note that pasting the output directly into an unquoted command substitution, 44for example 45.Ql cc $(pkgconf \-\-libs foo) , 46performs word-splitting and pathname expansion but does 47.Em not 48remove the backslashes, so a value containing such characters may reach the 49toolchain with the escaping still present. 50.Pp 51The 52.Xr pc 5 53files are searched for along a path constructed from the 54.Fl -with-path 55option, the 56.Ev PKG_CONFIG_PATH 57and 58.Ev PKG_CONFIG_LIBDIR 59environment variables, and some compiled-in default directories. 60The 61.Ar module 62arguments correspond to the file names, but without the 63.Pa .pc 64filename extension. 65.Pp 66Several of the 67.Ar options 68cause immediate exit. 69If multiple of these options are given, only the option with the 70highest priority takes effect and those with lower priority are 71silently ignored. 72These options are, ordered by descending priority: 73.Bl -enum 74.It 75No-module options: 76.Fl -dump-personality , 77.Fl -about , 78.Fl -version , 79.Fl -help , 80.Fl -atleast-pkgconfig-version , 81.Fl -list-all , 82and 83.Fl -list-package-names : 84These options cause all arguments to be ignored. 85.It 86Argument-only options: 87.Fl -atleast-version , 88.Fl -exact-version , 89and 90.Fl -max-version : 91These options only inspect modules explicitly specified on the 92command line and do not look at dependencies. 93.It 94Limited-output options: 95.Fl -validate , 96.Fl -license , 97.Fl -license-file , 98.Fl -link-abi , 99.Fl -source , 100.Fl -uninstalled , 101and 102.Fl -env : 103These options perform dependency resolution, but exit after printing 104the information requested by the highest-priority option, 105ignoring other output options that may have been specified. 106.El 107.Pp 108Several other options require at least one 109.Ar module 110argument, produce output, do not cause early exit, can be combined 111with each other, but override and disable all 112.Fl -cflags 113and 114.Fl -libs 115options: 116.Bl -enum 117.It 118Single-module output options: 119.Fl -path , 120.Fl -print-variables , 121.Fl -variable : 122If any of these options is specified, only the first 123.Ar module 124argument is used, all other arguments are silently ignored, 125and no dependency resolution is attempted. 126.It 127Depth-one output options: 128.Fl -print-provides , 129.Fl -modversion , 130.Fl -print-requires , 131and 132.Fl -print-requires-private : 133If any of these options is specified, only modules 134explicitly specified on the command line are inspected 135and no dependency resolution is attempted. 136.It 137General output options: 138.Fl -simulate , 139.Fl -digraph , 140.Fl -solution , 141.Fl -fragment-tree , 142.Fl -newlines : 143These options do not limit dependency resolution. 144.El 145.Pp 146The most important output options 147.Fl -cflags 148and 149.Fl -libs 150can be combined with each other, but are overridden and ignored if 151any of the options listed above are specified. 152.Pp 153The complete list of 154.Ar options 155is as follows: 156.Bl -tag -width indent 157.It Fl -about 158Print the version number, the Copyright notice, and the license of the 159.Nm 160program to standard output and exit. 161Most other options and all command line arguments are ignored. 162.It Fl -atleast-pkgconfig-version Ns = Ns Ar version 163Exit with error if the requested 164.Ar version 165number is greater than the version number of the 166.Nm 167program, or with success otherwise. 168Most other options and all command line arguments are ignored. 169.It Fl -atleast-version Ns = Ns Ar version 170Check the 171.Ar module 172arguments in the given order. 173Exit with error as soon as a 174.Ar module 175does not exist, and exit with success as soon as the version number of a 176.Ar module 177is greater than or equal to the requested 178.Ar version 179number. 180Exit with error if the version number of each 181.Ar module 182is less than the requested 183.Ar version 184number. 185.It Fl -cflags , Fl -cflags-only-I , Fl -cflags-only-other 186Print all compiler flags required to compile against the 187.Ar module , 188or only the include path 189.Pq Fl I 190flags, or only the compiler flags that are not include path flags, 191respectively. 192These options imply 193.Fl -print-errors . 194.It Fl -debug 195Print some non-fatal warning messages to standard error output 196that would otherwise silently be ignored. 197This option also implies 198.Fl -print-errors . 199If 200.Nm 201was compiled without defining the preprocessor macro 202.Dv PKGCONF_LITE , 203this option also prints many debugging messages to standard error output. 204.It Fl -define-prefix 205Attempts to determine the prefix variable to use for CFLAGS and LIBS entry relocations. 206This is mainly useful for platforms where framework SDKs are relocatable, such as Windows. 207.It Fl -define-variable Ns = Ns Ar varname Ns = Ns Ar value 208Define 209.Ar varname 210as 211.Ar value . 212Variables are used in query output, and some modules' results may change based 213on the presence of a variable definition. 214.It Fl -digraph 215Dump the dependency resolver's solution as a graphviz 216.Sq dot 217file. 218This can be used with graphviz to visualize module interdependencies. 219This option is only available if the preprocessor macro 220.Dv PKGCONF_LITE 221was not defined during compilation. 222.It Fl -dont-define-prefix 223Disables the 224.Sq define-prefix 225feature. 226.It Fl -dont-relocate-paths 227Disables the path relocation feature. 228.It Fl -dump-personality 229Print some default settings to standard output, in particular 230the default module search path that is used when 231.Ev PKG_CONFIG_LIBDIR 232is not defined, the default list of include paths that are filtered out when 233.Ev PKG_CONFIG_SYSTEM_INCLUDE_PATH 234is not defined, 235and the default list of library paths that are filtered out when 236.Ev PKG_CONFIG_SYSTEM_LIBRARY_PATH 237is not defined, and exit. 238Most other options and all command line arguments are ignored. 239This option is only available if the preprocessor macro 240.Dv PKGCONF_LITE 241was not defined during compilation. 242.It Fl -env Ns = Ns Ar varname 243Print the requested values as variable declarations in a similar format as the 244.Xr env 1 245command. 246.It Fl -env-only 247Initialize the module search path from 248.Fl -with-path 249and 250.Ev PKG_CONFIG_PATH 251only, ignoring 252.Ev PKG_CONFIG_LIBDIR 253and the compiled-in default directories. 254.It Fl -errors-to-stdout 255Print all error, warning, and debugging messages to standard output 256instead of to standard error output. 257.It Fl -exact-version Ns = Ns Ar version 258Check the 259.Ar module 260arguments in the given order. 261Exit with error as soon as a 262.Ar module 263does not exist, and exit with success as soon as the version number of a 264.Ar module 265is exactly the requested 266.Ar version 267number. 268Exit with error if the version number of each 269.Ar module 270differs from the requested 271.Ar version 272number. 273.It Fl -exists 274Exit with a non-zero exit status 275if the dependency resolver is unable to find all of the requested 276.Ar module Ns s . 277This option is active by default and cannot be disabled. 278However, various other options cause 279.Nm 280to exit and report success or failure before all arguments have been inspected. 281.It Fl -fragment-filter Ns = Ns Ar types 282Filter the fragment lists for the specified 283.Ar types . 284.It Fl -help 285Print a usage summary on standard output and exit. 286Most other options and all command line arguments are ignored. 287.It Fl -ignore-conflicts 288Ignore 289.Sq Conflicts 290rules in modules. 291.It Fl -keep-system-cflags , Fl -keep-system-libs 292Keep CFLAGS or linker flag fragments that would be filtered due to being 293included by default in the compiler. 294.It Fl -libs , Fl -libs-only-L , Fl -libs-only-l , Fl -libs-only-other 295Print all linker flags required to link against the 296.Ar module , 297or only the library path 298.Pq Fl L 299flags, or only the library 300.Pq Fl l 301flags, or only the linker flags that are neither library path 302nor library flags, respectively. 303These options imply 304.Fl -print-errors . 305.It Fl -link-abi 306Print the set of link ABI tags 307.Pq for example Sy c No or Sy c++ 308that the 309.Ar module 310must be linked against, derived from the 311.Sy Link.ABI 312properties found across its dependency closure. 313The tags from a package's own 314.Sy Link.ABI 315property and those of its public 316.Sy Requires 317always apply, while 318.Sy Requires.private 319tags apply only when linking statically 320.Pq Fl -static . 321A module with no link ABI requirements prints 322.Sy c . 323See 324.Xr pc 5 325for details of the 326.Sy Link.ABI 327property. 328.It Fl -list-all 329Walk the module search path in the order of descending priority. 330For each 331.Xr pc 5 332file found, print one line to standard output, 333containing the basename of the file without the extension, the 334.Ic Name 335property, a dash 336.Pq Sq \- , 337and the 338.Ic Description 339property. 340This option implies 341.Fl -print-errors . 342All command line arguments are ignored. 343.It Fl -list-package-names 344Perform the same search as 345.Fl -list-all , 346but only print the basename of each 347.Xr pc 5 348file without the extension, not the module name and the description. 349This option implies 350.Fl -print-errors . 351All command line arguments are ignored. 352.It Fl -log-file Ns = Ns Ar file 353Set the name of the output 354.Ar file 355where information about selected modules is logged, 356both about those selected by arguments and as dependencies. 357For each selected module, one line is printed, 358containing the basename of the 359.Xr pc 5 360file without the extension, optionally an operator and version number 361describing the desired range of versions, and either the actual version 362number in square brackets or the string 363.Qq NOT-FOUND . 364If this option is not provided, the name of the output file 365is instead taken from the 366.Ev PKG_CONFIG_LOG 367environment variable, and if that is not provided either, 368this kind of logging is disabled. 369.It Fl -max-version Ns = Ns Ar version 370Check the 371.Ar module 372arguments in the given order. 373Exit with error as soon as a 374.Ar module 375does not exist, and exit with success as soon as the version number of a 376.Ar module 377is less than or equal to the requested 378.Ar version 379number. 380Exit with error if the version number of each 381.Ar module 382is greater than the requested 383.Ar version 384number. 385.It Fl -maximum-traverse-depth Ns = Ns Ar depth 386Impose a limit on the allowed depth in the dependency graph. 387For example, a 388.Ar depth 389of 2 restricts the resolver from acting on child 390dependencies of modules added to the resolver's solution. 391This option is overridden by the 392.Ev PKG_CONFIG_MAXIMUM_TRAVERSE_DEPTH 393environment variable and by the options 394.Fl -modversion , 395.Fl -path , 396.Fl -print-provides , 397.Fl -print-requires , 398.Fl -print-requires-private , 399.Fl -print-variables , 400and 401.Fl -variable . 402.It Fl -modversion 403For each specified 404.Ar module , 405print the version number to standard output. 406If the 407.Fl -verbose 408option is also specified, the name of the respective 409.Ar module 410and a colon is printed before each version number. 411This option implies 412.Fl -print-errors 413and 414.Fl -maximum-traverse-depth Ns =1 415and overrides and disables all 416.Fl -cflags 417and 418.Fl -libs 419flags. 420.It Fl -msvc-syntax 421Use MSVC syntax for 422.Fl -cflags , 423.Fl -env , 424and 425.Fl -libs 426output. 427This option is only available if the preprocessor macro 428.Dv PKGCONF_LITE 429was not defined during compilation. 430.It Fl -newlines 431Use newlines to separate individual CFLAGS or linker flag fragments 432instead of spaces. 433.It Fl -no-cache 434Skip caching packages when they are loaded into the internal resolver. 435This may result in an alternate dependency graph being computed. 436.It Fl -no-provides 437Ignore 438.Sq Provides 439rules in modules when resolving dependencies. 440.It Fl -no-uninstalled 441Forbids the dependency resolver from considering 'uninstalled' modules as part 442of a solution. 443.It Fl -path 444For the first 445.Ar module 446given on the command line, let the dependency resolver find the 447.Xr pc 5 448file describing that module, print the absolute pathname of that file 449to standard output, and exit immediately, 450ignoring most other options and all other arguments. 451.It Fl -prefix-variable Ns = Ns Ar variable 452Sets the 453.Sq prefix 454variable used by the 455.Sq define-prefix 456feature. 457.It Fl -print-errors 458Print some messages about fatal errors to standard error output 459that would otherwise be omitted. 460This option is implied by many other options, but not by all. 461It can be overridden with 462.Fl -silence-errors . 463.It Fl -print-provides 464For each specified 465.Ar module , 466print one line to standard output containing the 467.Ic Name 468property, an equal sign 469.Pq Sq = , 470and the 471.Ic Version 472property. 473If the 474.Ar module 475contains one or more 476.Ic Provides 477properties, print additional lines in dependency list format, one name 478per line, each name optionally followed by an operator and a version. 479This option implies 480.Fl -maximum-traverse-depth Ns =1 481and overrides and disables all 482.Fl -cflags 483and 484.Fl -libs 485flags. 486.It Fl -print-requires , Fl -print-requires-private 487For each specified 488.Ar module , 489print the 490.Ic Requires 491or 492.Ic Requires.private 493properties, respectively, in dependency list format to standard output. 494Both of these options imply 495.Fl -maximum-traverse-depth Ns =1 496and override and disable all 497.Fl -cflags 498and 499.Fl -libs 500flags. 501.It Fl -print-variables 502For the first 503.Ar module 504given on the command line, print the names of all seen variables 505to standard output, one per line. 506Any subsequent arguments are silently ignored. 507This option implies 508.Fl -print-errors 509and 510.Fl -maximum-traverse-depth Ns =1 511and overrides and disables all 512.Fl -cflags 513and 514.Fl -libs 515flags. 516.It Fl -pure 517Treats the computed dependency graph as if it were pure. 518This is mainly intended for use with the 519.Fl -static 520flag and has no effect if 521.Fl -shared 522is also specified. 523.It Fl -shared 524Compute a simple dependency graph that is only suitable for shared linking. 525This option overrides 526.Fl -static . 527.It Fl -short-errors 528When printing error messages about modules that are not found 529or conflict with each other, avoid printing additional, verbose 530instructions explaining potential methods for solving the problem. 531.It Fl -silence-errors 532Do not print any error, warning, or debugging messages at all. 533Overrides all of 534.Fl -debug , 535.Fl -errors-to-stdout , 536and 537.Fl -print-errors . 538This option is overridden and disabled if the 539.Ev PKG_CONFIG_DEBUG_SPEW 540environment variable is set. 541.It Fl -simulate 542Simulates resolving a dependency graph based on the requested modules on the 543command line. 544Dumps a series of trees denoting pkgconf's resolver state. 545This option is only available if the preprocessor macro 546.Dv PKGCONF_LITE 547was not defined during compilation. 548.It Fl -solution 549Print the names of the modules requested with 550.Ar module 551arguments and their dependencies to standard output. 552This option is only available if the preprocessor macro 553.Dv PKGCONF_LITE 554was not defined during compilation. 555.It Fl -static 556Compute a deeper dependency graph and use compiler/linker flags intended for 557static linking. 558This option is overridden by 559.Fl -shared . 560.It Fl -uninstalled 561Exit with a non-zero result if the dependency resolver uses an 562.Sq uninstalled 563module as part of its solution. 564.It Fl -validate Ar package ... 565Validate specific 566.Sq .pc 567files for correctness. 568This option implies 569.Fl -print-errors 570and 571.Fl -errors-to-stdout . 572.It Fl -variable Ns = Ns Ar varname 573For the first 574.Ar module 575given on the command line, print the value of the variable with the name 576.Ar varname 577to standard output. 578Any subsequent arguments are silently ignored. 579This option implies 580.Fl -maximum-traverse-depth Ns =1 581and overrides and disables all 582.Fl -cflags 583and 584.Fl -libs 585flags. 586.It Fl -verbose 587This option only has an effect if 588.Fl -modversion 589is also specified. 590It prints the name of the respective 591.Ar module 592and a colon before each version number. 593.It Fl -version 594Print the version number of the 595.Nm 596program to standard output and exit. 597Most other options and all command line arguments are ignored. 598.It Fl -with-path Ns = Ns Ar path 599Prepend the directory 600.Ar path 601to the module search path, 602giving it priority over all other directories including those from 603.Ev PKG_CONFIG_PATH 604and 605.Ev PKG_CONFIG_LIBDIR . 606.El 607.Sh ENVIRONMENT 608.Bl -tag -width indent 609.It Ev CPATH 610First supplementary colon-separated list of include paths filtered out 611in the same way as 612.Ev PKG_CONFIG_SYSTEM_INCLUDE_PATH . 613.It Ev CPLUS_INCLUDE_PATH 614Third supplementary colon-separated list of include paths filtered out 615in the same way as 616.Ev PKG_CONFIG_SYSTEM_INCLUDE_PATH . 617.It Ev C_INCLUDE_PATH 618Second supplementary colon-separated list of include paths filtered out 619in the same way as 620.Ev PKG_CONFIG_SYSTEM_INCLUDE_PATH . 621.It Ev DESTDIR 622If set to the same value as 623.Ev PKG_CONFIG_SYSROOT_DIR , 624behave in the same way as if 625.Ev PKG_CONFIG_FDO_SYSROOT_RULES 626is set. 627If 628.Ev PKG_CONFIG_SYSROOT_DIR 629is not set or set to a different value, 630.Ev DESTDIR 631is ignored. 632.It Ev LIBRARY_PATH 633Supplementary colon-separated list of library paths filtered out 634in the same way as 635.Ev PKG_CONFIG_SYSTEM_LIBRARY_PATH . 636.It Ev OBJC_INCLUDE_PATH 637Fourth supplementary colon-separated list of include paths filtered out 638in the same way as 639.Ev PKG_CONFIG_SYSTEM_INCLUDE_PATH . 640.It Ev PKG_CONFIG_ALLOW_SYSTEM_CFLAGS 641If set, this variable has the same effect as the 642.Fl -keep-system-cflags 643option. 644.It Ev PKG_CONFIG_ALLOW_SYSTEM_LIBS 645If set, this variable has the same effect as the 646.Fl -keep-system-libs 647option. 648.It Ev PKG_CONFIG_DEBUG_SPEW 649If set, override and disable the 650.Fl -silence-errors 651option. 652.It Ev PKG_CONFIG_DISABLE_UNINSTALLED 653If set, enables the same behaviour as the 654.Fl -no-uninstalled 655flag. 656.It Ev PKG_CONFIG_DONT_DEFINE_PREFIX 657If set, this variable has the same effect as the 658.Fl -dont-define-prefix 659option. 660.It Ev PKG_CONFIG_DONT_RELOCATE_PATHS 661If set, disables the path relocation feature. 662.It Ev PKG_CONFIG_FDO_SYSROOT_RULES 663If set, follow the sysroot prefixing rules that freedesktop.org pkg-config uses. 664.It Ev PKG_CONFIG_IGNORE_CONFLICTS 665If set, ignore 666.Ic Conflicts 667rules in modules. 668Has the same effect as the 669.Fl -ignore-conflicts 670option. 671.It Ev PKG_CONFIG_LIBDIR 672A colon-separated list of low-priority directories where 673.Xr pc 5 674files are looked up. 675The module search path is constructed by appending this list to 676.Ev PKG_CONFIG_PATH , 677which enjoys higher priority. 678If 679.Ev PKG_CONFIG_LIBDIR 680is not defined, the default list compiled into the 681.Nm 682program from the 683.Dv PKG_DEFAULT_PATH 684preprocessor macro is appended instead. 685If 686.Ev PKG_CONFIG_LIBDIR 687is defined but empty, nothing is appended. 688.It Ev PKG_CONFIG_LOG 689If set, log information about selected modules 690to the file with the name stored in this variable. 691For more details, see the 692.Fl -log-file 693command line option, which overrides this variable. 694.It Ev PKG_CONFIG_MAXIMUM_TRAVERSE_DEPTH 695Impose a limit on the allowed depth in the dependency graph. 696This variable overrides the 697.Fl -maximum-traverse-depth 698option, but is overridden by the other options mentioned there. 699.It Ev PKG_CONFIG_MSVC_SYNTAX 700If set, use MSVC syntax for 701.Fl -cflags , 702.Fl -env , 703and 704.Fl -libs 705output. 706This variable has the same effect as the 707.Fl -msvc-syntax 708option. 709If the preprocessor macro 710.Dv PKGCONF_LITE 711was defined during compilation, this variable is ignored. 712.It Ev PKG_CONFIG_PATH 713A colon-separated list of high-priority directories where 714.Xr pc 5 715files are looked up. 716The module search path is constructed 717by prepending the directory specified with 718.Fl -with-path , 719if any, and unless 720.Fl -env-only 721is specified, by appending either 722.Ev PKG_CONFIG_LIBDIR 723or the compiled-in default directories with lower priority. 724.It Ev PKG_CONFIG_PRELOADED_FILES 725Colon-separated list of 726.Xr pc 5 727files which are loaded before any other pkg-config files. 728These packages are given highest priority over any other 729.Xr pc 5 730files that would otherwise provide a given package. 731.It Ev PKG_CONFIG_PURE_DEPGRAPH 732If set, enables the same behaviour as the 733.Fl -pure 734flag. 735.It Ev PKG_CONFIG_RELOCATE_PATHS 736If set, this variable has the same effect as the 737.Fl -define-prefix 738option. 739.It Ev PKG_CONFIG_SYSROOT_DIR 740If set, this variable defines a 741.Sq sysroot 742directory, which will be prepended to every path variable 743beginning with the prefix variable in a given 744.Xr pc 5 745file. 746Useful for cross compilation. 747The value of this environment variable is also copied into the global variable 748.Va pc_sysrootdir . 749.It Ev PKG_CONFIG_SYSTEM_INCLUDE_PATH 750Colon-separated list of include paths that are filtered out 751and not printed by the 752.Fl -cflags 753and 754.Fl -cflags-only-I 755options because they are considered system include paths. 756If not defined, the default list compiled into the 757.Nm 758program from the 759.Dv SYSTEM_INCLUDEDIR 760preprocessor macro is used instead. 761Any directories listed in the environment variables 762.Ev CPATH , 763.Ev C_INCLUDE_PATH , 764.Ev CPLUS_INCLUDE_PATH , 765and 766.Ev OBJC_INCLUDE_PATH 767are also filtered out. 768.It Ev PKG_CONFIG_SYSTEM_LIBRARY_PATH 769Colon-separated list of library paths that are filtered out 770and not printed by the 771.Fl -libs 772and 773.Fl -libs-only-L 774options because they are considered system library paths. 775If not defined, the default list compiled into the 776.Nm 777program from the 778.Dv SYSTEM_LIBDIR 779preprocessor macro is used instead. 780.It Ev PKG_CONFIG_TOP_BUILD_DIR 781The value of the 782.Va pc_top_builddir 783global variable. 784If this environment variable is not defined, the string 785.Qq $(top_builddir) 786is used as the value of 787.Va pc_top_builddir . 788.El 789.Sh EXIT STATUS 790.Ex -std 791.Sh EXAMPLES 792Displaying the CFLAGS of a package: 793.Dl $ pkgconf --cflags foo 794.Dl -fPIC -I/usr/include/foo 795.Sh SEE ALSO 796.Xr pc 5 , 797.Xr pkg.m4 7 798