]> Pileus Git - ~andy/gtk/commitdiff
Bug 99192 - Add --with-include-input-modules
authorTor Lillqvist <tml@novell.com>
Mon, 17 Mar 2008 23:53:18 +0000 (23:53 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Mon, 17 Mar 2008 23:53:18 +0000 (23:53 +0000)
2008-03-18  Tor Lillqvist  <tml@novell.com>

Bug 99192 - Add --with-include-input-modules

* configure.in: Add --with-included-immodules switch. Handled in a
similar way as the --with-included-loaders switch. For each input
method module foo: Collect the list of input modules to be built
into libgtk into INCLUDED_IMMODULE_OBJ. Collect a list of
-DINCLUDE_IM_foo definitions into INCLUDED_IMMODULE_DEFINE.
Define Automake conditionals INCLUDE_IM_FOO.

* modules/input/Makefile.am: For modules to be included in libgtk,
build a static library.

* modules/input/im*.c: Use MODULE_ENTRY macros much like in
gdk-pixbuf to get unique names for the functions called by libgtk
in the included case. Use G_MODULE_EXPORT in the non-included case
so that we don't unnecessarily export unneeded random global
symbols on Windows.

* gtk/Makefile.am: Build the included modules and link them into libgtk.

* gtk/gtkimmodule.c: Handle the built-in modules. Remove
copy/paste leftover mentions of "themes" in comments.

svn path=/trunk/; revision=19896

17 files changed:
ChangeLog
configure.in
gtk/Makefile.am
gtk/gtkimmodule.c
modules/input/Makefile.am
modules/input/imam-et.c
modules/input/imcedilla.c
modules/input/imcyrillic-translit.c
modules/input/imime.c
modules/input/iminuktitut.c
modules/input/imipa.c
modules/input/immultipress.c
modules/input/imthai.c
modules/input/imti-er.c
modules/input/imti-et.c
modules/input/imviqr.c
modules/input/imxim.c

index 121bad9c7450a58c5c07d92d2449c9e78b2b1c4c..a125e4b89a6782b65e04609843e795b64cc23dff 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2008-03-18  Tor Lillqvist  <tml@novell.com>
+
+       Bug 99192 - Add --with-include-input-modules
+
+       * configure.in: Add --with-included-immodules switch. Handled in a
+       similar way as the --with-included-loaders switch. For each input
+       method module foo: Collect the list of input modules to be built
+       into libgtk into INCLUDED_IMMODULE_OBJ. Collect a list of
+       -DINCLUDE_IM_foo definitions into INCLUDED_IMMODULE_DEFINE.
+       Define Automake conditionals INCLUDE_IM_FOO.
+
+       * modules/input/Makefile.am: For modules to be included in libgtk,
+       build a static library.
+       
+       * modules/input/im*.c: Use MODULE_ENTRY macros much like in
+       gdk-pixbuf to get unique names for the functions called by libgtk
+       in the included case. Use G_MODULE_EXPORT in the non-included case
+       so that we don't unnecessarily export unneeded random global
+       symbols on Windows.
+
+       * gtk/Makefile.am: Build the included modules and link them into libgtk.
+
+       * gtk/gtkimmodule.c: Handle the built-in modules. Remove
+       copy/paste leftover mentions of "themes" in comments.
+
 2008-03-18  Tor Lillqvist  <tml@novell.com>
 
        * tests/Makefile.am: Build testmountoperation only on Unix for now.
index 009fd78000587a5b295efe15ac30fb39c9ffc8d3..106fe15cf215f60f8447c212b266cde3e791fe6d 100644 (file)
@@ -974,6 +974,81 @@ AM_CONDITIONAL(INCLUDE_PCX, [test x"$INCLUDE_pcx" = xyes])
 AM_CONDITIONAL(INCLUDE_ICNS, [test x"$INCLUDE_icns" = xyes])
 AM_CONDITIONAL(INCLUDE_JASPER, [test x"$INCLUDE_jasper" = xyes])
 
+#
+# Allow building some or all immodules included
+#
+AC_MSG_CHECKING(immodules to build)
+
+dnl due to an autoconf bug, commas in the first arg to
+dnl AC_HELP_STRING cause problems.
+dnl AC_HELP_STRING([--with-included-immodules=MODULE1 MODULE2 ...],
+dnl                [build the specified input method modules into gtk])
+AC_ARG_WITH(included_immodules,
+[  --with-included-immodules=MODULE1,MODULE2,...
+                          build the specified input methods into gtk])
+
+if $dynworks; then 
+   :
+else
+   ## if the option was specified, leave it; otherwise disable included immodules
+   if test x$with_included_immodules = xno; then
+           with_included_immodules=yes
+   fi
+fi
+
+all_immodules="am-et,cedilla,cyrillic-translit"
+if test "$gdktarget" = "win32"; then
+   all_immodules="${all_immodules},ime"
+fi
+all_immodules="${all_immodules},inuktitut,ipa,multipress,thai,ti-er,ti-et,viqr"
+if test "$gdktarget" = "x11"; then
+   all_immodules="${all_immodules},xim"
+fi
+
+included_immodules=""
+# If the switch specified without listing any specific ones, include all
+if test "x$with_included_immodules" = xyes ; then
+  included_immodules="$all_immodules"
+else
+  included_immodules="$with_included_immodules"
+fi
+
+AC_MSG_RESULT($included_immodules)
+AM_CONDITIONAL(HAVE_INCLUDED_IMMMODULES, test "x$included_immodules" != x)
+
+INCLUDED_IMMODULE_OBJ=
+INCLUDED_IMMODULE_DEFINE=
+
+IFS="${IFS=    }"; gtk_save_ifs="$IFS"; IFS=","
+for immodule in $included_immodules; do
+ immodule_underscores=`echo $immodule | sed -e 's/-/_/g'`
+ if echo "$all_immodules" | egrep "(^|,)$immodule(\$|,)" > /dev/null; then
+   :
+ else
+   AC_MSG_ERROR([the specified input method $immodule does not exist])
+ fi
+
+ INCLUDED_IMMODULE_OBJ="$INCLUDED_IMMODULE_OBJ ../modules/input/libstatic-im-$immodule.la"
+ INCLUDED_IMMODULE_DEFINE="$INCLUDED_IMMODULE_DEFINE -DINCLUDE_IM_$immodule_underscores"
+ eval INCLUDE_$immodule_underscores=yes
+done
+IFS="$gtk_save_ifs"
+AC_SUBST(INCLUDED_IMMODULE_OBJ)
+AC_SUBST(INCLUDED_IMMODULE_DEFINE)
+
+AM_CONDITIONAL(INCLUDE_IM_AM_ET, [test x"$INCLUDE_am_et" = xyes])
+AM_CONDITIONAL(INCLUDE_IM_CEDILLA, [test x"$INCLUDE_cedilla" = xyes])
+AM_CONDITIONAL(INCLUDE_IM_CYRILLIC_TRANSLIT, [test x"$INCLUDE_cyrillic_translit" = xyes])
+AM_CONDITIONAL(INCLUDE_IM_IME, [test x"$INCLUDE_ime" = xyes])
+AM_CONDITIONAL(INCLUDE_IM_INUKTITUT, [test x"$INCLUDE_inuktitut" = xyes])
+AM_CONDITIONAL(INCLUDE_IM_IPA, [test x"$INCLUDE_ipa" = xyes])
+AM_CONDITIONAL(INCLUDE_IM_MULTIPRESS, [test x"$INCLUDE_multipress" = xyes])
+AM_CONDITIONAL(INCLUDE_IM_THAI, [test x"$INCLUDE_thai" = xyes])
+AM_CONDITIONAL(INCLUDE_IM_TI_ER, [test x"$INCLUDE_ti_er" = xyes])
+AM_CONDITIONAL(INCLUDE_IM_TI_ET, [test x"$INCLUDE_ti_et" = xyes])
+AM_CONDITIONAL(INCLUDE_IM_VIQR, [test x"$INCLUDE_viqr" = xyes])
+AM_CONDITIONAL(INCLUDE_IM_XIM, [test x"$INCLUDE_xim" = xyes])
+
 AC_HEADER_SYS_WAIT
 
 AC_TYPE_SIGNAL
index 3d911ddebf380c52292722401ba3ec1608e31382..ee48eae742da18253277753ca70fdda6501ebf4d 100644 (file)
@@ -44,7 +44,8 @@ INCLUDES =                                            \
        -DGTK_PRINT_BACKEND_ENABLE_UNSUPPORTED          \
        $(GTK_DEBUG_FLAGS)                              \
        $(GTK_DEP_CFLAGS)                               \
-       $(gtk_clipboard_dnd_c_sources_CFLAGS)
+       $(gtk_clipboard_dnd_c_sources_CFLAGS)           \
+       $(INCLUDED_IMMODULE_DEFINE)
 
 gtarget=$(gdktarget)
 
@@ -106,26 +107,39 @@ if OS_LINUX
 TESTS += abicheck.sh pltcheck.sh
 endif
 
-# libtool stuff: set version and export symbols for resolving
-# since automake doesn't support conditionalized libsomething_la_LDFLAGS
-# we use the general approach here
 libgtkincludedir = $(includedir)/gtk-2.0/gtk
 libadd =                                                               \
        $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la  \
        $(top_builddir)/gdk/$(gdktargetlib)                             \
        $(GTK_DEP_LIBS)
+deps =
 
 if OS_UNIX
 libadd += xdgmime/libxdgmime.la
 endif
 
-# common options for the various packages.
+# libtool stuff: set version and export symbols for resolving
+# since automake doesn't support conditionalized libsomething_la_LDFLAGS
+# we use the general approach here
 libtool_opts =                                                 \
   -version-info $(LT_VERSION_INFO)                             \
   -export-dynamic $(no_undefined) $(LIBTOOL_EXPORT_OPTIONS)    \
   -rpath $(libdir) $(libgtk_target_ldflags)
 
 
+included-modules:
+if HAVE_INCLUDED_IMMMODULES
+       @cd $(top_builddir)/modules/input && $(MAKE) $(AM_MAKEFLAGS) included-modules
+
+libadd += $(INCLUDED_IMMODULE_OBJ)
+deps += $(INCLUDED_IMMODULE_OBJ)
+
+$(INCLUDED_IMMODULE_OBJ): included-modules
+       @true
+endif
+
+.PHONY: included-modules
+
 #
 # setup source file variables
 #
@@ -833,7 +847,8 @@ gtktypebuiltins.c: @REBUILD@ $(gtk_public_h_sources) gtktypebuiltins.c.template
 gtktypefuncs.c: @REBUILD@ $(top_srcdir)/gtk/*.h $(top_srcdir)/gdk/*.h Makefile
        echo '#include <gtk/gtk.h>' > xgen-gtfsrc.c && \
          ${CPP} $(DEFS) $(INCLUDES) -DGTK_ENABLE_BROKEN $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) xgen-gtfsrc.c | \
-         grep -o '\bg[td]k_[a-zA-Z0-9_]*_get_type\b' | \
+         egrep '\<g[td]k_[a-zA-Z0-9_]+_get_type\>' | \
+         sed -e 's/.*\(\<g[td]k_[a-zA-Z0-9_]\+_get_type\>\).*/\1/' | \
          sort | uniq | \
          sed '{ s/^/*tp++ = /; s/$$/();/; }' > xgen-gtf \
        && cp xgen-gtf $@ && rm -f xgen-gtf
@@ -860,10 +875,14 @@ libgtk_directfb_2_0_la_LDFLAGS = $(libtool_opts)
 
 libgtk_x11_2_0_la_LIBADD = $(libadd)
 libgtk_win32_2_0_la_LIBADD = $(libadd) -lole32 -lgdi32 -lcomdlg32 -lwinspool -lcomctl32
-libgtk_win32_2_0_la_DEPENDENCIES = $(gtk_def) $(gtk_win32_res)
 libgtk_quartz_2_0_la_LIBADD = $(libadd)
 libgtk_directfb_2_0_la_LIBADD = $(libadd)
 
+libgtk_x11_2_0_la_DEPENDENCIES = $(deps)
+libgtk_win32_2_0_la_DEPENDENCIES = $(gtk_def) $(gtk_win32_res) $(deps)
+libgtk_quartz_2_0_la_DEPENDENCIES = $(deps)
+libgtk_directfb_2_0_la_DEPENDENCIES = $(deps)
+
 if USE_WIN32
 libgtk_target_ldflags = $(gtk_win32_res_ldflag) $(gtk_win32_symbols)
 endif
index 9229504ca9d1add3e02f531225066787c5037502..9f68f624664e96398e8c6f1c30ce295beaf34e45 100644 (file)
@@ -1,8 +1,6 @@
 /* GTK - The GIMP Toolkit
  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  *
- * Themes added by The Rasterman <raster@redhat.com>
- * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
@@ -65,6 +63,8 @@ struct _GtkIMModule
 {
   GTypeModule parent_instance;
   
+  gboolean builtin;
+
   GModule *library;
 
   void          (*list)   (const GtkIMContextInfo ***contexts,
@@ -97,30 +97,33 @@ gtk_im_module_load (GTypeModule *module)
 {
   GtkIMModule *im_module = GTK_IM_MODULE (module);
   
-  im_module->library = g_module_open (im_module->path, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
-  if (!im_module->library)
+  if (!im_module->builtin)
     {
-      g_warning (g_module_error());
-      return FALSE;
-    }
+      im_module->library = g_module_open (im_module->path, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
+      if (!im_module->library)
+       {
+         g_warning (g_module_error());
+         return FALSE;
+       }
   
-  /* extract symbols from the lib */
-  if (!g_module_symbol (im_module->library, "im_module_init",
-                       (gpointer *)&im_module->init) ||
-      !g_module_symbol (im_module->library, "im_module_exit", 
-                       (gpointer *)&im_module->exit) ||
-      !g_module_symbol (im_module->library, "im_module_list", 
-                       (gpointer *)&im_module->list) ||
-      !g_module_symbol (im_module->library, "im_module_create", 
-                       (gpointer *)&im_module->create))
-    {
-      g_warning (g_module_error());
-      g_module_close (im_module->library);
-      
-      return FALSE;
+      /* extract symbols from the lib */
+      if (!g_module_symbol (im_module->library, "im_module_init",
+                           (gpointer *)&im_module->init) ||
+         !g_module_symbol (im_module->library, "im_module_exit", 
+                           (gpointer *)&im_module->exit) ||
+         !g_module_symbol (im_module->library, "im_module_list", 
+                           (gpointer *)&im_module->list) ||
+         !g_module_symbol (im_module->library, "im_module_create", 
+                           (gpointer *)&im_module->create))
+       {
+         g_warning (g_module_error());
+         g_module_close (im_module->library);
+         
+         return FALSE;
+       }
     }
            
-  /* call the theme's init (theme_init) function to let it */
+  /* call the module's init function to let it */
   /* setup anything it needs to set up. */
   im_module->init (module);
 
@@ -134,13 +137,16 @@ gtk_im_module_unload (GTypeModule *module)
   
   im_module->exit();
 
-  g_module_close (im_module->library);
-  im_module->library = NULL;
+  if (!im_module->builtin)
+    {
+      g_module_close (im_module->library);
+      im_module->library = NULL;
 
-  im_module->init = NULL;
-  im_module->exit = NULL;
-  im_module->list = NULL;
-  im_module->create = NULL;
+      im_module->init = NULL;
+      im_module->exit = NULL;
+      im_module->list = NULL;
+      im_module->create = NULL;
+    }
 }
 
 /* This only will ever be called if an error occurs during
@@ -262,6 +268,36 @@ correct_localedir_prefix (gchar **path)
 #endif
 
 
+static GtkIMModule *
+add_builtin_module (const gchar             *module_name,
+                   const GtkIMContextInfo **contexts,
+                   int                      n_contexts)
+{
+  GtkIMModule *module = g_object_new (GTK_TYPE_IM_MODULE, NULL);
+  GSList *infos = NULL;
+  int i;
+
+  for (i = 0; i < n_contexts; i++)
+    {
+      GtkIMContextInfo *info = g_new (GtkIMContextInfo, 1);
+      info->context_id = g_strdup (contexts[i]->context_id);
+      info->context_name = g_strdup (contexts[i]->context_name);
+      info->domain = g_strdup (contexts[i]->domain);
+      info->domain_dirname = g_strdup (contexts[i]->domain_dirname);
+#ifdef G_OS_WIN32
+      correct_localedir_prefix ((char **) &info->domain_dirname);
+#endif
+      info->default_locales = g_strdup (contexts[i]->default_locales);
+      infos = g_slist_prepend (infos, info);
+    }
+
+  module->builtin = TRUE;
+  g_type_module_set_name (G_TYPE_MODULE (module), module_name);
+  add_module (module, infos);
+
+  return module;
+}
+
 static void
 gtk_im_module_initialize (void)
 {
@@ -276,6 +312,63 @@ gtk_im_module_initialize (void)
 
   contexts_hash = g_hash_table_new (g_str_hash, g_str_equal);
 
+#define do_builtin(m)                                                  \
+  {                                                                    \
+    const GtkIMContextInfo **contexts;                                 \
+    int n_contexts;                                                    \
+    extern void _gtk_immodule_ ## m ## _list (const GtkIMContextInfo ***contexts, \
+                                             guint                    *n_contexts); \
+    extern void _gtk_immodule_ ## m ## _init (GTypeModule *module);    \
+    extern void _gtk_immodule_ ## m ## _exit (void);                   \
+    extern GtkIMContext *_gtk_immodule_ ## m ## _create (const gchar *context_id); \
+                                                                       \
+    _gtk_immodule_ ## m ## _list (&contexts, &n_contexts);             \
+    module = add_builtin_module (#m, contexts, n_contexts);            \
+    module->init = _gtk_immodule_ ## m ## _init;                       \
+    module->exit = _gtk_immodule_ ## m ## _exit;                       \
+    module->create = _gtk_immodule_ ## m ## _create;                   \
+    module = NULL;                                                     \
+  }
+
+#ifdef INCLUDE_IM_am_et
+  do_builtin (am_et);
+#endif
+#ifdef INCLUDE_IM_cedilla
+  do_builtin (cedilla);
+#endif
+#ifdef INCLUDE_IM_cyrillic_translit
+  do_builtin (cyrillic_translit);
+#endif
+#ifdef INCLUDE_IM_ime
+  do_builtin (ime);
+#endif
+#ifdef INCLUDE_IM_inuktitut
+  do_builtin (inuktitut);
+#endif
+#ifdef INCLUDE_IM_ipa
+  do_builtin (ipa);
+#endif
+#ifdef INCLUDE_IM_multipress
+  do_builtin (multipress);
+#endif
+#ifdef INCLUDE_IM_thai
+  do_builtin (thai);
+#endif
+#ifdef INCLUDE_IM_ti_er
+  do_builtin (ti_er);
+#endif
+#ifdef INCLUDE_IM_ti_et
+  do_builtin (ti_et);
+#endif
+#ifdef INCLUDE_IM_viqr
+  do_builtin (viqr);
+#endif
+#ifdef INCLUDE_IM_xim
+  do_builtin (xim);
+#endif
+
+#undef do_builtin
+
   file = g_fopen (filename, "r");
   if (!file)
     {
index 472ed75c2044f06bab7c99475db371b3086a096b..d098c78e6e9ea6924acf8d136f635dacadbd3ac8 100644 (file)
@@ -14,7 +14,8 @@ INCLUDES = \
        -DGTK_DISABLE_DEPRECATED                        \
        $(GTK_DEBUG_FLAGS)                              \
        $(GTK_XIM_FLAGS)                                \
-       $(GTK_DEP_CFLAGS)
+       $(GTK_DEP_CFLAGS)                               \
+       $(INCLUDED_IMMODULE_DEFINE)
 
 DEPS = \
        $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la  \
@@ -34,30 +35,65 @@ im_xim_la_SOURCES =                 \
        gtkimcontextxim.c       \
        gtkimcontextxim.h       \
        imxim.c
+libstatic_im_xim_la_SOURCES = $(im_xim_la_SOURCES)
 im_xim_la_LIBADD = $(LDADDS)
 if HAVE_X11R6
-IM_XIM_MODULE=im-xim.la 
+if INCLUDE_IM_XIM
+STATIC_XIM_MODULE = libstatic-im-xim.la
+else
+XIM_MODULE=im-xim.la 
+endif
 endif
 
 im_am_et_la_LDFLAGS = -rpath $(moduledir) -avoid-version -module $(no_undefined)
 im_am_et_la_SOURCES = imam-et.c
+libstatic_im_am_et_la_SOURCES = $(im_am_et_la_SOURCES)
 im_am_et_la_LIBADD = $(LDADDS)
+if INCLUDE_IM_AM_ET
+STATIC_AM_ET_MODULE = libstatic-im-am-et.la
+else
+AM_ET_MODULE = im-am-et.la
+endif
 
 im_cedilla_la_LDFLAGS = -rpath $(moduledir) -avoid-version -module $(no_undefined)
 im_cedilla_la_SOURCES = imcedilla.c
+libstatic_im_cedilla_la_SOURCES = $(im_cedilla_la_SOURCES)
 im_cedilla_la_LIBADD = $(LDADDS)
+if INCLUDE_IM_CEDILLA
+STATIC_CEDILLA_MODULE = libstatic-im-cedilla.la
+else
+CEDILLA_MODULE = im-cedilla.la
+endif
 
 im_cyrillic_translit_la_LDFLAGS = -rpath $(moduledir) -avoid-version -module $(no_undefined)
 im_cyrillic_translit_la_SOURCES = imcyrillic-translit.c
+libstatic_im_cyrillic_translit_la_SOURCES = $(im_cyrillic_translit_la_SOURCES)
 im_cyrillic_translit_la_LIBADD = $(LDADDS)
+if INCLUDE_IM_CYRILLIC_TRANSLIT
+STATIC_CYRILLIC_TRANSLIT_MODULE = libstatic-im-cyrillic-translit.la
+else
+CYRILLIC_TRANSLIT_MODULE = im-cyrillic-translit.la
+endif
 
 im_ti_er_la_LDFLAGS = -rpath $(moduledir) -avoid-version -module $(no_undefined)
 im_ti_er_la_SOURCES = imti-er.c
+libstatic_im_ti_er_la_SOURCES = $(im_ti_er_la_SOURCES)
 im_ti_er_la_LIBADD = $(LDADDS)
+if INCLUDE_IM_TI_ER
+STATIC_TI_ER_MODULE = libstatic-im-ti-er.la
+else
+TI_ER_MODULE = im-ti-er.la
+endif
 
 im_ti_et_la_LDFLAGS = -rpath $(moduledir) -avoid-version -module $(no_undefined)
 im_ti_et_la_SOURCES = imti-et.c
+libstatic_im_ti_et_la_SOURCES = $(im_ti_et_la_SOURCES)
 im_ti_et_la_LIBADD = $(LDADDS)
+if INCLUDE_IM_TI_ET
+STATIC_TI_ET_MODULE = libstatic-im-ti-et.la
+else
+TI_ET_MODULE = im-ti-et.la
+endif
 
 im_thai_la_LDFLAGS = -rpath $(moduledir) -avoid-version -module $(no_undefined)
 im_thai_la_SOURCES =           \
@@ -66,20 +102,43 @@ im_thai_la_SOURCES =               \
        gtkimcontextthai.c      \
        gtkimcontextthai.h      \
        imthai.c
+libstatic_im_thai_la_SOURCES = $(im_thai_la_SOURCES)
 im_thai_la_LIBADD = $(LDADDS)
+if INCLUDE_IM_THAI
+STATIC_THAI_MODULE = libstatic-im-thai.la
+else
+THAI_MODULE = im-thai.la
+endif
 
 im_viqr_la_LDFLAGS = -rpath $(moduledir) -avoid-version -module $(no_undefined)
 im_viqr_la_SOURCES = imviqr.c
+libstatic_im_viqr_la_SOURCES = $(im_viqr_la_SOURCES)
 im_viqr_la_LIBADD = $(LDADDS)
+if INCLUDE_IM_VIQR
+STATIC_VIQR_MODULE = libstatic-im-viqr.la
+else
+VIQR_MODULE = im-viqr.la
+endif
 
 im_inuktitut_la_LDFLAGS = -rpath $(moduledir) -avoid-version -module $(no_undefined)
 im_inuktitut_la_SOURCES = iminuktitut.c
+libstatic_im_inuktitut_la_SOURCES = $(im_inuktitut_la_SOURCES)
 im_inuktitut_la_LIBADD = $(LDADDS)
+if INCLUDE_IM_INUKTITUT
+STATIC_INUKTITUT_MODULE = libstatic-im-inuktitut.la
+else
+INUKTITUT_MODULE = im-inuktitut.la
+endif
 
 im_ipa_la_LDFLAGS = -rpath $(moduledir) -avoid-version -module $(no_undefined)
 im_ipa_la_SOURCES = imipa.c
+libstatic_im_ipa_la_SOURCES = $(im_ipa_la_SOURCES)
 im_ipa_la_LIBADD = $(LDADDS)
-
+if INCLUDE_IM_IPA
+STATIC_IPA_MODULE = libstatic-im-ipa.la
+else
+IPA_MODULE = im-ipa.la
+endif
 
 im_ime_la_LDFLAGS = -rpath $(moduledir) -avoid-version -module $(no_undefined)
 im_ime_la_SOURCES = \
@@ -87,19 +146,32 @@ im_ime_la_SOURCES = \
        gtkimcontextime.h \
        imime.c           \
        imm-extra.h
+libstatic_im_ime_la_SOURCES = $(im_ime_la_SOURCES)
 im_ime_la_LIBADD = -limm32 $(LDADDS)
+libstatic_im_ime_la_LIBADD = -limm32
 if USE_WIN32
-IM_IME_MODULE=im-ime.la 
+if INCLUDE_IM_IME
+STATIC_IME_MODULE = libstatic-im-ime.la
+else
+IME_MODULE=im-ime.la 
+endif
 endif
 
 multipress_defs = -DMULTIPRESS_LOCALEDIR=\""$(mplocaledir)"\" -DMULTIPRESS_CONFDIR=\""$(sysconfdir)/gtk-2.0"\"
 im_multipress_la_CPPFLAGS = $(multipress_defs)
+libstatic_im_multipress_la_CPPFLAGS = $(im_multipress_la_CPPFLAGS)
 im_multipress_la_LDFLAGS = -rpath $(moduledir) -avoid-version -module $(no_undefined)
 im_multipress_la_SOURCES =     \
        gtkimcontextmultipress.c        \
        gtkimcontextmultipress.h        \
        immultipress.c
+libstatic_im_multipress_la_SOURCES = $(im_multipress_la_SOURCES)
 im_multipress_la_LIBADD = $(LDADDS)
+if INCLUDE_IM_MULTIPRESS
+STATIC_MULTIPRESS_MODULE = libstatic-im-multipress.la
+else
+MULTIPRESS_MODULE = im-multipress.la
+endif
 
 imconffiledir = $(sysconfdir)/gtk-2.0
 dist_imconffile_DATA = im-multipress.conf
@@ -134,19 +206,39 @@ install-data-hook:
 uninstall-local:
        rm -f $(DESTDIR)$(sysconfdir)/gtk-2.0/gtk.immodules
 
-module_LTLIBRARIES =                           \
-       $(IM_XIM_MODULE)                        \
-       im-am-et.la                             \
-       im-cedilla.la                           \
-       im-cyrillic-translit.la                 \
-       im-inuktitut.la                         \
-       im-ipa.la                               \
-       im-thai.la                              \
-       im-ti-er.la                             \
-       im-ti-et.la                             \
-       im-viqr.la                              \
-       im-multipress.la                        \
-       $(IM_IME_MODULE)
+if BUILD_DYNAMIC_MODULES
+
+module_LTLIBRARIES =                   \
+       $(AM_ET_MODULE)                 \
+       $(CEDILLA_MODULE)               \
+       $(CYRILLIC_TRANSLIT_MODULE)     \
+       $(IME_MODULE)                   \
+       $(INUKTITUT_MODULE)             \
+       $(IPA_MODULE)                   \
+       $(MULTIPRESS_MODULE)            \
+       $(THAI_MODULE)                  \
+       $(TI_ER_MODULE)                 \
+       $(TI_ET_MODULE)                 \
+       $(VIQR_MODULE)                  \
+       $(XIM_MODULE)
+
+endif
+
+noinst_LTLIBRARIES =                           \
+       $(STATIC_AM_ET_MODULE)                  \
+       $(STATIC_CEDILLA_MODULE)                \
+       $(STATIC_CYRILLIC_TRANSLIT_MODULE)      \
+       $(STATIC_IME_MODULE)                    \
+       $(STATIC_INUKTITUT_MODULE)              \
+       $(STATIC_IPA_MODULE)                    \
+       $(STATIC_MULTIPRESS_MODULE)             \
+       $(STATIC_THAI_MODULE)                   \
+       $(STATIC_TI_ER_MODULE)                  \
+       $(STATIC_TI_ET_MODULE)                  \
+       $(STATIC_VIQR_MODULE)                   \
+       $(STATIC_XIM_MODULE)
+
+included-modules: $(noinst_LTLIBRARIES)
 
 gtk.immodules: Makefile.am $(module_LTLIBRARIES)
        $(top_builddir)/gtk/gtk-query-immodules-2.0 $(module_LTLIBRARIES) > gtk.immodules
index cabf03a638e5ec0b2d445c987db79ec3ecde94c1..8701d550be37719a79ec6875ca11d65779e2b789 100644 (file)
@@ -461,27 +461,33 @@ static const GtkIMContextInfo *info_list[] = {
   &am_et_info
 };
 
+#ifndef INCLUDE_IM_am_et
+#define MODULE_ENTRY(function) G_MODULE_EXPORT im_module_ ## function
+#else
+#define MODULE_ENTRY(function) _gtk_immodule_am_et_ ## function
+#endif
+
 void
-im_module_init (GTypeModule *module)
+MODULE_ENTRY (init) (GTypeModule *module)
 {
   am_et_register_type (module);
 }
 
 void 
-im_module_exit (void)
+MODULE_ENTRY (exit) (void)
 {
 }
 
 void 
-im_module_list (const GtkIMContextInfo ***contexts,
-               int                      *n_contexts)
+MODULE_ENTRY (list) (const GtkIMContextInfo ***contexts,
+                    int                      *n_contexts)
 {
   *contexts = info_list;
   *n_contexts = G_N_ELEMENTS (info_list);
 }
 
 GtkIMContext *
-im_module_create (const gchar *context_id)
+MODULE_ENTRY (create) (const gchar *context_id)
 {
   if (strcmp (context_id, "am_et") == 0)
     return g_object_new (type_am_et_translit, NULL);
index 5914a6686a7914c986d390caa86748802e82ebd1..f3b0c9ff617db62d031f5555f23456833d8cb9cf 100644 (file)
@@ -98,27 +98,33 @@ static const GtkIMContextInfo *info_list[] = {
   &cedilla_info
 };
 
+#ifndef INCLUDE_IM_cedilla
+#define MODULE_ENTRY(function) G_MODULE_EXPORT im_module_ ## function
+#else
+#define MODULE_ENTRY(function) _gtk_immodule_cedilla_ ## function
+#endif
+
 void
-im_module_init (GTypeModule *module)
+MODULE_ENTRY (init) (GTypeModule *module)
 {
   cedilla_register_type (module);
 }
 
 void 
-im_module_exit (void)
+MODULE_ENTRY (exit) (void)
 {
 }
 
 void 
-im_module_list (const GtkIMContextInfo ***contexts,
-               int                      *n_contexts)
+MODULE_ENTRY (list) (const GtkIMContextInfo ***contexts,
+                    int                      *n_contexts)
 {
   *contexts = info_list;
   *n_contexts = G_N_ELEMENTS (info_list);
 }
 
 GtkIMContext *
-im_module_create (const gchar *context_id)
+MODULE_ENTRY (create) (const gchar *context_id)
 {
   if (strcmp (context_id, "cedilla") == 0)
     return g_object_new (type_cedilla, NULL);
index b9c6c562bb69495efcd1573bcbf131ba5fd693a0..c7c9a0370b4e1e69c7c762f5495cb6c474750159 100644 (file)
@@ -224,27 +224,33 @@ static const GtkIMContextInfo *info_list[] = {
   &cyrillic_translit_info
 };
 
+#ifndef INCLUDE_IM_cyrillic_translit
+#define MODULE_ENTRY(function) G_MODULE_EXPORT im_module_ ## function
+#else
+#define MODULE_ENTRY(function) _gtk_immodule_cyrillic_translit_ ## function
+#endif
+
 void
-im_module_init (GTypeModule *module)
+MODULE_ENTRY (init) (GTypeModule *module)
 {
   cyrillic_translit_register_type (module);
 }
 
 void 
-im_module_exit (void)
+MODULE_ENTRY (exit) (void)
 {
 }
 
 void 
-im_module_list (const GtkIMContextInfo ***contexts,
-               int                      *n_contexts)
+MODULE_ENTRY (list) (const GtkIMContextInfo ***contexts,
+                    int                      *n_contexts)
 {
   *contexts = info_list;
   *n_contexts = G_N_ELEMENTS (info_list);
 }
 
 GtkIMContext *
-im_module_create (const gchar *context_id)
+MODULE_ENTRY (create) (const gchar *context_id)
 {
   if (strcmp (context_id, "cyrillic_translit") == 0)
     return g_object_new (type_cyrillic_translit, NULL);
index 72bc6afef7e8b384a2a0c1b70d153986e67ac8a0..843917cdabdd3f27e6394c6c2cd19d1a919112a4 100644 (file)
@@ -39,26 +39,32 @@ static const GtkIMContextInfo *info_list[] = {
   &ime_info,
 };
 
+#ifndef INCLUDE_IM_ime
+#define MODULE_ENTRY(function) G_MODULE_EXPORT im_module_ ## function
+#else
+#define MODULE_ENTRY(function) _gtk_immodule_ime_ ## function
+#endif
+
 void
-im_module_init (GTypeModule * module)
+MODULE_ENTRY (init) (GTypeModule * module)
 {
   gtk_im_context_ime_register_type (module);
 }
 
 void
-im_module_exit (void)
+MODULE_ENTRY (exit) (void)
 {
 }
 
 void
-im_module_list (const GtkIMContextInfo *** contexts, int *n_contexts)
+MODULE_ENTRY (list) (const GtkIMContextInfo *** contexts, int *n_contexts)
 {
   *contexts = info_list;
   *n_contexts = G_N_ELEMENTS (info_list);
 }
 
 GtkIMContext *
-im_module_create (const gchar * context_id)
+MODULE_ENTRY (create) (const gchar * context_id)
 {
   g_return_val_if_fail (context_id, NULL);
 
index b5ee5456dab04ea1ac943556329025cfc433e64c..86e97abbe1f7838bd7fc0713a184c75f088e9fb2 100644 (file)
@@ -134,27 +134,33 @@ static const GtkIMContextInfo *info_list[] = {
   &inuktitut_info
 };
 
+#ifndef INCLUDE_IM_inuktitut
+#define MODULE_ENTRY(function) G_MODULE_EXPORT im_module_ ## function
+#else
+#define MODULE_ENTRY(function) _gtk_immodule_inuktitut_ ## function
+#endif
+
 void
-im_module_init (GTypeModule *module)
+MODULE_ENTRY (init) (GTypeModule *module)
 {
   inuktitut_register_type (module);
 }
 
 void 
-im_module_exit (void)
+MODULE_ENTRY (exit) (void)
 {
 }
 
 void 
-im_module_list (const GtkIMContextInfo ***contexts,
-               int                      *n_contexts)
+MODULE_ENTRY (list) (const GtkIMContextInfo ***contexts,
+                    int                      *n_contexts)
 {
   *contexts = info_list;
   *n_contexts = G_N_ELEMENTS (info_list);
 }
 
 GtkIMContext *
-im_module_create (const gchar *context_id)
+MODULE_ENTRY (create) (const gchar *context_id)
 {
   if (strcmp (context_id, "inuktitut") == 0)
     return g_object_new (type_inuktitut_translit, NULL);
index c4a64023ee1f2a036116ae472322bdda0d1ae6e3..853b3663c61990747956b4fa64d5ed49904fb6bf 100644 (file)
@@ -152,27 +152,33 @@ static const GtkIMContextInfo *info_list[] = {
   &ipa_info
 };
 
+#ifndef INCLUDE_IM_ipa
+#define MODULE_ENTRY(function) G_MODULE_EXPORT im_module_ ## function
+#else
+#define MODULE_ENTRY(function) _gtk_immodule_ipa_ ## function
+#endif
+
 void
-im_module_init (GTypeModule *module)
+MODULE_ENTRY (init) (GTypeModule *module)
 {
   ipa_register_type (module);
 }
 
 void 
-im_module_exit (void)
+MODULE_ENTRY (exit) (void)
 {
 }
 
 void 
-im_module_list (const GtkIMContextInfo ***contexts,
-               int                      *n_contexts)
+MODULE_ENTRY (list) (const GtkIMContextInfo ***contexts,
+                    int                      *n_contexts)
 {
   *contexts = info_list;
   *n_contexts = G_N_ELEMENTS (info_list);
 }
 
 GtkIMContext *
-im_module_create (const gchar *context_id)
+MODULE_ENTRY (create) (const gchar *context_id)
 {
   if (strcmp (context_id, "ipa") == 0)
     return g_object_new (type_ipa, NULL);
index e53ccdd06797fd76c5710b361a0d24ce65d4165f..6430eaabf960c89c986fad3401c8e61f81f1be6a 100644 (file)
@@ -38,27 +38,33 @@ static const GtkIMContextInfo *info_list[] = {
   &info
 };
 
+#ifndef INCLUDE_IM_multipress
+#define MODULE_ENTRY(function) G_MODULE_EXPORT im_module_ ## function
+#else
+#define MODULE_ENTRY(function) _gtk_immodule_multipress_ ## function
+#endif
+
 void
-im_module_init (GTypeModule *module)
+MODULE_ENTRY (init) (GTypeModule *module)
 {
   gtk_im_context_multipress_register_type(module);
 }
 
 void 
-im_module_exit (void)
+MODULE_ENTRY (exit) (void)
 {
 }
 
 void 
-im_module_list (const GtkIMContextInfo ***contexts,
-               int                      *n_contexts)
+MODULE_ENTRY (list) (const GtkIMContextInfo ***contexts,
+                    int                      *n_contexts)
 {
   *contexts = info_list;
   *n_contexts = G_N_ELEMENTS (info_list);
 }
 
 GtkIMContext *
-im_module_create (const gchar *context_id)
+MODULE_ENTRY (create) (const gchar *context_id)
 {
   if (strcmp (context_id, CONTEXT_ID) == 0)
   {
index 45bceb7063e0851f041c78d231cb8d4df2628679..96b9f38b7bfb58b05d6f07784c2b30e62386a3ea 100644 (file)
@@ -42,27 +42,33 @@ static const GtkIMContextInfo *info_list[] = {
   &thai_info
 };
 
+#ifndef INCLUDE_IM_thai
+#define MODULE_ENTRY(function) G_MODULE_EXPORT im_module_ ## function
+#else
+#define MODULE_ENTRY(function) _gtk_immodule_thai_ ## function
+#endif
+
 void
-im_module_init (GTypeModule *module)
+MODULE_ENTRY (init) (GTypeModule *module)
 {
   gtk_im_context_thai_register_type (module);
 }
 
 void 
-im_module_exit (void)
+MODULE_ENTRY (exit) (void)
 {
 }
 
 void 
-im_module_list (const GtkIMContextInfo ***contexts,
-               int                      *n_contexts)
+MODULE_ENTRY (list) (const GtkIMContextInfo ***contexts,
+                    int                      *n_contexts)
 {
   *contexts = info_list;
   *n_contexts = G_N_ELEMENTS (info_list);
 }
 
 GtkIMContext *
-im_module_create (const gchar *context_id)
+MODULE_ENTRY (create) (const gchar *context_id)
 {
   if (strcmp (context_id, "thai") == 0)
     return gtk_im_context_thai_new ();
index 8c4b7c1043748cf38247b6b3813a53fbbc90facf..63d2cbb5d49a7cd88bb6d9ed0eb78ff6bc57519a 100644 (file)
@@ -460,27 +460,33 @@ static const GtkIMContextInfo *info_list[] = {
   &ti_er_info
 };
 
+#ifndef INCLUDE_IM_ti_er
+#define MODULE_ENTRY(function) G_MODULE_EXPORT im_module_ ## function
+#else
+#define MODULE_ENTRY(function) _gtk_immodule_ti_er_ ## function
+#endif
+
 void
-im_module_init (GTypeModule *module)
+MODULE_ENTRY (init) (GTypeModule *module)
 {
   ti_er_register_type (module);
 }
 
 void 
-im_module_exit (void)
+MODULE_ENTRY (exit) (void)
 {
 }
 
 void 
-im_module_list (const GtkIMContextInfo ***contexts,
-               int                      *n_contexts)
+MODULE_ENTRY (list) (const GtkIMContextInfo ***contexts,
+                    int                      *n_contexts)
 {
   *contexts = info_list;
   *n_contexts = G_N_ELEMENTS (info_list);
 }
 
 GtkIMContext *
-im_module_create (const gchar *context_id)
+MODULE_ENTRY (create) (const gchar *context_id)
 {
   if (strcmp (context_id, "ti_er") == 0)
     return g_object_new (type_ti_er_translit, NULL);
index fdcb763cc7bd122406f583e726b2e098dd7c6c5c..d438c1f13fb51451e4a68e0dc10cee386f3fdedc 100644 (file)
@@ -460,27 +460,33 @@ static const GtkIMContextInfo *info_list[] = {
   &ti_et_info
 };
 
+#ifndef INCLUDE_IM_ti_et
+#define MODULE_ENTRY(function) G_MODULE_EXPORT im_module_ ## function
+#else
+#define MODULE_ENTRY(function) _gtk_immodule_ti_et_ ## function
+#endif
+
 void
-im_module_init (GTypeModule *module)
+MODULE_ENTRY (init) (GTypeModule *module)
 {
   ti_et_register_type (module);
 }
 
 void 
-im_module_exit (void)
+MODULE_ENTRY (exit) (void)
 {
 }
 
 void 
-im_module_list (const GtkIMContextInfo ***contexts,
-               int                      *n_contexts)
+MODULE_ENTRY (list) (const GtkIMContextInfo ***contexts,
+                    int                      *n_contexts)
 {
   *contexts = info_list;
   *n_contexts = G_N_ELEMENTS (info_list);
 }
 
 GtkIMContext *
-im_module_create (const gchar *context_id)
+MODULE_ENTRY (create) (const gchar *context_id)
 {
   if (strcmp (context_id, "ti_et") == 0)
     return g_object_new (type_ti_et_translit, NULL);
index 6d269ea1c7e1dc2aebd7a628ba8426d62a672e75..ef072e51b6fda88f5e8f119b99e1dc9c86326cad 100644 (file)
@@ -251,27 +251,33 @@ static const GtkIMContextInfo *info_list[] = {
   &viqr_info
 };
 
+#ifndef INCLUDE_IM_viqr
+#define MODULE_ENTRY(function) G_MODULE_EXPORT im_module_ ## function
+#else
+#define MODULE_ENTRY(function) _gtk_immodule_viqr_ ## function
+#endif
+
 void
-im_module_init (GTypeModule *module)
+MODULE_ENTRY (init) (GTypeModule *module)
 {
   viqr_register_type (module);
 }
 
 void 
-im_module_exit (void)
+MODULE_ENTRY (exit) (void)
 {
 }
 
 void 
-im_module_list (const GtkIMContextInfo ***contexts,
-               int                      *n_contexts)
+MODULE_ENTRY (list) (const GtkIMContextInfo ***contexts,
+                    int                      *n_contexts)
 {
   *contexts = info_list;
   *n_contexts = G_N_ELEMENTS (info_list);
 }
 
 GtkIMContext *
-im_module_create (const gchar *context_id)
+MODULE_ENTRY (create) (const gchar *context_id)
 {
   if (strcmp (context_id, "viqr") == 0)
     return g_object_new (type_viqr_translit, NULL);
index 42a3d409eca5f6b80236d58c317f35eda3942df9..d4125760971c3e7d0c1d0d08f7cda047422b34d1 100644 (file)
@@ -35,28 +35,34 @@ static const GtkIMContextInfo *info_list[] = {
   &xim_ja_info
 };
 
+#ifndef INCLUDE_IM_xim
+#define MODULE_ENTRY(function) G_MODULE_EXPORT im_module_ ## function
+#else
+#define MODULE_ENTRY(function) _gtk_immodule_xim_ ## function
+#endif
+
 void
-im_module_init (GTypeModule *type_module)
+MODULE_ENTRY (init) (GTypeModule *type_module)
 {
   gtk_im_context_xim_register_type (type_module);
 }
 
 void 
-im_module_exit (void)
+MODULE_ENTRY (exit) (void)
 {
   gtk_im_context_xim_shutdown ();
 }
 
 void 
-im_module_list (const GtkIMContextInfo ***contexts,
-               int                      *n_contexts)
+MODULE_ENTRY (list) (const GtkIMContextInfo ***contexts,
+                    int                      *n_contexts)
 {
   *contexts = info_list;
   *n_contexts = G_N_ELEMENTS (info_list);
 }
 
 GtkIMContext *
-im_module_create (const gchar *context_id)
+MODULE_ENTRY (create) (const gchar *context_id)
 {
   if (strcmp (context_id, "xim") == 0)
     return gtk_im_context_xim_new ();