build: Require OCaml >= 4.01.

RHEL 6, Debian <= 7 and Ubuntu < 14.04 are no longer supported
(unless OCaml and other components are upgraded).

See: https://www.redhat.com/archives/libguestfs/2017-September/msg00203.html
This commit is contained in:
Richard W.M. Jones
2017-10-03 21:03:01 +01:00
parent 37c851697b
commit 2cdd2eb795
2 changed files with 10 additions and 7 deletions

View File

@@ -116,7 +116,7 @@ virt tools which are still written in Perl.
I<Required>. Part of Perl core.
=item OCaml E<ge> 3.11
=item OCaml E<ge> 4.02
=item OCaml findlib

View File

@@ -38,15 +38,18 @@ AC_ARG_ENABLE([ocaml],
[],
[enable_ocaml=yes])
dnl OCaml >= 3.11 is required.
AC_MSG_CHECKING([if OCaml version >= 3.11])
dnl OCaml >= 4.01 is required.
ocaml_ver_str=4.01
ocaml_min_major=4
ocaml_min_minor=1
AC_MSG_CHECKING([if OCaml version >= $ocaml_ver_str])
ocaml_major="`echo $OCAMLVERSION | $AWK -F. '{print $1}'`"
ocaml_minor="`echo $OCAMLVERSION | $AWK -F. '{print $2}'`"
AS_IF([test "$ocaml_major" -ge 4 || ( test "$ocaml_major" -eq 3 && test "$ocaml_minor" -ge 11 )],[
AC_MSG_RESULT([yes])
ocaml_minor="`echo $OCAMLVERSION | $AWK -F. '{print $2}' | sed 's/^0//'`"
AS_IF([test "$ocaml_major" -ge $((ocaml_min_major+1)) || ( test "$ocaml_major" -eq $ocaml_min_major && test "$ocaml_minor" -ge $ocaml_min_minor )],[
AC_MSG_RESULT([yes ($ocaml_major, $ocaml_minor)])
],[
AC_MSG_RESULT([no])
AC_MSG_FAILURE([OCaml compiler is not new enough. At least OCaml 3.11 is required])
AC_MSG_FAILURE([OCaml compiler is not new enough. At least OCaml $ocaml_ver_str is required])
])
AM_CONDITIONAL([HAVE_OCAML],