[Spice-devel] [spice-gtk 2/2] build-sys: Workaround missing openssl.pc for FreeBSD

Christophe Fergeau cfergeau at redhat.com
Mon Jan 8 11:29:48 UTC 2018


From: Ting-Wei Lan <lantw at src.gnome.org>

FreeBSD has OpenSSL installed in base, but .pc files are not available.
We can still successfully build spice-gtk by setting SSL_CFLAGS and
SSL_LIBS variables manually, but openssl will still be recorded to
Requires.private field of spice-client-glib-2.0.pc, causing problems for
applications using spice-gtk. To workaround the issue, we do the check
again without using SSL_CFLAGS and SSL_LIBS variables and put SSL_LIBS
into Libs.private field when openssl.pc cannot be found.

https://bugs.freedesktop.org/show_bug.cgi?id=104524
---
 configure.ac                | 6 +++++-
 spice-client-glib-2.0.pc.in | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 6101c220..2a14055b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -107,6 +107,7 @@ dnl =========================================================================
 dnl Chek optional features
 
 SPICE_GLIB_REQUIRES=""
+SPICE_GLIB_LIBS=""
 SPICE_GTK_REQUIRES=""
 
 PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.17.7)
@@ -115,7 +116,9 @@ SPICE_GLIB_REQUIRES="${SPICE_GLIB_REQUIRES} pixman-1 >= 0.17.7"
 
 PKG_CHECK_MODULES(SSL, openssl)
 
-SPICE_GLIB_REQUIRES="${SPICE_GLIB_REQUIRES} openssl"
+PKG_CHECK_EXISTS(openssl,
+  [SPICE_GLIB_REQUIRES="${SPICE_GLIB_REQUIRES} openssl"],
+  [SPICE_GLIB_LIBS="${SPICE_GLIB_LIBS} ${SSL_LIBS}"])
 
 SPICE_CHECK_SASL
 
@@ -588,6 +591,7 @@ AC_SUBST(SPICE_GLIB_CFLAGS)
 AC_SUBST(SPICE_GTK_CFLAGS)
 
 AC_SUBST(SPICE_GLIB_REQUIRES)
+AC_SUBST(SPICE_GLIB_LIBS)
 AC_SUBST(SPICE_GTK_REQUIRES)
 
 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
diff --git a/spice-client-glib-2.0.pc.in b/spice-client-glib-2.0.pc.in
index 27d6886d..1b5cce02 100644
--- a/spice-client-glib-2.0.pc.in
+++ b/spice-client-glib-2.0.pc.in
@@ -10,4 +10,5 @@ Version: @VERSION@
 Requires: spice-protocol
 Requires.private: @SPICE_GLIB_REQUIRES@
 Libs: -L${libdir} -lspice-client-glib-2.0
+Libs.private: @SPICE_GLIB_LIBS@
 Cflags: -I${includedir}/spice-client-glib-2.0
-- 
2.14.3



More information about the Spice-devel mailing list