Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Enrico Weigelt <weigelt@metux.de>
To: caml-list@inria.fr
Subject: Re: [Caml-list] crosscompile problem
Date: Fri, 26 Aug 2005 21:50:48 +0200	[thread overview]
Message-ID: <20050826195048.GA1534@nibiru.local> (raw)
In-Reply-To: <20050826134238.GB8648@localhost>

[-- Attachment #1: Type: text/plain, Size: 1231 bytes --]


Hi folks,


I've now identified an really, really ugly problem:

Some parts of the package use an self-contained binary for
building. This absolutely breaks every cross compiling approach.

Either we need to build it twice - once for the build process
and once for the target system (we have to be very careful to
use the right toolchain everytime) or we splitt it off into
several packages, which are build separately and have the 
caml compiler stuff as an built-tool dependency (= required
on the building system), such as ie. make+friends.


BTW: here's my current state ...

I can now (partially) cross-compile - this works because 
both systems are quite compatible. But it will fail when
building for some incompatible target.



cu
-- 
---------------------------------------------------------------------
 Enrico Weigelt    ==   metux IT service

  phone:     +49 36207 519931         www:       http://www.metux.de/
  fax:       +49 36207 519932         email:     contact@metux.de
  cellphone: +49 174 7066481
---------------------------------------------------------------------
 -- DSL ab 0 Euro. -- statische IP -- UUCP -- Hosting -- Webshops --
---------------------------------------------------------------------

[-- Attachment #2: configure.diff --]
[-- Type: text/plain, Size: 66727 bytes --]

diff -ruN ocaml-3.08.4.orig/Makefile ocaml-3.08.4/Makefile
--- ocaml-3.08.4.orig/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/Makefile	Fri Aug 26 05:29:38 2005
@@ -232,24 +232,24 @@
 
 # Installation
 install: FORCE
-	if test -d $(BINDIR); then : ; else $(MKDIR) $(BINDIR); fi
-	if test -d $(LIBDIR); then : ; else $(MKDIR) $(LIBDIR); fi
-	if test -d $(STUBLIBDIR); then : ; else $(MKDIR) $(STUBLIBDIR); fi
-	if test -d $(MANDIR)/man$(MANEXT); then : ; else $(MKDIR) $(MANDIR)/man$(MANEXT); fi
-	cd $(LIBDIR); rm -f dllbigarray.so dlllabltk.so dllnums.so \
+	mkdir -p $(DESTDIR)$(BINDIR)
+	mkdir -p $(DESTDIR)$(LIBDIR)
+	mkdir -p $(DESTDIR)$(STUBLIBDIR)
+	mkdir -p $(DESTDIR)$(MANDIR)/man$(MANEXT)
+	cd $(DESTDIR)$(LIBDIR) && rm -f dllbigarray.so dlllabltk.so dllnums.so \
           dllthreads.so dllunix.so dllgraphics.so dllmldbm.so dllstr.so \
           dlltkanim.so
 	cd byterun; $(MAKE) install
-	cp ocamlc $(BINDIR)/ocamlc$(EXE)
-	cp ocaml $(BINDIR)/ocaml$(EXE)
+	cp ocamlc $(DESTDIR)$(BINDIR)/ocamlc$(EXE)
+	cp ocaml $(DESTDIR)$(BINDIR)/ocaml$(EXE)
 	cd stdlib; $(MAKE) install
-	cp lex/ocamllex $(BINDIR)/ocamllex$(EXE)
-	cp yacc/ocamlyacc$(EXE) $(BINDIR)/ocamlyacc$(EXE)
-	cp toplevel/toplevellib.cma $(LIBDIR)/toplevellib.cma
-	cp expunge $(LIBDIR)/expunge$(EXE)
-	cp typing/outcometree.cmi typing/outcometree.mli $(LIBDIR)
-	cp toplevel/topstart.cmo $(LIBDIR)
-	cp toplevel/toploop.cmi toplevel/topdirs.cmi toplevel/topmain.cmi $(LIBDIR)
+	cp lex/ocamllex $(DESTDIR)$(BINDIR)/ocamllex$(EXE)
+	cp yacc/ocamlyacc$(EXE) $(DESTDIR)$(BINDIR)/ocamlyacc$(EXE)
+	cp toplevel/toplevellib.cma $(DESTDIR)$(LIBDIR)/toplevellib.cma
+	cp expunge $(DESTDIR)$(LIBDIR)/expunge$(EXE)
+	cp typing/outcometree.cmi typing/outcometree.mli $(DESTDIR)$(LIBDIR)
+	cp toplevel/topstart.cmo $(DESTDIR)$(LIBDIR)
+	cp toplevel/toploop.cmi toplevel/topdirs.cmi toplevel/topmain.cmi $(DESTDIR)$(LIBDIR)
 	cd tools; $(MAKE) install
 	-cd man; $(MAKE) install
 	for i in $(OTHERLIBRARIES); do \
@@ -263,17 +263,18 @@
 
 # Installation of the native-code compiler
 installopt:
+	mkdir -p $(DESTDIR)$(BINDIR)
 	cd asmrun; $(MAKE) install
-	cp ocamlopt $(BINDIR)/ocamlopt$(EXE)
+	cp ocamlopt $(DESTDIR)$(BINDIR)/ocamlopt$(EXE)
 	cd stdlib; $(MAKE) installopt
 	cd ocamldoc; $(MAKE) installopt
 	for i in $(OTHERLIBRARIES); do (cd otherlibs/$$i; $(MAKE) installopt) || exit $$?; done
 	if test -f ocamlc.opt; \
-	  then cp ocamlc.opt $(BINDIR)/ocamlc.opt$(EXE); else :; fi
+	  then cp ocamlc.opt $(DESTDIR)$(BINDIR)/ocamlc.opt$(EXE); else :; fi
 	if test -f ocamlopt.opt; \
-	  then cp ocamlopt.opt $(BINDIR)/ocamlopt.opt$(EXE); else :; fi
+	  then cp ocamlopt.opt $(DESTDIR)$(BINDIR)/ocamlopt.opt$(EXE); else :; fi
 	if test -f lex/ocamllex.opt; \
-	  then cp lex/ocamllex.opt $(BINDIR)/ocamllex.opt$(EXE); else :; fi
+	  then cp lex/ocamllex.opt $(DESTDIR)$(BINDIR)/ocamllex.opt$(EXE); else :; fi
 
 clean:: partialclean
 
diff -ruN ocaml-3.08.4.orig/asmrun/Makefile ocaml-3.08.4/asmrun/Makefile
--- ocaml-3.08.4.orig/asmrun/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/asmrun/Makefile	Fri Aug 26 06:22:23 2005
@@ -58,15 +58,17 @@
 install: install-default install-$(PROFILING)
 
 install-default:
-	cp libasmrun.a $(LIBDIR)/libasmrun.a
-	cd $(LIBDIR); $(RANLIB) libasmrun.a
+	mkdir -p $(DESTDIR)$(LIBDIR)
+	cp libasmrun.a $(DESTDIR)$(LIBDIR)/libasmrun.a
+	cd $(DESTDIR)$(LIBDIR) && $(RANLIB) libasmrun.a
 
 install-noprof:
 	rm -f $(LIBDIR)/libasmrunp.a; ln -s libasmrun.a $(LIBDIR)/libasmrunp.a
 
 install-prof:
-	cp libasmrunp.a $(LIBDIR)/libasmrunp.a
-	cd $(LIBDIR); $(RANLIB) libasmrunp.a
+	mkdir -p $(DESTDIR)$(LIBDIR)
+	cp libasmrunp.a $(DESTDIR)$(LIBDIR)/libasmrunp.a
+	cd $(DESTDIR)$(LIBDIR) && $(RANLIB) libasmrunp.a
 
 power.o: power-$(SYSTEM).o
 	cp power-$(SYSTEM).o power.o
@@ -181,9 +183,9 @@
 	rm -f *.o *.a *~
 
 depend: $(COBJS:.o=.c) ${LINKEDFILES}
-	gcc -MM $(FLAGS) *.c > .depend
-	gcc -MM $(FLAGS) -DDEBUG *.c | sed -e 's/\.o/.d.o/' >> .depend
-	gcc -MM $(FLAGS) -DDEBUG *.c | sed -e 's/\.o/.p.o/' >> .depend
+	$(CC) -MM $(FLAGS) *.c > .depend
+	$(CC) -MM $(FLAGS) -DDEBUG *.c | sed -e 's/\.o/.d.o/' >> .depend
+	$(CC) -MM $(FLAGS) -DDEBUG *.c | sed -e 's/\.o/.p.o/' >> .depend
 
 include .depend
 
diff -ruN ocaml-3.08.4.orig/byterun/Makefile ocaml-3.08.4/byterun/Makefile
--- ocaml-3.08.4.orig/byterun/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/byterun/Makefile	Fri Aug 26 12:15:17 2005
@@ -48,12 +48,12 @@
 	          prims.o libcamlrund.a $(BYTECCLIBS)
 
 install:
-	cp ocamlrun$(EXE) $(BINDIR)/ocamlrun$(EXE)
-	cp libcamlrun.a $(LIBDIR)/libcamlrun.a
-	cd $(LIBDIR); $(RANLIB) libcamlrun.a
-	if test -d $(LIBDIR)/caml; then : ; else mkdir $(LIBDIR)/caml; fi
+	mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(LIBDIR)/caml
+	cp ocamlrun$(EXE) $(DESTDIR)$(BINDIR)/ocamlrun$(EXE)
+	cp libcamlrun.a $(DESTDIR)$(LIBDIR)/libcamlrun.a
+	cd $(DESTDIR)$(LIBDIR) && $(RANLIB) libcamlrun.a
 	for i in $(PUBLIC_INCLUDES); do \
-          sed -f ../tools/cleanup-header $$i > $(LIBDIR)/caml/$$i; \
+          sed -f ../tools/cleanup-header $$i > $(DESTDIR)$(LIBDIR)/caml/$$i; \
         done
 	cp ld.conf $(LIBDIR)/ld.conf
 
@@ -110,7 +110,7 @@
 	@ if test -f $*.f.o; then mv $*.f.o $*.o; else :; fi
 
 depend : prims.c opnames.h jumptbl.h
-	gcc -MM $(BYTECCCOMPOPTS) *.c > .depend
-	gcc -MM $(BYTECCCOMPOPTS) -DDEBUG *.c | sed -e 's/\.o/.d.o/' >> .depend
+	$(CC) -MM $(BYTECCCOMPOPTS) *.c > .depend
+	$(CC) -MM $(BYTECCCOMPOPTS) -DDEBUG *.c | sed -e 's/\.o/.d.o/' >> .depend
 
 include .depend
diff -ruN ocaml-3.08.4.orig/camlp4/camlp4/Makefile ocaml-3.08.4/camlp4/camlp4/Makefile
--- ocaml-3.08.4.orig/camlp4/camlp4/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/camlp4/camlp4/Makefile	Fri Aug 26 06:03:53 2005
@@ -69,26 +69,25 @@
 	done
 
 install:
-	-$(MKDIR) "$(BINDIR)"
-	-$(MKDIR) "$(LIBDIR)/camlp4"
-	cp $(CAMLP4) "$(BINDIR)/."
-	cp mLast.mli quotation.mli ast2pt.mli pcaml.mli spretty.mli "$(LIBDIR)/camlp4/."
-	cp mLast.cmi quotation.cmi ast2pt.cmi pcaml.cmi spretty.cmi "$(LIBDIR)/camlp4/."
-	cp  argl.cmi argl.cmo "$(LIBDIR)/camlp4/."
+	mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR)/camlp4
+	cp $(CAMLP4) "$(DESTDIR)$(BINDIR)/."
+	cp mLast.mli quotation.mli ast2pt.mli pcaml.mli spretty.mli "$(DESTDIR)$(LIBDIR)/camlp4/."
+	cp mLast.cmi quotation.cmi ast2pt.cmi pcaml.cmi spretty.cmi "$(DESTDIR)$(LIBDIR)/camlp4/."
+	cp  argl.cmi argl.cmo "$(DESTDIR)$(LIBDIR)/camlp4/."
 	for f in argl.o argl.cmx; do \
 	  if test -r $$f ; then \
-		cp $$f "$(LIBDIR)/camlp4/." ; \
+		cp $$f "$(DESTDIR)$(LIBDIR)/camlp4/." ; \
 	  fi ; \
 	done
-	cp camlp4.cma $(LIBDIR)/camlp4/.
+	cp camlp4.cma $(DESTDIR)$(LIBDIR)/camlp4/.
 	for f in  camlp4.$(A)  camlp4.p.$(A) ; do \
 	  if test -f $$f ; then \
-	     cp $$f "$(LIBDIR)/camlp4/." && ( cd  "$(LIBDIR)/camlp4/." && $(RANLIB) $$f ) ; \
+	     cp $$f "$(DESTDIR)$(LIBDIR)/camlp4/." && ( cd  "$(DESTDIR)$(LIBDIR)/camlp4/." && $(RANLIB) $$f ) ; \
 	  fi ; \
 	done
 	for f in camlp4.cmxa camlp4.p.cmxa ; do \
 	  if test -f $$f ; then \
-	     cp $$f "$(LIBDIR)/camlp4/." ; \
+	     cp $$f "$(DESTDIR)$(LIBDIR)/camlp4/." ; \
 	  fi ; \
 	done
 
diff -ruN ocaml-3.08.4.orig/camlp4/compile/Makefile ocaml-3.08.4/camlp4/compile/Makefile
--- ocaml-3.08.4.orig/camlp4/compile/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/camlp4/compile/Makefile	Fri Aug 26 06:02:48 2005
@@ -30,8 +30,9 @@
 	OTOP=$(OTOP) EXE=$(EXE) ./compile.sh $(COMP_OPT) $(SRC) >> $D_fast.ml
 
 install:
-	if test -f camlp4$D.fast.opt; then cp camlp4$D.fast.opt $(BINDIR)/camlp4$D.opt$(EXE); fi
-	for TARG in  pa_$D_fast.cmi  pa_$D_fast.cmo pa_$D_fast.cmx ; do if test -f $$TARG; then cp $$TARG "$(LIBDIR)/camlp4/."; fi; done
+	mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR)/camlp4
+	if test -f camlp4$D.fast.opt; then cp camlp4$D.fast.opt $(DESTDIR)$(BINDIR)/camlp4$D.opt$(EXE); fi
+	for TARG in  pa_$D_fast.cmi  pa_$D_fast.cmo pa_$D_fast.cmx ; do if test -f $$TARG; then cp $$TARG "$(DESTDIR)$(LIBDIR)/camlp4/."; fi; done
 
 clean::
 	rm -f *.cm* *.pp[io] *.o *.bak .*.bak *.out *.opt
