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] autoconf and caml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-09-06 (09:42)
From: Hendrik Tews <tews@t...>
Subject: Re: [Caml-list] autoconf and caml
> I'm writing a piece of software using O'Caml and GNU autoconf (among
> others).  In C the results of running `./configure' are conveniently
> accessed with `#include "config.h"'.  My current solution is to
> preprocess also the O'Caml code, but this requires some clumsy hacks
> in Makefiles etc.  Is there a better way?  If not, then I'ld suggest
> some flag in O'Caml which would run the source files through cpp.
Why not writing Ocaml files directly through configure? Just set
your own variables and apply AC_SUBST to them. And if you need
conditional compilation use camlp4 and pa_ifdef.

In our Ocaml project I let configure write a shell script and
invoke the shell script immediately to write other files
(including ml files). The redirection via a shell script is
necessary because configure might output something like


Here are fragments from the relevant files, you can inspect the
full source code at fragment

AC_OUTPUT(Makefile, sh


files="Common/ Doc/ccslc.1 Doc/ccslc.html"


echo writing files $files
for f in $files ; do
# echo sed -e "s%@mllibdir@%$libdir%" \< ${mlconfigfile}.in \> ${mlconfigfile}
   echo writing $f
   sed -e "s%@mllibdir@%$libdir%" < $ > $f


let fixedpointlib = "@mllibdir@"



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