caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] question: "autoconfiguration" of Ocaml code (checking for libraries)
@ 2003-01-29 19:58 Basile STARYNKEVITCH
  2003-01-29 20:04 ` Will Benton
  2003-01-29 21:43 ` Gerd Stolpmann
  0 siblings, 2 replies; 8+ messages in thread
From: Basile STARYNKEVITCH @ 2003-01-29 19:58 UTC (permalink / raw)
  To: caml-list

Dear All

(while working on Poesia - see www.poesia-filter.org for more)

Does anyone have some tricks or code (usable in a GPL-ed opensource
project) to facilitate configuration (more precisely checking of
installed tools & libraries) of Ocaml code.

I need something which checks that

Ocaml is installed, with version >= 3.06

ocamlfind is installed (both for bytecode & native)

[actually my wish would be that ocamlfind is part of ocaml, like
camlp4 is]

xstr is installed (both bytecode & native)

netstring is installed (both bytecode & native)

ocamlnet is installed, at least version >= 0.92

etc..

(Unfortunately, I cannot do distribution specific stuff; I want a
script usable on Linux Redhat, Mandrake, Debian, ....)

Regards.
-- 

Basile STARYNKEVITCH         http://starynkevitch.net/Basile/ 
email: basile<at>starynkevitch<dot>net 
alias: basile<at>tunes<dot>org 
8, rue de la Faïencerie, 92340 Bourg La Reine, France
-------------------
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


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

* Re: [Caml-list] question: "autoconfiguration" of Ocaml code (checking for libraries)
  2003-01-29 19:58 [Caml-list] question: "autoconfiguration" of Ocaml code (checking for libraries) Basile STARYNKEVITCH
@ 2003-01-29 20:04 ` Will Benton
  2003-01-29 20:15   ` Basile STARYNKEVITCH
  2003-01-29 21:43 ` Gerd Stolpmann
  1 sibling, 1 reply; 8+ messages in thread
From: Will Benton @ 2003-01-29 20:04 UTC (permalink / raw)
  To: Basile STARYNKEVITCH; +Cc: caml-list

You should check out autoconf; you can use it to generate Makefiles or
even code.  There is a free autoconf book available somewhere on
redhat.com (I don't have the link in front of me ATM).  It will do
everything you want, though, and it is a commonplace -- everyone knows
how to type "./configure && make && make install"



best,
wb

-- 
Will Benton
willb@acm.org 
-------------------
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


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

* Re: [Caml-list] question: "autoconfiguration" of Ocaml code (checking for libraries)
  2003-01-29 20:04 ` Will Benton
@ 2003-01-29 20:15   ` Basile STARYNKEVITCH
  2003-01-29 20:22     ` Will Benton
  2003-01-29 21:54     ` Maxence Guesdon
  0 siblings, 2 replies; 8+ messages in thread
From: Basile STARYNKEVITCH @ 2003-01-29 20:15 UTC (permalink / raw)
  To: Will Benton; +Cc: caml-list

>>>>> "Will" == Will Benton <willb@cs.wisc.edu> writes:

    Will> You should check out autoconf; you can use it to generate
    Will> Makefiles or even code.  There is a free autoconf book
    Will> available somewhere on redhat.com [...]

Thanks. I know about autoconf, but would like to avoid it. Apparently,
the Ocaml team don't like it neither, since they don't use it in
Ocaml.

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

Maybe my perception of autoconf is wrong, but the mere fact that my
Debian distribution (ok it is sid, a.k.a unstable) requires several
versions of it makes me really feel uneasy.

Regards.
-- 

Basile STARYNKEVITCH         http://starynkevitch.net/Basile/ 
email: basile<at>starynkevitch<dot>net 
alias: basile<at>tunes<dot>org 
8, rue de la Faïencerie, 92340 Bourg La Reine, France
-------------------
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


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

* Re: [Caml-list] question: "autoconfiguration" of Ocaml code (checking for libraries)
  2003-01-29 20:15   ` Basile STARYNKEVITCH
