make/common/Program.gmk

Print this page

        

@@ -124,10 +124,30 @@
   endif # STATIC_JLI
   OTHER_LDLIBS += jli.lib
 endif # PLATFORM
 
 #
+# Applications expect to be able to link against libjawt without invoking
+# System.loadLibrary("jawt") first. This was the behaviour described in the
+# devloper documentation of JAWT and what worked with OpenJDK6.
+#
+ifeq ($(PLATFORM), solaris)
+  ifeq ($(ARCH_DATA_MODEL), 32)
+    LDFLAGS += -R \$$ORIGIN/../lib/$(LIBARCH)
+    LDFLAGS += -R \$$ORIGIN/../jre/lib/$(LIBARCH)
+  else # ! ARCH_DATA_MODEL 64-bit
+    LDFLAGS += -R \$$ORIGIN/../../lib/$(LIBARCH)
+    LDFLAGS += -R \$$ORIGIN/../../jre/lib/$(LIBARCH)
+  endif # ARCH_DATA_MODEL
+endif # PLATFORM SOLARIS
+ifeq ($(PLATFORM), linux)
+  LDFLAGS += -Wl,-rpath -Wl,\$$ORIGIN/../lib/$(LIBARCH)
+  LDFLAGS += -Wl,-rpath -Wl,\$$ORIGIN/../jre/lib/$(LIBARCH)
+endif # PLATFORM LINUX
+
+
+#
 # Launcher specific files.
 #
 FILES_o = $(OBJDIR)/main.$(OBJECT_SUFFIX)
 
 $(ACTUAL_PROGRAM):: classes $(INIT)