My OCaml program uses some functions in the OCaml standard library that were only introduced in version 4.01.0. How can I arrange that when my user compiles my code, the compiler emits an error if the OCaml compiler's version is not 4.01.0 or higher? I feel that this error would be more helpful than just a generic "unbound variable" error.
I see that ocaml -vnum
emits "4.01.0" so I guess I could try to check that in my Makefile, but perhaps there is a proper way to do this already? I'm using OCamlBuild, if that helps.
My current Makefile looks like this, by the way:
all:
@ echo "Attention: requires OCaml version >= 4.01.0."
ocamlbuild -cflag -annot -lib str -lib unix name_of_my_project.native
mv name_of_my_project.native name_of_my_project
clean:
ocamlbuild -clean
rm -f name_of_my_project