Version franaise
Home About Download Resources Contact us

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Conditional compilation wrt OCaml version?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-01-26 (22:58)
From: Mikkel_Fahnøe_Jørgensen <mikkel@d...>
Subject: Re: [Caml-list] Conditional compilation wrt OCaml version?
>  Working on Batteries, we're faced with a few places where we'd like to
> perform conditional compilation depending on the version of OCaml being
> used. We could probably do this with Camlp4, cpp, Autoconf hackery, etc.
> -- but first, we need to decide on which of these options we'll adopt.
> Any suggestion?

If you are interested in using ocamlbuild you can have a look at

I added extensions to ocamlbuild using a syntax like


this is done in a .cprog file that lists all files to include, but
that same could be done with other similar files e.g. .mllib

Also, I added multi-variant builds so the same build can handle
multiple build targets based on tags - for example debug and release
builds. Multivariant builds work by adding tags in the filename:

Most of this could be integrated into ocamlbuild, but ocamlbuild is
not very actively maintained as I understand.