diff -ruN ocaml-3.08.4.orig/camlp4/etc/Makefile ocaml-3.08.4/camlp4/etc/Makefile
--- ocaml-3.08.4.orig/camlp4/etc/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/camlp4/etc/Makefile	Fri Aug 26 06:02:13 2005
@@ -68,19 +68,19 @@
 get_promote:
 
 install:
-	-$(MKDIR) "$(LIBDIR)/camlp4" "$(BINDIR)"
-	cp $(OBJS) "$(LIBDIR)/camlp4/."
-	cp $(INTF) "$(LIBDIR)/camlp4/."
-	cp camlp4o$(EXE) "$(BINDIR)/."
+	mkdir -p $(DESTDIR)$(LIBDIR)/camlp4 $(DESTDIR)$(BINDIR)
+	cp $(OBJS) "$(DESTDIR)$(LIBDIR)/camlp4/."
+	cp $(INTF) "$(DESTDIR)$(LIBDIR)/camlp4/."
+	cp camlp4o$(EXE) "$(DESTDIR)$(BINDIR)/."
 	if test -f camlp4o.opt; then \
-	  cp camlp4o.opt "$(BINDIR)/camlp4o.opt$(EXE)"; \
-	  cp $(OBJSX) "$(LIBDIR)/camlp4/."; \
+	  cp camlp4o.opt "$(DESTDIR)$(BINDIR)/camlp4o.opt$(EXE)"; \
+	  cp $(OBJSX) "$(DESTDIR)$(LIBDIR)/camlp4/."; \
 	  for file in $(OBJSX); do \
-	    cp "`echo $$file | sed -e 's/\.cmx$$/.$(O)/'`" "$(LIBDIR)/camlp4/."; \
+	    cp "`echo $$file | sed -e 's/\.cmx$$/.$(O)/'`" "$(DESTDIR)$(LIBDIR)/camlp4/."; \
 	  done ; \
 	fi
-	cp mkcamlp4.sh "$(BINDIR)/mkcamlp4"
-	chmod a+x "$(BINDIR)/mkcamlp4"
+	cp mkcamlp4.sh "$(DESTDIR)$(BINDIR)/mkcamlp4"
+	chmod a+x "$(DESTDIR)$(BINDIR)/mkcamlp4"
 
 pr_extend.cmo: pa_extfun.cmo
 pr_o.cmo: pa_extfun.cmo
diff -ruN ocaml-3.08.4.orig/camlp4/lib/Makefile ocaml-3.08.4/camlp4/lib/Makefile
--- ocaml-3.08.4.orig/camlp4/lib/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/camlp4/lib/Makefile	Fri Aug 26 06:01:16 2005
@@ -42,19 +42,20 @@
 	done
 
 install:
-	-$(MKDIR) "$(LIBDIR)/camlp4"
-	cp $(TARGET) *.mli "$(LIBDIR)/camlp4/."
-	cp *.cmi "$(LIBDIR)/camlp4/."
+	mkdir -p $(DESTDIR)$(LIBDIR)/camlp4
+	cp $(TARGET) *.mli "$(DESTDIR)$(LIBDIR)/camlp4/."
+	cp *.cmi "$(DESTDIR)$(LIBDIR)/camlp4/."
 	test -f $(TARGET:.cma=.cmxa) && $(MAKE) installopt LIBDIR="$(LIBDIR)" || true
 
 installopt:
+	mkdir -p $(DESTDIR)$(LIBDIR)/camlp4
 	for f in $(TARGET:.cma=.cmxa) $(TARGET:.cma=.p.cmxa) *.cmx ; do \
-		test -f $$f && cp $$f "$(LIBDIR)/camlp4/." || true ; \
+		test -f $$f && cp $$f "$(DESTDIR)$(LIBDIR)/camlp4/." || true ; \
 	done
 	# Special treatment for this one: some versions of make don't like $(A) in $(TARGET:.cma=.$(A)) 
 	target="`echo $(TARGET) | sed -e 's/\.cma$$/.$(A)/'`" ; \
 	   if test -f $$target ; then \
-	      cp $$target "$(LIBDIR)/camlp4/." && ( cd "$(LIBDIR)/camlp4/." && $(RANLIB) $$target ) \
+	      cp $$target "$(DESTDIR)$(LIBDIR)/camlp4/." && ( cd "$(DESTDIR)$(LIBDIR)/camlp4/." && $(RANLIB) $$target ) \
 	  fi
 
 include .depend
diff -ruN ocaml-3.08.4.orig/camlp4/man/Makefile ocaml-3.08.4/camlp4/man/Makefile
--- ocaml-3.08.4.orig/camlp4/man/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/camlp4/man/Makefile	Fri Aug 26 06:00:11 2005
@@ -15,12 +15,11 @@
 get_promote:
 
 install:
-	if test -n '$(MANDIR)'; then \
-	  $(MKDIR) $(MANDIR)/man1 ; \
-	  cp $(TARGET) $(MANDIR)/man1/. ; \
+	mkdir -p $(DESTDIR)$(MANDIR)/man1
+	cp $(TARGET) $(DESTDIR)$(MANDIR)/man1/. ; \
 	  for i in $(ALIASES); do \
-            rm -f $(MANDIR)/man1/$$i; \
-            echo '.so man1/$(TARGET)' > $(MANDIR)/man1/$$i; \
+            rm -f $(DESTDIR)$(MANDIR)/man1/$$i; \
+            echo '.so man1/$(TARGET)' > $(DESTDIR)$(MANDIR)/man1/$$i; \
           done; \
 	fi
 
diff -ruN ocaml-3.08.4.orig/camlp4/meta/Makefile ocaml-3.08.4/camlp4/meta/Makefile
--- ocaml-3.08.4.orig/camlp4/meta/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/camlp4/meta/Makefile	Fri Aug 26 05:59:26 2005
@@ -43,15 +43,15 @@
 	done
 
 install:
-	-$(MKDIR) "$(LIBDIR)/camlp4" "$(BINDIR)"
-	cp $(OBJS) "$(LIBDIR)/camlp4/."
-	cp pa_macro.cmi pa_extend.cmi "$(LIBDIR)/camlp4/."
-	cp camlp4r$(EXE) "$(BINDIR)/."
+	mkdir -p $(DESTDIR)$(LIBDIR)/camlp4 $(DESTDIR)$(BINDIR)
+	cp $(OBJS) "$(DESTDIR)$(LIBDIR)/camlp4/."
+	cp pa_macro.cmi pa_extend.cmi "$(DESTDIR)$(LIBDIR)/camlp4/."
+	cp camlp4r$(EXE) "$(DESTDIR)$(BINDIR)/."
 	if test -f camlp4r.opt; then \
-	  cp camlp4r.opt "$(BINDIR)/camlp4r.opt$(EXE)" ;\
-	  cp $(OBJSX) "$(LIBDIR)/camlp4/."; \
+	  cp camlp4r.opt "$(DESTDIR)$(BINDIR)/camlp4r.opt$(EXE)" ;\
+	  cp $(OBJSX) "$(DESTDIR)$(LIBDIR)/camlp4/."; \
 	  for file in $(OBJSX); do \
-	    cp "`echo $$file | sed -e 's/\.cmx$$/.$(O)/'`" "$(LIBDIR)/camlp4/."; \
+	    cp "`echo $$file | sed -e 's/\.cmx$$/.$(O)/'`" "$(DESTDIR)$(LIBDIR)/camlp4/."; \
 	  done ; \
 	fi
 
diff -ruN ocaml-3.08.4.orig/camlp4/ocaml_src/camlp4/Makefile ocaml-3.08.4/camlp4/ocaml_src/camlp4/Makefile
--- ocaml-3.08.4.orig/camlp4/ocaml_src/camlp4/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/camlp4/ocaml_src/camlp4/Makefile	Fri Aug 26 05:58:44 2005
@@ -69,26 +69,25 @@
 	done
 
 install:
-	-$(MKDIR) "$(BINDIR)"
-	-$(MKDIR) "$(LIBDIR)/camlp4"
-	cp $(CAMLP4) "$(BINDIR)/."
-	cp mLast.mli quotation.mli ast2pt.mli pcaml.mli spretty.mli "$(LIBDIR)/camlp4/."
-	cp mLast.cmi quotation.cmi ast2pt.cmi pcaml.cmi spretty.cmi "$(LIBDIR)/camlp4/."
-	cp  argl.cmi argl.cmo "$(LIBDIR)/camlp4/."
+	mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR)/camlp4
+	cp $(CAMLP4) "$(DESTDIR)$(BINDIR)/."
+	cp mLast.mli quotation.mli ast2pt.mli pcaml.mli spretty.mli "$(DESTDIR)$(LIBDIR)/camlp4/."
+	cp mLast.cmi quotation.cmi ast2pt.cmi pcaml.cmi spretty.cmi "$(DESTDIR)$(LIBDIR)/camlp4/."
+	cp  argl.cmi argl.cmo "$(DESTDIR)$(LIBDIR)/camlp4/."
 	for f in argl.o argl.cmx; do \
 	  if test -r $$f ; then \
-		cp $$f "$(LIBDIR)/camlp4/." ; \
+		cp $$f "$(DESTDIR)$(LIBDIR)/camlp4/." ; \
 	  fi ; \
 	done
-	cp camlp4.cma $(LIBDIR)/camlp4/.
+	cp camlp4.cma $(DESTDIR)$(LIBDIR)/camlp4/.
 	for f in  camlp4.$(A)  camlp4.p.$(A) ; do \
 	  if test -f $$f ; then \
-	     cp $$f "$(LIBDIR)/camlp4/." && ( cd  "$(LIBDIR)/camlp4/." && $(RANLIB) $$f ) ; \
+	     cp $$f "$(DESTDIR)$(LIBDIR)/camlp4/." && ( cd  "$(DESTDIR)$(LIBDIR)/camlp4/." && $(RANLIB) $$f ) ; \
 	  fi ; \
 	done
 	for f in camlp4.cmxa camlp4.p.cmxa ; do \
 	  if test -f $$f ; then \
-	     cp $$f "$(LIBDIR)/camlp4/." ; \
+	     cp $$f "$(DESTDIR)$(LIBDIR)/camlp4/." ; \
 	  fi ; \
 	done
 
diff -ruN ocaml-3.08.4.orig/camlp4/ocaml_src/lib/Makefile ocaml-3.08.4/camlp4/ocaml_src/lib/Makefile
--- ocaml-3.08.4.orig/camlp4/ocaml_src/lib/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/camlp4/ocaml_src/lib/Makefile	Fri Aug 26 05:57:47 2005
@@ -42,19 +42,20 @@
 	done
 
 install:
-	-$(MKDIR) "$(LIBDIR)/camlp4"
-	cp $(TARGET) *.mli "$(LIBDIR)/camlp4/."
-	cp *.cmi "$(LIBDIR)/camlp4/."
+	mkdir -p $(DESTDIR)$(LIBDIR)/camlp4
+	cp $(TARGET) *.mli "$(DESTDIR)$(LIBDIR)/camlp4/."
+	cp *.cmi "$(DESTDIR)$(LIBDIR)/camlp4/."
 	test -f $(TARGET:.cma=.cmxa) && $(MAKE) installopt LIBDIR="$(LIBDIR)" || true
 
 installopt:
+	mkdir -p $(DESTDIR)$(LIBDIR)
 	for f in $(TARGET:.cma=.cmxa) $(TARGET:.cma=.p.cmxa) *.cmx ; do \
-		test -f $$f && cp $$f "$(LIBDIR)/camlp4/." || true ; \
+		test -f $$f && cp $$f "$(DESTDIR)$(LIBDIR)/camlp4/." || true ; \
 	done
 	# Special treatment for this one: some versions of make don't like $(A) in $(TARGET:.cma=.$(A)) 
 	target="`echo $(TARGET) | sed -e 's/\.cma$$/.$(A)/'`" ; \
 	   if test -f $$target ; then \
-	      cp $$target "$(LIBDIR)/camlp4/." && ( cd "$(LIBDIR)/camlp4/." && $(RANLIB) $$target ) \
+	      cp $$target "$(DESTDIR)$(LIBDIR)/camlp4/." && ( cd "$(DESTDIR)$(LIBDIR)/camlp4/." && $(RANLIB) $$target ) \
 	  fi
 
 include .depend
diff -ruN ocaml-3.08.4.orig/camlp4/ocaml_src/meta/Makefile ocaml-3.08.4/camlp4/ocaml_src/meta/Makefile
--- ocaml-3.08.4.orig/camlp4/ocaml_src/meta/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/camlp4/ocaml_src/meta/Makefile	Fri Aug 26 05:56:42 2005
@@ -43,15 +43,15 @@
 	done
 
 install:
-	-$(MKDIR) "$(LIBDIR)/camlp4" "$(BINDIR)"
-	cp $(OBJS) "$(LIBDIR)/camlp4/."
-	cp pa_macro.cmi pa_extend.cmi "$(LIBDIR)/camlp4/."
-	cp camlp4r$(EXE) "$(BINDIR)/."
+	mkdir -p $(DESTDIR)$(LIBDIR)/camlp4 $(DESTDIR)$(BINDIR)
+	cp $(OBJS) "$(DESTDIR)$(LIBDIR)/camlp4/."
+	cp pa_macro.cmi pa_extend.cmi "$(DESTDIR)$(LIBDIR)/camlp4/."
+	cp camlp4r$(EXE) "$(DESTDIR)$(BINDIR)/."
 	if test -f camlp4r.opt; then \
-	  cp camlp4r.opt "$(BINDIR)/camlp4r.opt$(EXE)" ;\
-	  cp $(OBJSX) "$(LIBDIR)/camlp4/."; \
+	  cp camlp4r.opt "$(DESTDIR)$(BINDIR)/camlp4r.opt$(EXE)" ;\
+	  cp $(OBJSX) "$(DESTDIR)$(LIBDIR)/camlp4/."; \
 	  for file in $(OBJSX); do \
-	    cp "`echo $$file | sed -e 's/\.cmx$$/.$(O)/'`" "$(LIBDIR)/camlp4/."; \
+	    cp "`echo $$file | sed -e 's/\.cmx$$/.$(O)/'`" "$(DESTDIR)$(LIBDIR)/camlp4/."; \
 	  done ; \
 	fi
 
diff -ruN ocaml-3.08.4.orig/camlp4/ocaml_src/odyl/Makefile ocaml-3.08.4/camlp4/ocaml_src/odyl/Makefile
--- ocaml-3.08.4.orig/camlp4/ocaml_src/odyl/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/camlp4/ocaml_src/odyl/Makefile	Fri Aug 26 05:55:53 2005
@@ -66,16 +66,16 @@
 compare:
 
 install:
-	-$(MKDIR) "$(LIBDIR)/camlp4" "$(BINDIR)"
-	cp odyl.cmo odyl.cma odyl_main.cmi $(LIBDIR)/camlp4/.
+	mkdir -p $(DESTDIR)$(LIBDIR)/camlp4 $(DESTDIR)$(BINDIR)
+	cp odyl.cmo odyl.cma odyl_main.cmi $(DESTDIR)$(LIBDIR)/camlp4/.
 	for f in odyl.$(A) odyl.p.$(A)  ; do \
 	   if test -f $$f ; then \
-		cp $$f "$(LIBDIR)/camlp4/."  && ( cd "$(LIBDIR)/camlp4/." && $(RANLIB) $$f ) ; \
+		cp $$f "$(DESTDIR)$(LIBDIR)/camlp4/."  && ( cd "$(DESTDIR)$(LIBDIR)/camlp4/." && $(RANLIB) $$f ) ; \
 	   fi ; \
 	done
 	for f in odyl.cmx odyl.o odyl.p.cmx odyl.p.o odyl.cmxa odyl.p.cmxa ; do \
 	    if test -f $$f ; then \
-	       cp $$f "$(LIBDIR)/camlp4/." ; \
+	       cp $$f "$(DESTDIR)$(LIBDIR)/camlp4/." ; \
 	    fi ; \
 	done
 
diff -ruN ocaml-3.08.4.orig/camlp4/ocpp/Makefile ocaml-3.08.4/camlp4/ocpp/Makefile
--- ocaml-3.08.4.orig/camlp4/ocpp/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/camlp4/ocpp/Makefile	Fri Aug 26 05:54:53 2005
@@ -18,8 +18,8 @@
 	rm -f *.cm[ioa] *.pp[io] *.o *.out *.bak .*.bak ocpp$(EXE)
 
 install:
-	-$(MKDIR) "$(LIBDIR)/camlp4" "$(BINDIR)"
-	cp $(OBJS) "$(LIBDIR)/camlp4/."
-	cp ocpp$(EXE) "$(BINDIR)/."
+	mkdir -p $(DESTDIR)$(LIBDIR)/camlp4 $(DESTDIR)$(BINDIR)
+	cp $(OBJS) "$(DESTDIR)$(LIBDIR)/camlp4/."
+	cp ocpp$(EXE) "$(DESTDIR)$(BINDIR)/."
 
 depend:
diff -ruN ocaml-3.08.4.orig/camlp4/odyl/Makefile ocaml-3.08.4/camlp4/odyl/Makefile
--- ocaml-3.08.4.orig/camlp4/odyl/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/camlp4/odyl/Makefile	Fri Aug 26 05:54:22 2005
@@ -66,16 +66,16 @@
 compare:
 
 install:
-	-$(MKDIR) "$(LIBDIR)/camlp4" "$(BINDIR)"
+	mkdir -p $(DESTDIR)$(LIBDIR)/camlp4 $(DESTDIR)$(BINDIR)
 	cp odyl.cmo odyl.cma odyl_main.cmi $(LIBDIR)/camlp4/.
 	for f in odyl.$(A) odyl.p.$(A)  ; do \
 	   if test -f $$f ; then \
-		cp $$f "$(LIBDIR)/camlp4/."  && ( cd "$(LIBDIR)/camlp4/." && $(RANLIB) $$f ) ; \
+		cp $$f "$(DESTDIR)$(LIBDIR)/camlp4/."  && ( cd "$(DESTDIR)$(LIBDIR)/camlp4/." && $(RANLIB) $$f ) ; \
 	   fi ; \
 	done
 	for f in odyl.cmx odyl.o odyl.p.cmx odyl.p.o odyl.cmxa odyl.p.cmxa ; do \
 	    if test -f $$f ; then \
-	       cp $$f "$(LIBDIR)/camlp4/." ; \
+	       cp $$f "$(DESTDIR)$(LIBDIR)/camlp4/." ; \
 	    fi ; \
 	done
 
diff -ruN ocaml-3.08.4.orig/camlp4/top/Makefile ocaml-3.08.4/camlp4/top/Makefile
--- ocaml-3.08.4.orig/camlp4/top/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/camlp4/top/Makefile	Fri Aug 26 05:53:37 2005
@@ -42,7 +42,7 @@
 get_promote:
 
 install:
-	-$(MKDIR) "$(LIBDIR)/camlp4"
-	cp $(TARGET) "$(LIBDIR)/camlp4/."
+	mkdir -p $(DESTDIR)$(LIBDIR)/camlp4
+	cp $(TARGET) $(DESTDIR)$(LIBDIR)/camlp4/.
 
 include .depend
diff -ruN ocaml-3.08.4.orig/config/auto-aux/runtest ocaml-3.08.4/config/auto-aux/runtest
--- ocaml-3.08.4.orig/config/auto-aux/runtest	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/config/auto-aux/runtest	Fri Aug 26 20:37:27 2005
@@ -1,8 +1,8 @@
 #!/bin/sh
 if test "$verbose" = yes; then
-echo "runtest: $cc -o tst $* $cclibs" >&2
-$cc -o tst $* $cclibs || exit 100
-else
-$cc -o tst $* $cclibs 2> /dev/null || exit 100
+    echo "runtest: $cc_cmdline -o tst $* $cclibs" >&2
 fi
+
+$CC $CFLAGS -o tst $* $cclibs || exit 100
+
 exec ./tst
diff -ruN ocaml-3.08.4.orig/config/config-util.sh ocaml-3.08.4/config/config-util.sh
--- ocaml-3.08.4.orig/config/config-util.sh	Thu Jan  1 01:00:00 1970
+++ ocaml-3.08.4/config/config-util.sh	Fri Aug 26 20:32:03 2005
@@ -0,0 +1,35 @@
+
+## getcf(variable,property,error-text)
+function getcf()
+{
+    if [ ! "$1" ]; then echo "getcf(): missing variable name"; exit 1; fi
+    if [ ! "$2" ]; then echo "getcf(): missing property"; exit 1; fi
+    
+    if ! DATA=`$buildconf_query "$2"`; then
+	echo "getcf() undefined platform property: $2"
+	exit 3;
+    fi
+    eval "$1=\"$DATA\""
+}
+
+## define some symbol if a certain property is true/yes
+## $1: symbol
+## $2: property 
+## $3: description
+function define_when()
+{
+    if [ "$3" ]; then
+	echo -n "Checking: $3 ($2) ... "
+    else
+	echo -n "Checking: $2 ... "
+    fi
+    
+    getcf TMP_DEFINE_WHEN $2
+    if [ "$TMP_DEFINE_WHEN" == "yes" ]; then
+	echo "yes .. defining $1"
+	echo "#define $1" >> s.h
+    else
+	echo "no ... undefining $1"
+	echo "#undef $1" >> s.h
+    fi
+}
diff -ruN ocaml-3.08.4.orig/configure ocaml-3.08.4/configure
--- ocaml-3.08.4.orig/configure	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/configure	Fri Aug 26 20:20:50 2005
@@ -50,9 +50,13 @@
 
 # Parse command-line arguments
 
+. ./config/config-util.sh
+
 while : ; do
   case "$1" in
     "") break;;
+    --buildconf-query)
+	buildconf_query="$2"; shift;;
     -prefix|--prefix)
         prefix=$2; shift;;
     -bindir|--bindir)
@@ -108,6 +112,12 @@
   shift
 done
 
+if [ ! "$buildconf_query" ]; then
+    echo "missing --buildconf-query parameter."
+    echo "you need to pass a command for queueing your target system's build config"
+    exit 1;
+fi
+
 # Sanity checks
 
 case "$prefix" in
@@ -179,12 +189,16 @@
 # Do we have gcc?
 
 if test -z "$ccoption"; then
-  if sh ./searchpath gcc; then
-    echo "gcc found"
-    cc=gcc
-  else
-    cc=cc
-  fi
+    if [ "${CC}" ]; then
+	echo "user defined cc: ${CC}"
+    else
+	if sh ./searchpath gcc; then
+	    echo "gcc found"
+	    cc=gcc
+	else
+	    cc=cc
+	fi
+    fi
 else
   cc="$ccoption"
 fi
@@ -234,7 +248,7 @@
 
 # Configure the bytecode compiler
 
-bytecc="$cc"
+bytecc="${CC}"
 bytecccompopts=""
 bytecclinkopts=""
 ostype="Unix"
@@ -303,27 +317,34 @@
 
 # Configure compiler to use in further tests
 
-cc="$bytecc -O $bytecclinkopts"
-export cc cclibs verbose
+cc_cmdline="$bytecc -O $bytecclinkopts"
+CFLAGS="${CFLAGS} -O $byptecclinkopts"
+export cc cc_cmdline cclibs verbose
 
 # Check C compiler
 
+echo "CC=${CC}"
+echo "CFLAGS=${CFLAGS}"
+
 sh ./runtest ansi.c
 case $? in
   0) echo "The C compiler is ANSI-compliant.";;
-  1) echo "The C compiler $cc is not ANSI-compliant."
+  1) echo "The C compiler $cc_cmdline is not ANSI-compliant."
      echo "You need an ANSI C compiler to build Objective Caml."
      exit 2;;
   *) echo "Unable to compile the test program."
-     echo "Make sure the C compiler $cc is properly installed."
+     echo "Make sure the C compiler $cc_cmdline is properly installed."
      exit 2;;
 esac
 
-# Check the sizes of data types
-
 echo "Checking the sizes of integers and pointers..."
-set `sh ./runtest sizes.c`
-case "$2,$3" in
+
+getcf SZ_LONG	host.ansi-c.sizes.long
+getcf SZ_INT	host.ansi-c.sizes.int
+getcf SZ_SHORT	host.ansi-c.sizes.short
+getcf SZ_PTR	host.ansi-c.sizes.ptr
+
+case "$SZ_LONG,$SZ_PTR" in
   4,4) echo "OK, this is a regular 32 bit architecture."
        echo "#undef ARCH_SIXTYFOUR" >> m.h;;
   8,8) echo "Wow! A 64 bit architecture!"
@@ -340,60 +361,80 @@
        echo "Make sure the C compiler $cc is properly installed."
        exit 2;;
 esac
-if test $1 != 4 && test $2 != 4 && test $4 != 4; then
+if test $SZ_INT != 4 && test $SZ_LONG != 4 && test $SZ_SHORT != 4; then
   echo "Sorry, we can't find a 32-bit integer type"
-  echo "(sizeof(short) = $4, sizeof(int) = $1, sizeof(long) = $2)"
+  echo "(sizeof(short) = $SZ_SHORT, sizeof(int) = $SZ_INT, sizeof(long) = $SZ_LONG)"
   echo "Objective Caml won't run on this architecture."
   exit 2
 fi
 
-echo "#define SIZEOF_INT $1" >> m.h
-echo "#define SIZEOF_LONG $2" >> m.h
-echo "#define SIZEOF_SHORT $4" >> m.h
+echo "#define SIZEOF_INT $SZ_INT" >> m.h
+echo "#define SIZEOF_LONG $SZ_LONG" >> m.h
+echo "#define SIZEOF_SHORT $SZ_SHORT" >> m.h
 
-if test $2 = 8; then
+if test $SZ_LONG = 8; then
      echo "#define ARCH_INT64_TYPE long" >> m.h
      echo "#define ARCH_UINT64_TYPE unsigned long" >> m.h
      echo '#define ARCH_INT64_PRINTF_FORMAT "l"' >> m.h
      int64_native=true
 else
