diff --git a/configure.ac b/configure.ac
index f81468f811..d6bfe474de 100644
--- a/configure.ac
+++ b/configure.ac
@@ -242,6 +242,13 @@ AC_ARG_ENABLE(rebuilds,
[disable all source autogeneration rules])],,
[enable_rebuilds=yes])
+AC_ARG_ENABLE(gtk2-dependency,
+ AC_HELP_STRING([--enable-gtk2-dependency],
+ [Do not build gtk-update-icon-cache and other shared tools]),,
+ [enable_gtk2_dependency=no])
+
+AM_CONDITIONAL(BUILD_ICON_CACHE, [test "x$enable_gtk2_dependency" = xno])
+
AC_ARG_ENABLE(xkb,
[AC_HELP_STRING([--enable-xkb],
[support XKB extension [default=maybe]])],,
@@ -875,13 +882,15 @@ dnl Look for a host system's gdk-pixbuf-csource if we are cross-compiling
AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
-if test $cross_compiling = yes; then
+if test "x$cross_compiling" = xyes || test "x$enable_gtk2_dependency" = xyes; then
AC_PATH_PROG(GTK_UPDATE_ICON_CACHE, gtk-update-icon-cache, no)
if test x$GTK_UPDATE_ICON_CACHE = xno; then
REBUILD_PNGS=#
fi
fi
+AM_CONDITIONAL(USE_EXTERNAL_ICON_CACHE, [test "x$cross_compiling" = xyes || test "x$enable_gtk2_dependency" = xyes])
+
AC_PATH_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource, no)
if test ! -f $srcdir/gtk/gtkbuiltincache.h &&
diff --git a/docs/reference/gtk/building.sgml b/docs/reference/gtk/building.sgml
index ac9e3483f0..70802e53c9 100644
--- a/docs/reference/gtk/building.sgml
+++ b/docs/reference/gtk/building.sgml
@@ -363,6 +363,10 @@ How to compile GTK+ itself
--enable-introspection=[no/auto/yes]
+
+ --enable-gtk2-dependency
+ --disable-gtk2-dependency
+
@@ -559,6 +563,7 @@ How to compile GTK+ itself
supported backends are the quartz backend for OS X.
+
--enable-introspection
@@ -567,6 +572,19 @@ How to compile GTK+ itself
The default is 'auto'.
+
+
+ --enable-gtk2-dependency or
+ --disable-gtk2-dependency
+
+
+ Whether to rely on an exiting gtk-update-icon-cache utility
+ instead of building our own. Distributions which are shipping
+ both GTK+ 2.x and GTK+ 3 may want to use this option to
+ avoid file conflicts between these packages.
+ The default is to build gtk-update-icon-cache.
+
+
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index db679bb7f2..00739174cf 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -1000,8 +1000,11 @@ endif
# Installed tools
#
bin_PROGRAMS = \
- gtk-query-immodules-3.0 \
- gtk-update-icon-cache
+ gtk-query-immodules-3.0
+
+if BUILD_ICON_CACHE
+bin_PROGRAMS += gtk-update-icon-cache
+endif
bin_SCRIPTS = gtk-builder-convert
@@ -1042,8 +1045,10 @@ gtk_query_immodules_3_0_DEPENDENCIES = $(DEPS)
gtk_query_immodules_3_0_LDADD = $(LDADDS)
gtk_query_immodules_3_0_SOURCES = queryimmodules.c
+if BUILD_ICON_CACHE
gtk_update_icon_cache_LDADD = $(GDK_PIXBUF_LIBS)
gtk_update_icon_cache_SOURCES = updateiconcache.c
+endif
.PHONY: files test test-debug
@@ -1336,11 +1341,10 @@ stamp-icons: $(STOCK_ICONS)
) done \
&& touch stamp-icons
-if CROSS_COMPILING
+if USE_EXTERNAL_ICON_CACHE
gtk_update_icon_cache_program = $(GTK_UPDATE_ICON_CACHE)
else
-gtk_update_icon_cache_program = \
- ./gtk-update-icon-cache
+gtk_update_icon_cache_program = ./gtk-update-icon-cache
endif
gtkbuiltincache.h: @REBUILD@ stamp-icons