[libvirt] [libvirt-sandbox][PATCH] configure: Get static libs for static linking

Michal Privoznik mprivozn at redhat.com
Thu Sep 24 08:42:20 UTC 2015


So you wanna build libvirt-sandbox, right? And you think you have
everything you need. Dang, you don't! Because we check for libz
and liblzma for dynamic linking. However,
libvirt-sandbox-init-qemu is linked statically. Therefore, we
need to ask pkg-config to fetch us the list of libs for static
linking.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---

Okay, I admit that this may be not as serious as I made it in the commit message. The only difference after this patch is -pthread added to LZMA libs:

configure: Configuration summary
configure: =====================
configure: 
configure: 
configure:  Libraries:
configure: 
configure:             LZMA:  -llzma -pthread 
configure:             ZLIB:  -lz 
configure:          GOBJECT: -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include  -lgobject-2.0 -lglib-2.0 
configure:  LIBVIRT_GOBJECT: -pthread -I/usr/include/libvirt-gobject-1.0 -I/usr/include/libvirt-gconfig-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libxml2  -lvirt-gobject-1.0 -lgio-2.0 -lvirt-gconfig-1.0 -lgobject-2.0 -lglib-2.0 -lxml2 -lvir

 configure.ac | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configure.ac b/configure.ac
index 92d65f4..00c2d7e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -86,6 +86,8 @@ AC_ARG_WITH([zlib],
     [add ZLIB support @<:@default=yes@:>@])])
 m4_divert_text([DEFAULTS], [with_zlib=yes])
 
+orig_pkg_config="$PKG_CONFIG"
+PKG_CONFIG="$PKG_CONFIG --static"
 if test "$with_zlib" = "yes" ; then
     PKG_CHECK_MODULES(ZLIB, zlib >= $ZLIB_REQUIRED)
     AC_DEFINE([WITH_ZLIB], [1], [Whether ZLIB support was enabled])
@@ -100,6 +102,7 @@ if test "$with_lzma" = "yes" ; then
     PKG_CHECK_MODULES(LZMA, liblzma >= $LZMA_REQUIRED)
     AC_DEFINE([WITH_LZMA], [1], [Whether LZMA support was enabled])
 fi
+PKG_CONFIG="$orig_pkg_config"
 
 LIBVIRT_SANDBOX_CAPNG
 LIBVIRT_SANDBOX_GETTEXT
-- 
2.4.9




More information about the libvir-list mailing list