Index: /trunk/src/VBox/Additions/x11/VBoxClient/Makefile.kmk
===================================================================
--- /trunk/src/VBox/Additions/x11/VBoxClient/Makefile.kmk	(revision 100575)
+++ /trunk/src/VBox/Additions/x11/VBoxClient/Makefile.kmk	(revision 100576)
@@ -200,40 +200,45 @@
 
 ifdef VBOX_WITH_VBOXCLIENT_LAZY_LOAD
+ # Macro for generating the lazy loading assembly stub loader for a specific .def file.
+ #
+ # @param 1  Absolute path of the .def file to use as a template.
+ # @param 2  The library name w/o suffix (e.g. "libFoo").
+ # @param 3  The library version, to be appended to the library .so name (e.g. "6.42" -> "libFoo.so.6.42").
+ define def_libToLazyLoad
+        VBoxClient_SOURCES += \
+		$$(VBoxClient_0_OUTDIR)/$(2)LazyLoad.asm
+        VBoxClient_CLEAN   += \
+		$$(VBoxClient_0_OUTDIR)/$(2).def \
+		$$(VBoxClient_0_OUTDIR)/$(2)LazyLoad.asm
+        $$$$(VBoxClient_0_OUTDIR)/$(2).def: \
+		$$(PATH_ROOT)/src/VBox/GuestHost/$(2).def $(MAKEFILE_CURRENT) | $$$$(dir $$@)
+		$$(call MSG_GENERATE,$(2).def,$$@,$$<)
+		$$(eval LIB_TO_LAZYLOAD_SUFF=$$$$(if $(3),$(SUFF_DLL).$(3),$(SUFF_DLL)))
+		$$(QUIET)$$(RM) -f $$@
+		$$(QUIET)$$(REDIRECT) -o $$@ -- $$(SED) -e "s+@VBOX_LAZYLOAD_DEF_LIB_STRING@+$(2)$$(LIB_TO_LAZYLOAD_SUFF)+g" $$(PATH_ROOT)/src/VBox/GuestHost/$(2).def
+        $$$$(VBoxClient_0_OUTDIR)/$(2)LazyLoad.asm: $$$$(VBoxClient_0_OUTDIR)/$(2).def $$(VBOX_DEF_2_LAZY_LOAD) | $$$$(dir $$@)
+		$$(call MSG_TOOL,VBoxDef2LazyLoad,VBoxClient,$$(VBoxClient_0_OUTDIR)/$(2).def -> $$@)
+		$$(QUIET)$$(RM) -f -- "$$@"
+		$$(QUIET)$$(VBOX_DEF_2_LAZY_LOAD) --system --library $(2)$(SUFF_DLL).$(3) --output "$$@" $$(VBoxClient_0_OUTDIR)/$(2).def
+ endef # VBOXCLIENT_LAZYLOAD_GEN_ASM_FN
+
  VBoxClient_DEFS    += VBOX_WITH_VBOXCLIENT_LAZY_LOAD
