summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pkg-config-guide.html4
-rw-r--r--pkg-config.16
-rw-r--r--pkg.m4.in21
3 files changed, 31 insertions, 0 deletions
diff --git a/pkg-config-guide.html b/pkg-config-guide.html
index 16c43e2..c666fe5 100644
--- a/pkg-config-guide.html
+++ b/pkg-config-guide.html
@@ -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>
diff --git a/pkg-config.1 b/pkg-config.1
index 74bb70a..11e6292 100644
--- a/pkg-config.1
+++ b/pkg-config.1
@@ -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,
diff --git a/pkg.m4.in b/pkg.m4.in
index 62995f0..0a1536a 100644
--- a/pkg.m4.in
+++ b/pkg.m4.in
@@ -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],