configure: Don't test for camlp4of.opt, test for camlp4of.
[ocaml-bitstring.git] / configure.ac
1 # Bitstring syntax extension.
2 # Copyright (C) 2008-2013 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.4)
21
22 AC_PROG_SED
23
24 dnl Check for basic C environment.
25 AC_PROG_CC
26 AC_PROG_INSTALL
27 AC_PROG_CPP
28
29 AC_C_PROTOTYPES
30 test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant)
31
32 AC_PROG_CC_C_O
33
34 dnl Check for native endianness.
35 AC_C_BIGENDIAN(,,
36   [AC_MSG_ERROR([Machine endianness could not be determined])]
37 )
38 if test "x$WORDS_BIGENDIAN" = "x"; then
39   NATIVEENDIAN=LittleEndian
40 else
41   NATIVEENDIAN=BigEndian
42 fi
43 AC_SUBST(NATIVEENDIAN)
44
45 dnl Create byteswap.h if the system doesn't have this file.
46 dnl Written by Oskar Liljeblad.
47 dnl From gnulib, license is LGPLv2+.
48 AC_CHECK_HEADERS([byteswap.h], [
49   BYTESWAP_H=''
50 ], [
51   BYTESWAP_H='byteswap.h'
52 ])
53 AC_SUBST(BYTESWAP_H)
54
55 dnl Check for basic OCaml environment & findlib.
56 AC_PROG_OCAML
57 AC_PROG_FINDLIB
58
59 if test "x$OCAMLFIND" = "x"; then
60     AC_MSG_ERROR([You must have ocaml and findlib installed])
61 fi
62
63 dnl Check for camlp4
64 AC_CHECK_PROG(CAMLP4OF,camlp4of,camlp4of,no)
65 if test "x$CAMLP4OF" = "xno"; then
66     AC_MSG_ERROR([You must have camlp4 installed])
67 fi
68
69 dnl Check for Extlib (optional)
70 AC_CHECK_OCAML_PKG(extlib)
71
72 dnl Check for CIL (optional)
73 AC_CHECK_OCAML_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