summaryrefslogtreecommitdiff
path: root/build-aux
diff options
context:
space:
mode:
authorSébastien Hinderer <Sebastien.Hinderer@inria.fr>2021-10-08 12:19:55 +0200
committerSébastien Hinderer <Sebastien.Hinderer@inria.fr>2021-10-08 12:19:55 +0200
commitce97e67006024957fe3e5638902ddcce6b4b456e (patch)
tree07e4480ad5484e4148be8b69fb4d57a46ede2bb5 /build-aux
parente9eb2fb5f08d2c9cf153858d43ec042444adf6c6 (diff)
downloadocaml-ce97e67006024957fe3e5638902ddcce6b4b456e.tar.gz
Define OCaml's version in build-aux/ocaml_version.m4
Before this commit, the version of OCaml was defined on the first line of the VERSION file present at the top-level of the source tree. This commit defines the version of OCaml in build-aux/ocaml_version.m4 as a series of macros defining each component of the version and then putting all these components together in the right way to obtain the main version string and the other variants used here and there. With this commit, the VERSION file becomes a by-product of running autoocnf, which is usually done by running tools/autogen. However, this commit takes special care of generating the very same VERSION file than the one used before the commit. The modifications in the comments will be introduced in subsequent commits, for the sake of clarity and to make it possible and eaiser to verify that nothing has been broken or altered. With this commit all the components of the version number become available to the configure script which will thus be available to propagate them to the whole build system.
Diffstat (limited to 'build-aux')
-rw-r--r--build-aux/ocaml_version.m460
1 files changed, 60 insertions, 0 deletions
diff --git a/build-aux/ocaml_version.m4 b/build-aux/ocaml_version.m4
new file mode 100644
index 0000000000..a439ec92dd
--- /dev/null
+++ b/build-aux/ocaml_version.m4
@@ -0,0 +1,60 @@
+#**************************************************************************
+#* *
+#* OCaml *
+#* *
+#* Sebastien Hinderer, projet Cambium, INRIA Paris *
+#* *
+#* Copyright 2021 Institut National de Recherche en Informatique et *
+#* en Automatique. *
+#* *
+#* All rights reserved. This file is distributed under the terms of *
+#* the GNU Lesser General Public License version 2.1, with the *
+#* special exception on linking described in the file LICENSE. *
+#* *
+#**************************************************************************
+
+# This file contains all the macros used to describe the current version of
+# OCaml. It first defines the basic components and then computes all
+# the different variants of the version used across the build system.
+
+# For the M4 macros defined below, we use the OCAML__VERSION (with a double
+# underscore) to distinguish them from the C preprocessor macros which
+# use a single underscore, since the two families of macros coexist
+# in configure.ac.
+
+# The three following components (major, minor and patch level) MUST be
+# integers. They MUST NOT be left-padded with zeros and all of them,
+# including the patchlevel, are mandatory.
+
+m4_define([OCAML__VERSION_MAJOR], [4])
+m4_define([OCAML__VERSION_MINOR], [14])
+m4_define([OCAML__VERSION_PATCHLEVEL], [0])
+m4_define([OCAML__VERSION_EXTRA], [dev0-2021-06-03])
+
+# The OCAML__VERSION_EXTRA_PREFIX macro defined below should be a
+# single character:
+# Either [~] to mean that we are approaching the OCaml public release
+# OCAML__VERSION_MAJOR.OCAML__VERSION_MINOR.OCAML__VERSION_PATCHLEVEL
+# and with an empty OCAML__VERSION_EXTRA string;
+# Or [+] to give more info about this specific version.
+# Development releases, for instance, should use a [+] prefix.
+m4_define([OCAML__VERSION_EXTRA_PREFIX], [+])
+m4_define([OCAML__VERSION_SHORT], [OCAML__VERSION_MAJOR.OCAML__VERSION_MINOR])
+m4_define([OCAML__VERSION],
+ [m4_do(
+ OCAML__VERSION_SHORT.OCAML__VERSION_PATCHLEVEL,
+ m4_if(OCAML__VERSION_EXTRA,[],[],
+ OCAML__VERSION_EXTRA_PREFIX[]OCAML__VERSION_EXTRA))])
+
+# Generate the VERSION file
+# The following command is invoked when autoconf is run to generate configure
+# from configure.ac, not while configure itself is run.
+# In other words, both VERSION and configure are produced by invoking
+# autoconf (usually done by calling tools/autogen for this project)
+m4_syscmd([cat > VERSION << END_OF_VERSION_FILE
+]OCAML__VERSION[
+
+# The version string is the first line of this file.
+# It must be in the format described in stdlib/sys.mli
+END_OF_VERSION_FILE
+])