--- hints/darwin.sh.b	2009-04-14 11:38:15.000000000 -0700
+++ hints/darwin.sh	2010-06-23 12:25:58.000000000 -0700
@@ -134,7 +134,6 @@
 
 # Shared library extension is .dylib.
 # Bundle extension is .bundle.
-ld='cc';
 so='dylib';
 dlext='bundle';
 usedl='define';
@@ -172,6 +171,20 @@
    ldflags="${ldflags} -flat_namespace"
    lddlflags="${ldflags} -bundle -undefined suppress"
    ;;
+9.*)
+   lddlflags="${ldflags} -bundle -undefined dynamic_lookup"
+   case "$ld" in
+       *MACOSX_DEVELOPMENT_TARGET*) ;;
+       *) ld="env MACOSX_DEPLOYMENT_TARGET=10.5 ${ld}" ;;
+   esac
+   ;;
+10.*)
+   lddlflags="${ldflags} -bundle -undefined dynamic_lookup"
+   case "$ld" in
+       *MACOSX_DEVELOPMENT_TARGET*) ;;
+       *) ld="env MACOSX_DEPLOYMENT_TARGET=10.6 ${ld}" ;;
+   esac
+   ;;
 *) 
    lddlflags="${ldflags} -bundle -undefined dynamic_lookup"
    case "$ld" in
@@ -253,6 +266,10 @@
 ;;
 esac
 
+# When the bind9 port is installed, its libbind includes dups from
+# /usr/lib/libdl, so remove libbind
+libswanted=`echo $libswanted | sed 's/ bind / /'`
+
 ##
 # System libraries
 ##
