blob: b5ee8a9d1e180999d41df3663fe6739b5df142ec [file] [log] [blame]
Nikita Iashchenko4c0e2862019-11-05 16:38:00 +00001# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
Jean-Baptiste Querub13da9d2009-07-17 17:53:22 -07002
Nikita Iashchenko4c0e2862019-11-05 16:38:00 +00003# Copyright (C) 1996-2017 Free Software Foundation, Inc.
Fredrik Roubertc14898b2015-09-28 19:31:03 +02004
ccornelius59d709d2014-02-20 10:29:46 -08005# This file is free software; the Free Software Foundation
6# gives unlimited permission to copy and/or distribute it,
7# with or without modifications, as long as this notice is preserved.
Jean-Baptiste Querub13da9d2009-07-17 17:53:22 -07008
ccornelius59d709d2014-02-20 10:29:46 -08009# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12# PARTICULAR PURPOSE.
Jean-Baptiste Querub13da9d2009-07-17 17:53:22 -070013
Fredrik Roubertc14898b2015-09-28 19:31:03 +020014m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
Fredrik Roubert64339d32016-10-21 19:43:16 +020015dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
Nikita Iashchenko4c0e2862019-11-05 16:38:00 +000016dnl serial 11 (pkg-config-0.29)
Fredrik Roubert64339d32016-10-21 19:43:16 +020017dnl
18dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
19dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
20dnl
21dnl This program is free software; you can redistribute it and/or modify
22dnl it under the terms of the GNU General Public License as published by
23dnl the Free Software Foundation; either version 2 of the License, or
24dnl (at your option) any later version.
25dnl
26dnl This program is distributed in the hope that it will be useful, but
27dnl WITHOUT ANY WARRANTY; without even the implied warranty of
28dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29dnl General Public License for more details.
30dnl
31dnl You should have received a copy of the GNU General Public License
32dnl along with this program; if not, write to the Free Software
33dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
34dnl 02111-1307, USA.
35dnl
36dnl As a special exception to the GNU General Public License, if you
37dnl distribute this file as part of a program that contains a
38dnl configuration script generated by Autoconf, you may include it under
39dnl the same distribution terms that you use for the rest of that
40dnl program.
ccorneliusf9878a22014-11-20 18:09:39 -080041
Fredrik Roubert64339d32016-10-21 19:43:16 +020042dnl PKG_PREREQ(MIN-VERSION)
43dnl -----------------------
44dnl Since: 0.29
45dnl
46dnl Verify that the version of the pkg-config macros are at least
47dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
48dnl installed version of pkg-config, this checks the developer's version
49dnl of pkg.m4 when generating configure.
50dnl
51dnl To ensure that this macro is defined, also add:
52dnl m4_ifndef([PKG_PREREQ],
53dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
54dnl
55dnl See the "Since" comment for each macro you use to see what version
56dnl of the macros you require.
57m4_defun([PKG_PREREQ],
Nikita Iashchenko4c0e2862019-11-05 16:38:00 +000058[m4_define([PKG_MACROS_VERSION], [0.29])
Fredrik Roubert64339d32016-10-21 19:43:16 +020059m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
60 [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
61])dnl PKG_PREREQ
62
63dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
64dnl ----------------------------------
65dnl Since: 0.16
66dnl
67dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
68dnl first found in the path. Checks that the version of pkg-config found
69dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
70dnl used since that's the first version where most current features of
71dnl pkg-config existed.
ccorneliusf9878a22014-11-20 18:09:39 -080072AC_DEFUN([PKG_PROG_PKG_CONFIG],
73[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
Fredrik Roubertc14898b2015-09-28 19:31:03 +020074m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
75m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
76AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
77AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
78AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
79
ccorneliusf9878a22014-11-20 18:09:39 -080080if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
81 AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
82fi
83if test -n "$PKG_CONFIG"; then
84 _pkg_min_version=m4_default([$1], [0.9.0])
85 AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
86 if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
87 AC_MSG_RESULT([yes])
88 else
89 AC_MSG_RESULT([no])
90 PKG_CONFIG=""
91 fi
ccorneliusf9878a22014-11-20 18:09:39 -080092fi[]dnl
Fredrik Roubert64339d32016-10-21 19:43:16 +020093])dnl PKG_PROG_PKG_CONFIG
ccorneliusf9878a22014-11-20 18:09:39 -080094
Fredrik Roubert64339d32016-10-21 19:43:16 +020095dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
96dnl -------------------------------------------------------------------
97dnl Since: 0.18
98dnl
99dnl Check to see whether a particular set of modules exists. Similar to
100dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
101dnl
102dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
103dnl only at the first occurence in configure.ac, so if the first place
104dnl it's called might be skipped (such as if it is within an "if", you
105dnl have to call PKG_CHECK_EXISTS manually
ccorneliusf9878a22014-11-20 18:09:39 -0800106AC_DEFUN([PKG_CHECK_EXISTS],
107[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
108if test -n "$PKG_CONFIG" && \
109 AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
Fredrik Roubertc14898b2015-09-28 19:31:03 +0200110 m4_default([$2], [:])
ccorneliusf9878a22014-11-20 18:09:39 -0800111m4_ifvaln([$3], [else
112 $3])dnl
113fi])
114
Fredrik Roubert64339d32016-10-21 19:43:16 +0200115dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
116dnl ---------------------------------------------
117dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
118dnl pkg_failed based on the result.
ccorneliusf9878a22014-11-20 18:09:39 -0800119m4_define([_PKG_CONFIG],
120[if test -n "$$1"; then
121 pkg_cv_[]$1="$$1"
122 elif test -n "$PKG_CONFIG"; then
123 PKG_CHECK_EXISTS([$3],
Fredrik Roubertc14898b2015-09-28 19:31:03 +0200124 [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
125 test "x$?" != "x0" && pkg_failed=yes ],
ccorneliusf9878a22014-11-20 18:09:39 -0800126 [pkg_failed=yes])
127 else
128 pkg_failed=untried
129fi[]dnl
Fredrik Roubert64339d32016-10-21 19:43:16 +0200130])dnl _PKG_CONFIG
ccorneliusf9878a22014-11-20 18:09:39 -0800131
Fredrik Roubert64339d32016-10-21 19:43:16 +0200132dnl _PKG_SHORT_ERRORS_SUPPORTED
133dnl ---------------------------
134dnl Internal check to see if pkg-config supports short errors.
ccorneliusf9878a22014-11-20 18:09:39 -0800135AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
136[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
137if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
138 _pkg_short_errors_supported=yes
139else
140 _pkg_short_errors_supported=no
141fi[]dnl
Fredrik Roubert64339d32016-10-21 19:43:16 +0200142])dnl _PKG_SHORT_ERRORS_SUPPORTED
ccorneliusf9878a22014-11-20 18:09:39 -0800143
144
Fredrik Roubert64339d32016-10-21 19:43:16 +0200145dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
146dnl [ACTION-IF-NOT-FOUND])
147dnl --------------------------------------------------------------
148dnl Since: 0.4.0
149dnl
150dnl Note that if there is a possibility the first call to
151dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
152dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
ccorneliusf9878a22014-11-20 18:09:39 -0800153AC_DEFUN([PKG_CHECK_MODULES],
154[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
155AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
156AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
157
158pkg_failed=no
159AC_MSG_CHECKING([for $1])
160
161_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
162_PKG_CONFIG([$1][_LIBS], [libs], [$2])
163
164m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
165and $1[]_LIBS to avoid the need to call pkg-config.
166See the pkg-config man page for more details.])
167
168if test $pkg_failed = yes; then
Fredrik Roubertc14898b2015-09-28 19:31:03 +0200169 AC_MSG_RESULT([no])
ccorneliusf9878a22014-11-20 18:09:39 -0800170 _PKG_SHORT_ERRORS_SUPPORTED
171 if test $_pkg_short_errors_supported = yes; then
Fredrik Roubertc14898b2015-09-28 19:31:03 +0200172 $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
ccorneliusf9878a22014-11-20 18:09:39 -0800173 else
Fredrik Roubertc14898b2015-09-28 19:31:03 +0200174 $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
ccorneliusf9878a22014-11-20 18:09:39 -0800175 fi
176 # Put the nasty error message in config.log where it belongs
177 echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
178
Fredrik Roubertc14898b2015-09-28 19:31:03 +0200179 m4_default([$4], [AC_MSG_ERROR(
ccorneliusf9878a22014-11-20 18:09:39 -0800180[Package requirements ($2) were not met:
181
182$$1_PKG_ERRORS
183
184Consider adjusting the PKG_CONFIG_PATH environment variable if you
185installed software in a non-standard prefix.
186
Fredrik Roubertc14898b2015-09-28 19:31:03 +0200187_PKG_TEXT])[]dnl
188 ])
ccorneliusf9878a22014-11-20 18:09:39 -0800189elif test $pkg_failed = untried; then
Fredrik Roubertc14898b2015-09-28 19:31:03 +0200190 AC_MSG_RESULT([no])
191 m4_default([$4], [AC_MSG_FAILURE(
ccorneliusf9878a22014-11-20 18:09:39 -0800192[The pkg-config script could not be found or is too old. Make sure it
193is in your PATH or set the PKG_CONFIG environment variable to the full
194path to pkg-config.
195
196_PKG_TEXT
197
Fredrik Roubertc14898b2015-09-28 19:31:03 +0200198To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
199 ])
ccorneliusf9878a22014-11-20 18:09:39 -0800200else
201 $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
202 $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
203 AC_MSG_RESULT([yes])
Fredrik Roubertc14898b2015-09-28 19:31:03 +0200204 $3
ccorneliusf9878a22014-11-20 18:09:39 -0800205fi[]dnl
Fredrik Roubert64339d32016-10-21 19:43:16 +0200206])dnl PKG_CHECK_MODULES
ccorneliusf9878a22014-11-20 18:09:39 -0800207
Fredrik Roubertc14898b2015-09-28 19:31:03 +0200208
Fredrik Roubert64339d32016-10-21 19:43:16 +0200209dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
210dnl [ACTION-IF-NOT-FOUND])
211dnl ---------------------------------------------------------------------
212dnl Since: 0.29
213dnl
214dnl Checks for existence of MODULES and gathers its build flags with
215dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
216dnl and VARIABLE-PREFIX_LIBS from --libs.
217dnl
218dnl Note that if there is a possibility the first call to
219dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
220dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
221dnl configure.ac.
222AC_DEFUN([PKG_CHECK_MODULES_STATIC],
223[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
224_save_PKG_CONFIG=$PKG_CONFIG
225PKG_CONFIG="$PKG_CONFIG --static"
226PKG_CHECK_MODULES($@)
227PKG_CONFIG=$_save_PKG_CONFIG[]dnl
228])dnl PKG_CHECK_MODULES_STATIC
229
230
231dnl PKG_INSTALLDIR([DIRECTORY])
232dnl -------------------------
233dnl Since: 0.27
234dnl
235dnl Substitutes the variable pkgconfigdir as the location where a module
236dnl should install pkg-config .pc files. By default the directory is
237dnl $libdir/pkgconfig, but the default can be changed by passing
238dnl DIRECTORY. The user can override through the --with-pkgconfigdir
239dnl parameter.
Fredrik Roubertc14898b2015-09-28 19:31:03 +0200240AC_DEFUN([PKG_INSTALLDIR],
241[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
242m4_pushdef([pkg_description],
243 [pkg-config installation directory @<:@]pkg_default[@:>@])
244AC_ARG_WITH([pkgconfigdir],
245 [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
246 [with_pkgconfigdir=]pkg_default)
247AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
248m4_popdef([pkg_default])
249m4_popdef([pkg_description])
Fredrik Roubert64339d32016-10-21 19:43:16 +0200250])dnl PKG_INSTALLDIR
Fredrik Roubertc14898b2015-09-28 19:31:03 +0200251
252
Fredrik Roubert64339d32016-10-21 19:43:16 +0200253dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
254dnl --------------------------------
255dnl Since: 0.27
256dnl
257dnl Substitutes the variable noarch_pkgconfigdir as the location where a
258dnl module should install arch-independent pkg-config .pc files. By
259dnl default the directory is $datadir/pkgconfig, but the default can be
260dnl changed by passing DIRECTORY. The user can override through the
261dnl --with-noarch-pkgconfigdir parameter.
Fredrik Roubertc14898b2015-09-28 19:31:03 +0200262AC_DEFUN([PKG_NOARCH_INSTALLDIR],
263[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
264m4_pushdef([pkg_description],
265 [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
266AC_ARG_WITH([noarch-pkgconfigdir],
267 [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
268 [with_noarch_pkgconfigdir=]pkg_default)
269AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
270m4_popdef([pkg_default])
271m4_popdef([pkg_description])
Fredrik Roubert64339d32016-10-21 19:43:16 +0200272])dnl PKG_NOARCH_INSTALLDIR
Fredrik Roubertc14898b2015-09-28 19:31:03 +0200273
274
Fredrik Roubert64339d32016-10-21 19:43:16 +0200275dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
276dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
277dnl -------------------------------------------
278dnl Since: 0.28
279dnl
280dnl Retrieves the value of the pkg-config variable for the given module.
Fredrik Roubertc14898b2015-09-28 19:31:03 +0200281AC_DEFUN([PKG_CHECK_VAR],
282[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
283AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
284
285_PKG_CONFIG([$1], [variable="][$3]["], [$2])
286AS_VAR_COPY([$1], [pkg_cv_][$1])
287
288AS_VAR_IF([$1], [""], [$5], [$4])dnl
Fredrik Roubert64339d32016-10-21 19:43:16 +0200289])dnl PKG_CHECK_VAR
Fredrik Roubertc14898b2015-09-28 19:31:03 +0200290
291m4_include([config/m4/icu-conditional.m4])
ccornelius59d709d2014-02-20 10:29:46 -0800292m4_include([acinclude.m4])