diff -rwub apt-0.5.4.orig/buildlib/environment.mak.in apt-0.5.4/buildlib/environment.mak.in
--- buildlib/environment.mak.in	Sun Apr 18 02:35:11 2004
+++ buildlib/environment.mak.in	Sun Apr 18 02:45:17 2004
@@ -50,7 +50,19 @@
 ifneq ($(words $(filter linux-gnu gnu%,$(HOST_OS))),0)
    SONAME_MAGIC=-Wl,-soname -Wl,
    LFLAGS_SO=
-else
+endif
+
+ifneq ($(words $(filter freebsd% %freebsd,$(HOST_OS))),0)
+   SONAME_MAGIC=-Wl,-soname -Wl,
+   LFLAGS_SO=
+endif
+
+ifneq ($(words $(filter darwin% %darwin,$(HOST_OS))),0)
+   SONAME_MAGIC=-install_name @PREFIX@/lib/
+   LFLAGS_SO=-dynamiclib
+endif
+
+ifndef SONAME_MAGIC
    # Do not know how to create shared libraries here.
    ONLYSTATICLIBS = yes
 endif
