18 | 18 |
You have another version of autoconf. It may work, but is not guaranteed to.
|
19 | 19 |
If you have problems, you may need to regenerate the build system entirely.
|
20 | 20 |
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
|
|
21 |
|
|
22 |
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
|
|
23 |
# serial 11 (pkg-config-0.29.1)
|
|
24 |
|
|
25 |
dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
|
|
26 |
dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
|
|
27 |
dnl
|
|
28 |
dnl This program is free software; you can redistribute it and/or modify
|
|
29 |
dnl it under the terms of the GNU General Public License as published by
|
|
30 |
dnl the Free Software Foundation; either version 2 of the License, or
|
|
31 |
dnl (at your option) any later version.
|
|
32 |
dnl
|
|
33 |
dnl This program is distributed in the hope that it will be useful, but
|
|
34 |
dnl WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
35 |
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
36 |
dnl General Public License for more details.
|
|
37 |
dnl
|
|
38 |
dnl You should have received a copy of the GNU General Public License
|
|
39 |
dnl along with this program; if not, write to the Free Software
|
|
40 |
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
41 |
dnl 02111-1307, USA.
|
|
42 |
dnl
|
|
43 |
dnl As a special exception to the GNU General Public License, if you
|
|
44 |
dnl distribute this file as part of a program that contains a
|
|
45 |
dnl configuration script generated by Autoconf, you may include it under
|
|
46 |
dnl the same distribution terms that you use for the rest of that
|
|
47 |
dnl program.
|
|
48 |
|
|
49 |
dnl PKG_PREREQ(MIN-VERSION)
|
|
50 |
dnl -----------------------
|
|
51 |
dnl Since: 0.29
|
|
52 |
dnl
|
|
53 |
dnl Verify that the version of the pkg-config macros are at least
|
|
54 |
dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
|
|
55 |
dnl installed version of pkg-config, this checks the developer's version
|
|
56 |
dnl of pkg.m4 when generating configure.
|
|
57 |
dnl
|
|
58 |
dnl To ensure that this macro is defined, also add:
|
|
59 |
dnl m4_ifndef([PKG_PREREQ],
|
|
60 |
dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
|
|
61 |
dnl
|
|
62 |
dnl See the "Since" comment for each macro you use to see what version
|
|
63 |
dnl of the macros you require.
|
|
64 |
m4_defun([PKG_PREREQ],
|
|
65 |
[m4_define([PKG_MACROS_VERSION], [0.29.1])
|
|
66 |
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
|
|
67 |
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
|
|
68 |
])dnl PKG_PREREQ
|
|
69 |
|
|
70 |
dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
|
|
71 |
dnl ----------------------------------
|
|
72 |
dnl Since: 0.16
|
|
73 |
dnl
|
|
74 |
dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
|
|
75 |
dnl first found in the path. Checks that the version of pkg-config found
|
|
76 |
dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
|
|
77 |
dnl used since that's the first version where most current features of
|
|
78 |
dnl pkg-config existed.
|
|
79 |
AC_DEFUN([PKG_PROG_PKG_CONFIG],
|
|
80 |
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
|
|
81 |
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
|
|
82 |
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
|
|
83 |
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
|
|
84 |
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
|
|
85 |
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
|
|
86 |
|
|
87 |
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
|
|
88 |
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
|
|
89 |
fi
|
|
90 |
if test -n "$PKG_CONFIG"; then
|
|
91 |
_pkg_min_version=m4_default([$1], [0.9.0])
|
|
92 |
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
|
|
93 |
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
|
|
94 |
AC_MSG_RESULT([yes])
|
|
95 |
else
|
|
96 |
AC_MSG_RESULT([no])
|
|
97 |
PKG_CONFIG=""
|
|
98 |
fi
|
|
99 |
fi[]dnl
|
|
100 |
])dnl PKG_PROG_PKG_CONFIG
|
|
101 |
|
|
102 |
dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
|
103 |
dnl -------------------------------------------------------------------
|
|
104 |
dnl Since: 0.18
|
|
105 |
dnl
|
|
106 |
dnl Check to see whether a particular set of modules exists. Similar to
|
|
107 |
dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
|
|
108 |
dnl
|
|
109 |
dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
|
110 |
dnl only at the first occurence in configure.ac, so if the first place
|
|
111 |
dnl it's called might be skipped (such as if it is within an "if", you
|
|
112 |
dnl have to call PKG_CHECK_EXISTS manually
|
|
113 |
AC_DEFUN([PKG_CHECK_EXISTS],
|
|
114 |
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
|
115 |
if test -n "$PKG_CONFIG" && \
|
|
116 |
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
|
|
117 |
m4_default([$2], [:])
|
|
118 |
m4_ifvaln([$3], [else
|
|
119 |
$3])dnl
|
|
120 |
fi])
|
|
121 |
|
|
122 |
dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
|
|
123 |
dnl ---------------------------------------------
|
|
124 |
dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
|
|
125 |
dnl pkg_failed based on the result.
|
|
126 |
m4_define([_PKG_CONFIG],
|
|
127 |
[if test -n "$$1"; then
|
|
128 |
pkg_cv_[]$1="$$1"
|
|
129 |
elif test -n "$PKG_CONFIG"; then
|
|
130 |
PKG_CHECK_EXISTS([$3],
|
|
131 |
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
|
|
132 |
test "x$?" != "x0" && pkg_failed=yes ],
|
|
133 |
[pkg_failed=yes])
|
|
134 |
else
|
|
135 |
pkg_failed=untried
|
|
136 |
fi[]dnl
|
|
137 |
])dnl _PKG_CONFIG
|
|
138 |
|
|
139 |
dnl _PKG_SHORT_ERRORS_SUPPORTED
|
|
140 |
dnl ---------------------------
|
|
141 |
dnl Internal check to see if pkg-config supports short errors.
|
|
142 |
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
|
|
143 |
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
|
144 |
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
|
|
145 |
_pkg_short_errors_supported=yes
|
|
146 |
else
|
|
147 |
_pkg_short_errors_supported=no
|
|
148 |
fi[]dnl
|
|
149 |
])dnl _PKG_SHORT_ERRORS_SUPPORTED
|
|
150 |
|
|
151 |
|
|
152 |
dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
|
|
153 |
dnl [ACTION-IF-NOT-FOUND])
|
|
154 |
dnl --------------------------------------------------------------
|
|
155 |
dnl Since: 0.4.0
|
|
156 |
dnl
|
|
157 |
dnl Note that if there is a possibility the first call to
|
|
158 |
dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
|
|
159 |
dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
|
|
160 |
AC_DEFUN([PKG_CHECK_MODULES],
|
|
161 |
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
|
162 |
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
|
|
163 |
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
|
|
164 |
|
|
165 |
pkg_failed=no
|
|
166 |
AC_MSG_CHECKING([for $1])
|
|
167 |
|
|
168 |
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
|
|
169 |
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
|
|
170 |
|
|
171 |
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
|
|
172 |
and $1[]_LIBS to avoid the need to call pkg-config.
|
|
173 |
See the pkg-config man page for more details.])
|
|
174 |
|
|
175 |
if test $pkg_failed = yes; then
|
|
176 |
AC_MSG_RESULT([no])
|
|
177 |
_PKG_SHORT_ERRORS_SUPPORTED
|
|
178 |
if test $_pkg_short_errors_supported = yes; then
|
|
179 |
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
|
|
180 |
else
|
|
181 |
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
|
|
182 |
fi
|
|
183 |
# Put the nasty error message in config.log where it belongs
|
|
184 |
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
|
|
185 |
|
|
186 |
m4_default([$4], [AC_MSG_ERROR(
|
|
187 |
[Package requirements ($2) were not met:
|
|
188 |
|
|
189 |
$$1_PKG_ERRORS
|
|
190 |
|
|
191 |
Consider adjusting the PKG_CONFIG_PATH environment variable if you
|
|
192 |
installed software in a non-standard prefix.
|
|
193 |
|
|
194 |
_PKG_TEXT])[]dnl
|
|
195 |
])
|
|
196 |
elif test $pkg_failed = untried; then
|
|
197 |
AC_MSG_RESULT([no])
|
|
198 |
m4_default([$4], [AC_MSG_FAILURE(
|
|
199 |
[The pkg-config script could not be found or is too old. Make sure it
|
|
200 |
is in your PATH or set the PKG_CONFIG environment variable to the full
|
|
201 |
path to pkg-config.
|
|
202 |
|
|
203 |
_PKG_TEXT
|
|
204 |
|
|
205 |
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
|
|
206 |
])
|
|
207 |
else
|
|
208 |
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
|
|
209 |
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
|
|
210 |
AC_MSG_RESULT([yes])
|
|
211 |
$3
|
|
212 |
fi[]dnl
|
|
213 |
])dnl PKG_CHECK_MODULES
|
|
214 |
|
|
215 |
|
|
216 |
dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
|
|
217 |
dnl [ACTION-IF-NOT-FOUND])
|
|
218 |
dnl ---------------------------------------------------------------------
|
|
219 |
dnl Since: 0.29
|
|
220 |
dnl
|
|
221 |
dnl Checks for existence of MODULES and gathers its build flags with
|
|
222 |
dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
|
|
223 |
dnl and VARIABLE-PREFIX_LIBS from --libs.
|
|
224 |
dnl
|
|
225 |
dnl Note that if there is a possibility the first call to
|
|
226 |
dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
|
|
227 |
dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
|
|
228 |
dnl configure.ac.
|
|
229 |
AC_DEFUN([PKG_CHECK_MODULES_STATIC],
|
|
230 |
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
|
231 |
_save_PKG_CONFIG=$PKG_CONFIG
|
|
232 |
PKG_CONFIG="$PKG_CONFIG --static"
|
|
233 |
PKG_CHECK_MODULES($@)
|
|
234 |
PKG_CONFIG=$_save_PKG_CONFIG[]dnl
|
|
235 |
])dnl PKG_CHECK_MODULES_STATIC
|
|
236 |
|
|
237 |
|
|
238 |
dnl PKG_INSTALLDIR([DIRECTORY])
|
|
239 |
dnl -------------------------
|
|
240 |
dnl Since: 0.27
|
|
241 |
dnl
|
|
242 |
dnl Substitutes the variable pkgconfigdir as the location where a module
|
|
243 |
dnl should install pkg-config .pc files. By default the directory is
|
|
244 |
dnl $libdir/pkgconfig, but the default can be changed by passing
|
|
245 |
dnl DIRECTORY. The user can override through the --with-pkgconfigdir
|
|
246 |
dnl parameter.
|
|
247 |
AC_DEFUN([PKG_INSTALLDIR],
|
|
248 |
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
|
|
249 |
m4_pushdef([pkg_description],
|
|
250 |
[pkg-config installation directory @<:@]pkg_default[@:>@])
|
|
251 |
AC_ARG_WITH([pkgconfigdir],
|
|
252 |
[AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
|
|
253 |
[with_pkgconfigdir=]pkg_default)
|
|
254 |
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
|
|
255 |
m4_popdef([pkg_default])
|
|
256 |
m4_popdef([pkg_description])
|
|
257 |
])dnl PKG_INSTALLDIR
|
|
258 |
|
|
259 |
|
|
260 |
dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
|
|
261 |
dnl --------------------------------
|
|
262 |
dnl Since: 0.27
|
|
263 |
dnl
|
|
264 |
dnl Substitutes the variable noarch_pkgconfigdir as the location where a
|
|
265 |
dnl module should install arch-independent pkg-config .pc files. By
|
|
266 |
dnl default the directory is $datadir/pkgconfig, but the default can be
|
|
267 |
dnl changed by passing DIRECTORY. The user can override through the
|
|
268 |
dnl --with-noarch-pkgconfigdir parameter.
|
|
269 |
AC_DEFUN([PKG_NOARCH_INSTALLDIR],
|
|
270 |
[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
|
|
271 |
m4_pushdef([pkg_description],
|
|
272 |
[pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
|
|
273 |
AC_ARG_WITH([noarch-pkgconfigdir],
|
|
274 |
[AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
|
|
275 |
[with_noarch_pkgconfigdir=]pkg_default)
|
|
276 |
AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
|
|
277 |
m4_popdef([pkg_default])
|
|
278 |
m4_popdef([pkg_description])
|
|
279 |
])dnl PKG_NOARCH_INSTALLDIR
|
|
280 |
|
|
281 |
|
|
282 |
dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
|
|
283 |
dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
|
284 |
dnl -------------------------------------------
|
|
285 |
dnl Since: 0.28
|
|
286 |
dnl
|
|
287 |
dnl Retrieves the value of the pkg-config variable for the given module.
|
|
288 |
AC_DEFUN([PKG_CHECK_VAR],
|
|
289 |
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
|
290 |
AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
|
|
291 |
|
|
292 |
_PKG_CONFIG([$1], [variable="][$3]["], [$2])
|
|
293 |
AS_VAR_COPY([$1], [pkg_cv_][$1])
|
|
294 |
|
|
295 |
AS_VAR_IF([$1], [""], [$5], [$4])dnl
|
|
296 |
])dnl PKG_CHECK_VAR
|
|
297 |
|
|
298 |
dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
|
|
299 |
dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
|
|
300 |
dnl [DESCRIPTION], [DEFAULT])
|
|
301 |
dnl ------------------------------------------
|
|
302 |
dnl
|
|
303 |
dnl Prepare a "--with-" configure option using the lowercase
|
|
304 |
dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
|
|
305 |
dnl PKG_CHECK_MODULES in a single macro.
|
|
306 |
AC_DEFUN([PKG_WITH_MODULES],
|
|
307 |
[
|
|
308 |
m4_pushdef([with_arg], m4_tolower([$1]))
|
|
309 |
|
|
310 |
m4_pushdef([description],
|
|
311 |
[m4_default([$5], [build with ]with_arg[ support])])
|
|
312 |
|
|
313 |
m4_pushdef([def_arg], [m4_default([$6], [auto])])
|
|
314 |
m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
|
|
315 |
m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
|
|
316 |
|
|
317 |
m4_case(def_arg,
|
|
318 |
[yes],[m4_pushdef([with_without], [--without-]with_arg)],
|
|
319 |
[m4_pushdef([with_without],[--with-]with_arg)])
|
|
320 |
|
|
321 |
AC_ARG_WITH(with_arg,
|
|
322 |
AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
|
|
323 |
[AS_TR_SH([with_]with_arg)=def_arg])
|
|
324 |
|
|
325 |
AS_CASE([$AS_TR_SH([with_]with_arg)],
|
|
326 |
[yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
|
|
327 |
[auto],[PKG_CHECK_MODULES([$1],[$2],
|
|
328 |
[m4_n([def_action_if_found]) $3],
|
|
329 |
[m4_n([def_action_if_not_found]) $4])])
|
|
330 |
|
|
331 |
m4_popdef([with_arg])
|
|
332 |
m4_popdef([description])
|
|
333 |
m4_popdef([def_arg])
|
|
334 |
|
|
335 |
])dnl PKG_WITH_MODULES
|
|
336 |
|
|
337 |
dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
|
|
338 |
dnl [DESCRIPTION], [DEFAULT])
|
|
339 |
dnl -----------------------------------------------
|
|
340 |
dnl
|
|
341 |
dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
|
|
342 |
dnl check._[VARIABLE-PREFIX] is exported as make variable.
|
|
343 |
AC_DEFUN([PKG_HAVE_WITH_MODULES],
|
|
344 |
[
|
|
345 |
PKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
|
|
346 |
|
|
347 |
AM_CONDITIONAL([HAVE_][$1],
|
|
348 |
[test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
|
|
349 |
])dnl PKG_HAVE_WITH_MODULES
|
|
350 |
|
|
351 |
dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
|
|
352 |
dnl [DESCRIPTION], [DEFAULT])
|
|
353 |
dnl ------------------------------------------------------
|
|
354 |
dnl
|
|
355 |
dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
|
|
356 |
dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
|
|
357 |
dnl and preprocessor variable.
|
|
358 |
AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
|
|
359 |
[
|
|
360 |
PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
|
|
361 |
|
|
362 |
AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
|
|
363 |
[AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
|
|
364 |
])dnl PKG_HAVE_DEFINE_WITH_MODULES
|
|
365 |
|
|
366 |
# Increment this whenever this file is changed.
|
|
367 |
#serial 1
|
21 | 368 |
|
22 | 369 |
dnl GLIB_GSETTINGS
|
23 | 370 |
dnl Defines GSETTINGS_SCHEMAS_INSTALL which controls whether
|
|
232 | 579 |
AC_MSG_RESULT([$USE_NLS])
|
233 | 580 |
AC_SUBST([USE_NLS])
|
234 | 581 |
])
|
235 | |
|
236 | |
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
|
237 | |
# serial 11 (pkg-config-0.29.1)
|
238 | |
|
239 | |
dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
|
240 | |
dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
|
241 | |
dnl
|
242 | |
dnl This program is free software; you can redistribute it and/or modify
|
243 | |
dnl it under the terms of the GNU General Public License as published by
|
244 | |
dnl the Free Software Foundation; either version 2 of the License, or
|
245 | |
dnl (at your option) any later version.
|
246 | |
dnl
|
247 | |
dnl This program is distributed in the hope that it will be useful, but
|
248 | |
dnl WITHOUT ANY WARRANTY; without even the implied warranty of
|
249 | |
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
250 | |
dnl General Public License for more details.
|
251 | |
dnl
|
252 | |
dnl You should have received a copy of the GNU General Public License
|
253 | |
dnl along with this program; if not, write to the Free Software
|
254 | |
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
255 | |
dnl 02111-1307, USA.
|
256 | |
dnl
|
257 | |
dnl As a special exception to the GNU General Public License, if you
|
258 | |
dnl distribute this file as part of a program that contains a
|
259 | |
dnl configuration script generated by Autoconf, you may include it under
|
260 | |
dnl the same distribution terms that you use for the rest of that
|
261 | |
dnl program.
|
262 | |
|
263 | |
dnl PKG_PREREQ(MIN-VERSION)
|
264 | |
dnl -----------------------
|
265 | |
dnl Since: 0.29
|
266 | |
dnl
|
267 | |
dnl Verify that the version of the pkg-config macros are at least
|
268 | |
dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
|
269 | |
dnl installed version of pkg-config, this checks the developer's version
|
270 | |
dnl of pkg.m4 when generating configure.
|
271 | |
dnl
|
272 | |
dnl To ensure that this macro is defined, also add:
|
273 | |
dnl m4_ifndef([PKG_PREREQ],
|
274 | |
dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
|
275 | |
dnl
|
276 | |
dnl See the "Since" comment for each macro you use to see what version
|
277 | |
dnl of the macros you require.
|
278 | |
m4_defun([PKG_PREREQ],
|
279 | |
[m4_define([PKG_MACROS_VERSION], [0.29.1])
|
280 | |
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
|
281 | |
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
|
282 | |
])dnl PKG_PREREQ
|
283 | |
|
284 | |
dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
|
285 | |
dnl ----------------------------------
|
286 | |
dnl Since: 0.16
|
287 | |
dnl
|
288 | |
dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
|
289 | |
dnl first found in the path. Checks that the version of pkg-config found
|
290 | |
dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
|
291 | |
dnl used since that's the first version where most current features of
|
292 | |
dnl pkg-config existed.
|
293 | |
AC_DEFUN([PKG_PROG_PKG_CONFIG],
|
294 | |
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
|
295 | |
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
|
296 | |
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
|
297 | |
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
|
298 | |
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
|
299 | |
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
|
300 | |
|
301 | |
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
|
302 | |
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
|
303 | |
fi
|
304 | |
if test -n "$PKG_CONFIG"; then
|
305 | |
_pkg_min_version=m4_default([$1], [0.9.0])
|
306 | |
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
|
307 | |
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
|
308 | |
AC_MSG_RESULT([yes])
|
309 | |
else
|
310 | |
AC_MSG_RESULT([no])
|
311 | |
PKG_CONFIG=""
|
312 | |
fi
|
313 | |
fi[]dnl
|
314 | |
])dnl PKG_PROG_PKG_CONFIG
|
315 | |
|
316 | |
dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
317 | |
dnl -------------------------------------------------------------------
|
318 | |
dnl Since: 0.18
|
319 | |
dnl
|
320 | |
dnl Check to see whether a particular set of modules exists. Similar to
|
321 | |
dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
|
322 | |
dnl
|
323 | |
dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
324 | |
dnl only at the first occurence in configure.ac, so if the first place
|
325 | |
dnl it's called might be skipped (such as if it is within an "if", you
|
326 | |
dnl have to call PKG_CHECK_EXISTS manually
|
327 | |
AC_DEFUN([PKG_CHECK_EXISTS],
|
328 | |
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
329 | |
if test -n "$PKG_CONFIG" && \
|
330 | |
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
|
331 | |
m4_default([$2], [:])
|
332 | |
m4_ifvaln([$3], [else
|
333 | |
$3])dnl
|
334 | |
fi])
|
335 | |
|
336 | |
dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
|
337 | |
dnl ---------------------------------------------
|
338 | |
dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
|
339 | |
dnl pkg_failed based on the result.
|
340 | |
m4_define([_PKG_CONFIG],
|
341 | |
[if test -n "$$1"; then
|
342 | |
pkg_cv_[]$1="$$1"
|
343 | |
elif test -n "$PKG_CONFIG"; then
|
344 | |
PKG_CHECK_EXISTS([$3],
|
345 | |
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
|
346 | |
test "x$?" != "x0" && pkg_failed=yes ],
|
347 | |
[pkg_failed=yes])
|
348 | |
else
|
349 | |
pkg_failed=untried
|
350 | |
fi[]dnl
|
351 | |
])dnl _PKG_CONFIG
|
352 | |
|
353 | |
dnl _PKG_SHORT_ERRORS_SUPPORTED
|
354 | |
dnl ---------------------------
|
355 | |
dnl Internal check to see if pkg-config supports short errors.
|
356 | |
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
|
357 | |
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
358 | |
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
|
359 | |
_pkg_short_errors_supported=yes
|
360 | |
else
|
361 | |
_pkg_short_errors_supported=no
|
362 | |
fi[]dnl
|
363 | |
])dnl _PKG_SHORT_ERRORS_SUPPORTED
|
364 | |
|
365 | |
|
366 | |
dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
|
367 | |
dnl [ACTION-IF-NOT-FOUND])
|
368 | |
dnl --------------------------------------------------------------
|
369 | |
dnl Since: 0.4.0
|
370 | |
dnl
|
371 | |
dnl Note that if there is a possibility the first call to
|
372 | |
dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
|
373 | |
dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
|
374 | |
AC_DEFUN([PKG_CHECK_MODULES],
|
375 | |
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
376 | |
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
|
377 | |
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
|
378 | |
|
379 | |
pkg_failed=no
|
380 | |
AC_MSG_CHECKING([for $1])
|
381 | |
|
382 | |
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
|
383 | |
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
|
384 | |
|
385 | |
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
|
386 | |
and $1[]_LIBS to avoid the need to call pkg-config.
|
387 | |
See the pkg-config man page for more details.])
|
388 | |
|
389 | |
if test $pkg_failed = yes; then
|
390 | |
AC_MSG_RESULT([no])
|
391 | |
_PKG_SHORT_ERRORS_SUPPORTED
|
392 | |
if test $_pkg_short_errors_supported = yes; then
|
393 | |
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
|
394 | |
else
|
395 | |
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
|
396 | |
fi
|
397 | |
# Put the nasty error message in config.log where it belongs
|
398 | |
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
|
399 | |
|
400 | |
m4_default([$4], [AC_MSG_ERROR(
|
401 | |
[Package requirements ($2) were not met:
|
402 | |
|
403 | |
$$1_PKG_ERRORS
|
404 | |
|
405 | |
Consider adjusting the PKG_CONFIG_PATH environment variable if you
|
406 | |
installed software in a non-standard prefix.
|
407 | |
|
408 | |
_PKG_TEXT])[]dnl
|
409 | |
])
|
410 | |
elif test $pkg_failed = untried; then
|
411 | |
AC_MSG_RESULT([no])
|
412 | |
m4_default([$4], [AC_MSG_FAILURE(
|
413 | |
[The pkg-config script could not be found or is too old. Make sure it
|
414 | |
is in your PATH or set the PKG_CONFIG environment variable to the full
|
415 | |
path to pkg-config.
|
416 | |
|
417 | |
_PKG_TEXT
|
418 | |
|
419 | |
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
|
420 | |
])
|
421 | |
else
|
422 | |
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
|
423 | |
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
|
424 | |
AC_MSG_RESULT([yes])
|
425 | |
$3
|
426 | |
fi[]dnl
|
427 | |
])dnl PKG_CHECK_MODULES
|
428 | |
|
429 | |
|
430 | |
dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
|
431 | |
dnl [ACTION-IF-NOT-FOUND])
|
432 | |
dnl ---------------------------------------------------------------------
|
433 | |
dnl Since: 0.29
|
434 | |
dnl
|
435 | |
dnl Checks for existence of MODULES and gathers its build flags with
|
436 | |
dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
|
437 | |
dnl and VARIABLE-PREFIX_LIBS from --libs.
|
438 | |
dnl
|
439 | |
dnl Note that if there is a possibility the first call to
|
440 | |
dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
|
441 | |
dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
|
442 | |
dnl configure.ac.
|
443 | |
AC_DEFUN([PKG_CHECK_MODULES_STATIC],
|
444 | |
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
445 | |
_save_PKG_CONFIG=$PKG_CONFIG
|
446 | |
PKG_CONFIG="$PKG_CONFIG --static"
|
447 | |
PKG_CHECK_MODULES($@)
|
448 | |
PKG_CONFIG=$_save_PKG_CONFIG[]dnl
|
449 | |
])dnl PKG_CHECK_MODULES_STATIC
|
450 | |
|
451 | |
|
452 | |
dnl PKG_INSTALLDIR([DIRECTORY])
|
453 | |
dnl -------------------------
|
454 | |
dnl Since: 0.27
|
455 | |
dnl
|
456 | |
dnl Substitutes the variable pkgconfigdir as the location where a module
|
457 | |
dnl should install pkg-config .pc files. By default the directory is
|
458 | |
dnl $libdir/pkgconfig, but the default can be changed by passing
|
459 | |
dnl DIRECTORY. The user can override through the --with-pkgconfigdir
|
460 | |
dnl parameter.
|
461 | |
AC_DEFUN([PKG_INSTALLDIR],
|
462 | |
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
|
463 | |
m4_pushdef([pkg_description],
|
464 | |
[pkg-config installation directory @<:@]pkg_default[@:>@])
|
465 | |
AC_ARG_WITH([pkgconfigdir],
|
466 | |
[AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
|
467 | |
[with_pkgconfigdir=]pkg_default)
|
468 | |
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
|
469 | |
m4_popdef([pkg_default])
|
470 | |
m4_popdef([pkg_description])
|
471 | |
])dnl PKG_INSTALLDIR
|
472 | |
|
473 | |
|
474 | |
dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
|
475 | |
dnl --------------------------------
|
476 | |
dnl Since: 0.27
|
477 | |
dnl
|
478 | |
dnl Substitutes the variable noarch_pkgconfigdir as the location where a
|
479 | |
dnl module should install arch-independent pkg-config .pc files. By
|
480 | |
dnl default the directory is $datadir/pkgconfig, but the default can be
|
481 | |
dnl changed by passing DIRECTORY. The user can override through the
|
482 | |
dnl --with-noarch-pkgconfigdir parameter.
|
483 | |
AC_DEFUN([PKG_NOARCH_INSTALLDIR],
|
484 | |
[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
|
485 | |
m4_pushdef([pkg_description],
|
486 | |
[pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
|
487 | |
AC_ARG_WITH([noarch-pkgconfigdir],
|
488 | |
[AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
|
489 | |
[with_noarch_pkgconfigdir=]pkg_default)
|
490 | |
AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
|
491 | |
m4_popdef([pkg_default])
|
492 | |
m4_popdef([pkg_description])
|
493 | |
])dnl PKG_NOARCH_INSTALLDIR
|
494 | |
|
495 | |
|
496 | |
dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
|
497 | |
dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
498 | |
dnl -------------------------------------------
|
499 | |
dnl Since: 0.28
|
500 | |
dnl
|
501 | |
dnl Retrieves the value of the pkg-config variable for the given module.
|
502 | |
AC_DEFUN([PKG_CHECK_VAR],
|
503 | |
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
504 | |
AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
|
505 | |
|
506 | |
_PKG_CONFIG([$1], [variable="][$3]["], [$2])
|
507 | |
AS_VAR_COPY([$1], [pkg_cv_][$1])
|
508 | |
|
509 | |
AS_VAR_IF([$1], [""], [$5], [$4])dnl
|
510 | |
])dnl PKG_CHECK_VAR
|
511 | |
|
512 | |
dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
|
513 | |
dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
|
514 | |
dnl [DESCRIPTION], [DEFAULT])
|
515 | |
dnl ------------------------------------------
|
516 | |
dnl
|
517 | |
dnl Prepare a "--with-" configure option using the lowercase
|
518 | |
dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
|
519 | |
dnl PKG_CHECK_MODULES in a single macro.
|
520 | |
AC_DEFUN([PKG_WITH_MODULES],
|
521 | |
[
|
522 | |
m4_pushdef([with_arg], m4_tolower([$1]))
|
523 | |
|
524 | |
m4_pushdef([description],
|
525 | |
[m4_default([$5], [build with ]with_arg[ support])])
|
526 | |
|
527 | |
m4_pushdef([def_arg], [m4_default([$6], [auto])])
|
528 | |
m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
|
529 | |
m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
|
530 | |
|
531 | |
m4_case(def_arg,
|
532 | |
[yes],[m4_pushdef([with_without], [--without-]with_arg)],
|
533 | |
[m4_pushdef([with_without],[--with-]with_arg)])
|
534 | |
|
535 | |
AC_ARG_WITH(with_arg,
|
536 | |
AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
|
537 | |
[AS_TR_SH([with_]with_arg)=def_arg])
|
538 | |
|
539 | |
AS_CASE([$AS_TR_SH([with_]with_arg)],
|
540 | |
[yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
|
541 | |
[auto],[PKG_CHECK_MODULES([$1],[$2],
|
542 | |
[m4_n([def_action_if_found]) $3],
|
543 | |
[m4_n([def_action_if_not_found]) $4])])
|
544 | |
|
545 | |
m4_popdef([with_arg])
|
546 | |
m4_popdef([description])
|
547 | |
m4_popdef([def_arg])
|
548 | |
|
549 | |
])dnl PKG_WITH_MODULES
|
550 | |
|
551 | |
dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
|
552 | |
dnl [DESCRIPTION], [DEFAULT])
|
553 | |
dnl -----------------------------------------------
|
554 | |
dnl
|
555 | |
dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
|
556 | |
dnl check._[VARIABLE-PREFIX] is exported as make variable.
|
557 | |
AC_DEFUN([PKG_HAVE_WITH_MODULES],
|
558 | |
[
|
559 | |
PKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
|
560 | |
|
561 | |
AM_CONDITIONAL([HAVE_][$1],
|
562 | |
[test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
|
563 | |
])dnl PKG_HAVE_WITH_MODULES
|
564 | |
|
565 | |
dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
|
566 | |
dnl [DESCRIPTION], [DEFAULT])
|
567 | |
dnl ------------------------------------------------------
|
568 | |
dnl
|
569 | |
dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
|
570 | |
dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
|
571 | |
dnl and preprocessor variable.
|
572 | |
AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
|
573 | |
[
|
574 | |
PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
|
575 | |
|
576 | |
AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
|
577 | |
[AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
|
578 | |
])dnl PKG_HAVE_DEFINE_WITH_MODULES
|
579 | 582 |
|
580 | 583 |
# Copyright (C) 2002-2017 Free Software Foundation, Inc.
|
581 | 584 |
#
|