diff options
author | Philip Withnall <philip.withnall@collabora.co.uk> | 2014-11-27 15:05:43 +0000 |
---|---|---|
committer | Peter Simons <simons@cryp.to> | 2014-11-30 23:47:42 +0100 |
commit | 34b55a19873baf7a06cde95e74711a2afe171ad3 (patch) | |
tree | c2c2432f7db1c86c2f23510c9206005474e0f671 /m4/ax_pkg_check_modules.m4 | |
parent | b0974fa133c34deb1bc7e13de73a5e2b879db62d (diff) | |
download | autoconf-archive-34b55a19873baf7a06cde95e74711a2afe171ad3.tar.gz |
AX_PKG_CHECK_MODULES: Add pkg-config wrapper splitting private deps
See the documentation in the macro file for a full description.
Diffstat (limited to 'm4/ax_pkg_check_modules.m4')
-rw-r--r-- | m4/ax_pkg_check_modules.m4 | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/m4/ax_pkg_check_modules.m4 b/m4/ax_pkg_check_modules.m4 new file mode 100644 index 0000000..490630e --- /dev/null +++ b/m4/ax_pkg_check_modules.m4 @@ -0,0 +1,66 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_pkg_check_modules.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PKG_CHECK_MODULES(PREFIX, PUBLIC-MODULES, PRIVATE-MODULES, [PUBLIC-VARIABLE], [PRIVATE-VARIABLE]) +# +# DESCRIPTION +# +# A wrapper around PKG_CHECK_MODULES which splits the list of modules into +# public and private dependencies, and produces two variables listing the +# dependencies across all invocations of AX_PKG_CHECK_MODULES. These two +# variables are exposed via AC_SUBST, and should be used in a pkg-config +# file as the substituted values for Requires and Requires.private. +# +# The PREFIX, PUBLIC-MODULES and PRIVATE-MODULES arguments should be +# specified as for PKG_CHECK_MODULES, with the concatenation of +# PUBLIC-MODULES and PRIVATE-MODULES equaling the LIST-OF-MODULES from +# PKG_CHECK_MODULES. +# +# PUBLIC-VARIABLE defaults to AX_PACKAGE_REQUIRES, and PRIVATE-VARIABLE +# defaults to AX_PACKAGE_REQUIRES_PRIVATE. Both variables are AC_SUBST-ed +# by this macro. +# +# For example: +# +# AX_PKG_CHECK_MODULES([GLIB],[glib-2.0 gio-2.0],[gthread-2.0]) +# AX_PKG_CHECK_MODULES([DBUS],[],[dbus-glib-1 >= 0.98 dbus-1]) +# +# results in the substitutions: +# +# AX_PACKAGE_REQUIRES="glib-2.0 gio-2.0" +# AX_PACKAGE_REQUIRES_PRIVATE="gthread-2.0 dbus-glib-1 >= 0.98 dbus-1" +# +# and can be used with a template pkg-config file (.pc.in) using: +# +# Requires: @AX_PACKAGE_REQUIRES@ +# Requires.private: @AX_PACKAGE_REQUIRES_PRIVATE@ +# +# LICENSE +# +# Copyright (c) 2014 Philip Withnall <philip@tecnocode.co.uk> +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 1 + +AC_DEFUN([AX_PKG_CHECK_MODULES],[ + m4_define([ax_package_requires], + [m4_default_quoted([$4],[AX_PACKAGE_REQUIRES])]) + m4_define([ax_package_requires_private], + [m4_default_quoted([$5],[AX_PACKAGE_REQUIRES_PRIVATE])]) + + ax_package_requires="$[]ax_package_requires $2" + ax_package_requires_private="$[]ax_package_requires_private $3" + + PKG_CHECK_MODULES([$1],[$2 $3]) + + # Substitute output. + AC_SUBST(ax_package_requires) + AC_SUBST(ax_package_requires_private) +])dnl AX_PKG_CHECK_MODULES |