.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "OCAML.M4 1" .TH OCAML.M4 1 "2009-07-19" "ocaml-autoconf-1.0" "Autoconf macros" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" ocaml.m4 \- Autoconf macros for OCaml .SH "SUMMARY" .IX Header "SUMMARY" .Vb 8 \& AC_PROG_OCAML \& AC_PROG_FINDLIB \& AC_PROG_OCAMLLEX \& AC_PROG_OCAMLYACC \& AC_PROG_CAMLP4 \& AC_CHECK_OCAML_PKG([name]) \& AC_CHECK_OCAML_MODULE(VARIABLE,NAME,MODULE,INCLUDE\-PATHS) \& AC_CHECK_OCAML_WORD_SIZE .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\fBocaml.m4\fR is a file containing standard, useful autoconf macros for detecting the OCaml, findlib, OCaml packages, and so on in your autoconf-generated ./configure scripts. .PP To begin using these macros, you will need to copy the \f(CW\*(C`ocaml.m4\*(C'\fR file (usually located at \f(CW\*(C`/usr/share/aclocal/ocaml.m4\*(C'\fR) to the autoconf macros directory in your project. Normally this is the \&\f(CW\*(C`m4/\*(C'\fR directory in your project, but the directory can be changed using the \f(CW\*(C`AC_CONFIG_MACRO_DIR(DIR)\*(C'\fR directive. If you have just created the \f(CW\*(C`m4/\*(C'\fR directory, then you may also need to do: .PP .Vb 1 \& aclocal \-I m4 .Ve .PP You can then add any of the macros described below to your \&\f(CW\*(C`configure.ac\*(C'\fR (or \f(CW\*(C`configure.in\*(C'\fR). Almost every OCaml project should use \f(CW\*(C`AC_PROG_OCAML\*(C'\fR first and probably \f(CW\*(C`AC_PROG_FINDLIB\*(C'\fR right after it. .PP This manual page does not describe how to use autoconf. For that you should read the detailed autoconf info file (\f(CW\*(C`info autoconf\*(C'\fR). .SH "AC_PROG_OCAML" .IX Header "AC_PROG_OCAML" This macro detects which tools of the usual OCaml toolchain are available. It defines and substitutes the following variables: .PP .Vb 10 \& OCAMLC set to the name of the bytecode compiler \& (eg. "ocamlc" or "ocamlc.opt"), or "no" if \& no OCaml installation was found \& OCAMLOPT the name of the native\-code compiler, eg. "ocamlopt", \& "ocamlopt.opt" or "no" \& OCAMLBEST "byte" (if only the bytecode compiler is available) \& or "opt" (if both bytecode and native code compilers \& are available) \& OCAMLDEP the name of the dependency resolver, eg. "ocamldep" \& OCAMLMKTOP the name of ocamlmktop \& OCAMLMKLIB the name of ocamlmklib \& OCAMLDOC the name of ocamldoc \& OCAMLBUILD the name of ocamlbuild \& OCAMLLIB the OCaml library path (eg. C) \& OCAMLVERSION the compiler version (eg. C<3.11.0>) .Ve .SS "Detecting if OCaml is installed" .IX Subsection "Detecting if OCaml is installed" Unlike old versions of these macros, \f(CW\*(C`AC_PROG_OCAML\*(C'\fR does \fInot\fR exit if no OCaml installation is detected. Therefore if you want to detect if OCaml is installed you have to do something like this: .PP .Vb 4 \& AC_PROG_OCAML \& if test "$OCAMLC" = "no"; then \& AC_MSG_ERROR([You must install the OCaml compiler]) \& fi .Ve .PP This behaviour and usage pattern are consistent with other macros of the \f(CW\*(C`AC_PROG_*\*(C'\fR) family. .SS "Cross-compiling" .IX Subsection "Cross-compiling" If the configure script is invoked for cross-compiling then \&\f(CW\*(C`AC_PROG_OCAML\*(C'\fR will detect the cross-compiler versions of the OCaml compiler, eg. \f(CW\*(C`OCAMLC=i686\-pc\-mingw32\-ocamlc\*(C'\fR etc. This happens automatically, and for most purposes you don't need to worry about it. .SH "AC_PROG_FINDLIB" .IX Header "AC_PROG_FINDLIB" This macro checks for the presence of the ocamlfind program (part of findlib). It defines and substitutes \f(CW\*(C`OCAMLFIND\*(C'\fR to the name of the ocamlfind program, or \f(CW\*(C`no\*(C'\fR if not found. .PP Note that this macro does not fail if ocamlfind is not found. If you want to force the user to install findlib, you should do: .PP .Vb 4 \& AC_PROG_FINDLIB \& if test "$OCAMLFIND" = "no"; then \& AC_MSG_ERROR([You must install OCaml findlib (the ocamlfind command)]) \& fi .Ve .PP See also \f(CW\*(C`AC_CHECK_OCAML_PKG\*(C'\fR. .SH "AC_PROG_OCAMLLEX" .IX Header "AC_PROG_OCAMLLEX" This checks for the ocamllex program and sets \f(CW\*(C`OCAMLLEX\*(C'\fR to the name of the program (eg. \f(CW\*(C`ocamllex\*(C'\fR or \f(CW\*(C`ocamllex.opt\*(C'\fR), or \f(CW\*(C`no\*(C'\fR if not found. .SH "AC_PROG_OCAMLYACC" .IX Header "AC_PROG_OCAMLYACC" This checks for the ocamlyacc program and sets \f(CW\*(C`OCAMLYACC\*(C'\fR to the name of the program, or \f(CW\*(C`no\*(C'\fR if not found. .SH "AC_PROG_CAMLP4" .IX Header "AC_PROG_CAMLP4" This checks for camlp4, and checks that the version matches the compiler version found previously. It sets \f(CW\*(C`CAMLP4\*(C'\fR to the name of the basic camlp4 program, or \f(CW\*(C`no\*(C'\fR if not found. .PP The macro also checks for other tools of the camlp4 suite like camlp4o, camlp4orf, etc. For each of them, a fully capitalized variable is set to the tool name (or \f(CW\*(C`no\*(C'\fR if not found); all variable are substituted for when filling .in files. The full list of tools and respective variable names is as follows: .PP .Vb 9 \& camlp4 CAMLP4 \& camlp4boot CAMLP4BOOT \& camlp4o CAMLP4O \& camlp4of CAMLP4OF \& camlp4oof CAMLP4OOF \& camlp4orf CAMLP4ORF \& camlp4prof CAMLP4PROF \& camlp4r CAMLP4R \& camlp4rf CAMLP4RF .Ve .SH "AC_CHECK_OCAML_PKG" .IX Header "AC_CHECK_OCAML_PKG" This is the main macro that can be used to detect the presence of OCaml findlib packages. This macro uses ocamlfind to look up findlib packages (and thus requires that findlib itself has been installed, and that the package has been properly packaged with a \s-1META\s0 file etc.) If you want to find an OCaml findlib package which hasn't been installed with findlib then you should try using \&\f(CW\*(C`AC_CHECK_OCAML_MODULE\*(C'\fR instead. .PP .Vb 1 \& AC_CHECK_OCAML_PKG([name]) .Ve .PP checks for an OCaml findlib package with the given name. If found, it defines and substitutes the variable \f(CW\*(C`OCAML_PKG_name\*(C'\fR where the \&\f(CW\*(C`name\*(C'\fR part is substituted for the package name by replacing all dashes with underscores. .PP For example, .PP .Vb 1 \& AC_CHECK_OCAML_PKG([xml\-light]) .Ve .PP will set \f(CW\*(C`OCAML_PKG_xml_light\*(C'\fR to either \f(CW\*(C`xml\-light\*(C'\fR or \f(CW\*(C`no\*(C'\fR. .PP To have the configure script fail if a package is not installed, do: .PP .Vb 4 \& AC_CHECK_OCAML_PKG([foo]) \& if test "$OCAML_PKG_foo" = "no"; then \& AC_MSG_ERROR([Please install OCaml findlib module \*(Aqfoo\*(Aq.]) \& fi .Ve .PP In your Makefile.in, use the substitution variable in conjunction with ocamlfind, eg: .PP .Vb 2 \& .ml.cmo: \& $(OCAMLFIND) ocamlc \-package @OCAML_PKG_foo@ \-c $< \-o $@ .Ve .PP Note that also in the substitution variable dashes are replaced with underscores. .SS "Checking for alternative findlib package names" .IX Subsection "Checking for alternative findlib package names" In the (unlikely) case where the same library corresponds to different findlib package names on different systems, you can improve portability by checking for the alternative names passing a second argument to \f(CW\*(C`AC_CHECK_OCAML_PKG\*(C'\fR: .PP .Vb 1 \& AC_CHECK_OCAML_PKG(PKGNAME,ALTERNATIVE\-NAMES) .Ve .PP The behaviour is the same as before if \f(CW\*(C`PKGNAME\*(C'\fR is found. Otherwise all names in \f(CW\*(C`ALTERNATIVE\-NAMES\*(C'\fR are tested in turn as findlib package names. If one is found, it is set as the value set by the macro and substituted in .in files; otherwise \f(CW\*(C`no\*(C'\fR is set. .PP Note that the variable name is determined by \f(CW\*(C`PKGNAME\*(C'\fR, while the value depends on the actual alternative name found. .PP For example, to detect the camlzip findlib package, either called \&\f(CW\*(C`zip\*(C'\fR or \f(CW\*(C`camlzip\*(C'\fR, and to store the found value in the \&\f(CW\*(C`OCAML_PKG_zip\*(C'\fR variable you can do in your configure.ac: .PP .Vb 1 \& AC_CHECK_OCAML_PKG(zip,camlzip) .Ve .PP and have a portable Makefile.in build line such as: .PP .Vb 2 \& .ml.cmo: \& $(OCAMLFIND) ocamlc \-package @OCAML_PKG_zip@ \-c $< \-o $@ .Ve .SH "AC_CHECK_OCAML_MODULE(VARIABLE,NAME,MODULE,INCLUDE\-PATHS)" .IX Header "AC_CHECK_OCAML_MODULE(VARIABLE,NAME,MODULE,INCLUDE-PATHS)" \&\f(CW\*(C`AC_CHECK_OCAML_MODULE\*(C'\fR is the hairier alternative to \&\f(CW\*(C`AC_CHECK_OCAML_PKG\*(C'\fR. You should always use \f(CW\*(C`AC_CHECK_OCAML_PKG\*(C'\fR and ocamlfind/findlib if possible. .PP The parameters are: .IP "\s-1VARIABLE\s0" 4 .IX Item "VARIABLE" This is the environment variable that is set. It will either be set to the include path, or to \f(CW\*(C`no\*(C'\fR if the module was not found. .IP "\s-1NAME\s0" 4 .IX Item "NAME" This is the name of the module we are looking for. This parameter is just used for printing messages, and does not affect how the module is found. .IP "\s-1MODULE\s0" 4 .IX Item "MODULE" This should be an OCaml module name, representing the module name being looked up. You can put sub-modules here, eg. \&\f(CW\*(C`CalendarLib.Date\*(C'\fR .IP "INCLUDE-PATHS" 4 .IX Item "INCLUDE-PATHS" This is the default list of include directories to search, eg. \&\f(CW\*(C`+calendar\*(C'\fR .PP For example, the following code will check for the OCaml Calendar module, and will distinguish between version 1 and version 2 of this module (which have incompatible APIs). .PP .Vb 2 \& AC_CHECK_OCAML_PKG(calendar) \& AC_CHECK_OCAML_MODULE(is_calendar2,calendar,[CalendarLib.Date],[+calendar]) .Ve .PP After the above code has run, variables \f(CW\*(C`OCAML_PKG_calendar\*(C'\fR and \&\f(CW\*(C`is_calendar2\*(C'\fR will be set as follows: .PP .Vb 1 \& OCAML_PKG_calendar is_calendar2 Result \& \& yes +calendar Calendar v2 is installed \& yes no Calendar v1 is installed \& no no No Calendar module installed .Ve .SH "AC_CHECK_OCAML_WORD_SIZE" .IX Header "AC_CHECK_OCAML_WORD_SIZE" This checks the word size of the OCaml compiler, and sets \&\f(CW\*(C`OCAML_WORD_SIZE\*(C'\fR to either \f(CW32\fR or \f(CW64\fR. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIautoconf\fR\|(1), , .SH "FILES" .IX Header "FILES" .IP "\(bu" 4 /usr/share/aclocal/ocaml.m4 .SH "AUTHORS" .IX Header "AUTHORS" Various people have contributed to these macros over many years: .IP "\(bu" 4 Olivier Andrieu .IP "\(bu" 4 Jean-Christophe Fillia\*^tre .IP "\(bu" 4 Richard W.M. Jones .IP "\(bu" 4 Georges Mariano .IP "\(bu" 4 Jim Meyering .IP "\(bu" 4 Stefano Zacchiroli .SH "LICENSE" .IX Header "LICENSE" .Vb 5 \& Copyright X 2009 Richard W.M. Jones \& Copyright X 2009 Stefano Zacchiroli \& Copyright X 2000\-2005 Olivier Andrieu \& Copyright X 2000\-2005 Jean\-Christophe Fillia\*^tre \& Copyright X 2000\-2005 Georges Mariano \& \& All rights reserved. \& \& Redistribution and use in source and binary forms, with or without modification, \& are permitted provided that the following conditions are met: \& \& * Redistributions of source code must retain the above copyright notice, this \& list of conditions and the following disclaimer. \& * Redistributions in binary form must reproduce the above copyright notice, \& this list of conditions and the following disclaimer in the documentation \& and/or other materials provided with the distribution. \& * The names of the contributors may not be used to endorse or promote \& products derived from this software without specific prior written \& permission. \& \& THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS \*(Aq\*(AqAS IS\*(Aq\*(Aq AND ANY \& EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \& WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE \& DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY \& DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES \& (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; \& LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON \& ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT \& (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS \& SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .Ve .SH "REPORTING BUGS" .IX Header "REPORTING BUGS" Please report bugs to the authors at the project page: , using the forge bug tracker .