[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ./configure for ocaml programs?



On 09-05-2007, Paul Wise <pabs@debian.org> wrote:
>
> On 2007-05-08 18:47, Sylvain Le Gall wrote:
>
>> There is no real difference between OCaml and any other languages: they
>> use sed (or camlp4 with macro).
>
> Hmm, don't think upstream would go for sed since they use Windows
> mostly. What about the ocaml equivalent of gcc -Dprefix=/usr, #ifdef and
> so on?
>

That was my point talking about "camlp4 with macro". 

For example:
IFDEF CAMOMILE THEN
module OcamlGettextRealize = GettextCamomile.Open
ELSE IFDEF STUB THEN
module OcamlGettextRealize =  GettextStub.Native
ELSE
module OcamlGettextRealize =  GettextDummy.Dummy
ENDIF
ENDIF
;;

Will choose an implementation, if -DCAMOMILE or -DSTUB has been used on
the command line for compiling this file (combined with a camlp4 call:
add  -pp 'camlp4o -I +camlp4 pa_macro.cmo -DCAMOMILE' to ocamlc command
line)

I am not sure this is what you want, because it is only a switch. You
cannot define value with it.

Another way: 
either 
cat <<EOT > test.ml
let prefix = "$prefix";;
EOT
or 
echo "let prefix = \"$prefix\";;" > test.ml


Regards,
Sylvain Le Gall



Reply to: