diff -urN ../mosml.orig/include/config.h ./include/config.h
--- ../mosml.orig/include/config.h	2004-01-19 15:02:21.000000000 +0000
+++ ./include/config.h	2008-12-03 11:39:56.000000000 +0000
@@ -2,7 +2,7 @@
 #define _config_
 
 
-#if defined(__MWERKS__) || defined(THINK_C)
+#if defined(__MWERKS__) || defined(THINK_C) || defined(LSB)
 #include "m.h"
 #include "s.h"
 #else
diff -urN ../mosml.orig/src/Makefile ./src/Makefile
--- ../mosml.orig/src/Makefile	2008-11-28 14:42:49.000000000 +0000
+++ ./src/Makefile	2008-12-09 17:09:12.000000000 +0000
@@ -25,6 +25,24 @@
 	cd lex; make all
 	cd launch; make all
 
+world-dyn:
+	cd dynlibs/msocket; make
+	cd dynlibs/crypt; make
+	cd dynlibs/munix; make
+	cd dynlibs/mregex; make
+	cd dynlibs/mgdbm; make
+	cd dynlibs/mgd; make
+	cd dynlibs/intinf; make
+
+install-world-dyn: dirs
+	cd dynlibs/msocket; make install
+	cd dynlibs/crypt; make install
+	cd dynlibs/munix; make install
+	cd dynlibs/mregex; make install
+	cd dynlibs/mgdbm; make install
+	cd dynlibs/mgd; make install
+	cd dynlibs/intinf; make install
+
 uptodate:
 	cd runtime; make all
 	cp runtime/camlrunm$(EXE) .
@@ -42,13 +60,15 @@
 	cd toolssrc; make clean all
 	cd lex; make clean all
 
-# Install the Mosml system
-install:
+dirs:
 	test -d $(BINDIR) || mkdir -p $(BINDIR)
 	test -d $(LIBDIR) || mkdir -p $(LIBDIR)
 	test -d $(INCDIR) || mkdir -p $(INCDIR)
 	test -d $(DOCDIR) || mkdir -p $(DOCDIR)
 	test -d $(TOOLDIR) || mkdir -p $(TOOLDIR)
+
+# Install the Mosml system
+install: dirs
 	cd runtime; make install
 	cd config; make install
 	cd launch; make all install
diff -urN ../mosml.orig/src/Makefile.inc ./src/Makefile.inc
--- ../mosml.orig/src/Makefile.inc	2008-11-28 14:42:49.000000000 +0000
+++ ./src/Makefile.inc	2008-12-09 17:24:00.000000000 +0000
@@ -30,9 +30,12 @@
 # For Linux (x86 or Alpha), use:
 # ------------------------------
 CPP=/usr/bin/cpp -P -traditional -Dunix -Umsdos
-STRIP=strip
-LD=gcc -rdynamic
-DYNLD=ld -shared
+STRIP=echo
+LD=gcc -Wl,-rpath -Wl,${DESTROOT}/lib/mosml
+DYNLD=gcc -bundle -bundle_loader ${DESTROOT}/bin/camlrunm
+ADDRUNLIBS=
+ADDRUNCFLAGS=
+ADDDYNLIBCFLAGS=-DLSB
 
 # For Cygwin 20.1, use:
 # ---------------------
diff -urN ../mosml.orig/src/dynlibs/crypt/Makefile ./src/dynlibs/crypt/Makefile
--- ../mosml.orig/src/dynlibs/crypt/Makefile	2000-02-16 15:36:57.000000000 +0000
+++ ./src/dynlibs/crypt/Makefile	2008-11-28 15:22:08.000000000 +0000
@@ -13,8 +13,10 @@
 	$(CC) $(CFLAGS) -c -o crypt.o crypt.c
 
 libcrypt.so: crypt.o
-	$(DYNLD) -lcrypt -o libcrypt.so crypt.o
-#	$(DYNLD)         -o libcrypt.so crypt.o
+	$(DYNLD)         -o libcrypt.so crypt.o
+
+install:
+	cp libcrypt.so $(LIBDIR)
 
 clean:
 	rm -f *.o
diff -urN ../mosml.orig/src/dynlibs/intinf/Makefile ./src/dynlibs/intinf/Makefile
--- ../mosml.orig/src/dynlibs/intinf/Makefile	2000-02-16 15:36:57.000000000 +0000
+++ ./src/dynlibs/intinf/Makefile	2008-12-09 17:58:03.000000000 +0000
@@ -5,12 +5,14 @@
 
 # Where to find GMP header file and compiled library
 
-GMPDIR=${HOME}/c/gmp-2.0.2
+GMPDIR=/opt/local
+GMPINCDIR=${GMPDIR}/include
+GMPLIBDIR=${GMPDIR}/lib
 
 include ../../Makefile.inc
 
 OPTS=-fno-defer-pop
