--- Makefile.in.orig	2006-01-28 17:33:25.000000000 -0800
+++ Makefile.in	2006-01-28 17:33:33.000000000 -0800
@@ -1,6 +1,7 @@
 # Makefile used by configure to create real Makefile
 
 CC=@CC@
+SHLIB_EXT=@SHLIB_EXT@
 prefix=@prefix@
 exec_prefix = @exec_prefix@
 libexecdir = @libexecdir@
@@ -23,11 +24,12 @@
 SCRIPT = tsocks
 SHLIB_MAJOR = 1
 SHLIB_MINOR = 8
-SHLIB = ${LIB_NAME}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
+SHLIB = ${LIB_NAME}.${SHLIB_EXT}.${SHLIB_MAJOR}.${SHLIB_MINOR}
 
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 CFLAGS = @CFLAGS@
+LDFLAGS = @LDFLAGS@
 INCLUDES = -I.
 LIBS = @LIBS@
 SPECIALLIBS = @SPECIALLIBS@
@@ -47,11 +49,11 @@
 	${SHCC} ${CFLAGS} ${INCLUDES} -o ${INSPECT} ${INSPECT}.c ${COMMON}.o ${LIBS} 
 
 ${SAVE}: ${SAVE}.c
-	${SHCC} ${CFLAGS} ${INCLUDES} -static -o ${SAVE} ${SAVE}.c
+	${SHCC} ${CFLAGS} ${INCLUDES} -o ${SAVE} ${SAVE}.c
 
 ${SHLIB}: ${OBJS} ${COMMON}.o ${PARSER}.o
-	${SHCC} ${CFLAGS} ${INCLUDES} -nostdlib -shared -o ${SHLIB} ${OBJS} ${COMMON}.o ${PARSER}.o ${DYNLIB_FLAGS} ${SPECIALLIBS} ${LIBS}
-	ln -sf ${SHLIB} ${LIB_NAME}.so
+	${SHCC} ${CFLAGS} ${INCLUDES} -nostdlib ${LDFLAGS} -o ${SHLIB} ${OBJS} ${COMMON}.o ${PARSER}.o ${DYNLIB_FLAGS} ${SPECIALLIBS} ${LIBS}
+	ln -sf ${SHLIB} ${LIB_NAME}.${SHLIB_EXT}
 
 %.so: %.c
 	${SHCC} ${CFLAGS} ${INCLUDES} -c ${CC_SWITCHES} $< -o $@
@@ -68,8 +70,8 @@
 installlib:
 	${MKINSTALLDIRS} "${DESTDIR}${libdir}"
 	${INSTALL} ${SHLIB} ${DESTDIR}${libdir}
-	ln -sf ${SHLIB} ${DESTDIR}${libdir}/${LIB_NAME}.so.${SHLIB_MAJOR}
-	ln -sf ${LIB_NAME}.so.${SHLIB_MAJOR} ${DESTDIR}${libdir}/${LIB_NAME}.so
+	ln -sf ${SHLIB} ${DESTDIR}${libdir}/${LIB_NAME}.${SHLIB_EXT}.${SHLIB_MAJOR}
+	ln -sf ${LIB_NAME}.${SHLIB_EXT}.${SHLIB_MAJOR} ${DESTDIR}${libdir}/${LIB_NAME}.${SHLIB_EXT}
 
 installman:
 	${MKINSTALLDIRS} "${DESTDIR}${mandir}/man1"
@@ -80,7 +82,7 @@
 	${INSTALL_DATA} tsocks.conf.5 ${DESTDIR}${mandir}/man5/
 	
 clean:
-	-rm -f *.so *.so.* *.o *~ ${TARGETS}
+	-rm -f *.so *.so.* *.dylib *.dylib.* *.o *~ ${TARGETS}
 
 distclean: clean
 	-rm -f config.cache config.log config.h Makefile

