Version française
Home     About     Download     Resources     Contact us    
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 my_conf_script.ml` then
  echo Type make to compile
else
  echo Damn, the configure script failed !

Then your my_conf_script.ml 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
    )
 else
   (
    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 configure.in examples on the caml humps.

Hope this helps,

-- 
Maxence Guesdon
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners