build an ocaml project with c dependencies and multiplatform support, using autoconf
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

This archive contains standard, useful autoconf macros for detecting OCaml, findlib, OCaml packages, etc.

It allows to compile ocaml project with benefits of powerful autoconf features (C dependencies, library dependencies, multi platform, cross compilation). The ocaml compilation part can be handled with standard Makefiles or ocamlbuild.

This project contains improvements on the base project, with no activity since 2009, which home page is: Improvements are :

  • revised documentation entry
  • improvements on use of autoconf macros in ocaml.m4
  • access via github


  • william3
  • Olivier Andrieu
  • Jean-Christophe Filliâtre
  • Richard W.M. Jones
  • Georges Mariano
  • Stefano Zacchiroli


Copy ocaml.m4 into the autoconf macros directory of your project (usually m4/, but could be changed with AC_CONFIG_MACRO_DIR). Then you would want to add the following lines to :


You are ready to include ocaml-autoconf macros in Once it is done, use something like this:

autoreconf -fi


ocaml-autoconf is an extension to autoconf. You will need to learn how to use autoconf before, which is the most difficult part. One should follow a tutorial on the net.

Then have a look at some ocaml projects that uses ocaml-autoconf :

ocaml-autoconf macros reference manual :

  • one good way is to look at ocaml.m4 file, along with the [autoconf reference manual] 1 beside
  • also, the [ocaml-autoconf reference manual] 2 is almost up to date

See the examples/ directory for a project skeleton using ocaml-autoconf, autoconf, and automake for an ocaml project.

Optional installation of macro and man page

To build the manual page, you'll need 'perldoc' (part of Perl).

To build the manual page, etc., do:


To install the manual page and macro centrally, do:

make install

You can then use :

man ocaml.m4


Development home page:

to download repository, either use the 'Download' button of this webpage, or use :

git clone