diff -ur ocaml-3.09.0.orig/byterun/Makefile ocaml-3.09.0/byterun/Makefile
--- ocaml-3.09.0.orig/byterun/Makefile	2005-10-18 15:03:52.000000000 +0100
+++ ocaml-3.09.0/byterun/Makefile	2005-11-15 19:12:54.000000000 +0000
@@ -29,6 +29,8 @@
 
 DOBJS=$(OBJS:.o=.d.o) instrtrace.d.o
 
+PICOBJS=$(OBJS:.o=.pic.o)
+
 PRIMS=alloc.c array.c compare.c extern.c floats.c gc_ctrl.c hash.c \
   intern.c interp.c ints.c io.c lexing.c md5.c meta.c obj.c parsing.c \
   signals.c str.c sys.c terminfo.c callback.c weak.c finalise.c stacks.c \
@@ -37,7 +39,12 @@
 PUBLIC_INCLUDES=alloc.h callback.h config.h custom.h fail.h intext.h \
   memory.h misc.h mlvalues.h printexc.h signals.h compatibility.h
 
+ifeq ($(SUPPORTS_SHARED_LIBRARIES),true)
+all: ocamlrun$(EXE) ld.conf libcamlrun.so
+else
 all: ocamlrun$(EXE) ld.conf
+endif
+
 
 ocamlrun$(EXE): libcamlrun.a prims.o
 	$(BYTECC) $(BYTECCCOMPOPTS) $(BYTECCLINKOPTS) -o ocamlrun$(EXE) \
@@ -51,6 +58,9 @@
 	cp ocamlrun$(EXE) $(BINDIR)/ocamlrun$(EXE)
 	cp libcamlrun.a $(LIBDIR)/libcamlrun.a
 	cd $(LIBDIR); $(RANLIB) libcamlrun.a
+ifeq ($(SUPPORTS_SHARED_LIBRARIES),true)
+	cp libcamlrun.so $(LIBDIR)/libcamlrun.so
+endif
 	if test -d $(LIBDIR)/caml; then : ; else mkdir $(LIBDIR)/caml; fi
 	for i in $(PUBLIC_INCLUDES); do \
           sed -f ../tools/cleanup-header $$i > $(LIBDIR)/caml/$$i; \
@@ -69,8 +79,11 @@
 	ar rc libcamlrund.a $(DOBJS)
 	$(RANLIB) libcamlrund.a
 
+libcamlrun.so: $(PICOBJS)
+	$(MKSHAREDLIB) $@ $(PICOBJS)
+
 clean:
-	rm -f ocamlrun$(EXE) ocamlrund$(EXE) *.o lib*.a
+	rm -f ocamlrun$(EXE) ocamlrund$(EXE) *.o lib*.a lib*.so
 	rm -f primitives prims.c opnames.h jumptbl.h ld.conf
 
 primitives : $(PRIMS)
@@ -105,7 +118,7 @@
             -e '/let *ocaml_version *= */s//#define OCAML_VERSION /p' \
             <../stdlib/sys.ml >version.h
 
-.SUFFIXES: .d.o
+.SUFFIXES: .d.o .pic.o
 
 .c.d.o:
 	@ if test -f $*.o; then mv $*.o $*.f.o; else :; fi
@@ -113,6 +126,12 @@
 	mv $*.o $*.d.o
 	@ if test -f $*.f.o; then mv $*.f.o $*.o; else :; fi
 
+.c.pic.o:
+	@ if test -f $*.o; then mv $*.o $*.f.o; else :; fi
+	$(CC) $(CFLAGS) $(SHAREDCCCOMPOPTS) -c $<
+	mv $*.o $*.pic.o
+	@ if test -f $*.f.o; then mv $*.f.o $*.o; else :; fi
+
 depend : prims.c opnames.h jumptbl.h version.h
 	gcc -MM $(BYTECCCOMPOPTS) *.c > .depend
 	gcc -MM $(BYTECCCOMPOPTS) -DDEBUG *.c | sed -e 's/\.o/.d.o/' >> .depend
