caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* crosscompile problem
@ 2005-08-26 12:00 Enrico Weigelt
  2005-08-26 12:18 ` [Caml-list] " David MENTRE
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Enrico Weigelt @ 2005-08-26 12:00 UTC (permalink / raw)
  To: caml-list

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


Hi folks,

it seems that crosscompiling ocaml is currently impossible. 
The whole ./configure stuff heavily relies on running several 
test programs checking target stuff (ie. sizeof()).
Of course this cannot work on cross targets. 

I started to add some options for bypassing such tests, 
ie. --32bit and --64bit, but this doesnt go far enough and 
also requires distro builders to add special fixes for this 
package on every target.

Since almost all packages have to cope with this problem and
also widely used buildsystems like autoconf also have no clean
way of handling this, I suggest moving away this configuration
from individual packages to some central point - an global 
config database.
We query this database by simply calling some given commandline
with the variable name as parameter. The value is simply printed
out on stdout, without linefeed.

For example to get some type sizes:

    /opt/xcompiler/minibox/bin/buildconf-query host.ansi-c.sizes.long


This can be easily solved by a tiny shellscript and some carefully
maintained text database. (see attachement)


I'll now starting to rewrite the configure script ...


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: buildconf-query --]
[-- Type: text/plain, Size: 255 bytes --]

#!/bin/bash

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

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

QUERY="$1";
OUT=`cat $DB | grep -E "^$QUERY:" | sed -e "s/^$QUERY://;" | sed 's/	/    /g;' | sed "s/^ *//"`
echo -n "$OUT"

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

### system build configuration stuff for: JAIL (HOMER)

host.cpu.family:		x86
host.cpu.type:			athlon-xp
host.cpu.has-mmx:		yes
host.cpu.has-mmx2:		yes
host.name:			jail
host.ansi-c.sizes.short:	2
host.ansi-c.sizes.long:		4
host.ansi-c.sizes.longlong:	8

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Caml-list] crosscompile problem
  2005-08-26 12:00 crosscompile problem Enrico Weigelt
@ 2005-08-26 12:18 ` David MENTRE
  2005-08-26 12:33   ` Enrico Weigelt
  2005-08-26 12:18 ` Sebastian Egner
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 12+ messages in thread
From: David MENTRE @ 2005-08-26 12:18 UTC (permalink / raw)
  To: weigelt; +Cc: caml-list

Hello,

2005/8/26, Enrico Weigelt <weigelt@metux.de>:
> it seems that crosscompiling ocaml is currently impossible.

Some people have already tackled this issue:
  http://sardes.inrialpes.fr/~aschmitt/cwn/2004.09.28.html#3

You might use it as a starting point.

Yours,
d.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Caml-list] crosscompile problem
  2005-08-26 12:00 crosscompile problem Enrico Weigelt
  2005-08-26 12:18 ` [Caml-list] " David MENTRE
@ 2005-08-26 12:18 ` Sebastian Egner
  2005-08-26 13:50   ` Enrico Weigelt
  2005-08-26 13:42 ` Eric Cooper
  2005-08-26 22:47 ` skaller
  3 siblings, 1 reply; 12+ messages in thread
From: Sebastian Egner @ 2005-08-26 12:18 UTC (permalink / raw)
  To: caml-list

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

Enrico Weigelt wrote:
> Hi folks,
>
> it seems that crosscompiling ocaml is currently impossible. 
> The whole ./configure stuff heavily relies on running several 
> test programs checking target stuff (ie. sizeof()).
> Of course this cannot work on cross targets. 

Just to chime in... 

I would like to second Enrico's suggestion for better cross-compilation 
support in Ocaml. 

Sebastian.

----
Dr. Sebastian Egner
Senior Scientist
Philips Research Laboratories
Prof. Holstlaan 4 (WDC 1-051, 1st floor, room 51)
5656 AA Eindhoven
The Netherlands
tel:       +31 40 27-43166
fax:      +31 40 27-44004
email: sebastian.egner@philips.com

[-- Attachment #2: Type: text/html, Size: 1049 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Caml-list] crosscompile problem
  2005-08-26 12:18 ` [Caml-list] " David MENTRE
@ 2005-08-26 12:33   ` Enrico Weigelt
  0 siblings, 0 replies; 12+ messages in thread
From: Enrico Weigelt @ 2005-08-26 12:33 UTC (permalink / raw)
  To: caml-list

* David MENTRE <david.mentre@gmail.com> wrote:

hi,

> Some people have already tackled this issue:
>   http://sardes.inrialpes.fr/~aschmitt/cwn/2004.09.28.html#3

Isn't really helpful, since its more or less a hack for getting
ocaml compiled on his individual arm-compiler, with all 
hardcoded pathes, etc.

I have to pass the toolchain commands by environment variables
and entirely work with an sysroot'ed build.

Such fixes for some really specific target are quite trivial, 
but being really cross-platform, also with crosscompiling, 
is a little bit more compilicated. The commonly used buildsystems
are not really suited for that.

I've now moved some more steps on my external buildconf database:
Defined some common variables (ie. endianess, type sizes, ...)
and rewritten ./configure to query the db instead of trying to
guess these things by itself.

I'll send some patches soon...


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 --
---------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Caml-list] crosscompile problem
  2005-08-26 12:00 crosscompile problem Enrico Weigelt
  2005-08-26 12:18 ` [Caml-list] " David MENTRE
  2005-08-26 12:18 ` Sebastian Egner
@ 2005-08-26 13:42 ` Eric Cooper
  2005-08-26 17:38   ` Enrico Weigelt
  2005-08-26 19:50   ` Enrico Weigelt
  2005-08-26 22:47 ` skaller
  3 siblings, 2 replies; 12+ messages in thread
From: Eric Cooper @ 2005-08-26 13:42 UTC (permalink / raw)
  To: caml-list

On Fri, Aug 26, 2005 at 02:00:42PM +0200, Enrico Weigelt wrote:
> it seems that crosscompiling ocaml is currently impossible. 
> The whole ./configure stuff heavily relies on running several 
> test programs checking target stuff (ie. sizeof()).
> Of course this cannot work on cross targets. 

I did this manually for powerpc and arm targets a while ago, but I
agree that it would be nice to automate it and have it merged into the
main build system.

You might want to look at the ScratchBox approach
(http://www.scratchbox.org/) which uses an emulator like qemu to run
test programs on the target.

-- 
Eric Cooper             e c c @ c m u . e d u


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Caml-list] crosscompile problem
  2005-08-26 12:18 ` Sebastian Egner
@ 2005-08-26 13:50   ` Enrico Weigelt
  0 siblings, 0 replies; 12+ messages in thread
From: Enrico Weigelt @ 2005-08-26 13:50 UTC (permalink / raw)
  To: caml-list

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


JFYI: here's my the current state of my buildconf file ...

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: buildconf.db --]
[-- Type: text/plain, Size: 738 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.libc.printf-fmt-longlong:	%lld		## macos uses %qd

## define whether some APIs are in our libc
host.libc.api.putenv:		yes
host.libc.api.locale:		yes
host.libc.api.dll.nslinkmodule:	no	## darwin
host.libc.api.dll.dlopen:	no
host.libc.api.dll.dlopen-ext:	yes
host.libc.api.getcwd:		yes

host.syscall.times:		yes

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Caml-list] crosscompile problem
  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
  1 sibling, 1 reply; 12+ messages in thread
From: Enrico Weigelt @ 2005-08-26 17:38 UTC (permalink / raw)
  To: caml-list

* Eric Cooper <ecc@cmu.edu> wrote:

<snip>
> I did this manually for powerpc and arm targets a while ago, but I
> agree that it would be nice to automate it and have it merged into the
> main build system.

Its not really necessary to automate evrything. All we need is a 
central database, which simply contains all we really need to know.
Of course we need *one* database per target system, which is 
really careefully maintained and the used by as many projects as
possible. 

The current situation of every project hacking its own whether 
forecast, is really unreliable and unsatisfying.


> You might want to look at the ScratchBox approach
> (http://www.scratchbox.org/) which uses an emulator like qemu to run
> test programs on the target.

Oh, no ... no more such bad jokes .... please, please lets stay serious! 
You dont really ask me to set up an complete (hardware) emulation 
for every target, just that braindead stuff like autoconf can guess 
how many bits an int takes ?! 
No, thats not serious software development.


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 --
---------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Caml-list] crosscompile problem
  2005-08-26 13:42 ` Eric Cooper
  2005-08-26 17:38   ` Enrico Weigelt
@ 2005-08-26 19:50   ` Enrico Weigelt
  1 sibling, 0 replies; 12+ messages in thread