@ 2003-01-29 20:22     ` Will Benton
  2003-01-29 21:54     ` Maxence Guesdon
  1 sibling, 0 replies; 8+ messages in thread
From: Will Benton @ 2003-01-29 20:22 UTC (permalink / raw)
  To: Basile STARYNKEVITCH; +Cc: caml-list

On Wed, Jan 29, 2003 at 09:15:02PM +0100, Basile STARYNKEVITCH wrote:

> Thanks. I know about autoconf, but would like to avoid it. Apparently,
> the Ocaml team don't like it neither, since they don't use it in
> Ocaml.
>
> I was seeking for something simpler. I'm not very fond of m4 macros
> (even if I did hack several years ago such stuff).

That's certainly fair.  There is a steep learning curve, but the
advantage is portability and not having to write all of the corner
cases yourself.

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

Autoconf has a lot of built-in macros for C/UNIX code, for sure, but
to say that you can't use it for Ocaml code is like saying that you
can't use GNU make for Ocaml projects (or csound code, or LaTeX
documents).  It is a particularly general-purpose tool, although it
will want to be able to preprocess the configurable files somehow.  In
C, this is trivial -- m4 macros for the Makefile which define
preprocessor constants.  In other language contexts, you will have to
use m4 macros.

> Maybe my perception of autoconf is wrong, but the mere fact that my
> Debian distribution (ok it is sid, a.k.a unstable) requires several
> versions of it makes me really feel uneasy.

I don't understand your concern.  The autoconf package generates a
configure script, which is portable to any system, even one without any
autoconf installed.  The reason to have multiple versions of autoconf
installed is that different development versions of packages are
relying on different versions of autoconf's macros/behaviors *to
generate* the configure script.



best,
wb

-- 
Will Benton
willb@acm.org 
-------------------
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


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

* Re: [Caml-list] question: "autoconfiguration" of Ocaml code (checking for libraries)
  2003-01-29 19:58 [Caml-list] question: "autoconfiguration" of Ocaml code (checking for libraries) Basile STARYNKEVITCH
  2003-01-29 20:04 ` Will Benton
@ 2003-01-29 21:43 ` Gerd Stolpmann
  1 sibling, 0 replies; 8+ messages in thread
From: Gerd Stolpmann @ 2003-01-29 21:43 UTC (permalink / raw)
  To: Basile STARYNKEVITCH; +Cc: caml-list

Am Mit, 2003-01-29 um 20.58 schrieb Basile STARYNKEVITCH:
> Dear All
> 
> (while working on Poesia - see www.poesia-filter.org for more)
> 
> Does anyone have some tricks or code (usable in a GPL-ed opensource
> project) to facilitate configuration (more precisely checking of
> installed tools & libraries) of Ocaml code.
> 
> I need something which checks that
> 
> Ocaml is installed, with version >= 3.06
> 
> ocamlfind is installed (both for bytecode & native)
> 
> [actually my wish would be that ocamlfind is part of ocaml, like
> camlp4 is]
> 
> xstr is installed (both bytecode & native)
> 
> netstring is installed (both bytecode & native)
> 
> ocamlnet is installed, at least version >= 0.92
> 
> etc..
> 
> (Unfortunately, I cannot do distribution specific stuff; I want a
> script usable on Linux Redhat, Mandrake, Debian, ....)

I am normally using self-written shell scripts for that purpose.
They are simple to write, easy to understand, and work for all
Unices.

As an example, here is the configure script of wdialog.
You can find code snippets for all the tests you have
mentioned:

http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/wdialog/wdialog/code/configure?rev=3.6&content-type=text/vnd.viewcvs-markup

Gerd
-- 
------------------------------------------------------------
Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany 
gerd@gerd-stolpmann.de          http://www.gerd-stolpmann.de
------------------------------------------------------------
-------------------
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


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