-CFLAGS=-Dunix -O2 $(OPTS) $(ADDDYNLIBCFLAGS) -I$(INCDIR) -I ${GMPDIR}
+CFLAGS=-Dunix -O2 $(OPTS) $(ADDDYNLIBCFLAGS) -I$(INCDIR) -I ${GMPINCDIR}
 
 MOSMLTOOLS=camlrunm $(MOSMLHOME)/tools
 MOSMLC=mosmlc -c
@@ -18,16 +20,19 @@
 MOSMLLEX=mosmllex
 MOSMLYACC=mosmlyac
 
-all: libmgmp.so IntInf.uo
+all: libmgmp.so IntInf.uo IntInf.ui
 
-install:
+install: all
 	cp libmgmp.so $(LIBDIR)
+	cp IntInf.uo $(LIBDIR)
+	cp IntInf.ui $(LIBDIR)
+	cp IntInf.sig $(LIBDIR)
 
 intinf.o: intinf.c
 	$(CC) $(CFLAGS) -c -o intinf.o intinf.c
 
 libmgmp.so: intinf.o
-	$(DYNLD) -o libmgmp.so intinf.o ${GMPDIR}/libgmp.a
+	$(DYNLD) -o libmgmp.so intinf.o ${GMPLIBDIR}/libgmp.a
 
 test:
 	mosml testintinf.sml
diff -urN ../mosml.orig/src/dynlibs/mgd/Makefile ./src/dynlibs/mgd/Makefile
--- ../mosml.orig/src/dynlibs/mgd/Makefile	2000-02-23 17:11:42.000000000 +0000
+++ ./src/dynlibs/mgd/Makefile	2008-11-28 15:44:28.000000000 +0000
@@ -5,12 +5,13 @@
 
 # Where to find gd header file and compiled library
 
-GDDIR=${HOME}/c/gd-1.7.3
+GDINCDIR=/opt/local/include
+GDLIBDIR=/opt/local/lib
 
 include ../../Makefile.inc
 
 OPTS=-fno-defer-pop
-CFLAGS=-Dunix -O2 $(OPTS) $(ADDDYNLIBCFLAGS) -I$(INCDIR) -I ${GDDIR}
+CFLAGS=-Dunix -O2 $(OPTS) $(ADDDYNLIBCFLAGS) -I$(INCDIR) -I ${GDINCDIR}
 
 MOSMLTOOLS=camlrunm $(MOSMLHOME)/tools
 MOSMLC=mosmlc -c
@@ -24,7 +25,7 @@
 	$(CC) $(CFLAGS) -c -o mgd.o mgd.c
 
 libmgd.so: mgd.o
-	$(DYNLD) -o libmgd.so mgd.o ${GDDIR}/libgd.a -L/usr/X11R6/lib -lpng -lz
+	$(DYNLD) -o libmgd.so mgd.o ${GDLIBDIR}/libgd.a -L/usr/X11R6/lib -lpng -lz
 #	$(DYNLD) -o libmgd.so mgd.o ${GDDIR}/libgd.a -R/pack/libs/lib -L/pack/libs/lib -lpng -lz
 
 test: Graphs.uo
diff -urN ../mosml.orig/src/dynlibs/mgdbm/Makefile ./src/dynlibs/mgdbm/Makefile
--- ../mosml.orig/src/dynlibs/mgdbm/Makefile	2000-02-16 15:36:57.000000000 +0000
+++ ./src/dynlibs/mgdbm/Makefile	2008-11-28 15:42:39.000000000 +0000
@@ -5,10 +5,8 @@
 
 # Where to find GDBM header file and compiled library
 
-GDBMLIBDIR=${HOME}/c/gdbm-1.7.3
-GDBMINCDIR=${HOME}/c/gdbm-1.7.3
-#GDBMLIBDIR=/usr/lib
-#GDBMINCDIR=/usr/include
+GDBMLIBDIR=/opt/local/lib
+GDBMINCDIR=/opt/local/include
 
 include ../../Makefile.inc
 
diff -urN ../mosml.orig/src/dynlibs/munix/munix.c ./src/dynlibs/munix/munix.c
--- ../mosml.orig/src/dynlibs/munix/munix.c	2000-01-21 10:07:13.000000000 +0000
+++ ./src/dynlibs/munix/munix.c	2008-11-28 15:20:53.000000000 +0000
@@ -59,8 +59,8 @@
     failwith("EINVAL"); break;
   case EISDIR:
     failwith("EISDIR"); break;
-  case ELIBBAD:
-    failwith("ELIBBAD"); break;
+/*  case ELIBBAD:
+    failwith("ELIBBAD"); break; */
   case ECHILD:
     failwith("ECHILD"); break;
   case EINTR:
diff -urN ../mosml.orig/src/runtime/config.h ./src/runtime/config.h
--- ../mosml.orig/src/runtime/config.h	2000-01-21 10:07:13.000000000 +0000
+++ ./src/runtime/config.h	2008-12-08 14:59:31.000000000 +0000
@@ -2,7 +2,7 @@
 #define _config_
 
 
-#if defined(__MWERKS__) || defined(THINK_C)
+#if defined(__MWERKS__) || defined(THINK_C) || defined(LSB)
 #include "m.h"
 #include "s.h"
 #else
