m4: Add PKG_PREREQ version checking macro

While PKG_PROG_PKG_CONFIG checks the version of pkg-config available at
build time, it doesn't check the version of the pkg-config macros being
used. PKG_PREREQ (like AC_PREREQ or LT_PREREQ) can be used to check the
version of the macros in use when configure is being generated by the
developer.

https://bugs.freedesktop.org/show_bug.cgi?id=89267
This commit is contained in:
Dan Nicholson 2015-09-26 13:08:04 -07:00
parent 7e8b0bf6d9
commit b51cd2165d
3 changed files with 31 additions and 0 deletions

View file

@ -342,6 +342,10 @@ $ pkg-config --modversion hello
projects.</p>
<ul>
<li><b>PKG_PREREQ(MIN-VERSION)</b>: Ensures that the version of the
<tt>pkg-config</tt> <tt>autoconf</tt> macros in use is at least
<tt>MIN-VERSION</tt>.</li>
<li><b>PKG_PROG_PKG_CONFIG([MIN-VERSION])</b>: Locates the
<tt>pkg-config</tt> tool on the system and checks the version for
compatibility.</li>

View file

@ -423,6 +423,12 @@ VARIABLE-PREFIX will simply use the _LIBS and _CFLAGS variables set from
the previous usage without calling \fIpkg-config\fP again.
.\"
.TP
.I "PKG_PREREQ(MIN-VERSION)"
Checks that the version of the pkg-config autoconf macros in use is at
least MIN-VERSION. This can be used to ensure a particular pkg-config
macro will be available.
.\"
.TP
.I "PKG_PROG_PKG_CONFIG([MIN-VERSION])"
Defines the PKG_CONFIG variable to the best pkg-config available,

View file

@ -22,6 +22,27 @@
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# PKG_PREREQ(MIN-VERSION)
# -------------------------------------
# Since: 0.29
#
# Verify that the version of the pkg-config macros are at least
# MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
# installed version of pkg-config, this checks the developer's version
# of pkg.m4 when generating configure.
#
# To ensure that this macro is defined, also add:
# m4_ifndef([PKG_PREREQ],
# [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
#
# See the "Since" comment for each macro you use to see what version of
# the macros you require.
m4_defun([PKG_PREREQ],
[m4_define([PKG_MACROS_VERSION], [@VERSION@])
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
])# PKG_PREREQ
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
# ----------------------------------
AC_DEFUN([PKG_PROG_PKG_CONFIG],