* Re: [Caml-list] question: "autoconfiguration" of Ocaml code (checking for libraries)
  2003-01-29 20:15   ` Basile STARYNKEVITCH
  2003-01-29 20:22     ` Will Benton
@ 2003-01-29 21:54     ` Maxence Guesdon
  2003-01-30 10:45       ` Jean-Christophe Filliatre
  2003-01-30 13:59       ` Damien Doligez
  1 sibling, 2 replies; 8+ messages in thread
From: Maxence Guesdon @ 2003-01-29 21:54 UTC (permalink / raw)
  To: caml-list

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


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

* Re: [Caml-list] question: "autoconfiguration" of Ocaml code (checking for libraries)
  2003-01-29 21:54     ` Maxence Guesdon
@ 2003-01-30 10:45       ` Jean-Christophe Filliatre
  2003-01-30 13:59       ` Damien Doligez
  1 sibling, 0 replies; 8+ messages in thread
From: Jean-Christophe Filliatre @ 2003-01-30 10:45 UTC (permalink / raw)
  To: caml-list


I will  not try to argue in  favor of autoconf w.r.t  to other methods
but, as far  as autoconf is concerned, I  already wrote a configure.in
for  ocaml  programs  which   sets  the  following  variables  (to  be
substituted in a Makefile or in any other file):

#   OCAMLC        "ocamlc" if present in the path, or a failure
#                 or "ocamlc.opt" if present with same version number as ocamlc
#   OCAMLOPT      "ocamlopt" (or "ocamlopt.opt" if present), or "no"
#   OCAMLBEST     either "byte" if no native compiler was found, 
#                 or "opt" otherwise
#   OCAMLDEP      "ocamldep"
#   OCAMLLEX      "ocamllex" (or "ocamllex.opt" if present)
#   OCAMLYACC     "ocamlyac"
#   OCAMLLIB      the path to the ocaml standard library
#   OCAMLVERSION  the ocaml version number
#   OCAMLWEB      "ocamlweb" (not mandatory)
#   OCAMLWIN32    "yes"/"no" depending on Sys.os_type = "Win32"
#   EXE           ".exe" if OCAMLWIN32=yes, "" otherwise

This configure.in can be fetched from 
http://www.lri.fr/~filliatr/software.en.html

As  already  mentioned  in  this  thread,  adding  checks  for  (caml)
libraries is not difficult.

Hope this helps,
-- 
Jean-Christophe Filliâtre (http://www.lri.fr/~filliatr)

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


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

* Re: [Caml-list] question: "autoconfiguration" of Ocaml code (checking for libraries)
  2003-01-29 21:54     ` Maxence Guesdon
  2003-01-30 10:45       ` Jean-Christophe Filliatre
@ 2003-01-30 13:59       ` Damien Doligez
  1 sibling, 0 replies; 8+ messages in thread
From: Damien Doligez @ 2003-01-30 13:59 UTC (permalink / raw)
  To: caml-list

On Wednesday, January 29, 2003, at 10:54 PM, Maxence Guesdon wrote:

>  let version = Sys.ocaml_version in
>  if float_of_string version < 3.06 then

Don't do that.  Sys.ocaml_version is not a floating-point number.
If it was, it would have type float instead of string.

This is much less likely to fail:

    if version < "3.06" then ...

-- Damien

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


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

end of thread, other threads:[~2003-01-30 13:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-29 19:58 [Caml-list] question: "autoconfiguration" of Ocaml code (checking for libraries) Basile STARYNKEVITCH
2003-01-29 20:04 ` Will Benton
2003-01-29 20:15   ` Basile STARYNKEVITCH
2003-01-29 20:22     ` Will Benton
2003-01-29 21:54     ` Maxence Guesdon
2003-01-30 10:45       ` Jean-Christophe Filliatre
2003-01-30 13:59       ` Damien Doligez
2003-01-29 21:43 ` Gerd Stolpmann

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