diff -ruN sources-original/glib/configure.ac sources/glib/configure.ac
--- sources-original/glib/configure.ac	2011-09-26 23:15:32 +0200
+++ sources/glib/configure.ac	2011-10-06 17:26:57 +0200
@@ -1659,6 +1659,24 @@
 	AC_MSG_ERROR(Cannot determine shared library suffix from libtool)
 fi
  
+dnl
+dnl Windows doesn't require any special prefix for loadable modules.
+dnl Since libtool doesn't have a special option for checking prefixes
+dnl we just assume that all other systems require a prefix of "lib".
+dnl This is certainly what code in GModule was assuming anyway. If any
+dnl other targets want to not use that prefix they can adjust the condition
+dnl below.
+dnl
+AC_MSG_CHECKING(for the prefix of module shared libraries)
+if test "$glib_native_win32" = "yes"; then
+  glib_module_prefix=""
+  AC_MSG_RESULT(none required)
+else
+  glib_module_prefix="lib"
+  AC_MSG_RESULT($glib_gmodule_prefix)
+fi
+
+
 AC_SUBST(G_MODULE_SUPPORTED)
 AC_SUBST(G_MODULE_IMPL)
 AC_SUBST(G_MODULE_LIBS)
@@ -3386,6 +3404,9 @@
 #define GLIB_SYSDEF_POLLNVAL =$g_pollnval
 
 #define G_MODULE_SUFFIX "$g_module_suffix"
+#define G_MODULE_SUFFIX_LEN (sizeof (G_MODULE_SUFFIX) - 1)
+#define G_MODULE_PREFIX "$g_module_prefix"
+#define G_MODULE_PREFIX_LEN (sizeof (G_MODULE_PREFIX) - 1)
 
 /* A GPid is an abstraction for a process "handle". It is *not* an
  * abstraction for a process identifier in general. GPid is used in
@@ -3731,6 +3752,7 @@
 g_gcc_atomic_ops="$glib_cv_gcc_has_builtin_atomic_operations"
 
 g_module_suffix="$glib_gmodule_suffix"
+g_module_prefix="$glib_gmodule_prefix"
 
 g_pid_type="$glib_pid_type"
 case $host in
diff -ruN sources-original/glib/gio/gio-querymodules.c sources/glib/gio/gio-querymodules.c
--- sources-original/glib/gio/gio-querymodules.c	2011-09-09 21:58:10 +0200
+++ sources/glib/gio/gio-querymodules.c	2011-10-06 19:40:44 +0200
@@ -26,13 +26,11 @@
 static gboolean
 is_valid_module_name (const gchar *basename)
 {
-#if !defined(G_OS_WIN32) && !defined(G_WITH_CYGWIN)
-  return
-    g_str_has_prefix (basename, "lib") &&
-    g_str_has_suffix (basename, ".so");
-#else
-  return g_str_has_suffix (basename, ".dll");
-#endif
+  if (G_MODULE_PREFIX[0] && !g_str_has_prefix (basename, G_MODULE_PREFIX))
+    return FALSE;
+  if (!g_str_has_suffix (basename, "." G_MODULE_SUFFIX))
+    return FALSE;
+  return TRUE;
 }
 
 static void
diff -ruN sources-original/glib/gio/giomodule.c sources/glib/gio/giomodule.c
--- sources-original/glib/gio/giomodule.c	2011-09-15 02:01:00 +0200
+++ sources/glib/gio/giomodule.c	2011-10-06 18:13:05 +0200
@@ -355,14 +355,10 @@
 {
   gboolean result;
 
-#if !defined(G_OS_WIN32) && !defined(G_WITH_CYGWIN)
-  if (!g_str_has_prefix (basename, "lib") ||
-      !g_str_has_suffix (basename, ".so"))
+  if (G_MODULE_PREFIX[0] && !g_str_has_prefix (basename, G_MODULE_PREFIX))
     return FALSE;
-#else
-  if (!g_str_has_suffix (basename, ".dll"))
+  if (!g_str_has_suffix (basename, "." G_MODULE_SUFFIX))
     return FALSE;
-#endif
 
   result = TRUE;
   if (scope)
diff -ruN sources-original/glib/glib/glibconfig.h.win32.in sources/glib/glib/glibconfig.h.win32.in
--- sources-original/glib/glib/glibconfig.h.win32.in	2011-09-26 22:54:50 +0200
+++ sources/glib/glib/glibconfig.h.win32.in	2011-10-06 17:27:16 +0200
@@ -261,6 +261,9 @@
 #define GLIB_SYSDEF_POLLNVAL =32
 
 #define G_MODULE_SUFFIX "dll"
+#define G_MODULE_SUFFIX_LEN (sizeof (G_MODULE_SUFFIX) - 1)
+#define G_MODULE_PREFIX ""
+#define G_MODULE_PREFIX_LEN (sizeof (G_MODULE_PREFIX) - 1)
 
 /* A GPid is an abstraction for a process "handle". It is *not* an
  * abstraction for a process identifier in general. GPid is used in
diff -ruN sources-original/glib/gmodule/gmodule-ar.c sources/glib/gmodule/gmodule-ar.c
--- sources-original/glib/gmodule/gmodule-ar.c	2011-09-09 21:58:10 +0200
+++ sources/glib/gmodule/gmodule-ar.c	2011-10-06 17:40:38 +0200
@@ -176,12 +176,12 @@
 		      const gchar *module_name)
 {
   if (directory && *directory) {
-    if (strncmp (module_name, "lib", 3) == 0)
+    if (strncmp (module_name, G_MODULE_PREFIX, G_MODULE_PREFIX_LEN) == 0)
       return g_strconcat (directory, "/", module_name, NULL);
     else
-      return g_strconcat (directory, "/lib", module_name, "." G_MODULE_SUFFIX, NULL);
-  } else if (strncmp (module_name, "lib", 3) == 0)
+      return g_strconcat (directory, "/" G_MODULE_PREFIX, module_name, "." G_MODULE_SUFFIX, NULL);
+  } else if (strncmp (module_name, G_MODULE_PREFIX, G_MODULE_PREFIX_LEN) == 0)
     return g_strdup (module_name);
   else
-    return g_strconcat ("lib", module_name, "." G_MODULE_SUFFIX, NULL);
+    return g_strconcat (G_MODULE_PREFIX, module_name, "." G_MODULE_SUFFIX, NULL);
 }
diff -ruN sources-original/glib/gmodule/gmodule-beos.c sources/glib/gmodule/gmodule-beos.c
--- sources-original/glib/gmodule/gmodule-beos.c	2011-09-09 21:58:10 +0200
+++ sources/glib/gmodule/gmodule-beos.c	2011-10-06 17:42:16 +0200
@@ -192,13 +192,13 @@
   
   if (directory && *directory)
     {
-      if (strncmp (module_name, "lib", 3) == 0)
+      if (strncmp (module_name, G_MODULE_PREFIX, G_MODULE_PREFIX_LEN) == 0)
 	return g_strconcat (directory, "/", module_name, NULL);
       else
-	return g_strconcat (directory, "/lib", module_name, "." G_MODULE_SUFFIX, NULL);
+	return g_strconcat (directory, "/" G_MODULE_PREFIX, module_name, "." G_MODULE_SUFFIX, NULL);
     }
-  else if (strncmp (module_name, "lib", 3) == 0)
+  else if (strncmp (module_name, G_MODULE_PREFIX, G_MODULE_PREFIX_LEN) == 0)
     return g_strdup (module_name);
   else
-    return g_strconcat ("lib", module_name, "." G_MODULE_SUFFIX, NULL);
+    return g_strconcat (G_MODULE_PREFIX, module_name, "." G_MODULE_SUFFIX, NULL);
 }
diff -ruN sources-original/glib/gmodule/gmodule-dl.c sources/glib/gmodule/gmodule-dl.c
--- sources-original/glib/gmodule/gmodule-dl.c	2011-09-09 21:58:10 +0200
+++ sources/glib/gmodule/gmodule-dl.c	2011-10-06 17:38:49 +0200
@@ -157,12 +157,12 @@
 		      const gchar *module_name)
 {
   if (directory && *directory) {
-    if (strncmp (module_name, "lib", 3) == 0)
+    if (strncmp (module_name, G_MODULE_PREFIX, G_MODULE_PREFIX_LEN) == 0)
       return g_strconcat (directory, "/", module_name, NULL);
     else
-      return g_strconcat (directory, "/lib", module_name, "." G_MODULE_SUFFIX, NULL);
-  } else if (strncmp (module_name, "lib", 3) == 0)
+      return g_strconcat (directory, "/" G_MODULE_PREFIX, module_name, "." G_MODULE_SUFFIX, NULL);
+  } else if (strncmp (module_name, G_MODULE_PREFIX, G_MODULE_PREFIX_LEN) == 0)
     return g_strdup (module_name);
   else
-    return g_strconcat ("lib", module_name, "." G_MODULE_SUFFIX, NULL);
+    return g_strconcat (G_MODULE_PREFIX, module_name, "." G_MODULE_SUFFIX, NULL);
 }
diff -ruN sources-original/glib/gmodule/gmodule-dld.c sources/glib/gmodule/gmodule-dld.c
--- sources-original/glib/gmodule/gmodule-dld.c	2011-09-09 21:58:10 +0200
+++ sources/glib/gmodule/gmodule-dld.c	2011-10-06 17:44:16 +0200
@@ -152,12 +152,12 @@
 		      const gchar *module_name)
 {
   if (directory && *directory)
-    if (strncmp (module_name, "lib", 3) == 0)
+    if (strncmp (module_name, G_MODULE_PREFIX, G_MODULE_PREFIX_LEN) == 0)
       return g_strconcat (directory, "/", module_name, NULL);
     else
-      return g_strconcat (directory, "/lib", module_name, ".sl", NULL);
-  else if (strncmp (module_name, "lib", 3) == 0)
+      return g_strconcat (directory, "/" G_MODULE_PREFIX, module_name, ".sl", NULL);
+  else if (strncmp (module_name, G_MODULE_PREFIX, G_MODULE_PREFIX_LEN) == 0)
     return g_strdup (module_name);
   else
-    return g_strconcat ("lib", module_name, ".sl", NULL);
+    return g_strconcat (G_MODULE_PREFIX, module_name, ".sl", NULL);
 }
diff -ruN sources-original/glib/gmodule/gmodule-dyld.c sources/glib/gmodule/gmodule-dyld.c
--- sources-original/glib/gmodule/gmodule-dyld.c	2011-09-09 21:58:10 +0200
+++ sources/glib/gmodule/gmodule-dyld.c	2011-10-06 17:45:32 +0200
@@ -142,13 +142,13 @@
 {
   if (directory && *directory)
     {
-      if (strncmp (module_name, "lib", 3) == 0)
+      if (strncmp (module_name, G_MODULE_PREFIX, G_MODULE_PREFIX_LEN) == 0)
 	return g_strconcat (directory, "/", module_name, NULL);
       else
-	return g_strconcat (directory, "/lib", module_name, "." G_MODULE_SUFFIX, NULL);
+	return g_strconcat (directory, "/" G_MODULE_PREFIX, module_name, "." G_MODULE_SUFFIX, NULL);
     }
-  else if (strncmp (module_name, "lib", 3) == 0)
+  else if (strncmp (module_name, G_MODULE_PREFIX, G_MODULE_PREFIX_LEN) == 0)
     return g_strdup (module_name);
   else
-    return g_strconcat ("lib", module_name, "." G_MODULE_SUFFIX, NULL);
+    return g_strconcat (G_MODULE_PREFIX, module_name, "." G_MODULE_SUFFIX, NULL);
 }
diff -ruN sources-original/glib/gmodule/gmodule-win32.c sources/glib/gmodule/gmodule-win32.c
--- sources-original/glib/gmodule/gmodule-win32.c	2011-09-09 21:58:10 +0200
+++ sources/glib/gmodule/gmodule-win32.c	2011-10-06 19:35:14 +0200
@@ -172,31 +172,32 @@
 
   k = strlen (module_name);
     
-  if (directory && *directory)
-    if (k > 4 && g_ascii_strcasecmp (module_name + k - 4, ".dll") == 0)
+  if (directory && *directory) {
+    if (k > G_MODULE_SUFFIX_LEN + 1 && g_ascii_strcasecmp (module_name + k - G_MODULE_SUFFIX_LEN - 1, "." G_MODULE_SUFFIX) == 0)
       return g_strconcat (directory, G_DIR_SEPARATOR_S, module_name, NULL);
 #ifdef G_WITH_CYGWIN
     else if (strncmp (module_name, "lib", 3) == 0 || strncmp (module_name, "cyg", 3) == 0)
-      return g_strconcat (directory, G_DIR_SEPARATOR_S, module_name, ".dll", NULL);
+      return g_strconcat (directory, G_DIR_SEPARATOR_S, module_name, "." G_MODULE_SUFFIX, NULL);
     else
-      return g_strconcat (directory, G_DIR_SEPARATOR_S, "cyg", module_name, ".dll", NULL);
+      return g_strconcat (directory, G_DIR_SEPARATOR_S, "cyg", module_name, "." G_MODULE_SUFFIX, NULL);
 #else
-    else if (strncmp (module_name, "lib", 3) == 0)
-      return g_strconcat (directory, G_DIR_SEPARATOR_S, module_name, ".dll", NULL);
+    else if (strncmp (module_name, G_MODULE_PREFIX, G_MODULE_PREFIX_LEN) == 0)
+      return g_strconcat (directory, G_DIR_SEPARATOR_S, module_name, "." G_MODULE_SUFFIX, NULL);
     else
-      return g_strconcat (directory, G_DIR_SEPARATOR_S, "lib", module_name, ".dll", NULL);
+      return g_strconcat (directory, G_DIR_SEPARATOR_S, G_MODULE_PREFIX, module_name, "." G_MODULE_SUFFIX, NULL);
 #endif
-  else if (k > 4 && g_ascii_strcasecmp (module_name + k - 4, ".dll") == 0)
+  } else if (k > G_MODULE_SUFFIX_LEN + 1 && g_ascii_strcasecmp (module_name + k - G_MODULE_SUFFIX_LEN - 1, "." G_MODULE_SUFFIX) == 0)
     return g_strdup (module_name);
 #ifdef G_WITH_CYGWIN
-  else if (strncmp (module_name, "lib", 3) == 0 || strncmp (module_name, "cyg", 3) == 0)
-    return g_strconcat (module_name, ".dll", NULL);
+  } else if (strncmp (module_name, "lib", 3) == 0 || strncmp (module_name, "cyg", 3) == 0)
+    return g_strconcat (module_name, "." G_MODULE_SUFFIX, NULL);
   else
-    return g_strconcat ("cyg", module_name, ".dll", NULL);
+    return g_strconcat ("cyg", module_name, "." G_MODULE_SUFFIX, NULL);
 #else
-  else if (strncmp (module_name, "lib", 3) == 0)
-    return g_strconcat (module_name, ".dll", NULL);
+  else if (strncmp (module_name, G_MODULE_PREFIX, G_MODULE_PREFIX_LEN) == 0)
+    return g_strconcat (module_name, "." G_MODULE_SUFFIX, NULL);
   else
-    return g_strconcat ("lib", module_name, ".dll", NULL);
+    return g_strconcat (G_MODULE_PREFIX, module_name, "." G_MODULE_SUFFIX, NULL);
 #endif
 }
+
