summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Nicholson <dbn.lists@gmail.com>2013-05-18 13:45:29 -0700
committerDan Nicholson <dbn.lists@gmail.com>2013-05-18 19:37:24 -0700
commit0efb668bd5990f52a6a93b2cde037185edbe11b0 (patch)
treeb3cb0f9cbb7a7f029feebd7534f4ead5e304d961
parent715cc306b0e4add06523b8fcce49867da469a728 (diff)
downloadpkg-config-0efb668bd5990f52a6a93b2cde037185edbe11b0.tar.gz
Add static linking variant of PKG_CHECK_MODULES
PKG_CHECK_MODULES_STATIC is a convenience autoconf macro wrapping PKG_CHECK_MODULES with --static enabled. This gives developers a way to get static linking information from a specific set of modules. Freedesktop #19541 (https://bugs.freedesktop.org/show_bug.cgi?id=19541)
-rw-r--r--pkg-config.14
-rw-r--r--pkg.m419
2 files changed, 23 insertions, 0 deletions
diff --git a/pkg-config.1 b/pkg-config.1
index ccbfa5c..3bf69d1 100644
--- a/pkg-config.1
+++ b/pkg-config.1
@@ -401,6 +401,10 @@ Defines the PKG_CONFIG variable to the best pkg-config available,
useful if you need pkg-config but don't want to use PKG_CHECK_MODULES.
.\"
.TP
+.I "PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]])"
+Enables static linking through --static prior to calling
+PKG_CHECK_MODULES.
+.TP
.I "PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])"
Check to see whether a particular set of modules exists. Similar
diff --git a/pkg.m4 b/pkg.m4
index c5b26b5..62995f0 100644
--- a/pkg.m4
+++ b/pkg.m4
@@ -159,6 +159,25 @@ fi[]dnl
])# PKG_CHECK_MODULES
+# PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+# [ACTION-IF-NOT-FOUND])
+# ---------------------------------------------------------------------
+# Checks for existence of MODULES and gathers its build flags with
+# static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
+# and VARIABLE-PREFIX_LIBS from --libs.
+#
+# Note that if there is a possibility the first call to
+# PKG_CHECK_MODULES_STATIC might not happen, you should be sure to include
+# an explicit call to PKG_PROG_PKG_CONFIG in your configure.ac.
+AC_DEFUN([PKG_CHECK_MODULES_STATIC],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+_save_PKG_CONFIG=$PKG_CONFIG
+PKG_CONFIG="$PKG_CONFIG --static"
+PKG_CHECK_MODULES($@)
+PKG_CONFIG=$_save_PKG_CONFIG[]dnl
+])
+
+
# PKG_INSTALLDIR(DIRECTORY)
# -------------------------
# Substitutes the variable pkgconfigdir as the location where a module