-  sh ./runtest longlong.c
-  case $? in
-  0) echo "64-bit \"long long\" integer type found (printf with \"%ll\")."
-     echo "#define ARCH_INT64_TYPE long long" >> m.h
-     echo "#define ARCH_UINT64_TYPE unsigned long long" >> m.h
-     echo '#define ARCH_INT64_PRINTF_FORMAT "ll"' >> m.h
-     int64_native=true;;
-  1) echo "64-bit \"long long\" integer type found (printf with \"%q\")."
-     echo "#define ARCH_INT64_TYPE long long" >> m.h
-     echo "#define ARCH_UINT64_TYPE unsigned long long" >> m.h
-     echo '#define ARCH_INT64_PRINTF_FORMAT "q"' >> m.h
-     int64_native=true;;
-  2) echo "64-bit \"long long\" integer type found (but no printf)."
-     echo "#define ARCH_INT64_TYPE long long" >> m.h
-     echo "#define ARCH_UINT64_TYPE unsigned long long" >> m.h
-     echo '#undef ARCH_INT64_PRINTF_FORMAT' >> m.h
-     int64_native=true;;
-  *) echo "No suitable 64-bit integer type found, will use software emulation."
-     echo "#undef ARCH_INT64_TYPE" >> m.h
-     echo "#undef ARCH_UINT64_TYPE" >> m.h
-     echo '#undef ARCH_INT64_PRINTF_FORMAT' >> m.h
-     int64_native=false;;
-  esac
+    if [ "$SZ_LONGLONG" != 8 ]; then
+	echo "No suitable 64-bit integer type found, will use software emulation."
+	echo "#undef ARCH_INT64_TYPE" >> m.h
+	echo "#undef ARCH_UINT64_TYPE" >> m.h
+	echo '#undef ARCH_INT64_PRINTF_FORMAT' >> m.h
+	int64_native=false
+    else
+	getcf LONGLONG_PRINTF host.api.libc.printf.fmt-longlong
+	case "$LONGLONG_PRINTF" in
+	    "")
+		echo "64-bit \"long long\" integer type found (but no printf)."
+		echo "#define ARCH_INT64_TYPE long long" >> m.h
+		echo "#define ARCH_UINT64_TYPE unsigned long long" >> m.h
+		echo '#undef ARCH_INT64_PRINTF_FORMAT' >> m.h
+		int64_native=true
+	    ;;
+	    "%lld")
+		echo "64-bit \"long long\" integer type found (printf with \"%ll\")."
+		echo "#define ARCH_INT64_TYPE long long" >> m.h
+		echo "#define ARCH_UINT64_TYPE unsigned long long" >> m.h
+		echo '#define ARCH_INT64_PRINTF_FORMAT "ll"' >> m.h
+		int64_native=true
+	    ;;
+	    "%qd")
+		echo "64-bit \"long long\" integer type found (printf with \"%q\")."
+		echo "#define ARCH_INT64_TYPE long long" >> m.h
+		echo "#define ARCH_UINT64_TYPE unsigned long long" >> m.h
+		echo '#define ARCH_INT64_PRINTF_FORMAT "q"' >> m.h
+		int64_native=true
+	    ;;
+	    *)
+		echo "Unhandled printf-fmt type: $LONGLONG_PRINTF"
+		echo "Dont know how to proceed." 
+		exit 1;
+	    ;;
+	esac
+    fi
 fi
 
 # Determine endianness
 
-sh ./runtest endian.c
-case $? in
-  0) echo "This is a big-endian architecture."
-     echo "#define ARCH_BIG_ENDIAN" >> m.h;;
-  1) echo "This is a little-endian architecture."
-     echo "#undef ARCH_BIG_ENDIAN" >> m.h;;
-  2) echo "This architecture seems to be neither big endian nor little endian."
+ENDIAN=`$buildconf_query "host.cpu.endian"`
+case "$ENDIAN" in
+  "big") 
+     echo "This is a big-endian architecture."
+     echo "#define ARCH_BIG_ENDIAN" >> m.h
+    ;;
+  "little") 
+     echo "This is a little-endian architecture."
+     echo "#undef ARCH_BIG_ENDIAN" >> m.h	
+    ;;
+  *) 
+     echo "Aehm, whats \"$ENDIAN\" endianess ?!"
+     echo "This architecture seems to be neither big endian nor little endian."
      echo "Objective Caml won't run on this architecture."
-     exit 2;;
-  *) echo "Something went wrong during endianness determination."
+     echo
+     echo "Maybe something went wrong during endianness determination."
      echo "You'll have to figure out endianness yourself"
      echo "(option ARCH_BIG_ENDIAN in m.h).";;
 esac
@@ -408,7 +449,7 @@
     # But there's a knack (PR#2572):
     # if we're in 64-bit mode (sizeof(long) == 8), 
     # we must not doubleword-align floats...
-    if test $2 = 8; then
+    if test $SZ_LONG = 8; then
       echo "Doubles can be word-aligned."
       echo "#undef ARCH_ALIGN_DOUBLE" >> m.h
     else
@@ -433,7 +474,7 @@
 if $int64_native; then
   case "$host" in
     hppa*-*-*)
-      if test $2 = 8; then
+      if test $SZ_LONG = 8; then
         echo "64-bit integers can be word-aligned."
         echo "#undef ARCH_ALIGN_INT64" >> m.h
       else
@@ -744,10 +785,44 @@
 
 # Check the semantics of signal handlers
 
-if sh ./hasgot sigaction sigprocmask; then
-  echo "POSIX signal handling found."
-  echo "#define POSIX_SIGNALS" >> s.h
+define_when	POSIX_SIGNALS		host.api.posix.signals
+define_when	HAS_TIMES		host.api.syscall.times
+define_when	HAS_GETPRIORITY		host.api.syscall.getpriority
+define_when	HAS_UTIME		host.api.syscall.utime
+define_when	HAS_UTIMES		host.api.syscall.utimes
+define_when	HAS_DUP2		host.api.syscall.dup2
+define_when	HAS_FCHMOD		host.api.syscall.fchmod
+define_when	HAS_FCHWOWN		host.api.syscall.fchown
+define_when	HAS_WAITPID		host.api.syscall.waitpid
+define_when	HAS_TRUNCATE		host.api.syscall.truncate
+define_when	HAS_FTRUNCATE		host.api.syscall.ftruncate
+define_when	HAS_SYMLINK		host.api.syscall.symlink
+define_when	HAS_READLINK		host.api.syscall.readlink
+define_when	HAS_SELECT		host.api.syscall.select
+define_when	HAS_GETHOSTNAME		host.api.syscall.gethostname
+define_when	HAS_UNAME		host.api.syscall.uname
+define_when	HAS_GETTIMEOFDAY	host.api.syscall.gettimeofday
+define_when	HAS_GETGROUPS	host.api.syscall.getgroups
+
+define_when	HAS_INET_ATON		host.api.libc.inet_aton
+define_when	HAS_UNISTD		host.api.libc.unistd
+define_when	HAS_OFF_T		host.api.libc.types.off_t
+define_when	HAS_DIRENT		host.api.libc.dirent
+define_when	HAS_REWINDDIR		host.api.libc.rewinddir
+define_when	HAS_LOCKF		host.api.libc.lockf
+define_when	HAS_MKFIFO		host.api.libc.mkfifo
+define_when	HAS_GETCWD		host.api.libc.getcwd
+define_when	HAS_GETWD		host.api.libc.getwd
+define_when	HAS_MKTIME		host.api.libc.mktime
+define_when 	HAS_PUTENV		host.api.libc.putenv
+define_when 	HAS_LOCALE		host.api.libc.locale
+
+getcf		HAVE_POSIX_SIGNALS	host.api.posix.signals
+
+if [ "$HAVE_POSIX_SIGNALS" ]; then
+    echo "POSIX signal handling found."
 else
+    ### FIXME !!!
   if sh ./runtest signals.c; then
     echo "Signals have the BSD semantics."
     echo "#define BSD_SIGNALS" >> s.h
@@ -760,15 +835,8 @@
   fi
 fi
 
-# For the sys module
-
-if sh ./hasgot times; then
-  echo "times() found."
-  echo "#define HAS_TIMES" >> s.h
-fi
 
 # For the terminfo module
-
 if test "$withcurses" = "yes"; then
   for libs in "" "-lcurses" "-ltermcap" "-lcurses -ltermcap" "-lncurses"; do
     if sh ./hasgot $libs tgetent tgetstr tgetnum tputs; then
@@ -786,104 +854,11 @@
 
 # For the Unix library
 
-has_sockets=no
-if sh ./hasgot socket socketpair bind listen accept connect; then
-  echo "You have BSD sockets."
-  echo "#define HAS_SOCKETS" >> s.h
-  has_sockets=yes
-elif sh ./hasgot -lnsl -lsocket socket socketpair bind listen accept connect; then
-  echo "You have BSD sockets (with libraries '-lnsl -lsocket')"
-  cclibs="$cclibs -lnsl -lsocket"
-  echo "#define HAS_SOCKETS" >> s.h
-  has_sockets=yes
-fi
-
-if sh ./hasgot -i sys/socket.h -t socklen_t; then
-  echo "socklen_t is defined in <sys/socket.h>"
-  echo "#define HAS_SOCKLEN_T" >> s.h
-fi
-
-if sh ./hasgot inet_aton; then
-  echo "inet_aton() found."
-  echo "#define HAS_INET_ATON" >> s.h
-fi
-
-if sh ./hasgot -i sys/types.h -i sys/socket.h -i netinet/in.h \
-               -t 'struct sockaddr_in6' \
-&& sh ./hasgot getaddrinfo getnameinfo inet_pton inet_ntop; then
-  echo "IPv6 is supported."
-  echo "#define HAS_IPV6" >> s.h
-fi
-
-if sh ./hasgot -i unistd.h; then
-  echo "unistd.h found."
-  echo "#define HAS_UNISTD" >> s.h
-fi
-
-if sh ./hasgot -i sys/types.h -t off_t; then
-  echo "off_t is defined in <sys/types.h>"
-  echo "#define HAS_OFF_T" >> s.h
-fi
-
-if sh ./hasgot -i sys/types.h -i dirent.h; then
-  echo "dirent.h found."
-  echo "#define HAS_DIRENT" >> s.h
-fi
-
-if sh ./hasgot rewinddir; then
-  echo "rewinddir() found."
-  echo "#define HAS_REWINDDIR" >> s.h
-fi
-
-if sh ./hasgot lockf; then
-  echo "lockf() found."
-  echo "#define HAS_LOCKF" >> s.h
-fi
-
-if sh ./hasgot mkfifo; then
-  echo "mkfifo() found."
-  echo "#define HAS_MKFIFO" >> s.h
-fi
-
-if sh ./hasgot getcwd; then
-  echo "getcwd() found."
-  echo "#define HAS_GETCWD" >> s.h
-fi
-
-if sh ./hasgot getwd; then
-  echo "getwd() found."
-  echo "#define HAS_GETWD" >> s.h
-fi
-
-if sh ./hasgot getpriority setpriority; then
-  echo "getpriority() found."
-  echo "#define HAS_GETPRIORITY" >> s.h
-fi
-
-if sh ./hasgot -i sys/types.h -i utime.h && sh ./hasgot utime; then
-  echo "utime() found."
-  echo "#define HAS_UTIME" >> s.h
-fi
-
-if sh ./hasgot utimes; then
-  echo "utimes() found."
-  echo "#define HAS_UTIMES" >> s.h
-fi
-
-if sh ./hasgot dup2; then
-  echo "dup2() found."
-  echo "#define HAS_DUP2" >> s.h
-fi
-
-if sh ./hasgot fchmod fchown; then
-  echo "fchmod() found."
-  echo "#define HAS_FCHMOD" >> s.h
-fi
-
-if sh ./hasgot truncate ftruncate; then
-  echo "truncate() found."
-  echo "#define HAS_TRUNCATE" >> s.h
-fi
+define_when	HAS_SOCKETS		host.api.bsd.sockets
+getcf		BSD_SOCKETS_LDFLAGS	host.api.bsd.sockets.ldflags
+getcf		has_sockets		host.api.bsd.sockets
+define_when	HAS_SOCKLEN_T		host.api.bsd.sockets.socklen_t
+define_when	HAS_IPV6		host.api.libc.ipv6
 
 select_include=''
 if sh ./hasgot -i sys/types.h -i sys/select.h; then
@@ -892,36 +867,6 @@
   select_include='-i sys/select.h'
 fi
 
-has_select=no
-if sh ./hasgot select && \
-   sh ./hasgot -i sys/types.h $select_include -t fd_set ; then
-  echo "select() found."
-  echo "#define HAS_SELECT" >> s.h
-  has_select=yes
-fi
-
-if sh ./hasgot symlink readlink lstat;  then
-  echo "symlink() found."
-  echo "#define HAS_SYMLINK" >> s.h
-fi
-
-has_wait=no
-if sh ./hasgot waitpid;  then
-  echo "waitpid() found."
-  echo "#define HAS_WAITPID" >> s.h
-  has_wait=yes
-fi
-
-if sh ./hasgot wait4;  then
-  echo "wait4() found."
-  echo "#define HAS_WAIT4" >> s.h
-  has_wait=yes
-fi
-
-if sh ./hasgot -i limits.h && sh ./runtest getgroups.c; then
-  echo "getgroups() found."
-  echo "#define HAS_GETGROUPS" >> s.h
-fi
 
 if sh ./hasgot -i termios.h &&
    sh ./hasgot tcgetattr tcsetattr tcsendbreak tcflush tcflow; then
@@ -948,27 +893,7 @@
   has_setitimer="yes"
 fi
 
-if sh ./hasgot gethostname; then
-  echo "gethostname() found."
-  echo "#define HAS_GETHOSTNAME" >> s.h
-fi
 
-if sh ./hasgot -i sys/utsname.h && sh ./hasgot uname; then
-  echo "uname() found."
-  echo "#define HAS_UNAME" >> s.h
-fi
-
-has_gettimeofday=no
-if sh ./hasgot gettimeofday; then
-  echo "gettimeofday() found."
-  echo "#define HAS_GETTIMEOFDAY" >> s.h
-  has_gettimeofday="yes"
-fi
-
-if sh ./hasgot mktime; then
-  echo "mktime() found."
-  echo "#define HAS_MKTIME" >> s.h
-fi
 
 case "$host" in
   *-*-cygwin*) ;;  # setsid emulation under Cygwin breaks the debugger
@@ -978,34 +903,32 @@
      fi;;
 esac
 
