Version française
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
[Caml-list] question: "autoconfiguration" of Ocaml code (checking for libraries)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Maxence Guesdon <maxence.guesdon@i...>
Subject: Re: [Caml-list] question: "autoconfiguration" of Ocaml code (checking for libraries)
> I was seeking for something simpler. I'm not very fond of m4 macros
> (even if I did hack several years ago such stuff).
> In my opinion, autoconf was suited for the problem of configuring C
> code for lots of Unix variants. This is not what I need (in particular
> Ocaml has a unique implementation).

You could create a script to launch the ocaml toplevel on a configuration script written in OCaml, like (without caring about the shell syntax) :

if `ocaml` then
  echo Type make to compile
  echo Damn, the configure script failed !

Then your file could be something like :

let config () = 
 let version = Sys.ocaml_version in
 if float_of_string version < 3.06 then
     prerr_endline "Your ocaml is too old !" ;
     exit 1
    Printf.printf "Using OCaml version %s is ok" version ;
    print_newline ()
 (* other tests using Sys.command for example *)

let _ = config ()

If you change your mind and want to use autoconf, you can find examples on the caml humps.

Hope this helps,

Maxence Guesdon
To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: