summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@novell.com>2006-10-11 12:41:14 +0000
committerTor Lillqvist <tml@src.gnome.org>2006-10-11 12:41:14 +0000
commitf6783c746673495080d737d2eed67f55188a34a5 (patch)
treee716d2ed5a3a2fe5540fce85540a5e05b93d524c
parentf58c280d21e87adfa34761f01497e188e222d3ad (diff)
downloadgtk+-f6783c746673495080d737d2eed67f55188a34a5.tar.gz
Enable having some gdk-pixbuf loaders built-in even if loading the others
2006-10-11 Tor Lillqvist <tml@novell.com> * configure.in: Enable having some gdk-pixbuf loaders built-in even if loading the others dynamically. Define Automake conditional INCLUDE_FOO for each loader as TRUE if that loader is built-in. See also gdk-pixbuf/ChangeLog. 2006-10-11 Tor Lillqvist <tml@novell.com> Enable having some loaders built-in even if loading the others dynamically. Have loaders in the same order as in configure.in in all places where they are handled/listed. * Makefile.am: Define the STATIC_FOO_LIB and FOO_LIB macros conditionally depending on whether said loader is built-in or not. Use the names libstatic-pixbufloader-foo.la instead of libpixbufloader-static-foo.la for the built-in ones so that the "echo libpixbufloader-*.la" won't match them. * gdk-pixbuf-io.c: Reorganize code as to plumb the built-in loaders also if USE_GMODULE. Don't warn about a missing gdk-pixbuf.loaders file if we have at least one included loader. * gdk-pixbuf-private.h * io-*.c: Don't define a generic MODULE_ENTRY, as we can't use it in the loaders anyway. Each loader needs to check if INCLUDE_foo is defined.
-rw-r--r--ChangeLog7
-rw-r--r--configure.in25
-rw-r--r--gdk-pixbuf/ChangeLog21
-rw-r--r--gdk-pixbuf/Makefile.am194
-rw-r--r--gdk-pixbuf/gdk-pixbuf-io.c265
-rw-r--r--gdk-pixbuf/gdk-pixbuf-private.h6
-rw-r--r--gdk-pixbuf/io-ani.c6
-rw-r--r--gdk-pixbuf/io-bmp.c6
-rw-r--r--gdk-pixbuf/io-gif.c6
-rw-r--r--gdk-pixbuf/io-ico.c6
-rw-r--r--gdk-pixbuf/io-jpeg.c6
-rw-r--r--gdk-pixbuf/io-pcx.c6
-rw-r--r--gdk-pixbuf/io-png.c6
-rw-r--r--gdk-pixbuf/io-pnm.c6
-rw-r--r--gdk-pixbuf/io-ras.c6
-rw-r--r--gdk-pixbuf/io-tga.c6
-rw-r--r--gdk-pixbuf/io-tiff.c6
-rw-r--r--gdk-pixbuf/io-wbmp.c6
-rw-r--r--gdk-pixbuf/io-xbm.c6
-rw-r--r--gdk-pixbuf/io-xpm.c6
20 files changed, 375 insertions, 227 deletions
diff --git a/ChangeLog b/ChangeLog
index 2ee7c2b2e5..76b0f44119 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-10-11 Tor Lillqvist <tml@novell.com>
+
+ * configure.in: Enable having some gdk-pixbuf loaders built-in
+ even if loading the others dynamically. Define Automake
+ conditional INCLUDE_FOO for each loader as TRUE if that loader is
+ built-in. See also gdk-pixbuf/ChangeLog.
+
Wed Oct 11 14:31:30 2006 Tim Janik <timj@imendio.com>
* docs/reference/gtk/gtk-sections.txt:
diff --git a/configure.in b/configure.in
index 4d96706ce2..39a2e634e7 100644
--- a/configure.in
+++ b/configure.in
@@ -874,11 +874,10 @@ dnl AC_HELP_STRING([--with-included-loaders=LOADER1 LOADER2 ...],
dnl [build the specified loaders into gdk-pixbuf (only used if module loading disabled)])
AC_ARG_WITH(included_loaders,
[ --with-included-loaders=LOADER1,LOADER2,...
- build the specified loaders into gdk-pixbuf (only
- used if module loading disabled)])
+ build the specified loaders into gdk-pixbuf])
if $dynworks; then
- :
+ :
else
## if the option was specified, leave it; otherwise disable included loaders
if test x$with_included_loaders = xno; then
@@ -886,7 +885,7 @@ else
fi
fi
-all_loaders="png,bmp,wbmp,gif,ico,ani,jpeg,pnm,ras,tiff,xpm,tga,pcx"
+all_loaders="png,bmp,wbmp,gif,ico,ani,jpeg,pnm,ras,tiff,xpm,xbm,tga,pcx"
included_loaders=""
# If no loaders specified, include all
if test "x$with_included_loaders" = xyes ; then
@@ -908,13 +907,29 @@ for loader in $included_loaders; do
AC_MSG_ERROR([the specified loader $loader does not exist])
fi
- INCLUDED_LOADER_OBJ="$INCLUDED_LOADER_OBJ libpixbufloader-static-$loader.la"
+ INCLUDED_LOADER_OBJ="$INCLUDED_LOADER_OBJ libstatic-pixbufloader-$loader.la"
INCLUDED_LOADER_DEFINE="$INCLUDED_LOADER_DEFINE -DINCLUDE_$loader"
+ eval INCLUDE_$loader=yes
done
IFS="$gtk_save_ifs"
AC_SUBST(INCLUDED_LOADER_OBJ)
AC_SUBST(INCLUDED_LOADER_DEFINE)
+AM_CONDITIONAL(INCLUDE_PNG, [test x"$INCLUDE_png" = xyes])
+AM_CONDITIONAL(INCLUDE_BMP, [test x"$INCLUDE_bmp" = xyes])
+AM_CONDITIONAL(INCLUDE_WBMP, [test x"$INCLUDE_wbmp" = xyes])
+AM_CONDITIONAL(INCLUDE_GIF, [test x"$INCLUDE_gif" = xyes])
+AM_CONDITIONAL(INCLUDE_ICO, [test x"$INCLUDE_ico" = xyes])
+AM_CONDITIONAL(INCLUDE_ANI, [test x"$INCLUDE_ani" = xyes])
+AM_CONDITIONAL(INCLUDE_JPEG, [test x"$INCLUDE_jpeg" = xyes])
+AM_CONDITIONAL(INCLUDE_PNM, [test x"$INCLUDE_pnm" = xyes])
+AM_CONDITIONAL(INCLUDE_RAS, [test x"$INCLUDE_ras" = xyes])
+AM_CONDITIONAL(INCLUDE_TIFF, [test x"$INCLUDE_tiff" = xyes])
+AM_CONDITIONAL(INCLUDE_XPM, [test x"$INCLUDE_xpm" = xyes])
+AM_CONDITIONAL(INCLUDE_XBM, [test x"$INCLUDE_xbm" = xyes])
+AM_CONDITIONAL(INCLUDE_TGA, [test x"$INCLUDE_tga" = xyes])
+AM_CONDITIONAL(INCLUDE_PCX, [test x"$INCLUDE_pcx" = xyes])
+
AC_HEADER_SYS_WAIT
AC_TYPE_SIGNAL
diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog
index 7da70a49f1..ea6713a0da 100644
--- a/gdk-pixbuf/ChangeLog
+++ b/gdk-pixbuf/ChangeLog
@@ -1,3 +1,24 @@
+2006-10-11 Tor Lillqvist <tml@novell.com>
+
+ Enable having some loaders built-in even if loading the others
+ dynamically. Have loaders in the same order as in configure.in in
+ all places where they are handled/listed.
+
+ * Makefile.am: Define the STATIC_FOO_LIB and FOO_LIB macros
+ conditionally depending on whether said loader is built-in or
+ not. Use the names libstatic-pixbufloader-foo.la instead of
+ libpixbufloader-static-foo.la for the built-in ones so that the
+ "echo libpixbufloader-*.la" won't match them.
+
+ * gdk-pixbuf-io.c: Reorganize code as to plumb the built-in
+ loaders also if USE_GMODULE. Don't warn about a missing
+ gdk-pixbuf.loaders file if we have at least one included loader.
+
+ * gdk-pixbuf-private.h
+ * io-*.c: Don't define a generic MODULE_ENTRY, as we can't use it
+ in the loaders anyway. Each loader needs to check if INCLUDE_foo
+ is defined.
+
2006-10-08 Matthias Clasen <mclasen@redhat.com>
* Apply a cleanup patch by Kjartan Maraas (#341812)
diff --git a/gdk-pixbuf/Makefile.am b/gdk-pixbuf/Makefile.am
index 90bc5a4ecb..9f68c9107e 100644
--- a/gdk-pixbuf/Makefile.am
+++ b/gdk-pixbuf/Makefile.am
@@ -61,33 +61,33 @@ loaderdir = $(libdir)/gtk-2.0/$(GTK_BINARY_VERSION)/loaders
module_libs = libgdk_pixbuf-$(GTK_API_VERSION).la $(GDK_PIXBUF_DEP_LIBS)
#
-# The PNG plugin.
+# The PNG loader
#
libpixbufloader_png_la_SOURCES = io-png.c
libpixbufloader_png_la_LDFLAGS = -avoid-version -module $(no_undefined)
libpixbufloader_png_la_LIBADD = $(LIBPNG) $(module_libs)
-libpixbufloader_static_png_la_SOURCES = io-png.c
+libstatic_pixbufloader_png_la_SOURCES = io-png.c
#
-# The JPEG loader
+# The BMP loader
#
-libpixbufloader_static_jpeg_la_SOURCES = io-jpeg.c
-libpixbufloader_jpeg_la_SOURCES = io-jpeg.c
-libpixbufloader_jpeg_la_LDFLAGS = -avoid-version -module $(no_undefined)
-libpixbufloader_jpeg_la_LIBADD = $(LIBJPEG) $(module_libs)
+libstatic_pixbufloader_bmp_la_SOURCES = io-bmp.c
+libpixbufloader_bmp_la_SOURCES = io-bmp.c
+libpixbufloader_bmp_la_LDFLAGS = -avoid-version -module $(no_undefined)
+libpixbufloader_bmp_la_LIBADD = $(module_libs)
#
-# The XPM loader
+# The WBMP loader
#
-libpixbufloader_static_xpm_la_SOURCES = io-xpm.c
-libpixbufloader_xpm_la_SOURCES = io-xpm.c
-libpixbufloader_xpm_la_LDFLAGS = -avoid-version -module $(no_undefined)
-libpixbufloader_xpm_la_LIBADD = $(module_libs)
+libstatic_pixbufloader_wbmp_la_SOURCES = io-wbmp.c
+libpixbufloader_wbmp_la_SOURCES = io-wbmp.c
+libpixbufloader_wbmp_la_LDFLAGS = -avoid-version -module $(no_undefined)
+libpixbufloader_wbmp_la_LIBADD = $(module_libs)
#
# The GIF loader
#
-libpixbufloader_static_gif_la_SOURCES = io-gif.c io-gif-animation.c io-gif-animation.h
+libstatic_pixbufloader_gif_la_SOURCES = io-gif.c io-gif-animation.c io-gif-animation.h
libpixbufloader_gif_la_SOURCES = io-gif.c io-gif-animation.c io-gif-animation.h
libpixbufloader_gif_la_LDFLAGS = -avoid-version -module $(no_undefined)
libpixbufloader_gif_la_LIBADD = $(module_libs)
@@ -95,7 +95,7 @@ libpixbufloader_gif_la_LIBADD = $(module_libs)
#
# The ICO loader
#
-libpixbufloader_static_ico_la_SOURCES = io-ico.c
+libstatic_pixbufloader_ico_la_SOURCES = io-ico.c
libpixbufloader_ico_la_SOURCES = io-ico.c
libpixbufloader_ico_la_LDFLAGS = -avoid-version -module $(no_undefined)
libpixbufloader_ico_la_LIBADD = $(module_libs)
@@ -103,15 +103,31 @@ libpixbufloader_ico_la_LIBADD = $(module_libs)
#
# The ANI loader
#
-libpixbufloader_static_ani_la_SOURCES = io-ani.c io-ani-animation.c io-ani-animation.h
+libstatic_pixbufloader_ani_la_SOURCES = io-ani.c io-ani-animation.c io-ani-animation.h
libpixbufloader_ani_la_SOURCES = io-ani.c io-ani-animation.c io-ani-animation.h
libpixbufloader_ani_la_LDFLAGS = -avoid-version -module $(no_undefined)
libpixbufloader_ani_la_LIBADD = $(module_libs)
#
+# The JPEG loader
+#
+libstatic_pixbufloader_jpeg_la_SOURCES = io-jpeg.c
+libpixbufloader_jpeg_la_SOURCES = io-jpeg.c
+libpixbufloader_jpeg_la_LDFLAGS = -avoid-version -module $(no_undefined)
+libpixbufloader_jpeg_la_LIBADD = $(LIBJPEG) $(module_libs)
+
+#
+# The PNM loader
+#
+libstatic_pixbufloader_pnm_la_SOURCES = io-pnm.c
+libpixbufloader_pnm_la_SOURCES = io-pnm.c
+libpixbufloader_pnm_la_LDFLAGS = -avoid-version -module $(no_undefined)
+libpixbufloader_pnm_la_LIBADD = $(module_libs)
+
+#
# The RAS loader
#
-libpixbufloader_static_ras_la_SOURCES = io-ras.c
+libstatic_pixbufloader_ras_la_SOURCES = io-ras.c
libpixbufloader_ras_la_SOURCES = io-ras.c
libpixbufloader_ras_la_LDFLAGS = -avoid-version -module $(no_undefined)
libpixbufloader_ras_la_LIBADD = $(module_libs)
@@ -119,39 +135,23 @@ libpixbufloader_ras_la_LIBADD = $(module_libs)
#
# The TIFF loader
#
-libpixbufloader_static_tiff_la_SOURCES = io-tiff.c
+libstatic_pixbufloader_tiff_la_SOURCES = io-tiff.c
libpixbufloader_tiff_la_SOURCES = io-tiff.c
libpixbufloader_tiff_la_LDFLAGS = -avoid-version -module $(no_undefined)
libpixbufloader_tiff_la_LIBADD = $(LIBTIFF) $(module_libs)
#
-# The PNM loader
-#
-libpixbufloader_static_pnm_la_SOURCES = io-pnm.c
-libpixbufloader_pnm_la_SOURCES = io-pnm.c
-libpixbufloader_pnm_la_LDFLAGS = -avoid-version -module $(no_undefined)
-libpixbufloader_pnm_la_LIBADD = $(module_libs)
-
-#
-# The BMP loader
-#
-libpixbufloader_static_bmp_la_SOURCES = io-bmp.c
-libpixbufloader_bmp_la_SOURCES = io-bmp.c
-libpixbufloader_bmp_la_LDFLAGS = -avoid-version -module $(no_undefined)
-libpixbufloader_bmp_la_LIBADD = $(module_libs)
-
-#
-# The WBMP loader
+# The XPM loader
#
-libpixbufloader_static_wbmp_la_SOURCES = io-wbmp.c
-libpixbufloader_wbmp_la_SOURCES = io-wbmp.c
-libpixbufloader_wbmp_la_LDFLAGS = -avoid-version -module $(no_undefined)
-libpixbufloader_wbmp_la_LIBADD = $(module_libs)
+libstatic_pixbufloader_xpm_la_SOURCES = io-xpm.c
+libpixbufloader_xpm_la_SOURCES = io-xpm.c
+libpixbufloader_xpm_la_LDFLAGS = -avoid-version -module $(no_undefined)
+libpixbufloader_xpm_la_LIBADD = $(module_libs)
#
# The XBM loader
#
-libpixbufloader_static_xbm_la_SOURCES = io-xbm.c
+libstatic_pixbufloader_xbm_la_SOURCES = io-xbm.c
libpixbufloader_xbm_la_SOURCES = io-xbm.c
libpixbufloader_xbm_la_LDFLAGS = -avoid-version -module $(no_undefined)
libpixbufloader_xbm_la_LIBADD = $(module_libs)
@@ -159,7 +159,7 @@ libpixbufloader_xbm_la_LIBADD = $(module_libs)
#
# The TGA loader
#
-libpixbufloader_static_tga_la_SOURCES = io-tga.c
+libstatic_pixbufloader_tga_la_SOURCES = io-tga.c
libpixbufloader_tga_la_SOURCES = io-tga.c
libpixbufloader_tga_la_LDFLAGS = -avoid-version -module $(no_undefined)
libpixbufloader_tga_la_LIBADD = $(module_libs)
@@ -167,102 +167,140 @@ libpixbufloader_tga_la_LIBADD = $(module_libs)
#
# The PCX loader
#
-libpixbufloader_static_pcx_la_SOURCES = io-pcx.c
+libstatic_pixbufloader_pcx_la_SOURCES = io-pcx.c
libpixbufloader_pcx_la_SOURCES = io-pcx.c
libpixbufloader_pcx_la_LDFLAGS = -avoid-version -module $(no_undefined)
libpixbufloader_pcx_la_LIBADD = $(module_libs)
if HAVE_PNG
+if INCLUDE_PNG
+STATIC_PNG_LIB = libstatic-pixbufloader-png.la
+else
PNG_LIB = libpixbufloader-png.la
-STATIC_PNG_LIB = libpixbufloader-static-png.la
+endif
endif
-if HAVE_JPEG
-JPEG_LIB = libpixbufloader-jpeg.la
-STATIC_JPEG_LIB = libpixbufloader-static-jpeg.la
+if INCLUDE_BMP
+STATIC_BMP_LIB = libstatic-pixbufloader-bmp.la
+else
+BMP_LIB = libpixbufloader-bmp.la
endif
+if INCLUDE_WBMP
+STATIC_WBMP_LIB = libstatic-pixbufloader-wbmp.la
+else
+WBMP_LIB = libpixbufloader-wbmp.la
+endif
+
+if INCLUDE_GIF
+STATIC_GIF_LIB = libstatic-pixbufloader-gif.la
+else
GIF_LIB = libpixbufloader-gif.la
-STATIC_GIF_LIB = libpixbufloader-static-gif.la
+endif
+if INCLUDE_ICO
+STATIC_ICO_LIB = libstatic-pixbufloader-ico.la
+else
ICO_LIB = libpixbufloader-ico.la
-STATIC_ICO_LIB = libpixbufloader-static-ico.la
+endif
+if INCLUDE_ANI
+STATIC_ANI_LIB = libstatic-pixbufloader-ani.la
+else
ANI_LIB = libpixbufloader-ani.la
-STATIC_ANI_LIB = libpixbufloader-static-ani.la
+endif
+
+if HAVE_JPEG
+if INCLUDE_JPEG
+STATIC_JPEG_LIB = libstatic-pixbufloader-jpeg.la
+else
+JPEG_LIB = libpixbufloader-jpeg.la
+endif
+endif
+
+if INCLUDE_PNM
+STATIC_PNM_LIB = libstatic-pixbufloader-pnm.la
+else
+PNM_LIB = libpixbufloader-pnm.la
+endif
+if INCLUDE_RAS
+STATIC_RAS_LIB = libstatic-pixbufloader-ras.la
+else
RAS_LIB = libpixbufloader-ras.la
-STATIC_RAS_LIB = libpixbufloader-static-ras.la
+endif
if HAVE_TIFF
+if INCLUDE_TIFF
+STATIC_TIFF_LIB = libstatic-pixbufloader-tiff.la
+else
TIFF_LIB = libpixbufloader-tiff.la
-STATIC_TIFF_LIB = libpixbufloader-static-tiff.la
+endif
endif
+if INCLUDE_XPM
+STATIC_XPM_LIB = libstatic-pixbufloader-xpm.la
+else
XPM_LIB = libpixbufloader-xpm.la
-STATIC_XPM_LIB = libpixbufloader-static-xpm.la
-
-PNM_LIB = libpixbufloader-pnm.la
-STATIC_PNM_LIB = libpixbufloader-static-pnm.la
-
-BMP_LIB = libpixbufloader-bmp.la
-STATIC_BMP_LIB = libpixbufloader-static-bmp.la
-
-WBMP_LIB = libpixbufloader-wbmp.la
-STATIC_WBMP_LIB = libpixbufloader-static-wbmp.la
+endif
+if INCLUDE_XBM
+STATIC_XBM_LIB = libstatic-pixbufloader-xbm.la
+else
XBM_LIB = libpixbufloader-xbm.la
-STATIC_XBM_LIB = libpixbufloader-static-xbm.la
+endif
+if INCLUDE_TGA
+STATIC_TGA_LIB = libstatic-pixbufloader-tga.la
+else
TGA_LIB = libpixbufloader-tga.la
-STATIC_TGA_LIB = libpixbufloader-static-tga.la
+endif
+if INCLUDE_PCX
+STATIC_PCX_LIB = libstatic-pixbufloader-pcx.la
+else
PCX_LIB = libpixbufloader-pcx.la
-STATIC_PCX_LIB = libpixbufloader-static-pcx.la
+endif
if BUILD_DYNAMIC_MODULES
loader_LTLIBRARIES = \
$(PNG_LIB) \
- $(JPEG_LIB) \
+ $(BMP_LIB) \
+ $(WBMP_LIB) \
$(GIF_LIB) \
$(ICO_LIB) \
$(ANI_LIB) \
+ $(JPEG_LIB) \
+ $(PNM_LIB) \
$(RAS_LIB) \
- $(XPM_LIB) \
$(TIFF_LIB) \
- $(PNM_LIB) \
- $(BMP_LIB) \
- $(WBMP_LIB) \
+ $(XPM_LIB) \
$(XBM_LIB) \
$(TGA_LIB) \
$(PCX_LIB)
-extra_sources =
-builtin_objs =
-else
-loader_LTLIBRARIES =
+endif
noinst_LTLIBRARIES = \
$(STATIC_PNG_LIB) \
- $(STATIC_JPEG_LIB) \
+ $(STATIC_BMP_LIB) \
+ $(STATIC_WBMP_LIB) \
$(STATIC_GIF_LIB) \
$(STATIC_ICO_LIB) \
$(STATIC_ANI_LIB) \
+ $(STATIC_JPEG_LIB) \
+ $(STATIC_PNM_LIB) \
$(STATIC_RAS_LIB) \
- $(STATIC_XPM_LIB) \
$(STATIC_TIFF_LIB) \
- $(STATIC_PNM_LIB) \
- $(STATIC_BMP_LIB) \
- $(STATIC_WBMP_LIB) \
+ $(STATIC_XPM_LIB) \
$(STATIC_XBM_LIB) \
$(STATIC_TGA_LIB) \
$(STATIC_PCX_LIB)
builtin_objs = @INCLUDED_LOADER_OBJ@
-endif
DEPS = libgdk_pixbuf-$(GTK_API_VERSION).la
INCLUDES = \
diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c
index 9b83f4b48a..1dbbd26cf9 100644
--- a/gdk-pixbuf/gdk-pixbuf-io.c
+++ b/gdk-pixbuf/gdk-pixbuf-io.c
@@ -282,9 +282,12 @@ gdk_pixbuf_get_module_file (void)
return result;
}
+#endif /* USE_GMODULE */
+
static void
gdk_pixbuf_io_init (void)
{
+#ifdef USE_GMODULE
GIOChannel *channel;
gchar *line_buf;
gsize term;
@@ -296,11 +299,69 @@ gdk_pixbuf_io_init (void)
int n_patterns = 0;
GdkPixbufModulePattern *pattern;
GError *error = NULL;
+#endif
+ GdkPixbufModule *builtin_module = NULL;
+
+#define load_one_builtin_module(format) \
+ builtin_module = g_new0 (GdkPixbufModule, 1); \
+ builtin_module->module_name = #format; \
+ if (_gdk_pixbuf_load_module (builtin_module, NULL)) \
+ file_formats = g_slist_prepend (file_formats, builtin_module);\
+ else \
+ g_free (builtin_module)
+#ifdef INCLUDE_ani
+ load_one_builtin_module (ani);
+#endif
+#ifdef INCLUDE_png
+ load_one_builtin_module (png);
+#endif
+#ifdef INCLUDE_bmp
+ load_one_builtin_module (bmp);
+#endif
+#ifdef INCLUDE_wbmp
+ load_one_builtin_module (wbmp);
+#endif
+#ifdef INCLUDE_gif
+ load_one_builtin_module (gif);
+#endif
+#ifdef INCLUDE_ico
+ load_one_builtin_module (ico);
+#endif
+#ifdef INCLUDE_jpeg
+ load_one_builtin_module (jpeg);
+#endif
+#ifdef INCLUDE_pnm
+ load_one_builtin_module (pnm);
+#endif
+#ifdef INCLUDE_ras
+ load_one_builtin_module (ras);
+#endif
+#ifdef INCLUDE_tiff
+ load_one_builtin_module (tiff);
+#endif
+#ifdef INCLUDE_xpm
+ load_one_builtin_module (xpm);
+#endif
+#ifdef INCLUDE_xbm
+ load_one_builtin_module (xbm);
+#endif
+#ifdef INCLUDE_tga
+ load_one_builtin_module (tga);
+#endif
+#ifdef INCLUDE_pcx
+ load_one_builtin_module (pcx);
+#endif
+
+#undef load_one_builtin_module
+
+#ifdef USE_GMODULE
channel = g_io_channel_new_file (filename, "r", &error);
if (!channel) {
- g_warning ("Cannot open pixbuf loader module file '%s': %s",
- filename, error->message);
+ /* Don't bother warning if we have some built-in loaders */
+ if (file_formats == NULL)
+ g_warning ("Cannot open pixbuf loader module file '%s': %s",
+ filename, error->message);
return;
}
@@ -438,8 +499,11 @@ gdk_pixbuf_io_init (void)
g_string_free (tmp_buf, TRUE);
g_io_channel_unref (channel);
g_free (filename);
+#endif
}
+#ifdef USE_GMODULE
+
/* actually load the image handler - gdk_pixbuf_get_module only get a */
/* reference to the module to load, it doesn't actually load it */
/* perhaps these actions should be combined in one function */
@@ -481,199 +545,124 @@ _gdk_pixbuf_load_module_unlocked (GdkPixbufModule *image_module,
}
}
-gboolean
-_gdk_pixbuf_load_module (GdkPixbufModule *image_module,
- GError **error)
-{
- gboolean ret;
- gboolean locked = FALSE;
-
- /* be extra careful, maybe the module initializes
- * the thread system
- */
- if (g_threads_got_initialized)
- {
- G_LOCK (init_lock);
- locked = TRUE;
- }
- ret = _gdk_pixbuf_load_module_unlocked (image_module, error);
- if (locked)
- G_UNLOCK (init_lock);
- return ret;
-}
-
-#else /* !USE_GMODULE */
+#endif /* !USE_GMODULE */
#define module(type) \
- extern void MODULE_ENTRY (type, fill_info) (GdkPixbufFormat *info); \
- extern void MODULE_ENTRY (type, fill_vtable) (GdkPixbufModule *module)
+ extern void _gdk_pixbuf__##type##_fill_info (GdkPixbufFormat *info); \
+ extern void _gdk_pixbuf__##type##_fill_vtable (GdkPixbufModule *module)
module (png);
-module (bmp);
-module (wbmp);
+module (jpeg);
module (gif);
module (ico);
module (ani);
-module (jpeg);
-module (pnm);
module (ras);
-module (tiff);
module (xpm);
+module (tiff);
+module (pnm);
+module (bmp);
+module (wbmp);
module (xbm);
module (tga);
module (pcx);
+#undef module
+
gboolean
_gdk_pixbuf_load_module (GdkPixbufModule *image_module,
- GError **error)
+ GError **error)
{
+ gboolean ret;
+ gboolean locked = FALSE;
GdkPixbufModuleFillInfoFunc fill_info = NULL;
GdkPixbufModuleFillVtableFunc fill_vtable = NULL;
- image_module->module = (void *) 1;
-
- if (FALSE) {
- /* Ugly hack so we can use else if unconditionally below ;-) */
- }
-
-#ifdef INCLUDE_png
- else if (strcmp (image_module->module_name, "png") == 0) {
- fill_info = MODULE_ENTRY (png, fill_info);
- fill_vtable = MODULE_ENTRY (png, fill_vtable);
+#define try_module(format) \
+ if (fill_info == NULL && \
+ strcmp (image_module->module_name, #format) == 0) { \
+ fill_info = _gdk_pixbuf__##format##_fill_info; \
+ fill_vtable = _gdk_pixbuf__##format##_fill_vtable; \
}
+#ifdef INCLUDE_png
+ try_module (png);
#endif
-
-#ifdef INCLUDE_bmp
- else if (strcmp (image_module->module_name, "bmp") == 0) {
- fill_info = MODULE_ENTRY (bmp, fill_info);
- fill_vtable = MODULE_ENTRY (bmp, fill_vtable);
- }
+#ifdef INCLUDE_bmp
+ try_module (bmp);
#endif
-
#ifdef INCLUDE_wbmp
- else if (strcmp (image_module->module_name, "wbmp") == 0) {
- fill_info = MODULE_ENTRY (wbmp, fill_info);
- fill_vtable = MODULE_ENTRY (wbmp, fill_vtable);
- }
+ try_module (wbmp);
#endif
-
#ifdef INCLUDE_gif
- else if (strcmp (image_module->module_name, "gif") == 0) {
- fill_info = MODULE_ENTRY (gif, fill_info);
- fill_vtable = MODULE_ENTRY (gif, fill_vtable);
- }
+ try_module (gif);
#endif
-
#ifdef INCLUDE_ico
- else if (strcmp (image_module->module_name, "ico") == 0) {
- fill_info = MODULE_ENTRY (ico, fill_info);
- fill_vtable = MODULE_ENTRY (ico, fill_vtable);
- }
+ try_module (ico);
#endif
-
#ifdef INCLUDE_ani
- else if (strcmp (image_module->module_name, "ani") == 0) {
- fill_info = MODULE_ENTRY (ani, fill_info);
- fill_vtable = MODULE_ENTRY (ani, fill_vtable);
- }
+ try_module (ani);
#endif
-
#ifdef INCLUDE_jpeg
- else if (strcmp (image_module->module_name, "jpeg") == 0) {
- fill_info = MODULE_ENTRY (jpeg, fill_info);
- fill_vtable = MODULE_ENTRY (jpeg, fill_vtable);
- }
+ try_module (jpeg);
#endif
-
#ifdef INCLUDE_pnm
- else if (strcmp (image_module->module_name, "pnm") == 0) {
- fill_info = MODULE_ENTRY (pnm, fill_info);
- fill_vtable = MODULE_ENTRY (pnm, fill_vtable);
- }
+ try_module (pnm);
#endif
-
#ifdef INCLUDE_ras
- else if (strcmp (image_module->module_name, "ras") == 0) {
- fill_info = MODULE_ENTRY (ras, fill_info);
- fill_vtable = MODULE_ENTRY (ras, fill_vtable);
- }
+ try_module (ras);
#endif
-
#ifdef INCLUDE_tiff
- else if (strcmp (image_module->module_name, "tiff") == 0) {
- fill_info = MODULE_ENTRY (tiff, fill_info);
- fill_vtable = MODULE_ENTRY (tiff, fill_vtable);
- }
+ try_module (tiff);
#endif
-
#ifdef INCLUDE_xpm
- else if (strcmp (image_module->module_name, "xpm") == 0) {
- fill_info = MODULE_ENTRY (xpm, fill_info);
- fill_vtable = MODULE_ENTRY (xpm, fill_vtable);
- }
+ try_module (xpm);
#endif
-
#ifdef INCLUDE_xbm
- else if (strcmp (image_module->module_name, "xbm") == 0) {
- fill_info = MODULE_ENTRY (xbm, fill_info);
- fill_vtable = MODULE_ENTRY (xbm, fill_vtable);
- }
+ try_module (xbm);
#endif
-
#ifdef INCLUDE_tga
- else if (strcmp (image_module->module_name, "tga") == 0) {
- fill_info = MODULE_ENTRY (tga, fill_info);
- fill_vtable = MODULE_ENTRY (tga, fill_vtable);
- }
+ try_module (tga);
#endif
-
#ifdef INCLUDE_pcx
- else if (strcmp (image_module->module_name, "pcx") == 0) {
- fill_info = MODULE_ENTRY (pcx, fill_info);
- fill_vtable = MODULE_ENTRY (pcx, fill_vtable);
- }
+ try_module (pcx);
#endif
+
+#undef try_module
if (fill_vtable) {
+ image_module->module = (void *) 1;
(* fill_vtable) (image_module);
image_module->info = g_new0 (GdkPixbufFormat, 1);
(* fill_info) (image_module->info);
return TRUE;
- } else {
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
- _("Image type '%s' is not supported"),
- image_module->module_name);
-
- return FALSE;
- }
-}
+ }
-static void
-gdk_pixbuf_io_init ()
-{
- gchar *included_formats[] = {
- "ani", "png", "bmp", "wbmp", "gif",
- "ico", "jpeg", "pnm", "ras", "tiff",
- "xpm", "xbm", "tga", "pcx",
- NULL
- };
- gchar **name;
- GdkPixbufModule *module = NULL;
+#ifdef USE_GMODULE
- for (name = included_formats; *name; name++) {
- module = g_new0 (GdkPixbufModule, 1);
- module->module_name = *name;
- if (_gdk_pixbuf_load_module (module, NULL))
- file_formats = g_slist_prepend (file_formats, module);
- else
- g_free (module);
+ /* be extra careful, maybe the module initializes
+ * the thread system
+ */
+ if (g_threads_got_initialized)
+ {
+ G_LOCK (init_lock);
+ locked = TRUE;
}
-}
+ ret = _gdk_pixbuf_load_module_unlocked (image_module, error);
+ if (locked)
+ G_UNLOCK (init_lock);
+ return ret;
-#endif /* !USE_GMODULE */
+#else
+ g_set_error (error,
+ GDK_PIXBUF_ERROR,
+ GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
+ _("Image type '%s' is not supported"),
+ image_module->module_name);
+
+ return FALSE;
+
+#endif
+}
diff --git a/gdk-pixbuf/gdk-pixbuf-private.h b/gdk-pixbuf/gdk-pixbuf-private.h
index 9e48b32a5d..1687875896 100644
--- a/gdk-pixbuf/gdk-pixbuf-private.h
+++ b/gdk-pixbuf/gdk-pixbuf-private.h
@@ -96,12 +96,6 @@ GdkPixbuf *_gdk_pixbuf_generic_image_load (GdkPixbufModule *image_module,
GdkPixbufFormat *_gdk_pixbuf_get_format (GdkPixbufModule *image_module);
-#ifdef USE_GMODULE
-#define MODULE_ENTRY(type,function) function
-#else
-#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
-#endif
-
#endif /* GDK_PIXBUF_ENABLE_BACKEND */
#endif /* GDK_PIXBUF_PRIVATE_H */
diff --git a/gdk-pixbuf/io-ani.c b/gdk-pixbuf/io-ani.c
index dd0ad7e40d..6ac343c0c6 100644
--- a/gdk-pixbuf/io-ani.c
+++ b/gdk-pixbuf/io-ani.c
@@ -644,6 +644,12 @@ gdk_pixbuf__ani_image_load_animation (FILE *f, GError **error)
return anim;
}
+#ifndef INCLUDE_ani
+#define MODULE_ENTRY(type,function) function
+#else
+#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
+#endif
+
void
MODULE_ENTRY (ani, fill_vtable) (GdkPixbufModule *module)
{
diff --git a/gdk-pixbuf/io-bmp.c b/gdk-pixbuf/io-bmp.c
index eecef9efac..271f20774b 100644
--- a/gdk-pixbuf/io-bmp.c
+++ b/gdk-pixbuf/io-bmp.c
@@ -1260,6 +1260,12 @@ gdk_pixbuf__bmp_image_save (FILE *f,
values, error);
}
+#ifndef INCLUDE_bmp
+#define MODULE_ENTRY(type,function) function
+#else
+#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
+#endif
+
void
MODULE_ENTRY (bmp, fill_vtable) (GdkPixbufModule *module)
{
diff --git a/gdk-pixbuf/io-gif.c b/gdk-pixbuf/io-gif.c
index 74fab8cc6e..004aa484e5 100644
--- a/gdk-pixbuf/io-gif.c
+++ b/gdk-pixbuf/io-gif.c
@@ -1649,6 +1649,12 @@ gdk_pixbuf__gif_image_load_animation (FILE *file,
return animation;
}
+#ifndef INCLUDE_gif
+#define MODULE_ENTRY(type,function) function
+#else
+#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
+#endif
+
void
MODULE_ENTRY (gif, fill_vtable) (GdkPixbufModule *module)
{
diff --git a/gdk-pixbuf/io-ico.c b/gdk-pixbuf/io-ico.c
index 812683daa6..2923c77aeb 100644
--- a/gdk-pixbuf/io-ico.c
+++ b/gdk-pixbuf/io-ico.c
@@ -1186,6 +1186,12 @@ gdk_pixbuf__ico_image_save (FILE *f,
return TRUE;
}
+#ifndef INCLUDE_ico
+#define MODULE_ENTRY(type,function) function
+#else
+#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
+#endif
+
void
MODULE_ENTRY (ico, fill_vtable) (GdkPixbufModule *module)
{
diff --git a/gdk-pixbuf/io-jpeg.c b/gdk-pixbuf/io-jpeg.c
index 3ec2292b41..52c17d5112 100644
--- a/gdk-pixbuf/io-jpeg.c
+++ b/gdk-pixbuf/io-jpeg.c
@@ -1067,6 +1067,12 @@ gdk_pixbuf__jpeg_image_save_to_callback (GdkPixbufSaveFunc save_func,
TRUE, NULL, save_func, user_data);
}
+#ifndef INCLUDE_jpeg
+#define MODULE_ENTRY(type,function) function
+#else
+#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
+#endif
+
void
MODULE_ENTRY (jpeg, fill_vtable) (GdkPixbufModule *module)
{
diff --git a/gdk-pixbuf/io-pcx.c b/gdk-pixbuf/io-pcx.c
index e4d375fe7c..019604916d 100644
--- a/gdk-pixbuf/io-pcx.c
+++ b/gdk-pixbuf/io-pcx.c
@@ -723,6 +723,12 @@ gdk_pixbuf__pcx_stop_load(gpointer data, GError **error)
return TRUE;
}
+#ifndef INCLUDE_pcx
+#define MODULE_ENTRY(type,function) function
+#else
+#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
+#endif
+
void
MODULE_ENTRY (pcx, fill_vtable) (GdkPixbufModule *module)
{
diff --git a/gdk-pixbuf/io-png.c b/gdk-pixbuf/io-png.c
index f6b1bc1ede..19a35251f7 100644
--- a/gdk-pixbuf/io-png.c
+++ b/gdk-pixbuf/io-png.c
@@ -994,6 +994,12 @@ gdk_pixbuf__png_image_save_to_callback (GdkPixbufSaveFunc save_func,
TRUE, NULL, save_func, user_data);
}
+#ifndef INCLUDE_png
+#define MODULE_ENTRY(type,function) function
+#else
+#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
+#endif
+
void
MODULE_ENTRY (png, fill_vtable) (GdkPixbufModule *module)
{
diff --git a/gdk-pixbuf/io-pnm.c b/gdk-pixbuf/io-pnm.c
index efba937444..f9391ca0b4 100644
--- a/gdk-pixbuf/io-pnm.c
+++ b/gdk-pixbuf/io-pnm.c
@@ -1036,6 +1036,12 @@ gdk_pixbuf__pnm_image_load_increment (gpointer data,
return TRUE;
}
+#ifndef INCLUDE_pnm
+#define MODULE_ENTRY(type,function) function
+#else
+#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
+#endif
+
void
MODULE_ENTRY (pnm, fill_vtable) (GdkPixbufModule *module)
{
diff --git a/gdk-pixbuf/io-ras.c b/gdk-pixbuf/io-ras.c
index 6c20654c22..b03a4fb978 100644
--- a/gdk-pixbuf/io-ras.c
+++ b/gdk-pixbuf/io-ras.c
@@ -513,6 +513,12 @@ gdk_pixbuf__ras_image_load_increment(gpointer data,
return TRUE;
}
+#ifndef INCLUDE_ras
+#define MODULE_ENTRY(type,function) function
+#else
+#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
+#endif
+
void
MODULE_ENTRY (ras, fill_vtable) (GdkPixbufModule *module)
{
diff --git a/gdk-pixbuf/io-tga.c b/gdk-pixbuf/io-tga.c
index 2cde75f767..427fac4e08 100644
--- a/gdk-pixbuf/io-tga.c
+++ b/gdk-pixbuf/io-tga.c
@@ -953,6 +953,12 @@ static gboolean gdk_pixbuf__tga_stop_load(gpointer data, GError **err)
return TRUE;
}
+#ifndef INCLUDE_tga
+#define MODULE_ENTRY(type,function) function
+#else
+#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
+#endif
+
void
MODULE_ENTRY (tga, fill_vtable) (GdkPixbufModule *module)
{
diff --git a/gdk-pixbuf/io-tiff.c b/gdk-pixbuf/io-tiff.c
index 455d3691d7..79e8ef2c60 100644
--- a/gdk-pixbuf/io-tiff.c
+++ b/gdk-pixbuf/io-tiff.c
@@ -806,6 +806,12 @@ gdk_pixbuf__tiff_image_save (FILE *f,
values, error);
}
+#ifndef INCLUDE_tiff
+#define MODULE_ENTRY(type,function) function
+#else
+#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
+#endif
+
void
MODULE_ENTRY (tiff, fill_vtable) (GdkPixbufModule *module)
{
diff --git a/gdk-pixbuf/io-wbmp.c b/gdk-pixbuf/io-wbmp.c
index ab8cc1fb74..c058c3a7ea 100644
--- a/gdk-pixbuf/io-wbmp.c
+++ b/gdk-pixbuf/io-wbmp.c
@@ -339,6 +339,12 @@ static gboolean gdk_pixbuf__wbmp_image_load_increment(gpointer data,
return TRUE;
}
+#ifndef INCLUDE_wbmp
+#define MODULE_ENTRY(type,function) function
+#else
+#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
+#endif
+
void
MODULE_ENTRY (wbmp, fill_vtable) (GdkPixbufModule *module)
{
diff --git a/gdk-pixbuf/io-xbm.c b/gdk-pixbuf/io-xbm.c
index 19d0e20d5d..a649afb4bc 100644
--- a/gdk-pixbuf/io-xbm.c
+++ b/gdk-pixbuf/io-xbm.c
@@ -457,6 +457,12 @@ gdk_pixbuf__xbm_image_load_increment (gpointer data,
return TRUE;
}
+#ifndef INCLUDE_xbm
+#define MODULE_ENTRY(type,function) function
+#else
+#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
+#endif
+
void
MODULE_ENTRY (xbm, fill_vtable) (GdkPixbufModule *module)
{
diff --git a/gdk-pixbuf/io-xpm.c b/gdk-pixbuf/io-xpm.c
index 8959a04836..558196f848 100644
--- a/gdk-pixbuf/io-xpm.c
+++ b/gdk-pixbuf/io-xpm.c
@@ -781,6 +781,12 @@ gdk_pixbuf__xpm_image_load_increment (gpointer data,
return TRUE;
}
+#ifndef INCLUDE_xpm
+#define MODULE_ENTRY(type,function) function
+#else
+#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
+#endif
+
void
MODULE_ENTRY (xpm, fill_vtable) (GdkPixbufModule *module)
{