diff --git a/configure.in b/configure.in index 34ccef60b48a8baa3e646a4504142a5b580c92e2..7dc8101812382719767afcba555a12dc649a1a72 100644 --- a/configure.in +++ b/configure.in @@ -131,6 +131,33 @@ case $OCAMLVERSION in ;; esac +AC_SUBST(OCAMLMAJORNB) +AC_SUBST(OCAMLMINORNB) +AC_SUBST(OCAMLPATCHNB) + +AC_SUBST(HAS_OCAML403) +AC_SUBST(HAS_OCAML407) + +OCAMLMAJORNB=$(echo $OCAMLVERSION | cut -f 1 -d .) +OCAMLMINORNB=$(echo $OCAMLVERSION | cut -f 2 -d .) +OCAMLPATCHNB=$(echo $OCAMLVERSION | cut -f 3 -d .) + +if test $OCAMLMAJORNB -gt 4; then + HAS_OCAML403=yes; + HAS_OCAML407=yes; +else if test $OCAMLMINORNB -lt 3; then + HAS_OCAML403=no; + HAS_OCAML407=no; +else + HAS_OCAML403=yes; + if test $OCAMLMINORNB -lt 7; then + HAS_OCAML407=no; + else + HAS_OCAML407=yes; + fi; +fi; +fi; + # Ocaml library path AC_MSG_CHECKING(OCaml library path) OCAMLLIB=`$OCAMLC -where | tr -d '\\r'` diff --git a/share/Makefile.common b/share/Makefile.common index 88a4ce4b2fa204b55fd76a0bfea73dd8d680524d..d5061d699d1e11bbf51cdf910d717accfd93eccd 100644 --- a/share/Makefile.common +++ b/share/Makefile.common @@ -52,21 +52,6 @@ FRAMAC_SRC_DIRS= plugins/pdg_types plugins/value_types \ plugins/gui FRAMAC_SRC_DIRS:= $(addprefix src/, $(FRAMAC_SRC_DIRS)) -################# -# OCaml version # -################# - -# Cumulative semantics: HAS_OCAMLnnn should be set if OCaml version is mmm -# with mmm >= nnn - -# findstring returns an empty string if it does not match, and the value it -# searches if it matches. Hence we compare with the empty string -HAS_OCAML403=no -ifeq ($(findstring 4.02,$(OCAMLVERSION)),) - HAS_OCAML403 = yes -endif - - ################## # Flags # ################## diff --git a/share/Makefile.config.in b/share/Makefile.config.in index 0756a1bfe869afb44d1129167dabcc71e02c1a1d..ad081789b77d0ff25fde18f68720a5bc42f6a5b1 100644 --- a/share/Makefile.config.in +++ b/share/Makefile.config.in @@ -76,7 +76,16 @@ OCAML_ANNOT_OPTION ?=@OCAML_ANNOT_OPTION@ OCAMLLIB ?=@OCAMLLIB@ # either opt or byte OCAMLBEST ?=@OCAMLBEST@ + OCAMLVERSION ?=@OCAMLVERSION@ + +OCAMLMAJORNB ?=@OCAMLMAJORNB@ +OCAMLMINORNB ?=@OCAMLMINORNB@ +OCAMLPATCHNB ?=@OCAMLPATCHNB@ + +HAS_OCAML403 ?=@HAS_OCAML403@ +HAS_OCAML407 ?=@HAS_OCAML407@ + NATIVE_THREADS ?=@HAS_NATIVE_THREADS@ OCAMLWIN32 ?=@OCAMLWIN32@ PTESTSBEST ?=@PTESTSBEST@