1212# PARTICULAR PURPOSE.
1313
1414m4_ifndef ( [ AC_CONFIG_MACRO_DIRS] , [ m4_defun([ _AM_CONFIG_MACRO_DIRS] , [ ] )m4_defun([ AC_CONFIG_MACRO_DIRS] , [ _AM_CONFIG_MACRO_DIRS($@ )] )] )
15- # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
16- # serial 1 (pkg-config-0.24)
17- #
18- # Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
19- #
20- # This program is free software; you can redistribute it and/or modify
21- # it under the terms of the GNU General Public License as published by
22- # the Free Software Foundation; either version 2 of the License, or
23- # (at your option) any later version.
24- #
25- # This program is distributed in the hope that it will be useful, but
26- # WITHOUT ANY WARRANTY; without even the implied warranty of
27- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28- # General Public License for more details.
29- #
30- # You should have received a copy of the GNU General Public License
31- # along with this program; if not, write to the Free Software
32- # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
33- #
34- # As a special exception to the GNU General Public License, if you
35- # distribute this file as part of a program that contains a
36- # configuration script generated by Autoconf, you may include it under
37- # the same distribution terms that you use for the rest of that program.
38-
39- # PKG_PROG_PKG_CONFIG([MIN-VERSION])
40- # ----------------------------------
15+ dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
16+ dnl serial 11 (pkg-config-0.29.1)
17+ dnl
18+ dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
19+ dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
20+ dnl
21+ dnl This program is free software; you can redistribute it and/or modify
22+ dnl it under the terms of the GNU General Public License as published by
23+ dnl the Free Software Foundation; either version 2 of the License, or
24+ dnl (at your option) any later version.
25+ dnl
26+ dnl This program is distributed in the hope that it will be useful, but
27+ dnl WITHOUT ANY WARRANTY; without even the implied warranty of
28+ dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29+ dnl General Public License for more details.
30+ dnl
31+ dnl You should have received a copy of the GNU General Public License
32+ dnl along with this program; if not, write to the Free Software
33+ dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
34+ dnl 02111-1307, USA.
35+ dnl
36+ dnl As a special exception to the GNU General Public License, if you
37+ dnl distribute this file as part of a program that contains a
38+ dnl configuration script generated by Autoconf, you may include it under
39+ dnl the same distribution terms that you use for the rest of that
40+ dnl program.
41+
42+ dnl PKG_PREREQ(MIN-VERSION)
43+ dnl -----------------------
44+ dnl Since: 0.29
45+ dnl
46+ dnl Verify that the version of the pkg-config macros are at least
47+ dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
48+ dnl installed version of pkg-config, this checks the developer's version
49+ dnl of pkg.m4 when generating configure.
50+ dnl
51+ dnl To ensure that this macro is defined, also add:
52+ dnl m4_ifndef([PKG_PREREQ],
53+ dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
54+ dnl
55+ dnl See the "Since" comment for each macro you use to see what version
56+ dnl of the macros you require.
57+ m4_defun([ PKG_PREREQ] ,
58+ [ m4_define ( [ PKG_MACROS_VERSION] , [ 0.29.1] )
59+ m4_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+
63+ dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
64+ dnl ----------------------------------
65+ dnl Since: 0.16
66+ dnl
67+ dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
68+ dnl first found in the path. Checks that the version of pkg-config found
69+ dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
70+ dnl used since that's the first version where most current features of
71+ dnl pkg-config existed.
4172AC_DEFUN ( [ PKG_PROG_PKG_CONFIG] ,
4273[ m4_pattern_forbid ( [ ^_?PKG_[ A-Z_] +$] )
4374m4_pattern_allow ( [ ^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$] )
@@ -59,18 +90,19 @@ if test -n "$PKG_CONFIG"; then
5990 PKG_CONFIG=""
6091 fi
6192fi[ ] dnl
62- ] ) # PKG_PROG_PKG_CONFIG
63-
64- # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
65- #
66- # Check to see whether a particular set of modules exists. Similar
67- # to PKG_CHECK_MODULES(), but does not set variables or print errors.
68- #
69- # Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
70- # only at the first occurence in configure.ac, so if the first place
71- # it's called might be skipped (such as if it is within an "if", you
72- # have to call PKG_CHECK_EXISTS manually
73- # --------------------------------------------------------------
93+ ] ) dnl PKG_PROG_PKG_CONFIG
94+
95+ dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
96+ dnl -------------------------------------------------------------------
97+ dnl Since: 0.18
98+ dnl
99+ dnl Check to see whether a particular set of modules exists. Similar to
100+ dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
101+ dnl
102+ dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
103+ dnl only at the first occurence in configure.ac, so if the first place
104+ dnl it's called might be skipped (such as if it is within an "if", you
105+ dnl have to call PKG_CHECK_EXISTS manually
74106AC_DEFUN ( [ PKG_CHECK_EXISTS] ,
75107[ AC_REQUIRE ( [ PKG_PROG_PKG_CONFIG] ) dnl
76108if test -n "$PKG_CONFIG" && \
@@ -80,8 +112,10 @@ m4_ifvaln([$3], [else
80112 $3 ] ) dnl
81113fi] )
82114
83- # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
84- # ---------------------------------------------
115+ dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
116+ dnl ---------------------------------------------
117+ dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
118+ dnl pkg_failed based on the result.
85119m4_define ( [ _PKG_CONFIG] ,
86120[ if test -n "$$1 "; then
87121 pkg_cv_[ ] $1 ="$$1 "
@@ -93,30 +127,29 @@ m4_define([_PKG_CONFIG],
93127 else
94128 pkg_failed=untried
95129fi[ ] dnl
96- ] ) # _PKG_CONFIG
130+ ] ) dnl _PKG_CONFIG
97131
98- # _PKG_SHORT_ERRORS_SUPPORTED
99- # -----------------------------
132+ dnl _PKG_SHORT_ERRORS_SUPPORTED
133+ dnl ---------------------------
134+ dnl Internal check to see if pkg-config supports short errors.
100135AC_DEFUN ( [ _PKG_SHORT_ERRORS_SUPPORTED] ,
101136[ AC_REQUIRE ( [ PKG_PROG_PKG_CONFIG] )
102137if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
103138 _pkg_short_errors_supported=yes
104139else
105140 _pkg_short_errors_supported=no
106141fi[ ] dnl
107- ] ) # _PKG_SHORT_ERRORS_SUPPORTED
108-
109-
110- # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
111- # [ACTION-IF-NOT-FOUND])
112- #
113- #
114- # Note that if there is a possibility the first call to
115- # PKG_CHECK_MODULES might not happen, you should be sure to include an
116- # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
117- #
118- #
119- # --------------------------------------------------------------
142+ ] ) dnl _PKG_SHORT_ERRORS_SUPPORTED
143+
144+
145+ dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
146+ dnl [ACTION-IF-NOT-FOUND])
147+ dnl --------------------------------------------------------------
148+ dnl Since: 0.4.0
149+ dnl
150+ dnl Note that if there is a possibility the first call to
151+ dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
152+ dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
120153AC_DEFUN ( [ PKG_CHECK_MODULES] ,
121154[ AC_REQUIRE ( [ PKG_PROG_PKG_CONFIG] ) dnl
122155AC_ARG_VAR ( [ $1 ] [ _CFLAGS] , [ C compiler flags for $1 , overriding pkg-config] ) dnl
@@ -170,16 +203,40 @@ else
170203 AC_MSG_RESULT ( [ yes] )
171204 $3
172205fi[ ] dnl
173- ] ) # PKG_CHECK_MODULES
206+ ] ) dnl PKG_CHECK_MODULES
207+
208+
209+ dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
210+ dnl [ACTION-IF-NOT-FOUND])
211+ dnl ---------------------------------------------------------------------
212+ dnl Since: 0.29
213+ dnl
214+ dnl Checks for existence of MODULES and gathers its build flags with
215+ dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
216+ dnl and VARIABLE-PREFIX_LIBS from --libs.
217+ dnl
218+ dnl Note that if there is a possibility the first call to
219+ dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
220+ dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
221+ dnl configure.ac.
222+ AC_DEFUN ( [ PKG_CHECK_MODULES_STATIC] ,
223+ [ AC_REQUIRE ( [ PKG_PROG_PKG_CONFIG] ) dnl
224+ _save_PKG_CONFIG=$PKG_CONFIG
225+ PKG_CONFIG="$PKG_CONFIG --static"
226+ PKG_CHECK_MODULES($@ )
227+ PKG_CONFIG=$_save_PKG_CONFIG[ ] dnl
228+ ] ) dnl PKG_CHECK_MODULES_STATIC
174229
175230
176- # PKG_INSTALLDIR(DIRECTORY)
177- # -------------------------
178- # Substitutes the variable pkgconfigdir as the location where a module
179- # should install pkg-config .pc files. By default the directory is
180- # $libdir/pkgconfig, but the default can be changed by passing
181- # DIRECTORY. The user can override through the --with-pkgconfigdir
182- # parameter.
231+ dnl PKG_INSTALLDIR([DIRECTORY])
232+ dnl -------------------------
233+ dnl Since: 0.27
234+ dnl
235+ dnl Substitutes the variable pkgconfigdir as the location where a module
236+ dnl should install pkg-config .pc files. By default the directory is
237+ dnl $libdir/pkgconfig, but the default can be changed by passing
238+ dnl DIRECTORY. The user can override through the --with-pkgconfigdir
239+ dnl parameter.
183240AC_DEFUN ( [ PKG_INSTALLDIR] ,
184241[ m4_pushdef ( [ pkg_default] , [ m4_default ( [ $1 ] , [ '${libdir}/pkgconfig'] ) ] )
185242m4_pushdef ( [ pkg_description] ,
@@ -190,16 +247,18 @@ AC_ARG_WITH([pkgconfigdir],
190247AC_SUBST ( [ pkgconfigdir] , [ $with_pkgconfigdir] )
191248m4_popdef ( [ pkg_default] )
192249m4_popdef ( [ pkg_description] )
193- ] ) dnl PKG_INSTALLDIR
250+ ] ) dnl PKG_INSTALLDIR
194251
195252
196- # PKG_NOARCH_INSTALLDIR(DIRECTORY)
197- # -------------------------
198- # Substitutes the variable noarch_pkgconfigdir as the location where a
199- # module should install arch-independent pkg-config .pc files. By
200- # default the directory is $datadir/pkgconfig, but the default can be
201- # changed by passing DIRECTORY. The user can override through the
202- # --with-noarch-pkgconfigdir parameter.
253+ dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
254+ dnl --------------------------------
255+ dnl Since: 0.27
256+ dnl
257+ dnl Substitutes the variable noarch_pkgconfigdir as the location where a
258+ dnl module should install arch-independent pkg-config .pc files. By
259+ dnl default the directory is $datadir/pkgconfig, but the default can be
260+ dnl changed by passing DIRECTORY. The user can override through the
261+ dnl --with-noarch-pkgconfigdir parameter.
203262AC_DEFUN ( [ PKG_NOARCH_INSTALLDIR] ,
204263[ m4_pushdef ( [ pkg_default] , [ m4_default ( [ $1 ] , [ '${datadir}/pkgconfig'] ) ] )
205264m4_pushdef ( [ pkg_description] ,
@@ -210,13 +269,15 @@ AC_ARG_WITH([noarch-pkgconfigdir],
210269AC_SUBST ( [ noarch_pkgconfigdir] , [ $with_noarch_pkgconfigdir] )
211270m4_popdef ( [ pkg_default] )
212271m4_popdef ( [ pkg_description] )
213- ] ) dnl PKG_NOARCH_INSTALLDIR
272+ ] ) dnl PKG_NOARCH_INSTALLDIR
214273
215274
216- # PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
217- # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
218- # -------------------------------------------
219- # Retrieves the value of the pkg-config variable for the given module.
275+ dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
276+ dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
277+ dnl -------------------------------------------
278+ dnl Since: 0.28
279+ dnl
280+ dnl Retrieves the value of the pkg-config variable for the given module.
220281AC_DEFUN ( [ PKG_CHECK_VAR] ,
221282[ AC_REQUIRE ( [ PKG_PROG_PKG_CONFIG] ) dnl
222283AC_ARG_VAR ( [ $1 ] , [ value of $3 for $2 , overriding pkg-config] ) dnl
@@ -225,5 +286,5 @@ _PKG_CONFIG([$1], [variable="][$3]["], [$2])
225286AS_VAR_COPY ( [ $1 ] , [ pkg_cv_] [ $1 ] )
226287
227288AS_VAR_IF ( [ $1 ] , [ ""] , [ $5 ] , [ $4 ] ) dnl
228- ] ) # PKG_CHECK_VAR
289+ ] ) dnl PKG_CHECK_VAR
229290
0 commit comments