diff --git a/bin/smartlink b/bin/smartlink
index c7076424dc06c4ea551f714d27f4fbd6481603f6..f78db6ac4c3da5fb08b06f0abde0df86ddc48d61 100755
--- a/bin/smartlink
+++ b/bin/smartlink
@@ -176,6 +176,17 @@ if test x$# != x0 ; then
        LDOPTS="$LDOPTS -Xlinker -YP, -Xlinker $RPATH"
      fi
    ;;
+   Darwin\ *|NetBSD\ *)
+    if test x$LINKING != xno -a "x$RPATH" != x ; then
+      OIFS="$IFS"
+      IFS=":"
+      RPP="$PATH"
+      for RP in $RPATH ; do
+       LDOPTS="$LDOPTS -Wl,-rpath,$RP"
+     done
+     IFS="$OIFS"
+     fi
+   ;;
    *)
     LD_LIBRARY_PATH="$RPATH"
     LD_RUN_PATH="$RPATH"