-if sh ./hasgot putenv; then
-  echo "putenv() found."
-  echo "#define HAS_PUTENV" >> s.h
-fi
-
-if sh ./hasgot -i locale.h && sh ./hasgot setlocale; then
-  echo "setlocale() and <locale.h> found."
-  echo "#define HAS_LOCALE" >> s.h
-fi
-
-if sh ./hasgot -i mach-o/dyld.h && sh ./hasgot NSLinkModule; then
-  echo "NSLinkModule() found. Using darwin dynamic loading."
-  echo "#define HAS_NSLINKMODULE" >> s.h
-elif sh ./hasgot $dllib dlopen; then
-  echo "dlopen() found."
-elif sh ./hasgot $dllib -ldl dlopen; then
-  echo "dlopen() found in -ldl."
-  dllib="$dllib -ldl"
+
+getcf API_NSLINKMODULE	host.api.libc.dll.nslinkmodule
+getcf API_DLOPEN	host.api.libc.dll.dlopen
+getcf API_DLOPEN_EXT	host.api.libc.dll.dlopen-ext
+
+if [ "$API_NSLINKMODULE" == "yes" ]; then
+    shared_libraries_supported=true
+    echo "NSLinkModule() found. Using darwin dynamic loading."
+    echo "#define HAS_NSLINKMODULE" >> s.h
+elif [ "$API_DLOPEN_EXT" == "yes" ]; then
+    shared_libraries_supported=true
+    echo "dlopen() found in -ldl."
+    dllib="$dllib -ldl"
+elif [ "$API_DLOPEN" == "yes" ]; then
+    shared_libraries_supported=true
+    echo "dlopen() found."
 else
-  shared_libraries_supported=no
+    shared_libraries_supported=false
 fi
 
-if $shared_libraries_supported; then
-  echo "Dynamic loading of shared libraries is supported."
-  echo "#define SUPPORT_DYNAMIC_LINKING" >> s.h
-  if $dl_needs_underscore; then
-    echo '#define DL_NEEDS_UNDERSCORE' >>s.h
-  fi
+if "$shared_libraries_supported"; then
+    echo "Dynamic loading of shared libraries is supported."
+    echo "#define SUPPORT_DYNAMIC_LINKING" >> s.h
+    if $dl_needs_underscore; then
+	echo '#define DL_NEEDS_UNDERSCORE' >>s.h
+    fi
 fi
 
 if sh ./hasgot -i sys/types.h -i sys/mman.h && sh ./hasgot mmap munmap; then
@@ -1037,7 +960,7 @@
   echo "Replay debugger supported."
   debugger="ocamldebugger"
 else
-  echo "No replay debugger (missing system calls)"
+  echo "No replay debugger (missing bsd socket interface)"
   debugger=""
 fi
 
@@ -1108,6 +1031,17 @@
 
 # Determine if the bytecode thread library is supported
 
+getcf	has_gettimeofday	host.api.syscall.gettimeofday
+getcf 	has_select		host.api.syscall.select
+
+getcf	has_waitpid		host.api.syscall.waitpid
+getcf	has_wait4		host.api.syscall.wait4
+if [ "$has_waitpid" == "yes" ] || [ "$has_wait4" == "yes" ] ; then
+    has_wait=yes
+else
+    has_wait=no
+fi
+
 if test "$has_select" = "yes" \
 && test "$has_setitimer" = "yes" \
 && test "$has_gettimeofday" = "yes" \
@@ -1164,8 +1098,8 @@
     /usr/openwin/share/include \
     ; \
 do
-  if test -f $dir/X11/X.h; then
-    x11_include=$dir
+  if test -f $SYSROOT$dir/X11/X.h; then
+    x11_include=$SYSROOT$dir
     break
   fi
 done
@@ -1220,15 +1154,15 @@
     /usr/openwin/share/lib \
     ; \
 do
-  if test -f $dir/libX11.a || \
-     test -f $dir/libX11.so || \
-     test -f $dir/libX11.dll.a || \
-     test -f $dir/libX11.sa; then
-    if test $dir = /usr/lib; then
+  if test -f $SYSROOT$dir/libX11.a || \
+     test -f $SYSROOT$dir/libX11.so || \
+     test -f $SYSROOT$dir/libX11.dll.a || \
+     test -f $SYSROOT$dir/libX11.sa; then
+    if test $SYSROOT$dir = /usr/lib; then
       x11_link="-lX11"
     else
-      x11_link="-L$dir -lX11"
-      x11_libs="-L$dir"
+      x11_link="-L$SYSROOT$dir -lX11"
+      x11_libs="-L$SYSROOT$dir"
     fi
     break
   fi
diff -ruN ocaml-3.08.4.orig/debugger/Makefile ocaml-3.08.4/debugger/Makefile
--- ocaml-3.08.4.orig/debugger/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/debugger/Makefile	Fri Aug 26 05:52:53 2005
@@ -81,7 +81,8 @@
 	$(CAMLC) $(LINKFLAGS) -o ocamldebug$(EXE) -linkall $(OTHEROBJS) $(OBJS)
 
 install:
-	cp ocamldebug$(EXE) $(BINDIR)/ocamldebug$(EXE)
+	mkdir -p $(DESTDIR)$(BINDIR)
+	cp ocamldebug$(EXE) $(DESTDIR)$(BINDIR)/ocamldebug$(EXE)
 
 clean::
 	rm -f ocamldebug$(EXE)
diff -ruN ocaml-3.08.4.orig/emacs/Makefile ocaml-3.08.4/emacs/Makefile
--- ocaml-3.08.4.orig/emacs/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/emacs/Makefile	Fri Aug 26 05:52:37 2005
@@ -40,7 +40,8 @@
               (byte-compile-file "camldebug.el"))
 
 install:
-	@if test "$(EMACSDIR)" = ""; then \
+	mkdir -p $(DESTDIR)$(EMACSDIR)
+	@if test "$(DESTDIR)$(EMACSDIR)" = ""; then \
           set xxx `($(EMACS) --batch --eval "(mapcar 'print load-path)") \
                    2>/dev/null | \
                    sed -n -e '/\/site-lisp/s/"//gp'`; \
@@ -58,9 +59,9 @@
 	$(MAKE) NOCOMPILE=true install
 
 simple-install:
-	@echo "Installing in $(EMACSDIR)..."
-	if test -d $(EMACSDIR); then : ; else mkdir -p $(EMACSDIR); fi
-	cp $(FILES) $(EMACSDIR)
+	@echo "Installing in $(DESTDIR)$(EMACSDIR)..."
+	mkdir -p $(DESTDIR)$(EMACSDIR)
+	cp $(FILES) $(DESTDIR)$(EMACSDIR)
 	if [ -z "$(NOCOMPILE)" ]; then \
 	  cd $(EMACSDIR); $(EMACS) --batch --eval '$(COMPILECMD)'; \
 	fi
@@ -70,7 +71,8 @@
 	chmod a+x ocamltags
 
 install-ocamltags: ocamltags
-	cp ocamltags $(SCRIPTDIR)/ocamltags
+	mkdir -p $(DESTDIR)$(SCRIPTDIR)
+	cp ocamltags $(DESTDIR)$(SCRIPTDIR)/ocamltags
 
 clean:
 	rm -f ocamltags *~ #*#
diff -ruN ocaml-3.08.4.orig/man/Makefile ocaml-3.08.4/man/Makefile
--- ocaml-3.08.4.orig/man/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/man/Makefile	Fri Aug 26 05:51:23 2005
@@ -17,6 +17,7 @@
 DIR=$(MANDIR)/man$(MANEXT)
 
 install:
+	mkdir -p $(DESTDIR)$(DIR)
 	for i in *.m; do cp $$i $(DIR)/`basename $$i .m`.$(MANEXT); done
-	echo '.so man$(MANEXT)/ocamlc.$(MANEXT)' > $(DIR)/ocamlc.opt.$(MANEXT)
-	echo '.so man$(MANEXT)/ocamlopt.$(MANEXT)' > $(DIR)/ocamlopt.opt.$(MANEXT)
+	echo '.so man$(MANEXT)/ocamlc.$(MANEXT)' > $(DESTDIR)$(DIR)/ocamlc.opt.$(MANEXT)
+	echo '.so man$(MANEXT)/ocamlopt.$(MANEXT)' > $(DESTDIR)$(DIR)/ocamlopt.opt.$(MANEXT)
diff -ruN ocaml-3.08.4.orig/ocamldoc/Makefile ocaml-3.08.4/ocamldoc/Makefile
--- ocaml-3.08.4.orig/ocamldoc/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/ocamldoc/Makefile	Fri Aug 26 05:50:46 2005
@@ -252,24 +252,23 @@
 # Installation targets
 ######################
 install: dummy
