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