Skip to content

Commit

Permalink
Require OCaml 4.04 or later
Browse files Browse the repository at this point in the history
Earlier OCaml versions do not reliably support our use of the "%identity"
primitive.
  • Loading branch information
xavierleroy committed Jan 4, 2021
1 parent 0fd2478 commit 842fb20
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@ on large intergers use the low-level MPN functions from GMP.

Arbitrary-precision integers can be compared correctly using OCaml's
polymorphic comparison operators (`=`, `<`, `>`, etc.).
This requires OCaml version 3.12.1 or later, though.

Additional features include:
* a module `Q` for rationals, built on top of `Z` (see `q.mli`)
* a compatibility layer `Big_int_Z` that implements the same API as Big_int from the legacy `Num` library, but uses `Z` internally

## REQUIREMENTS

* OCaml, preferably version 3.12.1 or later. (Earlier versions are usable but generic comparisons will misbehave.)
* OCaml, version 4.04.0 or later.
* Either the GMP library or the MPIR library, including development files.
* GCC or Clang or a gcc-compatible C compiler and assembler (other compilers may work).
* The Perl programming language.
Expand Down
35 changes: 14 additions & 21 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -396,34 +396,27 @@ if test "$gmp" != 'OK'; then echo "cannot find GMP nor MPIR"; exit 2; fi

ocamlver=`ocamlc -version`

# Extended comparisons available since 3.12.1
# OCaml version 4.04 or later is required

case "$ocamlver" in
[12].* | 3.0* | 3.10* | 3.11* | 3.12.0*)
;;
*)
echo "OCaml extended comparison supported"
ccdef="-DZ_OCAML_COMPARE_EXT $ccdef"
[123].* | 4.0[0123].*)
echo "OCaml version $ocamlver is no longer supported."
echo "OCaml version 4.04.0 or later is required."
exit 2
;;
esac

# Extended comparisons available since 3.12.1
echo "OCaml extended comparison supported"
ccdef="-DZ_OCAML_COMPARE_EXT $ccdef"

# New hash functions available since 4.00.0
case "$ocamlver" in
[123].*)
;;
*)
echo "OCaml new hash functions available"
ccdef="-DZ_OCAML_HASH $ccdef"
;;
esac
echo "OCaml new hash functions available"
ccdef="-DZ_OCAML_HASH $ccdef"

# -bin-annot available since 4.00.0
case "$ocamlver" in
[123].*)
hasbinannot='no';;
*)
echo "OCaml supports -bin-annot to produce documentation"
hasbinannot='yes';;
esac
echo "OCaml supports -bin-annot to produce documentation"
hasbinannot='yes'

# Changes to C API (the custom_operation struct) since 4.08.0
case "$ocamlver" in
Expand Down

0 comments on commit 842fb20

Please sign in to comment.