pkgconf
TLDR
Get compiler flags
$ pkgconf --cflags [library]
Get linker flags$ pkgconf --libs [library]
Check if library exists$ pkgconf --exists [library] && echo "Found"
Get version$ pkgconf --modversion [library]
List all packages$ pkgconf --list-all
SYNOPSIS
pkgconf [options] packages...
DESCRIPTION
pkgconf is a program that helps configure compiler and linker flags for libraries. It's a drop-in replacement for pkg-config with improved performance and features.
PARAMETERS
--cflags
Compiler flags.--libs
Linker flags.--exists
Check existence.--modversion
Package version.--list-all
List all packages.--variable name
Get variable value.--print-requires
Show dependencies.
EXAMPLES
$ # Compile with library
gcc $(pkgconf --cflags --libs openssl) -o prog prog.c
# Check version requirement
pkgconf --atleast-version=1.1.0 openssl
# Get library directory
pkgconf --variable=libdir openssl
# In Makefile
CFLAGS += $(shell pkgconf --cflags gtk+-3.0)
LDFLAGS += $(shell pkgconf --libs gtk+-3.0)
gcc $(pkgconf --cflags --libs openssl) -o prog prog.c
# Check version requirement
pkgconf --atleast-version=1.1.0 openssl
# Get library directory
pkgconf --variable=libdir openssl
# In Makefile
CFLAGS += $(shell pkgconf --cflags gtk+-3.0)
LDFLAGS += $(shell pkgconf --libs gtk+-3.0)
ENVIRONMENT
$ PKG_CONFIG_PATH # Additional .pc file paths
PKG_CONFIG_LIBDIR # Override default paths
PKG_CONFIG_LIBDIR # Override default paths
CAVEATS
Reads .pc files. Compatible with pkg-config. Used in most build systems.
HISTORY
pkgconf was created by William Pitcock as a lighter, faster alternative to pkg-config from freedesktop.org.
SEE ALSO
pkg-config(1), gcc(1), make(1)