From: Enrico Weigelt @ 2005-08-26 19:50 UTC (permalink / raw)
  To: caml-list

[-- 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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Caml-list] crosscompile problem
  2005-08-26 17:38   ` Enrico Weigelt
@ 2005-08-26 20:11     ` Enrico Weigelt
  0 siblings, 0 replies; 12+ messages in thread
From: Enrico Weigelt @ 2005-08-26 20:11 UTC (permalink / raw)
  To: caml-list


folks,


the problem gets even worse:

when trying to build mldonkey with an crosscompile'd ocaml,
the ocamlc gives wrong parameters to gcc, so host system and 
sysroot get mixed up, and of course libc's don't match.

note: absolute pathes for -L and -I kill crosscompilers.


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 --
---------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Caml-list] crosscompile problem
  2005-08-26 12:00 crosscompile problem Enrico Weigelt
                   ` (2 preceding siblings ...)
  2005-08-26 13:42 ` Eric Cooper
@ 2005-08-26 22:47 ` skaller
  2005-08-27  6:20   ` Enrico Weigelt
  3 siblings, 1 reply; 12+ messages in thread
From: skaller @ 2005-08-26 22:47 UTC (permalink / raw)
  To: weigelt; +Cc: caml-list

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

On Fri, 2005-08-26 at 14:00 +0200, Enrico Weigelt wrote:

> it seems that crosscompiling ocaml is currently impossible. 
[]

> Since almost all packages have to cope with this problem and
> also widely used buildsystems like autoconf also have no clean
> way of handling this, I suggest moving away this configuration
> from individual packages to some central point - an global 
> config database.

Acceptance would require standardisation of some kind.

> We query this database by simply calling some given commandline
> with the variable name as parameter. The value is simply printed
> out on stdout, without linefeed.

> This can be easily solved by a tiny shellscript and some carefully
> maintained text database. (see attachement)

Not so easy. Briefly, I am porting Felix to full cross-compilation
support right now. This includes supporting Windows and OSX, as well
as all Unix variants. I have to distinguish FOUR separate platforms:

* build machine -- where package source is built
* host machine -- where developers run Felix
* target machine -- where the generated code is compiled 
* run machine -- where the compiled code is run

BTW: please do not use the archaic term 'Ansi C'. Responsibility
for C was taken over by ISO decades ago. References to the 
ISO C Standard differ in numbering to Ansi-C. It is particularly
strange to see non-American people using this terminology.

You need to recognize that the 'sizes' are dependent on many
factors including the compiler and options. For example gcc
can be coaxed into generating 32 bit code on a 64 bit platform
by using -m32 option.

For Ocaml in general there will be 3 machines: build/host, target, and
run platforms. 

Note that using bytecode compiler, you can cross-compile ..

