Version 2.0.0 for release.
[ocaml-bitstring.git] / configure.ac
1 # Bitstring syntax extension.
2 # Copyright (C) 2008 Red Hat Inc., Richard W.M. Jones
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2 of the License, or (at your option) any later version.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
17
18 dnl Process this file with autoconf to produce a configure script.
19
20 AC_INIT(ocaml-bitstring,2.0.0)
21
22 dnl Check for basic C environment.
23 AC_PROG_CC
24 AC_PROG_INSTALL
25 AC_PROG_CPP
26
27 AC_C_PROTOTYPES
28 test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant)
29
30 AC_PROG_CC_C_O
31
32 dnl Check for native endianness.
33 AC_C_BIGENDIAN(,,
34   [AC_MSG_ERROR([Machine endianness could not be determined])]
35 )
36 if test "x$WORDS_BIGENDIAN" = "x"; then
37   NATIVEENDIAN=LittleEndian
38 else
39   NATIVEENDIAN=BigEndian
40 fi
41 AC_SUBST(NATIVEENDIAN)
42
43 dnl Create byteswap.h if the system doesn't have this file.
44 dnl Written by Oskar Liljeblad.
45 dnl From gnulib, license is LGPLv2+.
46 AC_CHECK_HEADERS([byteswap.h], [
47   BYTESWAP_H=''
48 ], [
49   BYTESWAP_H='byteswap.h'
50 ])
51 AC_SUBST(BYTESWAP_H)
52
53 dnl Check for basic OCaml environment & findlib.
54 AC_PROG_OCAML
55 AC_PROG_FINDLIB
56
57 if test "x$OCAMLFIND" = "x"; then
58     AC_MSG_ERROR([You must have ocaml and findlib installed])
59 fi
60
61 dnl Check for camlp4
62 AC_CHECK_PROG(CAMLP4OF,camlp4of.opt,camlp4of.opt,no)
63 if test "x$CAMLP4OF" = "xno"; then
64     AC_MSG_ERROR([You must have camlp4 installed])
65 fi
66
67 dnl Check for Extlib (optional)
68 AC_CHECK_OCAML_PKG(extlib)
69 AC_SUBST(pkg_extlib)
70
71 dnl Check for CIL (optional)
72 AC_CHECK_OCAML_PKG(cil)
73 AC_SUBST(pkg_cil)
74
75 dnl Check for /usr/bin/time and get full path.
76 AC_PATH_PROG(TIME,time,no)
77 if test "x$TIME" = "xno"; then
78     AC_MSG_ERROR(['time' command not found])
79 fi
80
81 dnl Check for diff and get full path.
82 AC_PATH_PROG(DIFF,diff,no)
83 if test "x$DIFF" = "xno"; then
84     AC_MSG_ERROR(['diff' command not found])
85 fi
86 AC_SUBST(DIFF)
87
88 dnl Check for gprof (optional).
89 AC_CHECK_PROG(GPROF,gprof,gprof,no)
90
91 dnl Check for ocaml-bisect (optional) and --enable-coverage.
92 AC_CHECK_PROG(BISECT_REPORT,bisect-report,bisect-report,no)
93 AC_ARG_ENABLE([coverage],
94     [AS_HELP_STRING([--enable-coverage],
95         [add code coverage information (slow) @<:@default=no@:>@])],
96     [],
97     [enable_coverage=no])
98
99 if test "x$enable_coverage" != "xno" -a "x$BISECT_REPORT" = "xno"; then
100     AC_MSG_ERROR([You must install ocaml-bisect package to get code coverage])
101 fi
102 AC_SUBST(enable_coverage)
103
104 dnl Produce output files.
105 AC_CONFIG_HEADERS([config.h])
106 AC_CONFIG_FILES([Makefile META bitstring_config.ml cil-tools/Makefile])
107 AC_OUTPUT