Do not test for the presence of the Bytes module and do not create the backwards-compat Bytes module replacement if it is not present. Also we use the ‘-safe-strings’ option unconditionally. This requires OCaml >= 4.02. --- .gitignore | 1 - common/mlstdutils/Makefile.am | 8 +------- m4/guestfs_ocaml.m4 | 40 +--------------------------------------- 3 files changed, 2 insertions(+), 47 deletions(-) diff --git a/.gitignore b/.gitignore index 36a193054..8ce4bf10c 100644 --- a/.gitignore +++ b/.gitignore @@ -130,7 +130,6 @@ Makefile.in /common/mlpcre/pcre_tests /common/mlprogress/.depend /common/mlstdutils/.depend -/common/mlstdutils/bytes.ml /common/mlstdutils/guestfs_config.ml /common/mlstdutils/oUnit-* /common/mlstdutils/std_utils_tests diff --git a/common/mlstdutils/Makefile.am b/common/mlstdutils/Makefile.am index f4296daa4..9e90cab13 100644 --- a/common/mlstdutils/Makefile.am +++ b/common/mlstdutils/Makefile.am @@ -28,13 +28,7 @@ SOURCES_MLI = \ stringMap.mli \ stringSet.mli -if HAVE_BYTES_COMPAT_ML -SOURCES_ML = bytes.ml -else -SOURCES_ML = -endif - -SOURCES_ML += \ +SOURCES_ML = \ guestfs_config.ml \ stringMap.ml \ stringSet.ml \ diff --git a/m4/guestfs_ocaml.m4 b/m4/guestfs_ocaml.m4 index 162ec0dde..b6e4ad22d 100644 --- a/m4/guestfs_ocaml.m4 +++ b/m4/guestfs_ocaml.m4 @@ -88,7 +88,6 @@ OCAML_PKG_gettext=no OCAML_PKG_libvirt=no OCAML_PKG_oUnit=no ounit_is_v2=no -have_Bytes_module=no AS_IF([test "x$OCAMLC" != "xno"],[ # Create common/mlgettext/common_gettext.ml gettext functions or stubs. @@ -105,20 +104,6 @@ AS_IF([test "x$OCAMLC" != "xno"],[ if test "x$OCAML_PKG_oUnit" != "xno"; then AC_CHECK_OCAML_MODULE(ounit_is_v2,[OUnit.OUnit2],OUnit2,[+oUnit]) fi - - # Check if we have the 'Bytes' module. If not (OCaml < 4.02) then - # we need to create a compatibility module. - # AC_CHECK_OCAML_MODULE is a bit broken, so open code this test. - AC_MSG_CHECKING([for OCaml module Bytes]) - rm -f conftest.ml - echo 'let s = Bytes.empty' > conftest.ml - if $OCAMLC -c conftest.ml >&5 2>&5 ; then - AC_MSG_RESULT([yes]) - have_Bytes_module=yes - else - AC_MSG_RESULT([not found]) - have_Bytes_module=no - fi ]) AM_CONDITIONAL([HAVE_OCAML_PKG_GETTEXT], [test "x$OCAML_PKG_gettext" != "xno"]) @@ -131,31 +116,8 @@ AC_CHECK_PROG([OCAML_GETTEXT],[ocaml-gettext],[ocaml-gettext],[no]) AM_CONDITIONAL([HAVE_OCAML_GETTEXT], [test "x$OCAML_PKG_gettext" != "xno" && test "x$OCAML_GETTEXT" != "xno"]) -dnl Create the backwards compatibility Bytes module for OCaml < 4.02. -mkdir -p common/mlstdutils -rm -f common/mlstdutils/bytes.ml -AS_IF([test "x$have_Bytes_module" = "xno"],[ - cat > common/mlstdutils/bytes.ml <<EOF -include String -let of_string = String.copy -let to_string = String.copy -let sub_string = String.sub -EOF - OCAML_BYTES_COMPAT_CMO='$(top_builddir)/common/mlstdutils/bytes.cmo' - OCAML_BYTES_COMPAT_ML='$(top_builddir)/common/mlstdutils/bytes.ml' - safe_string_option= -],[ - OCAML_BYTES_COMPAT_CMO= - OCAML_BYTES_COMPAT_ML= - safe_string_option="-safe-string" -]) -AC_SUBST([OCAML_BYTES_COMPAT_CMO]) -AC_SUBST([OCAML_BYTES_COMPAT_ML]) -AM_CONDITIONAL([HAVE_BYTES_COMPAT_ML], - [test "x$OCAML_BYTES_COMPAT_ML" != "x"]) - dnl Flags we want to pass to every OCaml compiler call. OCAML_WARN_ERROR="-warn-error CDEFLMPSUVYZX-3" AC_SUBST([OCAML_WARN_ERROR]) -OCAML_FLAGS="-g -annot $safe_string_option" +OCAML_FLAGS="-g -annot -safe-string" AC_SUBST([OCAML_FLAGS]) -- 2.13.2