It isn't clear that it is all that easy to 'cross-compile' native
code, since it is not just a matter of emitting architecture
dependent instructions -- it also depends on the availability
of libraries, and assemblers and linkers with cross-compilation support,
eg not everyone uses ELF object files.

-- 
John Skaller <skaller at users dot sourceforge dot net>


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Caml-list] crosscompile problem
  2005-08-26 22:47 ` skaller
@ 2005-08-27  6:20   ` Enrico Weigelt
  2005-08-28 17:39     ` Quôc Peyrot
  0 siblings, 1 reply; 12+ messages in thread
From: Enrico Weigelt @ 2005-08-27  6:20 UTC (permalink / raw)
  To: caml-list

* skaller <skaller@users.sourceforge.net> wrote:

<snip>
> > Since almost all packages have to cope with this problem and
> > also widely used buildsystems like autoconf also have no clean
> > way of handling this, I suggest moving away this configuration
> > from individual packages to some central point - an global 
> > config database.
> 
> Acceptance would require standardisation of some kind.

Shouldn't be such a problem. We just have to found a separate 
group (outside of the caml project), which thinks carefully and
makes some definitions ...

<snip>
> > This can be easily solved by a tiny shellscript and some carefully
> > maintained text database. (see attachement)
> 
> Not so easy. Briefly, I am porting Felix to full cross-compilation
> support right now. This includes supporting Windows and OSX, as well
> as all Unix variants. I have to distinguish FOUR separate platforms:
> 
> * build machine -- where package source is built
> * host machine -- where developers run Felix
> * target machine -- where the generated code is compiled 
> * run machine -- where the compiled code is run

Well, just a job for namespaces ... (build.*, host.*, ...)

<snip>
> BTW: please do not use the archaic term 'Ansi C'. Responsibility
> for C was taken over by ISO decades ago. References to the 

Okay, s/ansi/iso/g;

<snip>

> You need to recognize that the 'sizes' are dependent on many
> factors including the compiler and options. For example gcc
> can be coaxed into generating 32 bit code on a 64 bit platform
> by using -m32 option.

In this case you explicitly change the host platform, so it also
requires proper adaption of the config-db.

<snip> 

> For Ocaml in general there will be 3 machines: build/host, target, and
> run platforms. 
> 
> Note that using bytecode compiler, you can cross-compile ..

BTW: is the output of the ocaml-compiler platform dependent ?

> It isn't clear that it is all that easy to 'cross-compile' native
> code, since it is not just a matter of emitting architecture
> dependent instructions -- it also depends on the availability
> of libraries, and assemblers and linkers with cross-compilation support,
> eg not everyone uses ELF object files.

Well, I'm crosscompiling quite evrything. It normally works.


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 --
---------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Caml-list] crosscompile problem
  2005-08-27  6:20   ` Enrico Weigelt
@ 2005-08-28 17:39     ` Quôc Peyrot
  0 siblings, 0 replies; 12+ messages in thread
From: Quôc Peyrot @ 2005-08-28 17:39 UTC (permalink / raw)
  To: caml-list


On Aug 26, 2005, at 11:20 PM, Enrico Weigelt wrote:

[...]

>> It isn't clear that it is all that easy to 'cross-compile' native
>> code, since it is not just a matter of emitting architecture
>> dependent instructions -- it also depends on the availability
>> of libraries, and assemblers and linkers with cross-compilation  
>> support,
>> eg not everyone uses ELF object files.
>>
>
> Well, I'm crosscompiling quite evrything. It normally works.

I'm under Mac OS X, I would like to (cross-)compile for:

- Mac (of course)
- Linux/ELF
- Windows/PE

(from Mac OS X)

Is there any chances I could do that? And how?

-- 
Best Regards,
Quôc

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2005-08-28 17:35 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-26 12:00 crosscompile problem 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
2005-08-26 22:47 ` skaller
2005-08-27  6:20   ` Enrico Weigelt
2005-08-28 17:39     ` Quôc Peyrot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).