pkg.m4 man page

pkg.m4 ā€” autoconf macros for using pkgconf

Synopsis

PKG_PREREQ
PKG_PROG_PKG_CONFIG
PKG_CHECK_MODULES
PKG_CHECK_MODULES_STATIC
PKG_INSTALLDIR
PKG_NOARCH_INSTALLDIR
PKG_CHECK_VAR
PKG_WITH_MODULES
PKG_HAVE_WITH_MODULES
PKG_HAVE_DEFINE_WITH_MODULES

Description

pkg.m4 is a collection of autoconf macros which help to configure compiler and linker flags for development libraries. This allows build systems to detect other dependencies and use them with the system toolchain.

Autoconf Macros

Pkg_prereq(Min-Version)

Checks that the version of the pkg.m4 autoconf macros in use is at least MIN-VERSION. This can be used to ensure a particular pkg.m4 macro will be available.

Pkg_prog_pkg_config([Min-Version])

Checks for an implementation of pkg-config which is at least MIN-VERSION or newer.

Pkg_check_modules(Variable-Prefix, Modules [,Action-if-Found [,Action-if-Not-Found]])

Pkg_check_modules_static(Variable-Prefix, Modules [,Action-if-Found [,Action-if-Not-Found]])

Checks whether a given module set exists, and if so, defines CFLAGS and LIBS variables prefixed by VARIABLE-PREFIX with the output from --cflags and --libs respectively.

The optional ACTION-IF-FOUND and ACTION-IF-NOT-FOUND arguments are shell fragments that should be executed if the module set is found or not found.

If $PKG_CONFIG is not defined, the PKG_PROG_PKG_CONFIG macro will be executed to locate a pkg-config implementation.

The PKG_CHECK_MODULES_STATIC macro provides the same behaviour as PKG_CHECK_MODULES with static linking enabled via the --static flag.

Pkg_installdir(Directory)

Defines the variable $pkgconfigdir as the location where a package should install pkg-config .pc files.

By default the directory is $libdir/pkgconfig, but the default can be changed by passing the DIRECTORY parameter.

This value can be overriden with the --with-pkgconfigdir configure parameter.

Pkg_noarch_installdir(Directory)

Defines the variable $noarch_pkgconfigdir as the location where a package should install pkg-config .pc files.

By default the directory is $datadir/pkgconfig, but the default can be changed by passing the DIRECTORY parameter.

This value can be overriden with the --with-noarch-pkgconfigdir configure parameter.

Pkg_check_var(Variable, Module, Config-Variable, [Action-if-Found], [Action-if-Not-Found])

Retrieves the value of the pkg-config variable CONFIG-VARIABLE from MODULE and stores it in the VARIABLE variable.

Note that repeated usage of VARIABLE is not recommended as the check will be skipped if the variable is already set.

Pkg_with_modules(Variable-Prefix, Modules, [Action-if-Found],[Action-if-Not-Found], [Description], [Default])

Prepares a "--with-" configure option using the lowercase VARIABLE-PREFIX name, merging the behaviour of AC_ARG_WITH and PKG_CHECK_MODULES in a single macro.

Pkg_have_with_modules(Variable-Prefix, Modules, [Description], [Default])

Convenience macro to trigger AM_CONDITIONAL after a PKG_WITH_MODULES check. VARIABLE-PREFIX is exported as a make variable.

Pkg_have_define_with_modules(Variable-Prefix, Modules, [Description], [Default])

Convenience macro to trigger AM_CONDITIONAL and AC_DEFINE after a PKG_WITH_MODULES check. VARIABLE-PREFIX is exported as a make variable.

Referenced By

pc(5), pkgconf(1), pkg-config(1).

December 5, 2017