cdk_config
cdk_config is a tool to help you give correct arguments when compiling
Ocaml programs.
Command line arguments
Currently, the following arguments are supported to generate direct
arguments to the ocaml compilers:
- -src Arguments are given to compile without installing.
- -c Arguments are given for compilation, without linking.
- -opt Arguments are given for native-code compilation.
- -byte Arguments are given for byte-code compilation
(Default).
- -thread Arguments are given for compilation with threads.
- -systhread Arguments are given for compilation with
system threads (only different from -thread with
-src )
The following arguments are also available to give information on the
CDK installation:
- -camlp4 Prints the camlp4 installation directory.
- -ocamllib Prints the Ocaml installation directory.
- -libdir Prints the CDK library directory.
- -bindir Prints the CDK binary directory.
- -mandir Prints the CDK manpages directory.
Anonymous arguments
Other arguments given to cdk_config are the names of the
packages needed during the compilation. For example, if your program is
using the wxlib widget toolkit library can compile its program
using the following command:
# ocamlc -c `cdk_config -c wxlib` interface.ml
# ocamlc -o interface `cdk_config wxlib` interface.cmo
For native code:
# ocamlopt -c `cdk_config -opt -c wxlib` interface.ml
# ocamlopt -o interface `cdk_config -opt wxlib` interface.cmx
The output of cdk_config in this last example is:
# cdk_config -opt -c wxlib
-I +xlib
# cdk_config -opt wxlib
unix.cmxa str.cmxa extlib.cmxa common.cmxa concur.cmxa X11.cmxa -I +xlib wxlib.cmxa
Anonymous arguments don't need to be sorted. Dependencies will be computed
by cdk_config so that compilation will be correct anyway.
Using cdk_config for non-CDK programs
When cdk_config finds a package name package it
doesn't know, he looks
in the ocaml installation directory for a file called
package.config .
This file should have the following format:
- The first line should be the arguments to give to the ocaml compiler
for compilation without linking.
- The second line should be the arguments to give to the ocaml compiler
for byte-code linking.
- The third line should be the arguments to give to the ocaml compiler
for native-code linking.
- The fourth line should be the packages on which package
depends.
For wxlib, it would be:
-I +xlib
wxlib.cma
wxlib.cmxa
X11 unix
Notice that cdk_config will also add the libraries which are
needed by X11 and unix , and so on.
Last modification April 13, 2001.