CIL: Include dynlink for OCaml 3.11.
[ocaml-bitstring.git] / configure.ac
index a964a9e..e8e0ec3 100644 (file)
@@ -1,4 +1,4 @@
-# Bitmatch syntax extension.
+# Bitstring syntax extension.
 # Copyright (C) 2008 Red Hat Inc., Richard W.M. Jones
 #
 # This library is free software; you can redistribute it and/or
@@ -17,7 +17,7 @@
 
 dnl Process this file with autoconf to produce a configure script.
 
-AC_INIT(ocaml-bitmatch,1.3)
+AC_INIT(ocaml-bitstring,2.0.0)
 
 dnl Check for basic C environment.
 AC_PROG_CC
@@ -30,13 +30,26 @@ test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant)
 AC_PROG_CC_C_O
 
 dnl Check for native endianness.
-AC_C_BIGENDIAN(
-  [NATIVEENDIAN=BigEndian],
-  [NATIVEENDIAN=LittleEndian],
+AC_C_BIGENDIAN(,,
   [AC_MSG_ERROR([Machine endianness could not be determined])]
 )
+if test "x$WORDS_BIGENDIAN" = "x"; then
+  NATIVEENDIAN=LittleEndian
+else
+  NATIVEENDIAN=BigEndian
+fi
 AC_SUBST(NATIVEENDIAN)
 
+dnl Create byteswap.h if the system doesn't have this file.
+dnl Written by Oskar Liljeblad.
+dnl From gnulib, license is LGPLv2+.
+AC_CHECK_HEADERS([byteswap.h], [
+  BYTESWAP_H=''
+], [
+  BYTESWAP_H='byteswap.h'
+])
+AC_SUBST(BYTESWAP_H)
+
 dnl Check for basic OCaml environment & findlib.
 AC_PROG_OCAML
 AC_PROG_FINDLIB
@@ -46,16 +59,49 @@ if test "x$OCAMLFIND" = "x"; then
 fi
 
 dnl Check for camlp4
-AC_CHECK_PROG(CAMLP4OF,camlp4of.opt,camlp4of.opt)
+AC_CHECK_PROG(CAMLP4OF,camlp4of.opt,camlp4of.opt,no)
 if test "x$CAMLP4OF" = "xno"; then
     AC_MSG_ERROR([You must have camlp4 installed])
 fi
 
+dnl Check for Extlib (optional)
+AC_CHECK_OCAML_PKG(extlib)
+AC_SUBST(pkg_extlib)
+
 dnl Check for CIL (optional)
 AC_CHECK_OCAML_PKG(cil)
 AC_SUBST(pkg_cil)
 
+dnl Check for /usr/bin/time and get full path.
+AC_PATH_PROG(TIME,time,no)
+if test "x$TIME" = "xno"; then
+    AC_MSG_ERROR(['time' command not found])
+fi
+
+dnl Check for diff and get full path.
+AC_PATH_PROG(DIFF,diff,no)
+if test "x$DIFF" = "xno"; then
+    AC_MSG_ERROR(['diff' command not found])
+fi
+AC_SUBST(DIFF)
+
+dnl Check for gprof (optional).
+AC_CHECK_PROG(GPROF,gprof,gprof,no)
+
+dnl Check for ocaml-bisect (optional) and --enable-coverage.
+AC_CHECK_PROG(BISECT_REPORT,bisect-report,bisect-report,no)
+AC_ARG_ENABLE([coverage],
+    [AS_HELP_STRING([--enable-coverage],
+       [add code coverage information (slow) @<:@default=no@:>@])],
+    [],
+    [enable_coverage=no])
+
+if test "x$enable_coverage" != "xno" -a "x$BISECT_REPORT" = "xno"; then
+    AC_MSG_ERROR([You must install ocaml-bisect package to get code coverage])
+fi
+AC_SUBST(enable_coverage)
+
 dnl Produce output files.
 AC_CONFIG_HEADERS([config.h])
-AC_CONFIG_FILES([Makefile META bitmatch_config.ml cil-tools/Makefile])
+AC_CONFIG_FILES([Makefile META bitstring_config.ml cil-tools/Makefile])
 AC_OUTPUT