-	if test -d $(INSTALL_BINDIR); then : ; else $(MKDIR) $(INSTALL_BINDIR); fi
-	if test -d $(INSTALL_LIBDIR); then : ; else $(MKDIR) $(INSTALL_LIBDIR); fi
-	if test -d $(INSTALL_CUSTOMDIR); then : ; else $(MKDIR) $(INSTALL_CUSTOMDIR); fi
-	$(CP) $(OCAMLDOC)$(EXE) $(INSTALL_BINDIR)/$(OCAMLDOC)$(EXE)
-	$(CP) ocamldoc.hva *.cmi $(OCAMLDOC_LIBCMA) $(INSTALL_LIBDIR)
-	$(CP) $(INSTALL_MLIS) $(INSTALL_CMIS) $(INSTALL_LIBDIR)
-	if test -d $(INSTALL_MANODIR); then : ; else $(MKDIR) $(INSTALL_MANODIR); fi
-	$(CP) stdlib_man/* $(INSTALL_MANODIR)
+	mkdir -p $(DESTDIR)$(INSTALL_BINDIR)
+	mkdir -p $(DESTDIR)$(INSTALL_LIBDIR)
+	mkdir -p $(DESTDIR)$(INSTALL_CUSTOMEDIR)
+	mkdir -p $(DESTDIR)$(INSTALL_MANODIR)
+	$(CP) $(OCAMLDOC)$(EXE) $(DESTDIR)$(INSTALL_BINDIR)/$(OCAMLDOC)$(EXE)
+	$(CP) ocamldoc.hva *.cmi $(OCAMLDOC_LIBCMA) $(DESTDIR)$(INSTALL_LIBDIR)
+	$(CP) $(INSTALL_MLIS) $(INSTALL_CMIS) $(DESTDIR)$(INSTALL_LIBDIR)
+	$(CP) stdlib_man/* $(DESTDIR)$(INSTALL_MANODIR)
 
 installopt:
 	if test -f $(OCAMLDOC_OPT) ; then $(MAKE) installopt_really ; fi
 
 installopt_really:
-	if test -d $(INSTALL_BINDIR); then : ; else $(MKDIR) $(INSTALL_BINDIR); fi
-	if test -d $(INSTALL_LIBDIR); then : ; else $(MKDIR) $(INSTALL_LIBDIR); fi
-	$(CP) $(OCAMLDOC_OPT) $(INSTALL_BINDIR)/$(OCAMLDOC_OPT)$(EXE)
-	$(CP) ocamldoc.hva $(OCAMLDOC_LIBA) $(OCAMLDOC_LIBCMXA) $(INSTALL_LIBDIR)
-	$(CP) $(INSTALL_MLIS) $(INSTALL_CMIS) $(INSTALL_LIBDIR)
+	mkdir -p $(DESTDIR)$(INSTALL_BINDIR) $(DESTDIR)$(INSTALL_LIBDIR)
+	$(CP) $(OCAMLDOC_OPT) $(DESTDIR)$(INSTALL_BINDIR)/$(OCAMLDOC_OPT)$(EXE)
+	$(CP) ocamldoc.hva $(OCAMLDOC_LIBA) $(OCAMLDOC_LIBCMXA) $(DESTDIR)$(INSTALL_LIBDIR)
+	$(CP) $(INSTALL_MLIS) $(INSTALL_CMIS) $(DESTDIR)$(INSTALL_LIBDIR)
 
 # Testing :
 ###########
diff -ruN ocaml-3.08.4.orig/otherlibs/bigarray/Makefile ocaml-3.08.4/otherlibs/bigarray/Makefile
--- ocaml-3.08.4.orig/otherlibs/bigarray/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/otherlibs/bigarray/Makefile	Fri Aug 26 12:13:51 2005
@@ -41,14 +41,16 @@
           $(CAML_OBJS:.cmo=.cmx)
 
 install:
-	if test -f dllbigarray.so; then cp dllbigarray.so $(STUBLIBDIR)/dllbigarray.so; fi
-	cp bigarray.cmi bigarray.mli libbigarray.a bigarray.cma $(LIBDIR)
-	cd $(LIBDIR); $(RANLIB) libbigarray.a
-	cp bigarray.h $(LIBDIR)/caml/bigarray.h
+	mkdir -p $(DESTDIR)$(STUBLIBDIR) $(DESTDIR)$(LIBDIR) 
+	if test -f dllbigarray.so; then cp dllbigarray.so $(DESTDIR)$(STUBLIBDIR)/dllbigarray.so; fi
+	cp bigarray.cmi bigarray.mli libbigarray.a bigarray.cma $(DESTDIR)$(LIBDIR)
+	cd $(DESTDIR)$(LIBDIR) && $(RANLIB) libbigarray.a
+	cp bigarray.h $(DESTDIR)$(LIBDIR)/caml/bigarray.h
 
 installopt:
-	cp bigarray.a $(CAML_OBJS:.cmo=.cmx) bigarray.cmxa $(LIBDIR)
-	cd $(LIBDIR); $(RANLIB) bigarray.a
+	mkdir -p $(DESTDIR)$(LIBDIR)
+	cp bigarray.a $(CAML_OBJS:.cmo=.cmx) bigarray.cmxa $(DESTDIR)$(LIBDIR)
+	cd $(DESTDIR)$(LIBDIR) && $(RANLIB) bigarray.a
 
 partialclean:
 	rm -f *.cm* 
@@ -68,7 +70,7 @@
 	$(CAMLOPT) -c $(COMPFLAGS) $<
 
 depend:
-	gcc -MM -I../../byterun -I../unix *.c > .depend
+	$(CC) -MM -I../../byterun -I../unix *.c > .depend
 	../../boot/ocamlrun ../../tools/ocamldep *.mli *.ml >> .depend
 
 include .depend
diff -ruN ocaml-3.08.4.orig/otherlibs/dbm/Makefile ocaml-3.08.4/otherlibs/dbm/Makefile
--- ocaml-3.08.4.orig/otherlibs/dbm/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/otherlibs/dbm/Makefile	Fri Aug 26 05:47:58 2005
@@ -47,14 +47,16 @@
 	rm -f *.a *.o *.so
 
 install:
-	if test -f dllmldbm.so; then cp dllmldbm.so $(STUBLIBDIR)/dllmldbm.so; fi
-	cp libmldbm.a $(LIBDIR)/libmldbm.a
-	cd $(LIBDIR); $(RANLIB) libmldbm.a
-	cp dbm.cma dbm.cmi dbm.mli $(LIBDIR)
+	mkdir -p $(DESTDIR)$(STUBLIBDIR)
+	if test -f dllmldbm.so; then cp dllmldbm.so $(DESTDIR)$(STUBLIBDIR)/dllmldbm.so; fi
+	cp libmldbm.a $(DESTDIR)$(LIBDIR)/libmldbm.a
+	cd $(DESTDIR)$(LIBDIR) && $(RANLIB) libmldbm.a
+	cp dbm.cma dbm.cmi dbm.mli $(DESTDIR)$(LIBDIR)
 
 installopt:
-	cp dbm.cmx dbm.cmxa dbm.a $(LIBDIR)
-	cd $(LIBDIR); $(RANLIB) dbm.a
+	mkdir -p $(DESTDIR)$(LIBDIR)
+	cp dbm.cmx dbm.cmxa dbm.a $(DESTDIR)$(LIBDIR)
+	cd $(DESTDIR)$(LIBDIR) && $(RANLIB) dbm.a
 
 .SUFFIXES: .ml .mli .cmo .cmi .cmx
 
diff -ruN ocaml-3.08.4.orig/otherlibs/dynlink/Makefile ocaml-3.08.4/otherlibs/dynlink/Makefile
--- ocaml-3.08.4.orig/otherlibs/dynlink/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/otherlibs/dynlink/Makefile	Fri Aug 26 05:47:03 2005
@@ -38,7 +38,8 @@
 	$(CAMLC) $(COMPFLAGS) -o extract_crc dynlink.cma extract_crc.cmo
 
 install:
-	cp dynlink.cmi dynlink.cma dynlink.mli extract_crc $(LIBDIR)
+	mkdir -p $(DESTDIR)$(LIBDIR)
+	cp dynlink.cmi dynlink.cma dynlink.mli extract_crc $(DESTDIR)$(LIBDIR)
 
 installopt:
 
diff -ruN ocaml-3.08.4.orig/otherlibs/graph/Makefile ocaml-3.08.4/otherlibs/graph/Makefile
--- ocaml-3.08.4.orig/otherlibs/graph/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/otherlibs/graph/Makefile	Fri Aug 26 12:13:35 2005
@@ -50,14 +50,16 @@
 	rm -f *.a *.so *.o
 
 install:
-	if test -f dllgraphics.so; then cp dllgraphics.so $(STUBLIBDIR)/dllgraphics.so; fi
-	cp libgraphics.a $(LIBDIR)/libgraphics.a
-	cd $(LIBDIR); $(RANLIB) libgraphics.a
-	cp graphics.cm[ia] graphicsX11.cmi graphics.mli graphicsX11.mli $(LIBDIR)
+	mkdir -p $(DESTDIR)$(STUBLIBDIR) $(DESTDIR)$(LIBDIR)
+	if test -f dllgraphics.so; then cp dllgraphics.so $(DESTDIR)$(STUBLIBDIR)/dllgraphics.so; fi
+	cp libgraphics.a $(DESTDIR)$(LIBDIR)/libgraphics.a
+	cd $(DESTDIR)$(LIBDIR) && $(RANLIB) libgraphics.a
+	cp graphics.cm[ia] graphicsX11.cmi graphics.mli graphicsX11.mli $(DESTDIR)$(LIBDIR)
 
 installopt:
-	cp graphics.cmx graphics.cmxa graphics.a $(LIBDIR)
-	cd $(LIBDIR); $(RANLIB) graphics.a
+	mkdir -p $(DESTDIR)$(LIBDIR)
+	cp graphics.cmx graphics.cmxa graphics.a $(DESTDIR)$(LIBDIR)
+	cd $(DESTDIR)$(LIBDIR) && $(RANLIB) graphics.a
 
 .SUFFIXES: .ml .mli .cmo .cmi .cmx
 
@@ -69,7 +71,7 @@
 	$(CAMLOPT) -c $(COMPFLAGS) $<
 
 depend:
-	gcc -MM $(CFLAGS) *.c | sed -e 's, /usr[^ ]*\.h,,g' > .depend
+	$(CC) -MM $(CFLAGS) *.c | sed -e 's, /usr[^ ]*\.h,,g' > .depend
 	../../boot/ocamlrun ../../tools/ocamldep *.mli *.ml >> .depend
 
 include .depend
diff -ruN ocaml-3.08.4.orig/otherlibs/labltk/browser/Makefile ocaml-3.08.4/otherlibs/labltk/browser/Makefile
--- ocaml-3.08.4.orig/otherlibs/labltk/browser/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/otherlibs/labltk/browser/Makefile	Fri Aug 26 05:45:44 2005
@@ -46,8 +46,9 @@
 	echo '";;' >> $@
 
 install:
+	mkdir -p $(DESTDIR)$(BINDIR)
 	if test -f ocamlbrowser$(EXE); then : ; \
-	  cp ocamlbrowser$(EXE) $(BINDIR); fi
+	  cp ocamlbrowser$(EXE) $(DESTDIR)$(BINDIR); fi
 
 clean:
 	rm -f *.cm? ocamlbrowser$(EXE) dummy.mli *~ *.orig
diff -ruN ocaml-3.08.4.orig/otherlibs/labltk/camltk/Makefile ocaml-3.08.4/otherlibs/labltk/camltk/Makefile
--- ocaml-3.08.4.orig/otherlibs/labltk/camltk/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/otherlibs/labltk/camltk/Makefile	Fri Aug 26 05:45:30 2005
@@ -21,14 +21,14 @@
 	$(MAKE) -f Makefile.gen clean
 
 install: $(CAMLTKOBJS)
-	if test -d $(INSTALLDIR); then : ; else mkdir $(INSTALLDIR); fi
-	cp $(CAMLTKOBJS:.cmo=.cmi) $(CWIDGETOBJS:.cmo=.mli) $(INSTALLDIR)
-	chmod 644 $(INSTALLDIR)/*.cmi
+	mkdir -p $(DESTDIR)$(INSTALLDIR)
+	cp $(CAMLTKOBJS:.cmo=.cmi) $(CWIDGETOBJS:.cmo=.mli) $(DESTDIR)$(INSTALLDIR)
+	chmod 644 $(DESTDIR)$(INSTALLDIR)/*.cmi
 
 installopt: $(CAMLTKOBJSX)
-	@if test -d $(INSTALLDIR); then : ; else mkdir $(INSTALLDIR); fi
-	cp $(CAMLTKOBJSX) $(INSTALLDIR)
-	chmod 644 $(INSTALLDIR)/*.cmx
+	mkdir -p $(DESTDIR)$(INSTALLDIR)
+	cp $(CAMLTKOBJSX) $(DESTDIR)$(INSTALLDIR)
+	chmod 644 $(DESTDIR)$(INSTALLDIR)/*.cmx
 
 .SUFFIXES :
 .SUFFIXES : .mli .ml .cmi .cmx .cmo .mlp
diff -ruN ocaml-3.08.4.orig/otherlibs/labltk/compiler/Makefile ocaml-3.08.4/otherlibs/labltk/compiler/Makefile
--- ocaml-3.08.4.orig/otherlibs/labltk/compiler/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/otherlibs/labltk/compiler/Makefile	Fri Aug 26 05:44:52 2005
@@ -45,8 +45,9 @@
 	rm -f *.cm*  pplex.ml ppyac.ml ppyac.mli pp$(EXE)
 
 install: 
-	cp tkcompiler$(EXE) $(INSTALLDIR)
-	cp pp$(EXE) $(INSTALLDIR)
+	mkdir -p $(DESTDIR)$(INSTALLDIR)
+	cp tkcompiler$(EXE) $(DESTDIR)$(INSTALLDIR)
+	cp pp$(EXE) $(DESTDIR)$(INSTALLDIR)
 
 .SUFFIXES :
 .SUFFIXES : .mli .ml .cmi .cmo .mlp
diff -ruN ocaml-3.08.4.orig/otherlibs/labltk/frx/Makefile ocaml-3.08.4/otherlibs/labltk/frx/Makefile
--- ocaml-3.08.4.orig/otherlibs/labltk/frx/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/otherlibs/labltk/frx/Makefile	Fri Aug 26 05:44:30 2005
@@ -20,10 +20,12 @@
 	$(CAMLOPTLIBR) -o frxlib.cmxa $(OBJSX)
 
 install: frxlib.cma
-	cp *.cmi *.mli frxlib.cma $(INSTALLDIR)
+	mkdir -p $(DESTDIR)$(INSTALLDIR)
+	cp *.cmi *.mli frxlib.cma $(DESTDIR)$(INSTALLDIR)
 
 installopt: frxlib.cmxa
-	cp frxlib.cmxa frxlib.a $(INSTALLDIR)
+	mkdir -p $(DESTDIR)$(INSTALLDIR)
+	cp frxlib.cmxa frxlib.a $(DESTDIR)$(INSTALLDIR)
 
 clean:
 	rm -f *.cm* *.o *.a
diff -ruN ocaml-3.08.4.orig/otherlibs/labltk/jpf/Makefile ocaml-3.08.4/otherlibs/labltk/jpf/Makefile
--- ocaml-3.08.4.orig/otherlibs/labltk/jpf/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/otherlibs/labltk/jpf/Makefile	Fri Aug 26 05:43:56 2005
@@ -21,10 +21,12 @@
 	$(CAMLOPTLIBR) -o jpflib.cmxa $(OBJSX)
 
 install: jpflib.cma
-	cp $(OBJS:.cmo=.cmi) $(OBJS:.cmo=.mli) jpflib.cma $(INSTALLDIR)
+	mkdir -p $(DESTDIR)$(INSTALLDIR)
+	cp $(OBJS:.cmo=.cmi) $(OBJS:.cmo=.mli) jpflib.cma $(DESTDIR)$(INSTALLDIR)
 
 installopt: jpflib.cmxa
-	cp jpflib.cmxa jpflib.a $(OBJS:.cmo=.cmx) $(INSTALLDIR)
+	mkdir -p $(DESTDIR)$(INSTALLDIR)
+	cp jpflib.cmxa jpflib.a $(OBJS:.cmo=.cmx) $(DESTDIR)$(INSTALLDIR)
 
 clean:
 	rm -f *.cm* *.o *.a *~ *test
diff -ruN ocaml-3.08.4.orig/otherlibs/labltk/labltk/Makefile ocaml-3.08.4/otherlibs/labltk/labltk/Makefile
--- ocaml-3.08.4.orig/otherlibs/labltk/labltk/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/otherlibs/labltk/labltk/Makefile	Fri Aug 26 05:43:29 2005
@@ -16,14 +16,14 @@
 labltkobjsx: $(LABLTKOBJSX)
 
 install: $(LABLTKOBJS)
-	if test -d $(INSTALLDIR); then : ; else mkdir $(INSTALLDIR); fi
-	cp $(LABLTKOBJS:.cmo=.cmi) $(WIDGETOBJS:.cmo=.mli) $(INSTALLDIR)
-	chmod 644 $(INSTALLDIR)/*.cmi
+	mkdir -p $(DESTDIR)$(INSTALLDIR)
+	cp $(LABLTKOBJS:.cmo=.cmi) $(WIDGETOBJS:.cmo=.mli) $(DESTDIR)$(INSTALLDIR)
+	chmod 644 $(DESTDIR)$(INSTALLDIR)/*.cmi
 
 installopt: $(LABLTKOBJSX)
-	@if test -d $(INSTALLDIR); then : ; else mkdir $(INSTALLDIR); fi
-	cp $(LABLTKOBJSX) $(INSTALLDIR)
-	chmod 644 $(INSTALLDIR)/*.cmx
+	mkdir -p $(DESTDIR)$(INSTALLDIR)
+	cp $(LABLTKOBJSX) $(DESTDIR)$(INSTALLDIR)
+	chmod 644 $(DESTDIR)$(INSTALLDIR)/*.cmx
 
 clean:
 	$(MAKE) -f Makefile.gen clean
diff -ruN ocaml-3.08.4.orig/otherlibs/labltk/lib/Makefile ocaml-3.08.4/otherlibs/labltk/lib/Makefile
--- ocaml-3.08.4.orig/otherlibs/labltk/lib/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/otherlibs/labltk/lib/Makefile	Fri Aug 26 06:10:16 2005
@@ -58,17 +58,16 @@
 	@echo 'exec $(INSTALLDIR)/$(LIBNAME)top$(EXE) -I $(INSTALLDIR) $$*' >> $@
 
 install:
-	if test -d $(INSTALLDIR); then : ; else mkdir $(INSTALLDIR); fi
-	cp $(LIBNAME).cma $(LIBNAME)top$(EXE) $(INSTALLDIR)
-	chmod 644 $(INSTALLDIR)/$(LIBNAME).cma
-	chmod 755 $(INSTALLDIR)/$(LIBNAME)top$(EXE)
-	@if test -d $(BINDIR); then : ; else mkdir $(BINDIR); fi
-	cp $(LIBNAME) $(BINDIR)
-	chmod 755 $(BINDIR)/$(LIBNAME)
+	mkdir -p $(DESTDIR)$(LIBDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(INSTALLDIR)
+	cp $(LIBNAME).cma $(LIBNAME)top$(EXE) $(DESTDIR)$(INSTALLDIR)
+	chmod 644 $(DESTDIR)$(INSTALLDIR)/$(LIBNAME).cma
+	chmod 755 $(DESTDIR)$(INSTALLDIR)/$(LIBNAME)top$(EXE)
+	cp $(LIBNAME) $(DESTDIR)$(BINDIR)
+	chmod 755 $(DESTDIR)$(BINDIR)/$(LIBNAME)
 
 installopt:
-	@if test -d $(INSTALLDIR); then : ; else mkdir $(INSTALLDIR); fi
-	cp $(LIBNAME).cmxa $(LIBNAME).a $(INSTALLDIR)
-	cd $(INSTALLDIR); $(RANLIB) $(LIBNAME).a
-	chmod 644 $(INSTALLDIR)/$(LIBNAME).cmxa
-	chmod 644 $(INSTALLDIR)/$(LIBNAME).a
+	mkdir -p $(DESTDIR)$(INSTALLDIR)
+	cp $(LIBNAME).cmxa $(LIBNAME).a $(DESTDIR)$(INSTALLDIR)
+	cd $(DESTDIR)$(INSTALLDIR) && $(RANLIB) $(LIBNAME).a
+	chmod 644 $(DESTDIR)$(INSTALLDIR)/$(LIBNAME).cmxa
+	chmod 644 $(DESTDIR)$(INSTALLDIR)/$(LIBNAME).a
diff -ruN ocaml-3.08.4.orig/otherlibs/labltk/support/Makefile ocaml-3.08.4/otherlibs/labltk/support/Makefile
--- ocaml-3.08.4.orig/otherlibs/labltk/support/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/otherlibs/labltk/support/Makefile	Fri Aug 26 06:09:33 2005
@@ -26,12 +26,12 @@
     widget.cmi widget.mli
 
 install: lib$(LIBNAME).a $(PUB)
-	if test -d $(INSTALLDIR); then : ; else mkdir $(INSTALLDIR); fi
-	cp $(PUB) lib$(LIBNAME).a $(INSTALLDIR)
-	cd $(INSTALLDIR); $(RANLIB) lib$(LIBNAME).a
-	cd $(INSTALLDIR); chmod 644 $(PUB) lib$(LIBNAME).a
+	mkdir -p $(DESTDIR)$(INSTALLDIR) $(DESTDIR)$(STUBLIBDIR)
+	cp $(PUB) lib$(LIBNAME).a $(DESTDIR)$(INSTALLDIR)
+	cd $(DESTDIR)$(INSTALLDIR) && $(RANLIB) lib$(LIBNAME).a
+	cd $(DESTDIR)$(INSTALLDIR) && chmod 644 $(PUB) lib$(LIBNAME).a
 	if test -f dll$(LIBNAME).so; then \
-	   cp dll$(LIBNAME).so $(STUBLIBDIR)/dll$(LIBNAME).so; fi
+	   cp dll$(LIBNAME).so $(DESTDIR)$(STUBLIBDIR)/dll$(LIBNAME).so; fi
 
 clean : 
 	rm -f *.cm* *.o *.a *.so
diff -ruN ocaml-3.08.4.orig/otherlibs/labltk/tkanim/Makefile ocaml-3.08.4/otherlibs/labltk/tkanim/Makefile
--- ocaml-3.08.4.orig/otherlibs/labltk/tkanim/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/otherlibs/labltk/tkanim/Makefile	Fri Aug 26 06:09:00 2005
@@ -56,13 +56,15 @@
 
 
 install: tkanim.cma 
-	cp tkanim.cma *.cmi *.mli libtkanim.a $(INSTALLDIR)
+	mkdir -p $(DESTDIR)$(SUBLIBDIR) $(DESTDIR)$(INSTALLDIR)
+	cp tkanim.cma *.cmi *.mli libtkanim.a $(DESTDIR)$(INSTALLDIR)
 	if [ -f dlltkanim.so ]; then \
-		cp dlltkanim.so $(STUBLIBDIR)/dlltkanim.so; \
+		cp dlltkanim.so $(DESTDIR)$(STUBLIBDIR)/dlltkanim.so; \
 	fi
 
 installopt: tkanim.cmxa
-	cp tkanim.cmxa tkanim.a $(INSTALLDIR)
+	mkdir -p $(DESTDIR)$(INSTALLDIR)
+	cp tkanim.cmxa tkanim.a $(DESTDIR)$(INSTALLDIR)
 
 depend: tkanim.ml
 	$(CAMLDEP) *.mli *.ml > .depend
diff -ruN ocaml-3.08.4.orig/otherlibs/num/Makefile ocaml-3.08.4/otherlibs/num/Makefile
--- ocaml-3.08.4.orig/otherlibs/num/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/otherlibs/num/Makefile	Fri Aug 26 12:13:18 2005
@@ -49,14 +49,16 @@
 $(CAMLOBJS:.cmo=.cmx): ../../ocamlopt
 
 install:
-	if test -f dllnums.so; then cp dllnums.so $(STUBLIBDIR)/dllnums.so; fi
-	cp libnums.a $(LIBDIR)/libnums.a
-	cd $(LIBDIR); $(RANLIB) libnums.a
-	cp nums.cma $(CMIFILES) $(CMIFILES:.cmi=.mli) $(LIBDIR)
+	mkdir -p $(DESTDIR)$(STUBLIBDIR) $(DESTDIR)$(LIBDIR)
+	if test -f dllnums.so; then cp dllnums.so $(DESTDIR)$(STUBLIBDIR)/dllnums.so; fi
+	cp libnums.a $(DEESTDIR)$(LIBDIR)/libnums.a
+	cd $(DESTDIR)$(LIBDIR) && $(RANLIB) libnums.a
+	cp nums.cma $(CMIFILES) $(CMIFILES:.cmi=.mli) $(DESTDIR)$(LIBDIR)
 
 installopt:
-	cp $(CAMLOBJS:.cmo=.cmx) nums.cmxa nums.a $(LIBDIR)
-	cd $(LIBDIR); $(RANLIB) nums.a
+	mkdir -p $(DESTDIR)$(LIBDIR)
+	cp $(CAMLOBJS:.cmo=.cmx) nums.cmxa nums.a $(DESTDIR)$(LIBDIR)
+	cd $(DESTDIR)$(LIBDIR) && $(RANLIB) nums.a
 
 partialclean:
 	rm -f *.cm*
@@ -80,7 +82,7 @@
        bng_alpha.c bng_amd64.c bng_ia32.c bng_mips.c bng_ppc.c bng_sparc.c
 
 depend:
-	gcc -MM $(CFLAGS) *.c > .depend
+	$(CC) -MM $(CFLAGS) *.c > .depend
 	../../boot/ocamlrun ../../tools/ocamldep *.mli *.ml >> .depend
 
 include .depend
diff -ruN ocaml-3.08.4.orig/otherlibs/str/Makefile ocaml-3.08.4/otherlibs/str/Makefile
--- ocaml-3.08.4.orig/otherlibs/str/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/otherlibs/str/Makefile	Fri Aug 26 12:12:41 2005
@@ -48,14 +48,15 @@
 	rm -f *.a *.so *.o
 
 install:
+	mkdir -p $(DESTDIR)$(STUBLIBDIR) $(DESTDIR)$(LIBDIR)
 	if test -f dllstr.so; then cp dllstr.so $(STUBLIBDIR)/dllstr.so; fi
-	cp libstr.a $(LIBDIR)/libstr.a
-	cd $(LIBDIR); $(RANLIB) libstr.a
-	cp str.cma str.cmi str.mli $(LIBDIR)
+	cp libstr.a $(DESTDIR)$(LIBDIR)/libstr.a
+	cd $(DESTDIR)$(LIBDIR) && $(RANLIB) libstr.a
+	cp str.cma str.cmi str.mli $(DESTDIR)$(LIBDIR)
 
 installopt:
-	cp str.cmx str.cmxa str.a $(LIBDIR)
-	cd $(LIBDIR); $(RANLIB) str.a
+	cp str.cmx str.cmxa str.a $(DESTDIR)$(LIBDIR)
+	cd $(DESTDIR)$(LIBDIR) && $(RANLIB) str.a
 
 .SUFFIXES: .ml .mli .cmo .cmi .cmx
 
@@ -69,7 +70,7 @@
 	$(CAMLOPT) -c $(COMPFLAGS) $<
 
 depend:
-	gcc -MM $(CFLAGS) *.c > .depend
+	$(CC) -MM $(CFLAGS) *.c > .depend
 	../../boot/ocamlrun ../../tools/ocamldep *.mli *.ml >> .depend
 
 include .depend
diff -ruN ocaml-3.08.4.orig/otherlibs/systhreads/Makefile ocaml-3.08.4/otherlibs/systhreads/Makefile
--- ocaml-3.08.4.orig/otherlibs/systhreads/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/otherlibs/systhreads/Makefile	Fri Aug 26 12:12:23 2005
@@ -70,19 +70,21 @@
 	rm -f $(GENFILES)
 
 install:
-	if test -f dllthreads.so; then cp dllthreads.so $(STUBLIBDIR)/dllthreads.so; fi
-	cp libthreads.a $(LIBDIR)/libthreads.a
-	cd $(LIBDIR); $(RANLIB) libthreads.a
-	if test -d $(LIBDIR)/threads; then :; else mkdir $(LIBDIR)/threads; fi
-	cp $(THREAD_OBJS:.cmo=.cmi) threads.cma $(LIBDIR)/threads
-	rm -f $(LIBDIR)/threads/stdlib.cma
-	cp thread.mli mutex.mli condition.mli event.mli threadUnix.mli $(LIBDIR)
+	mkdir -p $(DESTDIR)$(LIBDIR) $(DESTDIR)$(STUBLIBDIR)
+	if test -f dllthreads.so; then cp dllthreads.so $(DESTDIR)$(STUBLIBDIR)/dllthreads.so; fi
+	cp libthreads.a $(DESTDIR)$(LIBDIR)/libthreads.a
+	cd $(DESTDIR)$(LIBDIR) && $(RANLIB) libthreads.a
+	mkdir -p $(DESTDIR)$(LIBDIR)
+	cp $(THREAD_OBJS:.cmo=.cmi) threads.cma $(DESTDIR)$(LIBDIR)/threads
+	rm -f $(DESTDIR)$(LIBDIR)/threads/stdlib.cma
+	cp thread.mli mutex.mli condition.mli event.mli threadUnix.mli $(DESTDIR)$(LIBDIR)
 
 installopt:
-	cp libthreadsnat.a $(LIBDIR)/libthreadsnat.a
-	cd $(LIBDIR); $(RANLIB) libthreadsnat.a
-	cp $(THREAD_OBJS:.cmo=.cmx) threads.cmxa threads.a $(LIBDIR)/threads
-	cd $(LIBDIR)/threads; $(RANLIB) threads.a
+	mkdir -p $(DESTDIR)$(LIBDIR)
+	cp libthreadsnat.a $(DESTDIR)$(LIBDIR)/libthreadsnat.a
+	cd $(DESTDIR)$(LIBDIR) && $(RANLIB) libthreadsnat.a
+	cp $(THREAD_OBJS:.cmo=.cmx) threads.cmxa threads.a $(DESTDIR)$(LIBDIR)/threads
+	cd $(DESTDIR)$(LIBDIR)/threads && $(RANLIB) threads.a
 
 .SUFFIXES: .ml .mli .cmo .cmi .cmx
 
@@ -96,7 +98,7 @@
 	$(CAMLOPT) -c $(COMPFLAGS) $<
 
 depend: $(GENFILES)
-	gcc -MM -I../../byterun *.c > .depend
+	$(CC) -MM -I../../byterun *.c > .depend
 	../../boot/ocamlrun ../../tools/ocamldep *.mli *.ml >> .depend
 
 include .depend
diff -ruN ocaml-3.08.4.orig/otherlibs/threads/Makefile ocaml-3.08.4/otherlibs/threads/Makefile
--- ocaml-3.08.4.orig/otherlibs/threads/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/otherlibs/threads/Makefile	Fri Aug 26 12:11:56 2005
@@ -99,12 +99,13 @@
 	rm -f pervasives.mli marshal.mli unix.mli
 
 install:
-	if test -f dllvmthreads.so; then cp dllvmthreads.so $(STUBLIBDIR)/.; fi
-	mkdir -p $(LIBDIR)/vmthreads
-	cp libvmthreads.a $(LIBDIR)/vmthreads/libvmthreads.a
-	cd $(LIBDIR)/vmthreads; $(RANLIB) libvmthreads.a
-	cp thread.cmi mutex.cmi condition.cmi event.cmi threadUnix.cmi threads.cma stdlib.cma unix.cma $(LIBDIR)/vmthreads
-	cp thread.mli mutex.mli condition.mli event.mli threadUnix.mli $(LIBDIR)/vmthreads
+	mkdir -p $(DESTDIR)$(LIBDIR) $(DESTDIR)$(STUBLIBDIR)
+	if test -f dllvmthreads.so; then cp dllvmthreads.so $(DESTDIR)$(STUBLIBDIR)/.; fi
+	mkdir -p $(DESTDIR)$(LIBDIR)/vmthreads
+	cp libvmthreads.a $(DESTIDIR)$(LIBDIR)/vmthreads/libvmthreads.a
+	cd $(DESTDIR)$(LIBDIR)/vmthreads && $(RANLIB) libvmthreads.a
+	cp thread.cmi mutex.cmi condition.cmi event.cmi threadUnix.cmi threads.cma stdlib.cma unix.cma $(DESTDIR)$(LIBDIR)/vmthreads
+	cp thread.mli mutex.mli condition.mli event.mli threadUnix.mli $(DESTDIR)$(LIBDIR)/vmthreads
 
 installopt:
 
@@ -120,7 +121,7 @@
 	$(CAMLOPT) -c $(COMPFLAGS) $<
 
 depend:
-	gcc -MM $(CFLAGS) *.c > .depend
+	$(CC) -MM $(CFLAGS) *.c > .depend
 	../../boot/ocamlrun ../../tools/ocamldep *.mli *.ml >> .depend
 
 include .depend
diff -ruN ocaml-3.08.4.orig/otherlibs/unix/Makefile ocaml-3.08.4/otherlibs/unix/Makefile
--- ocaml-3.08.4.orig/otherlibs/unix/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/otherlibs/unix/Makefile	Fri Aug 26 12:11:27 2005
@@ -66,14 +66,16 @@
 	rm -f *.a *.o *.so
 
 install:
-	if test -f dllunix.so; then cp dllunix.so $(STUBLIBDIR)/dllunix.so; fi
-	cp libunix.a $(LIBDIR)/libunix.a
-	cd $(LIBDIR); $(RANLIB) libunix.a
-	cp unix.cma $(MLOBJS:.cmo=.cmi) $(MLOBJS:.cmo=.mli) $(LIBDIR)
+	mkdir -p $(DESTDIR)$(LIBDIR) $(DESTDIR)$(STUBLIBDIR)
+	if test -f dllunix.so; then cp dllunix.so $(DESTDIR)$(STUBLIBDIR)/dllunix.so; fi
+	cp libunix.a $(DESTDIR)$(LIBDIR)/libunix.a
+	cd $(DESTDIR)$(LIBDIR) && $(RANLIB) libunix.a
+	cp unix.cma $(MLOBJS:.cmo=.cmi) $(MLOBJS:.cmo=.mli) $(DESTDIR)$(LIBDIR)
 
 installopt:
-	cp $(MLOBJS:.cmo=.cmx) unix.cmxa unix.a $(LIBDIR)
-	cd $(LIBDIR); $(RANLIB) unix.a
+	mkdir -p $(DESTDIR)$(LIBDIR)
+	cp $(MLOBJS:.cmo=.cmx) unix.cmxa unix.a $(DESTDIR)$(LIBDIR)
+	cd $(DESTDIR)$(LIBDIR) && $(RANLIB) unix.a
 
 .SUFFIXES: .ml .mli .cmo .cmi .cmx
 
@@ -87,7 +89,7 @@
 	$(CAMLOPT) -c $(COMPFLAGS) -nolabels $<
 
 depend:
-	gcc -MM $(CFLAGS) *.c > .depend
+	$(CC) -MM $(CFLAGS) *.c > .depend
 	../../boot/ocamlrun ../../tools/ocamldep *.mli *.ml >> .depend
 
 include .depend
diff -ruN ocaml-3.08.4.orig/stdlib/Makefile ocaml-3.08.4/stdlib/Makefile
--- ocaml-3.08.4.orig/stdlib/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/stdlib/Makefile	Fri Aug 26 05:34:05 2005
@@ -47,25 +47,29 @@
 	rm -f std_exit.p.cmi
 
 install:
+	mkdir -p $(DESTDIR)$(LIBDIR)
 	cp stdlib.cma std_exit.cmo *.cmi *.mli *.ml camlheader camlheader_ur \
-           $(LIBDIR)
+           $(DESTDIR)$(LIBDIR)
 
 installopt: installopt-default installopt-$(PROFILING)
 
 installopt-default:
-	cp stdlib.cmxa stdlib.a std_exit.o *.cmx $(LIBDIR)
-	cd $(LIBDIR); $(RANLIB) stdlib.a
+	mkdir -p $(DESTDIR)$(LIBDIR)
+	cp stdlib.cmxa stdlib.a std_exit.o *.cmx $(DESTDIR)$(LIBDIR)
+	cd $(DESTDIR)$(LIBDIR) && $(RANLIB) stdlib.a
 
 installopt-noprof:
-	rm -f $(LIBDIR)/stdlib.p.cmxa; ln -s stdlib.cmxa $(LIBDIR)/stdlib.p.cmxa
-	rm -f $(LIBDIR)/stdlib.p.a; ln -s stdlib.a $(LIBDIR)/stdlib.p.a
-	rm -f $(LIBDIR)/std_exit.p.cmx; \
-          ln -s std_exit.cmx $(LIBDIR)/std_exit.p.cmx
-	rm -f $(LIBDIR)/std_exit.p.o; ln -s std_exit.o $(LIBDIR)/std_exit.p.o
+	mkdir -p $(DESTDIR)$(LIBDIR)
+	rm -f $(DESTDIR)$(LIBDIR)/stdlib.p.cmxa; ln -s stdlib.cmxa $(DESTDIR)$(LIBDIR)/stdlib.p.cmxa
+	rm -f $(DESTDIR)$(LIBDIR)/stdlib.p.a; ln -s stdlib.a $(DESTDIR)$(LIBDIR)/stdlib.p.a
+	rm -f $(DESTDIR)$(LIBDIR)/std_exit.p.cmx; \
+          ln -s std_exit.cmx $(DESTDIR)$(LIBDIR)/std_exit.p.cmx
+	rm -f $(DESTDIR)$(LIBDIR)/std_exit.p.o; ln -s std_exit.o $(DESTDIR)$(LIBDIR)/std_exit.p.o
 
 installopt-prof:
-	cp stdlib.p.cmxa stdlib.p.a std_exit.p.cmx std_exit.p.o $(LIBDIR)
-	cd $(LIBDIR); $(RANLIB) stdlib.p.a
+	mkdir -p $(DESTDIR)$(LIBDIR)
+	cp stdlib.p.cmxa stdlib.p.a std_exit.p.cmx std_exit.p.o $(DESTDIR)$(LIBDIR)
+	cd $(DESTDIR)$(LIBDIR) && $(RANLIB) stdlib.p.a
 
 stdlib.cma: $(OBJS)
 	$(CAMLC) -a -o stdlib.cma $(OBJS)
diff -ruN ocaml-3.08.4.orig/tools/Makefile ocaml-3.08.4/tools/Makefile
--- ocaml-3.08.4.orig/tools/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/tools/Makefile	Fri Aug 26 05:32:24 2005
@@ -48,9 +48,10 @@
 	rm -f ocamldep.opt
 
 install::
-	cp ocamldep $(BINDIR)/ocamldep$(EXE)
+	mkdir -p $(DESTDIR)$(BINDIR)
+	cp ocamldep $(DESTDIR)$(BINDIR)/ocamldep$(EXE)
 	if test -f ocamldep.opt; \
-	  then cp ocamldep.opt $(BINDIR)/ocamldep.opt$(EXE); else :; fi
+	  then cp ocamldep.opt $(DESTDIR)$(BINDIR)/ocamldep.opt$(EXE); else :; fi
 
 # The profiler
 
@@ -66,9 +67,10 @@
 	$(CAMLC) $(LINKFLAGS) -o ocamlcp main_args.cmo ocamlcp.cmo
 
 install::
-	cp ocamlprof $(BINDIR)/ocamlprof$(EXE)
-	cp ocamlcp $(BINDIR)/ocamlcp$(EXE)
-	cp profiling.cmi profiling.cmo $(LIBDIR)
+	mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR)
+	cp ocamlprof $(DESTDIR)$(BINDIR)/ocamlprof$(EXE)
+	cp ocamlcp $(DESTDIR)$(BINDIR)/ocamlcp$(EXE)
+	cp profiling.cmi profiling.cmo $(DESTDIR)$(LIBDIR)
 
 clean::
 	rm -f ocamlprof ocamlcp
@@ -80,7 +82,8 @@
 	chmod +x ocamlmktop
 
 install::
-	cp ocamlmktop $(BINDIR)/ocamlmktop
+	mkdir -p $(DESTDIR)$(BINDIR)
+	cp ocamlmktop $(DESTDIR)$(BINDIR)/ocamlmktop
 
 clean::
 	rm -f ocamlmktop
@@ -91,7 +94,8 @@
 	$(CAMLC) $(LINKFLAGS) -o ocamlmklib ocamlmklib.cmo
 
 install::
-	cp ocamlmklib $(BINDIR)/ocamlmklib
+	mkdir -p $(DESTDIR)$(BINDIR)
+	cp ocamlmklib $(DESTDIR)$(BINDIR)/ocamlmklib
 
 clean::
 	rm -f ocamlmklib
@@ -145,7 +149,8 @@
 	$(CAMLLEX) lexer301.mll
 
 install::
-	cp scrapelabels $(LIBDIR)
+	mkdir -p $(DESTDIR)$(LIBDIR)
+	cp scrapelabels $(DESTDIR)$(LIBDIR)
 
 clean::
 	rm -f scrapelabels lexer301.ml
@@ -161,7 +166,8 @@
 		$(ADDLABELS_IMPORTS) addlabels.ml
 
 install::
-	cp addlabels $(LIBDIR)
+	mkdir -p $(DESTDIR)$(LIBDIR)
+	cp addlabels $(DESTDIR)$(LIBDIR)
 
 clean::
 	rm -f addlabels
diff -ruN ocaml-3.08.4.orig/win32caml/Makefile ocaml-3.08.4/win32caml/Makefile
--- ocaml-3.08.4.orig/win32caml/Makefile	Fri Aug 26 05:24:45 2005
+++ ocaml-3.08.4/win32caml/Makefile	Fri Aug 26 05:29:56 2005
@@ -45,7 +45,8 @@
 	rm -f ocamlwin.exe *.$(O) *.pdb ocamlwin.ilk
 
 install:
-	cp ocamlwin.exe $(PREFIX)/OCamlWin.exe
+	mkdir -p $(DESTDIR)$(PREFIX)
+	cp ocamlwin.exe $(DESTDIR)$(PREFIX)/OCamlWin.exe
 
 .SUFFIXES: .c .$(O)
 
diff -ruN ocaml-3.08.4.orig/byterun/Makefile ocaml-3.08.4/byterun/Makefile
--- ocaml-3.08.4.orig/byterun/Makefile	Fri Aug 26 21:25:47 2005
+++ ocaml-3.08.4/byterun/Makefile	Fri Aug 26 21:28:06 2005
@@ -58,8 +58,8 @@
 	cp ld.conf $(LIBDIR)/ld.conf
 
 ld.conf:
-	echo "$(STUBLIBDIR)" >ld.conf
-	echo "$(LIBDIR)" >>ld.conf
+	echo "$(SYSROOT)$(STUBLIBDIR)" >ld.conf
+	echo "$(SYSROOT)$(LIBDIR)" >>ld.conf
 
 libcamlrun.a: $(OBJS)
 	ar rc libcamlrun.a $(OBJS)

[-- Attachment #3: buildconf-query --]
[-- Type: text/plain, Size: 451 bytes --]

#!/bin/bash

DB=/install/config/systems/jail/etc/buildconf/buildconf.db

if [ ! "$1" ]; then
    echo "$0 <query>";
    exit 1;
fi

QUERY="$1";
LINE=`cat $DB | grep -E "^$QUERY:" | sed -e "s/#.*//; s/	/    /g; s/^ *//; s/ *$//;"`
if [ ! "$LINE" ]; then
    echo "Missing Property: $QUERY" >&2
    exit 1;
