patch to improve uninstalled gtk+ handling
[email protected] Fri, 23 Oct 2009 19:41:24 +0900
| Newsgroups | gmane.comp.gnome.lib.librsvg.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
Attached is a patch to improve configure's handling of
uninstalled Gtk+. The Gtk+ library itself is detected
by pkg-config, so uninstalled Gtk+ can be detected.
However, in later, configure lookup the command
"gdk-pixbuf-query-loaders" listing available gdk-pixbuf
backend for various image file format. configure lookups
it by normal AC_PATH_PROG() macro. Therefore, when Gtk+
is installed to system and the user is trying to build
librsvg with uninstalled Gtk+, gdk-pixbuf-query-loaders
from system is used.
At present, autoconf macro AM_PATH_GTK_2_0() does not
provide an abstract macro to use gdk-pixbuf-query-loaders
of uninstalled Gtk+. I have to detect it by myself.
Invoking gdk-pixbuf-query-loaders simply is insufficient.
This command has a builtin information of the directory
to lookup the loaders (e.g. /usr/local/lib/gtk-2.0/2.x.y/loaders).
Of course, it is different from the building directory.
So the list of uninstalled shared objects or GNU libtool
libraries of the loaders should be passed to uninstalled.
Attached patch generates ${top_builddir}/gdk-pixbuf.loaders
for this purpose.
Thus, when I use uninstalled Gtk+, QUERYLOADERS is not
a pathname of the command, it should be a combination
of the pathname of the command and the arguments.
When "make check" is executed, private gdk-pixbuf.loaders
should be used instead of the file searched by gdk-pixbuf
builtin rule. I introduced new macro SET_GDK_PIXBUF_LOADERS.
It include a sh command setting environmental variable
GDK_PIXBUF_MODULE_FILE point to private gdk-pixbuf.loaders.
It is executed as a part of "TESTS_ENVIRONMENT" while
"make check" is executed.
I'm not sure if this should be proposed to librsvg or Gtk+
developers. So, please give me comment.
Regards,
mpsuzuki
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4b07418..d2c8aab 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,6 +1,8 @@
SUBDIRS=pdiff .
TESTS = rsvg-test
+TESTS_ENVIRONMENT = \
+ $(SET_GDK_PIXBUF_LOADERS)
LDADD = $(top_builddir)/librsvg-2.la \
$(top_builddir)/tests/pdiff/libpdiff.la
diff --git a/configure.in b/configure.in
index 2d9517f..c144ddf 100644
--- a/configure.in
+++ b/configure.in
@@ -254,14 +254,45 @@ fi
AM_CONDITIONAL(ENABLE_GTK_ENGINE, test "x$enable_gtk_theme" = "xyes")
-AC_PATH_PROG(QUERYLOADERS, gdk-pixbuf-query-loaders, true)
+m4_pattern_allow([PKG_CONFIG_DISABLE_UNINSTALLED])
+m4_pattern_allow([PKG_CONFIG_TOP_BUILD_DIR])
+
+
+SET_GDK_PIXBUF_LOADERS=
+gdk_installed=`env PKG_CONFIG_DISABLE_UNINSTALLED=yes $PKG_CONFIG --uninstalled gdk-pixbuf-2.0 && echo yes || echo no`
+if test "x${gdk_installed}" = "xno"; then
+ AC_MSG_WARN([check uninstalled gdk-pixbuf-query-loaders])
+ for gdk_pixbuf_libs_arg in `env PKG_CONFIG_TOP_BUILD_DIR=. $PKG_CONFIG gdk-pixbuf-2.0 --libs`
+ do
+ case ${gdk_pixbuf_libs_arg} in
+ -*) ;;
+ *la)
+ case `basename ${gdk_pixbuf_libs_arg}` in
+ libgdk_pixbuf*.la)
+ gdk_pixbuf_builddir=`dirname ${gdk_pixbuf_libs_arg}`
+ AC_MSG_WARN([generate gdk-pixbuf.loaders for libraries in ${gdk_pixbuf_builddir}])
+ QUERYLOADERS="${gdk_pixbuf_builddir}/gdk-pixbuf-query-loaders ${gdk_pixbuf_builddir}/libpixbufloader-*.la"
+ ${QUERYLOADERS} > gdk-pixbuf.loaders
+ SET_GDK_PIXBUF_LOADERS='GDK_PIXBUF_MODULE_FILE=${top_builddir}/gdk-pixbuf.loaders'
+ ;;
+ *) ;;
+ esac
+ ;;
+ *) ;;
+ esac
+ done
+else
+ AC_PATH_PROG(QUERYLOADERS, gdk-pixbuf-query-loaders, true)
+fi
+AC_SUBST(SET_GDK_PIXBUF_LOADERS)
+
AC_ARG_ENABLE(pixbuf-loader,
[ --enable-pixbuf-loader Enable a RSVG based GdkPixbuf loader [default=auto]],
enable_pixbuf_loader="$enableval", enable_pixbuf_loader=auto)
if test "x$enable_pixbuf_loader" = xauto ; then
- if test x$QUERYLOADERS != x ; then
+ if test "x$QUERYLOADERS" != x ; then
enable_pixbuf_loader=yes
else
enable_pixbuf_loader=no
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference