Blame m4/ax_pkg_check_modules.m4

Packit a7d494
# ===========================================================================
Packit a7d494
#   https://www.gnu.org/software/autoconf-archive/ax_pkg_check_modules.html
Packit a7d494
# ===========================================================================
Packit a7d494
#
Packit a7d494
# SYNOPSIS
Packit a7d494
#
Packit a7d494
#   AX_PKG_CHECK_MODULES(PREFIX, PUBLIC-MODULES, PRIVATE-MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [PUBLIC-VARIABLE], [PRIVATE-VARIABLE])
Packit a7d494
#
Packit a7d494
# DESCRIPTION
Packit a7d494
#
Packit a7d494
#   A wrapper around PKG_CHECK_MODULES which splits the list of modules into
Packit a7d494
#   public and private dependencies, and produces two variables listing the
Packit a7d494
#   dependencies across all invocations of AX_PKG_CHECK_MODULES. These two
Packit a7d494
#   variables are exposed via AC_SUBST, and should be used in a pkg-config
Packit a7d494
#   file as the substituted values for Requires and Requires.private.
Packit a7d494
#
Packit a7d494
#   The PREFIX, PUBLIC-MODULES and PRIVATE-MODULES arguments should be
Packit a7d494
#   specified as for PKG_CHECK_MODULES, with the concatenation of
Packit a7d494
#   PUBLIC-MODULES and PRIVATE-MODULES equaling the LIST-OF-MODULES from
Packit a7d494
#   PKG_CHECK_MODULES.  The ACTION-IF-FOUND and ACTION-IF-NOT-FOUND
Packit a7d494
#   arguments are optional, and should also be specified as for
Packit a7d494
#   PKG_CHECK_MODULES.  ACTION-IF-FOUND is evaluated if the full
Packit a7d494
#   LIST-OF-MODULES is found; ACTION-IF-NOT-FOUND similarly.
Packit a7d494
#
Packit a7d494
#   PUBLIC-VARIABLE defaults to AX_PACKAGE_REQUIRES, and PRIVATE-VARIABLE
Packit a7d494
#   defaults to AX_PACKAGE_REQUIRES_PRIVATE.  Both variables are AC_SUBST-ed
Packit a7d494
#   by this macro.
Packit a7d494
#
Packit a7d494
#   For example:
Packit a7d494
#
Packit a7d494
#     AX_PKG_CHECK_MODULES([GLIB],[glib-2.0 gio-2.0],[gthread-2.0])
Packit a7d494
#     AX_PKG_CHECK_MODULES([DBUS],[],[dbus-glib-1 >= 0.98 dbus-1])
Packit a7d494
#
Packit a7d494
#   results in the substitutions:
Packit a7d494
#
Packit a7d494
#     AX_PACKAGE_REQUIRES="glib-2.0 gio-2.0"
Packit a7d494
#     AX_PACKAGE_REQUIRES_PRIVATE="gthread-2.0 dbus-glib-1 >= 0.98 dbus-1"
Packit a7d494
#
Packit a7d494
#   and can be used with a template pkg-config file (.pc.in) using:
Packit a7d494
#
Packit a7d494
#     Requires: @AX_PACKAGE_REQUIRES@
Packit a7d494
#     Requires.private: @AX_PACKAGE_REQUIRES_PRIVATE@
Packit a7d494
#
Packit a7d494
# LICENSE
Packit a7d494
#
Packit a7d494
#   Copyright (c) 2014 Philip Withnall <philip@tecnocode.co.uk>
Packit a7d494
#
Packit a7d494
#   Copying and distribution of this file, with or without modification, are
Packit a7d494
#   permitted in any medium without royalty provided the copyright notice
Packit a7d494
#   and this notice are preserved.  This file is offered as-is, without any
Packit a7d494
#   warranty.
Packit a7d494
Packit a7d494
#serial 4
Packit a7d494
Packit a7d494
AC_DEFUN([AX_PKG_CHECK_MODULES],[
Packit a7d494
    m4_define([ax_package_requires],
Packit a7d494
              [m4_default_quoted([$6],[AX_PACKAGE_REQUIRES])])
Packit a7d494
    m4_define([ax_package_requires_private],
Packit a7d494
              [m4_default_quoted([$7],[AX_PACKAGE_REQUIRES_PRIVATE])])
Packit a7d494
Packit a7d494
    ax_package_requires="$[]ax_package_requires m4_normalize($2)"
Packit a7d494
    ax_package_requires_private="$[]ax_package_requires_private m4_normalize($3)"
Packit a7d494
Packit a7d494
    PKG_CHECK_MODULES([$1],[$2 $3],[$4],[$5])
Packit a7d494
Packit a7d494
    # Substitute output.
Packit a7d494
    AC_SUBST(ax_package_requires)
Packit a7d494
    AC_SUBST(ax_package_requires_private)
Packit a7d494
])dnl AX_PKG_CHECK_MODULES