fi

OUT=`echo "$LINE" | grep -E "^$QUERY:" | sed -e "s/^$QUERY://; s/#.*//; s/	/    /g; s/^ *//; s/ *$//;"`
#echo "OUT=+++$OUT+++"
echo -n "$OUT"

[-- Attachment #4: buildconf.db --]
[-- Type: text/plain, Size: 1690 bytes --]

### system build configuration stuff for: JAIL (HOMER)
### x86 / i686 athlon XP

host.cpu.family:		x86		## foo 123
host.cpu.type:			i686
host.cpu.model:			athlon-xp
host.cpu.has-mmx:		yes
host.cpu.has-mmx2:		yes
host.cpu.endian:		little		## allowed: "little" and "big"
host.name:			jail
host.ansi-c.sizes.short:	2
host.ansi-c.sizes.long:		4
host.ansi-c.sizes.longlong:	8
host.ansi-c.sizes.ptr:		4
host.ansi-c.sizes.int:		4
host.api.libc.printf.fmt-longlong:	%lld		## macos uses %qd

## define whether some APIs are in our libc
host.api.libc.putenv:		yes
host.api.libc.locale:		yes
host.api.libc.dll.nslinkmodule:	no	## darwin
host.api.libc.dll.dlopen:	no
host.api.libc.dll.dlopen-ext:	yes
host.api.libc.getcwd:		yes
host.api.libc.getwd:		yes
host.api.libc.mkfifo:		yes
host.api.libc.mktime:		yes
host.api.libc.rewinddir:	yes
host.api.libc.lockf:		yes
host.api.libc.dirent:		yes
host.api.libc.inet_aton:	yes
host.api.libc.unistd:		yes
host.api.libc.types.off_t:	yes
host.api.libc.ipv6:		yes

host.api.syscall.dup2:		yes
host.api.syscall.utimes:	yes
host.api.syscall.uname:		yes
host.api.syscall.gethostname:	yes
host.api.syscall.times:		yes
host.api.syscall.getpriority:	yes
host.api.syscall.utime:		yes
host.api.syscall.fchmod:	yes
host.api.syscall.fchown:	yes
host.api.syscall.waitpid:	yes
host.api.syscall.wait4:		yes
host.api.syscall.symlink:	yes
host.api.syscall.readlink:	yes
host.api.syscall.truncate:	yes
host.api.syscall.ftruncate:	yes
host.api.syscall.gettimeofday:	yes
host.api.syscall.select:	yes
host.api.syscall.getgroups:	yes

host.api.posix.signals:		yes

host.api.bsd.sockets.socklen_t:	yes
host.api.bsd.sockets:		yes
host.api.bsd.sockets.ldflags:	# empty ## -lnsl -lsocket

  parent reply	other threads:[~2005-08-26 19:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-26 12:00 Enrico Weigelt
2005-08-26 12:18 ` [Caml-list] " David MENTRE
2005-08-26 12:33   ` Enrico Weigelt
2005-08-26 12:18 ` Sebastian Egner
2005-08-26 13:50   ` Enrico Weigelt
2005-08-26 13:42 ` Eric Cooper
2005-08-26 17:38   ` Enrico Weigelt
2005-08-26 20:11     ` Enrico Weigelt
2005-08-26 19:50   ` Enrico Weigelt [this message]
2005-08-26 22:47 ` skaller
2005-08-27  6:20   ` Enrico Weigelt
2005-08-28 17:39     ` Quôc Peyrot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050826195048.GA1534@nibiru.local \
    --to=weigelt@metux.de \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox