changeset 1735:938129c1ba84

Attempt to dlopen unversioned shared libs after versioned ones fail. Fixes gtk look and feel on OpenBSD which has different major shlib versions.
author kurt
date Tue, 06 Oct 2009 22:08:00 -0400
parents b436a71e29d5
children e8bba2ae9acc
files src/solaris/native/sun/awt/awt_GraphicsEnv.c src/solaris/native/sun/awt/gtk2_interface.c src/solaris/native/sun/xawt/awt_Desktop.c
diffstat 3 files changed, 28 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/solaris/native/sun/awt/awt_GraphicsEnv.c	Tue Oct 06 22:05:07 2009 -0400
+++ b/src/solaris/native/sun/awt/awt_GraphicsEnv.c	Tue Oct 06 22:08:00 2009 -0400
@@ -428,6 +428,11 @@
     {
         xrenderLibHandle = dlopen("libXrender.so.1", RTLD_LAZY | RTLD_GLOBAL);
 
+        if (xrenderLibHandle == NULL) {
+            xrenderLibHandle = dlopen("libXrender.so",
+                                      RTLD_LAZY | RTLD_GLOBAL);
+        }
+
 #ifndef __linux__ /* SOLARIS */
         if (xrenderLibHandle == NULL) {
             xrenderLibHandle = dlopen("/usr/sfw/lib/libXrender.so.1",
--- a/src/solaris/native/sun/awt/gtk2_interface.c	Tue Oct 06 22:05:07 2009 -0400
+++ b/src/solaris/native/sun/awt/gtk2_interface.c	Tue Oct 06 22:08:00 2009 -0400
@@ -32,7 +32,8 @@
 #include "java_awt_Transparency.h"
 #include "jvm_md.h"
 
-#define GTK2_LIB VERSIONED_JNI_LIB_NAME("gtk-x11-2.0", "0")
+#define GTK2_LIB_VERSIONED VERSIONED_JNI_LIB_NAME("gtk-x11-2.0", "0")
+#define GTK2_LIB JNI_LIB_NAME("gtk-x11-2.0")
 
 #define G_TYPE_INVALID                  G_TYPE_MAKE_FUNDAMENTAL (0)
 #define G_TYPE_NONE                     G_TYPE_MAKE_FUNDAMENTAL (1)
@@ -398,9 +399,12 @@
         void *lib = NULL;
         gboolean result = FALSE;
 
-        lib = dlopen(GTK2_LIB, RTLD_LAZY | RTLD_LOCAL);
+        lib = dlopen(GTK2_LIB_VERSIONED, RTLD_LAZY | RTLD_LOCAL);
         if (lib == NULL) {
-            return FALSE;
+            lib = dlopen(GTK2_LIB, RTLD_LAZY | RTLD_LOCAL);
+            if (lib == NULL) {
+                return FALSE;
+            }
         }
 
         fp_gtk_check_version = dlsym(lib, "gtk_check_version");
@@ -423,9 +427,12 @@
     int (*io_handler)();
     char *gtk_modules_env;
 
-    gtk2_libhandle = dlopen(GTK2_LIB, RTLD_LAZY | RTLD_LOCAL);
-    if (gtk2_libhandle == NULL)
-        return FALSE;
+    gtk2_libhandle = dlopen(GTK2_LIB_VERSIONED, RTLD_LAZY | RTLD_LOCAL);
+    if (gtk2_libhandle == NULL) {
+        gtk2_libhandle = dlopen(GTK2_LIB, RTLD_LAZY | RTLD_LOCAL);
+        if (gtk2_libhandle == NULL)
+            return FALSE;
+    }
 
     if (setjmp(j) == 0)
     {
--- a/src/solaris/native/sun/xawt/awt_Desktop.c	Tue Oct 06 22:05:07 2009 -0400
+++ b/src/solaris/native/sun/xawt/awt_Desktop.c	Tue Oct 06 22:08:00 2009 -0400
@@ -39,10 +39,13 @@
 
     vfs_handle = dlopen(VERSIONED_JNI_LIB_NAME("gnomevfs-2", "0"), RTLD_LAZY);
     if (vfs_handle == NULL) {
+        vfs_handle = dlopen(JNI_LIB_NAME("gnomevfs-2"), RTLD_LAZY);
+        if (vfs_handle == NULL) {
 #ifdef INTERNAL_BUILD
-        fprintf(stderr, "can not load libgnomevfs-2.so\n");
+            fprintf(stderr, "can not load libgnomevfs-2.so\n");
 #endif
-        return 0;
+            return 0;
+        }
     }
     dlerror(); /* Clear errors */
     gnome_vfs_init = dlsym(vfs_handle, "gnome_vfs_init");
@@ -57,10 +60,13 @@
 
     gnome_handle = dlopen(VERSIONED_JNI_LIB_NAME("gnome-2", "0"), RTLD_LAZY);
     if (gnome_handle == NULL) {
+        gnome_handle = dlopen(JNI_LIB_NAME("gnome-2"), RTLD_LAZY);
+        if (gnome_handle == NULL) {
 #ifdef INTERNAL_BUILD
-        fprintf(stderr, "can not load libgnome-2.so\n");
+            fprintf(stderr, "can not load libgnome-2.so\n");
 #endif
-        return 0;
+            return 0;
+        }
     }
     dlerror(); /* Clear errors */
     gnome_url_show = dlsym(gnome_handle, "gnome_url_show");