From 7fed573a6f1c2fbceef56a2d1991d55f65309092 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Tue, 5 Dec 2017 19:47:11 -0600 Subject: [PATCH] man: finish pkg.m4(7) --- Makefile.am | 3 +- man/pkg.m4.7 | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++- meson.build | 1 + 3 files changed, 118 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 1d5c067..eeca2ce 100644 --- a/Makefile.am +++ b/Makefile.am @@ -133,7 +133,8 @@ libpkgconf_la_SOURCES = \ libpkgconf_la_LDFLAGS = -no-undefined -version-info 2:0:0 -export-symbols-regex '^pkgconf_' dist_man_MANS = \ - man/pkgconf.1 + man/pkgconf.1 \ + man/pkg.m4.7 pkgconf_LDADD = libpkgconf.la pkgconf_SOURCES = main.c getopt_long.c diff --git a/man/pkg.m4.7 b/man/pkg.m4.7 index 0807356..8515834 100644 --- a/man/pkg.m4.7 +++ b/man/pkg.m4.7 @@ -16,7 +16,7 @@ .Sh SYNOPSIS .Nm PKG_PREREQ .Nm PKG_PROG_PKG_CONFIG -.Nm PKG_CHECK_EXISTS +.Nm PKG_CHECK_MODULES .Nm PKG_CHECK_MODULES_STATIC .Nm PKG_INSTALLDIR .Nm PKG_NOARCH_INSTALLDIR @@ -29,3 +29,117 @@ 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. +.Sh "AUTOCONF MACROS" +.Pp +.Ss "PKG_PREREQ(MIN-VERSION)" +Checks that the version of the +.Nm +autoconf macros in use is at +least MIN-VERSION. This can be used to ensure a particular +.Nm +macro will be available. +.Pp +.Ss "PKG_PROG_PKG_CONFIG([MIN-VERSION])" +Checks for an implementation of +.Nm pkg-config +which is at least MIN-VERSION or newer. +.Pp +.Ss "PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]])" +.Ss "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 +.Nm CFLAGS +and +.Nm LIBS +variables prefixed by +.Nm VARIABLE-PREFIX +with the output from +.Fl -cflags +and +.Fl -libs +respectively. +.Pp +The optional +.Nm ACTION-IF-FOUND +and +.Nm ACTION-IF-NOT-FOUND +arguments are shell fragments that should be executed if the module set is +found or not found. +.Pp +If +.Nm $PKG_CONFIG +is not defined, the +.Nm PKG_PROG_PKG_CONFIG +macro will be executed to locate a +.Nm pkg-config +implementation. +.Pp +The +.Nm PKG_CHECK_MODULES_STATIC +macro provides the same behaviour as +.Nm PKG_CHECK_MODULES +with static linking enabled via the +.Fl -static +flag. +.Ss "PKG_INSTALLDIR(DIRECTORY)" +Defines the variable $pkgconfigdir as the location where a package +should install pkg-config .pc files. +.Pp +By default the directory is $libdir/pkgconfig, but the default can +be changed by passing the +.Nm DIRECTORY +parameter. +.Pp +This value can be overriden with the +.Fl -with-pkgconfigdir +configure parameter. +.Ss "PKG_NOARCH_INSTALLDIR(DIRECTORY)" +Defines the variable $noarch_pkgconfigdir as the location where a package +should install pkg-config .pc files. +.Pp +By default the directory is $datadir/pkgconfig, but the default can +be changed by passing the +.Nm DIRECTORY +parameter. +.Pp +This value can be overriden with the +.Fl -with-noarch-pkgconfigdir +configure parameter. +.Ss "PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])" +Retrieves the value of the +.Nm pkg-config +variable +.Nm CONFIG-VARIABLE +from +.Nm MODULE +and stores it in the +.Nm VARIABLE +variable. +.Pp +Note that repeated usage of +.Nm VARIABLE +is not recommended as the check will be skipped if the variable is +already set. +.Ss "PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND], [DESCRIPTION], [DEFAULT])" +Prepares a "--with-" configure option using the lowercase +.Nm VARIABLE-PREFIX +name, merging the behaviour of +.Nm AC_ARG_WITH +and +.Nm PKG_CHECK_MODULES +in a single macro. +.Ss "PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES, [DESCRIPTION], [DEFAULT])" +Convenience macro to trigger +.Nm AM_CONDITIONAL +after a +.Nm PKG_WITH_MODULES check. +.Nm VARIABLE-PREFIX +is exported as a make variable. +.Ss "PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES, [DESCRIPTION], [DEFAULT])" +Convenience macro to trigger +.Nm AM_CONDITIONAL +and +.Nm AC_DEFINE +after a +.Nm PKG_WITH_MODULES check. +.Nm VARIABLE-PREFIX +is exported as a make variable. diff --git a/meson.build b/meson.build index cc2136d..56cb1cf 100644 --- a/meson.build +++ b/meson.build @@ -92,4 +92,5 @@ subdir('tests') install_man('man/pkgconf.1') +install_man('man/pkg.m4.7') install_data('pkg.m4', install_dir: 'share/aclocal')