| 1 |
# pkg.m4 - Macros to locate and use pkg-config. -*- Autoconf -*- |
| 2 |
# serial 12 (pkg-config-0.29.2) |
| 3 |
|
| 4 |
# Copyright © 2004 Scott James Remnant <[email protected]>. |
| 5 |
# Copyright © 2012-2015 Dan Nicholson <[email protected]> |
| 6 |
# |
| 7 |
# This program is free software; you can redistribute it and/or modify |
| 8 |
# it under the terms of the GNU General Public License as published by |
| 9 |
# the Free Software Foundation; either version 2 of the License, or |
| 10 |
# (at your option) any later version. |
| 11 |
# |
| 12 |
# This program is distributed in the hope that it will be useful, but |
| 13 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 |
# General Public License for more details. |
| 16 |
# |
| 17 |
# You should have received a copy of the GNU General Public License |
| 18 |
# along with this program; if not, write to the Free Software |
| 19 |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
| 20 |
# 02111-1307, USA. |
| 21 |
# |
| 22 |
# As a special exception to the GNU General Public License, if you |
| 23 |
# distribute this file as part of a program that contains a |
| 24 |
# configuration script generated by Autoconf, you may include it under |
| 25 |
# the same distribution terms that you use for the rest of that |
| 26 |
# program. |
| 27 |
|
| 28 |
# PKG_PROG_PKG_CONFIG_COMPAT([MIN-VERSION], [ACTION-IF-NOT-FOUND]) |
| 29 |
# --------------------------------------------------------- |
| 30 |
# Backported from pkg-config 0.29.2. |
| 31 |
# |
| 32 |
# Search for the pkg-config tool and set the PKG_CONFIG variable to |
| 33 |
# first found in the path. Checks that the version of pkg-config found |
| 34 |
# is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is |
| 35 |
# used since that's the first version where most current features of |
| 36 |
# pkg-config existed. |
| 37 |
# |
| 38 |
# If pkg-config is not found or older than specified, it will result |
| 39 |
# in an empty PKG_CONFIG variable. To avoid widespread issues with |
| 40 |
# scripts not checking it, ACTION-IF-NOT-FOUND defaults to aborting. |
| 41 |
# You can specify [PKG_CONFIG=false] as an action instead, which would |
| 42 |
# result in pkg-config tests failing, but no bogus error messages. |
| 43 |
AC_DEFUN([PKG_PROG_PKG_CONFIG_COMPAT], |
| 44 |
[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) |
| 45 |
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) |
| 46 |
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) |
| 47 |
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) |
| 48 |
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) |
| 49 |
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) |
| 50 |
|
| 51 |
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then |
| 52 |
AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) |
| 53 |
fi |
| 54 |
if test -n "$PKG_CONFIG"; then |
| 55 |
_pkg_min_version=m4_default([$1], [0.9.0]) |
| 56 |
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) |
| 57 |
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then |
| 58 |
AC_MSG_RESULT([yes]) |
| 59 |
else |
| 60 |
AC_MSG_RESULT([no]) |
| 61 |
PKG_CONFIG="" |
| 62 |
fi |
| 63 |
fi |
| 64 |
if test -z "$PKG_CONFIG"; then |
| 65 |
m4_default([$2], [AC_MSG_ERROR([pkg-config not found])]) |
| 66 |
fi[] |
| 67 |
]) |
| 68 |
|
| 69 |
# PKG_INSTALLDIR_COMPAT([DIRECTORY]) |
| 70 |
# ------------------------- |
| 71 |
# Backported from pkg-config 0.27. |
| 72 |
# |
| 73 |
# Substitutes the variable pkgconfigdir as the location where a module |
| 74 |
# should install pkg-config .pc files. By default the directory is |
| 75 |
# $libdir/pkgconfig, but the default can be changed by passing |
| 76 |
# DIRECTORY. The user can override through the --with-pkgconfigdir |
| 77 |
# parameter. |
| 78 |
AC_DEFUN([PKG_INSTALLDIR_COMPAT], |
| 79 |
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) |
| 80 |
m4_pushdef([pkg_description], |
| 81 |
[pkg-config installation directory @<:@]pkg_default[@:>@]) |
| 82 |
AC_ARG_WITH([pkgconfigdir], |
| 83 |
[AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, |
| 84 |
[with_pkgconfigdir=]pkg_default) |
| 85 |
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) |
| 86 |
m4_popdef([pkg_default]) |
| 87 |
m4_popdef([pkg_description]) |
| 88 |
]) |