- # Dynamic import no. 1: libX11.so.6
- VBoxClient_SOURCES += \
- 	$(VBoxClient_0_OUTDIR)/libX11LazyLoad.asm
- VBoxClient_CLEAN         += $(VBoxClient_0_OUTDIR)/libX11LazyLoad.asm
- $$(VBoxClient_0_OUTDIR)/libX11LazyLoad.asm: $(PATH_ROOT)/src/VBox/GuestHost/libX11.def $(VBOX_DEF_2_LAZY_LOAD) | $$(dir $$@)
-	$(call MSG_TOOL,VBoxDef2LazyLoad,VBoxClient,$(filter %.def, $^),$@)
-	$(QUIET)$(RM) -f -- "$@"
-	$(VBOX_DEF_2_LAZY_LOAD) --system --library libX11.so.6 --output "$@" $(filter %.def, $^)
-
- # Dynamic import no. 2: libXt.so.6
- VBoxClient_SOURCES += \
- 	$(VBoxClient_0_OUTDIR)/libXtLazyLoad.asm
- VBoxClient_CLEAN         += $(VBoxClient_0_OUTDIR)/libXtLazyLoad.asm
- $$(VBoxClient_0_OUTDIR)/libXtLazyLoad.asm: $(PATH_ROOT)/src/VBox/GuestHost/libXt.def $(VBOX_DEF_2_LAZY_LOAD) | $$(dir $$@)
-	$(call MSG_TOOL,VBoxDef2LazyLoad,VBoxClient,$(filter %.def, $^),$@)
-	$(QUIET)$(RM) -f -- "$@"
-	$(VBOX_DEF_2_LAZY_LOAD) --system --library libXt.so.6 --output "$@" $(filter %.def, $^)
-
- # Dynamic import no. 3: libXmu.so.6
- VBoxClient_SOURCES += \
- 	$(VBoxClient_0_OUTDIR)/libXmuLazyLoad.asm
- VBoxClient_CLEAN         += $(VBoxClient_0_OUTDIR)/libXmuLazyLoad.asm
- $$(VBoxClient_0_OUTDIR)/libXmuLazyLoad.asm: $(PATH_ROOT)/src/VBox/GuestHost/libXmu.def $(VBOX_DEF_2_LAZY_LOAD) | $$(dir $$@)
-	$(call MSG_TOOL,VBoxDef2LazyLoad,VBoxClient,$(filter %.def, $^),$@)
-	$(QUIET)$(RM) -f -- "$@"
-	$(VBOX_DEF_2_LAZY_LOAD) --system --library libXmu.so.6 --output "$@" $(filter %.def, $^)
-
- # Dynamic import no. 4: libXrandr.so.2
- VBoxClient_SOURCES += \
- 	$(VBoxClient_0_OUTDIR)/libXrandrLazyLoad.asm
- VBoxClient_CLEAN         += $(VBoxClient_0_OUTDIR)/libXrandrLazyLoad.asm
- $$(VBoxClient_0_OUTDIR)/libXrandrLazyLoad.asm: $(PATH_ROOT)/src/VBox/GuestHost/libXrandr.def $(VBOX_DEF_2_LAZY_LOAD) | $$(dir $$@)
-	$(call MSG_TOOL,VBoxDef2LazyLoad,VBoxClient,$(filter %.def, $^),$@)
-	$(QUIET)$(RM) -f -- "$@"
-	$(VBOX_DEF_2_LAZY_LOAD) --system --library libXrandr.so.2 --output "$@" $(filter %.def, $^)
+
+ # Define library versions to use, depending on the OS we build for.
+ # Note: Solaris does *not* have any of those libs with a version suffix, so simply keep those empty (= unset) then.
+ if1of ($(KBUILD_TARGET), linux)
+  LIBX11_VER=6
+  LIBXT_VER=6
+  LIBXMU_VER=6
+  LIBXRANDR_VER=2
+ endif
+ ## Dynamic import no. 1: libX11.so.6
+ $(evalcall2 def_libToLazyLoad,$(PATH_ROOT)/src/VBox/GuestHost/libX11.def,libX11,$(LIBX11_VER))
+ ## Dynamic import no. 2: libXt.so.6
+ $(evalcall2 def_libToLazyLoad,$(PATH_ROOT)/src/VBox/GuestHost/libXt.def,libXt,$(LIBXT_VER))
+ ## Dynamic import no. 3: libXmu.so.6
+ $(evalcall2 def_libToLazyLoad,$(PATH_ROOT)/src/VBox/GuestHost/libXmu.def,libXmu,$(LIBXMU_VER))
+ ## Dynamic import no. 4: libXrandr.so.2
+ $(evalcall2 def_libToLazyLoad,$(PATH_ROOT)/src/VBox/GuestHost/libXrandr.def,libXrandr,$(LIBXRANDR_VER))
 endif
 
Index: /trunk/src/VBox/GuestHost/libX11.def
===================================================================
--- /trunk/src/VBox/GuestHost/libX11.def	(revision 100575)
+++ /trunk/src/VBox/GuestHost/libX11.def	(revision 100576)
@@ -26,5 +26,5 @@
 ;
 
-LIBRARY libX11.so.6
+LIBRARY @VBOX_LAZYLOAD_DEF_LIB_STRING@
 EXPORTS
     _XData32
Index: /trunk/src/VBox/GuestHost/libXmu.def
===================================================================
--- /trunk/src/VBox/GuestHost/libXmu.def	(revision 100575)
+++ /trunk/src/VBox/GuestHost/libXmu.def	(revision 100576)
@@ -25,6 +25,5 @@
 ; SPDX-License-Identifier: GPL-3.0-only
 ;
-LIBRARY libXmu.so.6
+LIBRARY @VBOX_LAZYLOAD_DEF_LIB_STRING@
 EXPORTS
     XmuClientWindow
-
Index: /trunk/src/VBox/GuestHost/libXrandr.def
===================================================================
--- /trunk/src/VBox/GuestHost/libXrandr.def	(revision 100575)
+++ /trunk/src/VBox/GuestHost/libXrandr.def	(revision 100576)
@@ -25,5 +25,5 @@
 ; SPDX-License-Identifier: GPL-3.0-only
 ;
-LIBRARY libXrandr.so.2
+LIBRARY @VBOX_LAZYLOAD_DEF_LIB_STRING@
 EXPORTS
     XRRAddOutputMode
@@ -48,3 +48,2 @@
     XRRSetScreenSize
     XRRUpdateConfiguration
-
Index: /trunk/src/VBox/GuestHost/libXt.def
===================================================================
--- /trunk/src/VBox/GuestHost/libXt.def	(revision 100575)
+++ /trunk/src/VBox/GuestHost/libXt.def	(revision 100576)
@@ -25,5 +25,5 @@
 ; SPDX-License-Identifier: GPL-3.0-only
 ;
-LIBRARY libXt.so.6
+LIBRARY @VBOX_LAZYLOAD_DEF_LIB_STRING@
 EXPORTS
     applicationShellWidgetClass         DATA
@@ -52,3 +52,2 @@
     XtVaAppCreateShell
     XtWindow
-
