Bug 26831 - Expose the dependency libraries if configured without shared lib.
Summary: Expose the dependency libraries if configured without shared lib.
Status: RESOLVED NOTABUG
Alias: None
Product: fontconfig
Classification: Unclassified
Component: library (show other bugs)
Version: 2_1
Hardware: Other All
: medium normal
Assignee: fontconfig-bugs
QA Contact: Behdad Esfahbod
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-01 21:28 UTC by suzuki toshiya
Modified: 2012-04-08 23:48 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Expose private libraries if configured without shared lib (1.11 KB, patch)
2010-03-01 21:28 UTC, suzuki toshiya
Details | Splinter Review

Description suzuki toshiya 2010-03-01 21:28:14 UTC
Created attachment 33676 [details] [review]
Expose private libraries if configured without shared lib

Currently, fontconfig.pc stores the dependency library info to
Libs.private, it is right design for the platforms that supports
both of static (without chain dependency) & shared libraries
(with chain dependency). However, when I build fontconfig with
the configuration without shared library, the dependency info
in Libs.private does not help.

For example, cairo checks the availability by pkg-config, and
the symbols by linking fontconfig, with FONTCONFIG_LIBS obtained
by pkg-config. Unfortunately, PKG_CHECK_MODULES() does not add
Libs.private automatically (theoretically, it is possible for
the combination of GNU libtool & pkg-config; checking shared
library of the module, if not found, add Libs.private to MODULES_LIBS,
but current pkg-config does not do such). As a result, if shared
library of fontconfig is unavailable, cairo configure finds fontconfig,
but misunderstands it as very legacy version without FcFini().
If the dependency info is correctly returned, this misunderstanding
does not occur.

So, I propose to expose dependency info to normal Libs, if configured
without shared library.

diff --git a/configure.in b/configure.in
index 001146d..365abff 100644
--- a/configure.in
+++ b/configure.in
@@ -389,6 +389,19 @@ if test "$enable_libxml2" = "yes" -o "$expat" = "no"; then
 fi
 
 #
+# Setup variables for fontconfig.pc
+#
+if test "$enable_shared" = "no" -a "$enable_static" = "yes"; then
+    FONTCONFIG_LIBS_EXTRA="$LIBXML2_LIBS $EXPAT_LIBS $FREETYPE_LIBS $ICONV_LIBS"
+    FONTCONFIG_LIBS_PRIVATE=
+else
+    FONTCONFIG_LIBS_EXTRA=
+    FONTCONFIG_LIBS_PRIVATE="$LIBXML2_LIBS $EXPAT_LIBS $FREETYPE_LIBS $ICONV_LIBS"
+fi
+AC_SUBST(FONTCONFIG_LIBS_EXTRA)
+AC_SUBST(FONTCONFIG_LIBS_PRIVATE)
+
+#
 # Set default font directory
 #
 
diff --git a/fontconfig.pc.in b/fontconfig.pc.in
index db55f6e..7578954 100644
--- a/fontconfig.pc.in
+++ b/fontconfig.pc.in
@@ -6,6 +6,6 @@ includedir=@includedir@
 Name: Fontconfig
 Description: Font configuration and customization library
 Version: @VERSION@
-Libs: -L${libdir} -lfontconfig
-Libs.private: @LIBXML2_LIBS@ @EXPAT_LIBS@ @FREETYPE_LIBS@ @ICONV_LIBS@
+Libs: -L${libdir} -lfontconfig @FONTCONFIG_LIBS_EXTRA@
+Libs.private: @FONTCONFIG_LIBS_PRIVATE@
 Cflags: -I${includedir}
Comment 1 Akira TAGOH 2011-11-10 00:33:17 UTC
I guess what you need is --static option in pkg-config:

$ pkg-config --libs fontconfig
-lfontconfig  

$ pkg-config --static --libs fontconfig
-lfontconfig -lexpat -lfreetype


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.