[cogl] Specify the full filename when g_module_open'ing the GL library



commit 03c4b20931438cc0387b1b8fe2dca26aafefbb0f
Author: Neil Roberts <neil linux intel com>
Date:   Mon Jul 18 18:07:06 2011 +0100

    Specify the full filename when g_module_open'ing the GL library
    
    Instead of using g_module_build_path with the short name of the GL
    library (eg, "GL") and relying on glib to add the suffix and prefix,
    the configure script now directly encodes the full name including the
    version number (eg, "libGL.so.1"). This is necessary because distros
    don't always install the non-versioned suffix for the library.
    
    The GLES libraries are left without the version suffix because it's
    not clear what should be placed here and I can't find any
    documentation from Khronos to clarify this. Mesa seems to install a
    file called libGLESv2.so.2 but the IMG SDK doesn't install any
    versioned library. There is an example of dynamically loading
    libGLESv2 in the Chromium source code and that does not use the
    version suffix even though it does use the version suffix for GL. This
    implies that it's at least fairly normal to load the unversioned name
    for GLES.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=654593

 cogl/cogl-renderer.c          |   10 +---------
 cogl/winsys/cogl-winsys-glx.c |    8 +-------
 configure.ac                  |   12 ++++++------
 3 files changed, 8 insertions(+), 22 deletions(-)
---
diff --git a/cogl/cogl-renderer.c b/cogl/cogl-renderer.c
index 8b76a77..be73adf 100644
--- a/cogl/cogl-renderer.c
+++ b/cogl/cogl-renderer.c
@@ -177,9 +177,6 @@ _cogl_renderer_choose_driver (CoglRenderer *renderer,
 {
   const char *driver_name = g_getenv ("COGL_DRIVER");
   const char *libgl_name;
-#ifndef HAVE_DIRECTLY_LINKED_GL_LIBRARY
-  char *libgl_module_path;
-#endif
 
 #ifdef HAVE_COGL_GL
   if (driver_name == NULL || !strcmp (driver_name, "gl"))
@@ -218,14 +215,9 @@ _cogl_renderer_choose_driver (CoglRenderer *renderer,
 
 #ifndef HAVE_DIRECTLY_LINKED_GL_LIBRARY
 
-  libgl_module_path = g_module_build_path (NULL, /* standard lib search path */
-                                           libgl_name);
-
-  renderer->libgl_module = g_module_open (libgl_module_path,
+  renderer->libgl_module = g_module_open (libgl_name,
                                           G_MODULE_BIND_LAZY);
 
-  g_free (libgl_module_path);
-
   if (renderer->libgl_module == NULL)
     {
       g_set_error (error, COGL_DRIVER_ERROR,
diff --git a/cogl/winsys/cogl-winsys-glx.c b/cogl/winsys/cogl-winsys-glx.c
index 17ac612..12d7a54 100644
--- a/cogl/winsys/cogl-winsys-glx.c
+++ b/cogl/winsys/cogl-winsys-glx.c
@@ -333,7 +333,6 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
 {
   CoglGLXRenderer *glx_renderer;
   CoglXlibRenderer *xlib_renderer;
-  char *libgl_module_path;
 
   renderer->winsys = g_slice_new0 (CoglGLXRenderer);
 
@@ -343,14 +342,9 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
   if (!_cogl_xlib_renderer_connect (renderer, error))
     goto error;
 
-  libgl_module_path = g_module_build_path (NULL, /* standard lib search path */
-                                           COGL_GL_LIBNAME);
-
-  glx_renderer->libgl_module = g_module_open (libgl_module_path,
+  glx_renderer->libgl_module = g_module_open (COGL_GL_LIBNAME,
                                               G_MODULE_BIND_LAZY);
 
-  g_free (libgl_module_path);
-
   if (glx_renderer->libgl_module == NULL)
     {
       g_set_error (error, COGL_WINSYS_ERROR,
diff --git a/configure.ac b/configure.ac
index 7162838..a31d65f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -387,7 +387,7 @@ AS_IF([test "x$enable_gles1" = "xyes"],
 
         PKG_CHECK_EXISTS([glesv1_cm],
           [COGL_PKG_REQUIRES_GL="$COGL_PKG_REQUIRES_GL glesv1_cm"
-           COGL_GLES1_LIBNAME="GLESv1_CM"
+           COGL_GLES1_LIBNAME="libGLESv1_CM.so"
            NEED_EGL=yes
           ],
           [
@@ -430,10 +430,10 @@ AS_IF([test "x$enable_gles1" = "xyes"],
             # bundles the GLES and EGL API together and -lGLESv1_CM
             # would be used for a standalone GLES API.
             AC_CHECK_LIB(GLES_CM, [eglInitialize],
-              [COGL_GLES1_LIBNAME="GLES_CM"],
+              [COGL_GLES1_LIBNAME="libGLES_CM.so"],
               [
                 AC_CHECK_LIB(GLESv1_CM, [glFlush],
-                  [COGL_GLES1_LIBNAME="GLESv1_CM"
+                  [COGL_GLES1_LIBNAME="libGLESv1_CM.so"
                    NEED_SEPARATE_EGL=yes
                   ],
                   [AC_MSG_ERROR([Unable to locate required GLES 1.x Common Profile library])])
@@ -463,7 +463,7 @@ AS_IF([test "x$enable_gles2" = "xyes"],
 
         PKG_CHECK_EXISTS([glesv2],
           [COGL_PKG_REQUIRES_GL="$COGL_PKG_REQUIRES_GL glesv2"
-           COGL_GLES2_LIBNAME="GLESv2"
+           COGL_GLES2_LIBNAME="libGLESv2.so"
           ],
           [
             # We have to check the two headers independently as GLES2/gl2ext.h
@@ -477,7 +477,7 @@ AS_IF([test "x$enable_gles2" = "xyes"],
                             [AC_MSG_ERROR([Unable to locate GLES2/gl2ext.h])],
                             [#include <GLES2/gl2.h>])
 
-            COGL_GLES2_LIBNAME="GLESv2"
+            COGL_GLES2_LIBNAME="libGLESv2.so"
           ])
 
         NEED_EGL=yes
@@ -527,7 +527,7 @@ AS_IF([test "x$enable_gl" = "xyes"],
 				,
 				[AC_MSG_ERROR([Unable to locate required GL library])])
 		  ])
-                COGL_GL_LIBNAME="GL"
+                COGL_GL_LIBNAME="libGL.so.1"
 	      ])
 
         AC_DEFINE([HAVE_COGL_GL], [1], [Have GL for rendering])



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]