diff --git buildtools/wafsamba/samba_install.py buildtools/wafsamba/samba_install.py
index a43d103..eb2ee57 100644
--- buildtools/wafsamba/samba_install.py
+++ buildtools/wafsamba/samba_install.py
@@ -81,7 +81,7 @@ def install_library(self):
 
         target_name = self.target
 
-        if install_ldflags != build_ldflags:
+        if False:
             # we will be creating a new target name, and using that for the
             # install link. That stops us from overwriting the existing build
             # target, which has different ldflags
@@ -138,6 +138,13 @@ def install_library(self):
                 t.env.append_value('LINKFLAGS', t.env.SONAME_ST % install_name)
             t.env.SONAME_ST = ''
 
+        if '-dynamiclib' in t.env.LINKFLAGS_cshlib:
+            t.env.append_value('LINKFLAGS_cshlib', '-install_name')
+            if install_link:
+                t.env.append_value('LINKFLAGS_cshlib', os.path.join(install_path, install_link))
+            else:
+                t.env.append_value('LINKFLAGS_cshlib', os.path.join(install_path, install_name))
+
         # tell waf to install the library
         bld.install_as(os.path.join(install_path, install_name),
                        self.path.find_or_declare(inst_name),
