#! /bin/sh /usr/share/dpatch/dpatch-run
## 08_CEGUI_Dynamic.dpatch by Vincent Fourmond <fourmond@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: A patch for CEGUIDynamicModule.cpp

@DPATCH@

--- cegui-mk2-0.6.2/build-tree/cegui_mk2/src/CEGUIDynamicModule.cpp	2009-04-29 00:05:28.000000000 -0430
+++ CEGUIDynamicModule.cpp	2009-04-29 00:06:57.000000000 -0430
@@ -89,7 +89,17 @@
             d_moduleName.insert(0, "lib");
             d_handle = DYNLIB_LOAD(d_moduleName.c_str());
         }
-    }
+       // We try looking for ".soversion" suffix
+       if(!d_handle) {
+         char buf[10];
+         for(int i = 0; i < 10; i++) { // The 10 is arbitrary and must be changed
+           snprintf(buf, sizeof(buf),".%d", i);
+           d_handle = DYNLIB_LOAD((d_moduleName + buf).c_str());
+           if(d_handle)
+             break;
+         }
+       }
+     }
 #endif
 
     // check for library load failure
