|
1 | | -m4_define([mongoc_major_version], [1]) |
2 | | -m4_define([mongoc_minor_version], [2]) |
3 | | -m4_define([mongoc_micro_version], [2]) |
4 | | -m4_define([mongoc_prerelease_version], [dev]) |
5 | | - |
6 | | -m4_define( |
7 | | - [mongoc_version], |
8 | | - m4_ifset( |
9 | | - [mongoc_prerelease_version], |
10 | | - [mongoc_major_version.mongoc_minor_version.mongoc_micro_version-mongoc_prerelease_version], |
11 | | - [mongoc_major_version.mongoc_minor_version.mongoc_micro_version])) |
| 1 | +AC_DEFUN([mongoc_parse_version], [ |
| 2 | + m4_define([ver_split], m4_split(m4_translit($2, [-], [.]), [\.])) |
| 3 | + m4_define([$1_major_version], m4_argn(1, ver_split)) |
| 4 | + m4_define([$1_minor_version], m4_argn(2, ver_split)) |
| 5 | + m4_define([$1_micro_version], m4_argn(3, ver_split)) |
| 6 | + m4_define([$1_prerelease_version], m4_argn(4, ver_split)) |
| 7 | +
|
| 8 | + # Set mongoc_version / mongoc_released_version to "x.y.z" from components. |
| 9 | + m4_define( |
| 10 | + [$1_version], |
| 11 | + m4_ifset( |
| 12 | + [$1_prerelease_version], |
| 13 | + [$1_major_version.$1_minor_version.$1_micro_version-$1_prerelease_version], |
| 14 | + [$1_major_version.$1_minor_version.$1_micro_version])) |
| 15 | +
|
| 16 | + # E.g., if prefix is "mongoc", substitute MONGOC_MAJOR_VERSION. |
| 17 | + m4_define([prefix_upper], [translit([$1],[a-z],[A-Z])]) |
| 18 | + AC_SUBST(m4_join([], prefix_upper, [_MAJOR_VERSION]), $1_major_version) |
| 19 | + AC_SUBST(m4_join([], prefix_upper, [_MINOR_VERSION]), $1_minor_version) |
| 20 | + AC_SUBST(m4_join([], prefix_upper, [_MICRO_VERSION]), $1_micro_version) |
| 21 | + AC_SUBST(m4_join([], prefix_upper, [_PRERELEASE_VERSION]), $1_prerelease_version) |
| 22 | +
|
| 23 | + # Substitute the joined version string, e.g. set MONGOC_VERSION to $mongoc_version. |
| 24 | + AC_SUBST(m4_join([], prefix_upper, [_VERSION]), $1_version) |
| 25 | +]) |
| 26 | + |
| 27 | +# Parse version, perhaps like "x.y.z-dev", from VERSION_CURRENT file. |
| 28 | +mongoc_parse_version(mongoc, m4_esyscmd_s(cat VERSION_CURRENT)) |
| 29 | + |
| 30 | +# Parse most recent stable release, like "x.y.z", from VERSION_RELEASED file. |
| 31 | +mongoc_parse_version(mongoc_released, m4_esyscmd_s(cat VERSION_RELEASED)) |
| 32 | + |
| 33 | +AC_MSG_NOTICE([Current version (from VERSION_CURRENT file): $MONGOC_VERSION]) |
| 34 | + |
| 35 | +m4_ifset([mongoc_released_prerelease_version], |
| 36 | + [AC_ERROR([RELEASED_VERSION file has prerelease version $MONGOC_RELEASED_VERSION])]) |
| 37 | + |
| 38 | +if test "x$mongoc_version" != "x$mongoc_released_version"; then |
| 39 | + AC_MSG_NOTICE([Most recent release (from VERSION_RELEASED file): $MONGOC_RELEASED_VERSION]) |
| 40 | + m4_ifset([mongoc_prerelease_version], [], [ |
| 41 | + AC_ERROR([Current version must be a prerelease (with "-dev", "-beta", etc.) or equal to previous release]) |
| 42 | + ]) |
| 43 | +fi |
12 | 44 |
|
13 | 45 | # bump up by 1 for every micro release with no API changes, otherwise |
14 | 46 | # set to 0. after release, bump up by 1 |
15 | | -m4_define([mongoc_interface_age], [1]) |
16 | | -m4_define([mongoc_binary_age], [m4_eval(100 * mongoc_minor_version + mongoc_micro_version)]) |
| 47 | +m4_define([mongoc_released_interface_age], mongoc_released_micro_version) |
| 48 | +m4_define([mongoc_released_binary_age], |
| 49 | + [m4_eval(100 * mongoc_released_minor_version + |
| 50 | + mongoc_released_micro_version)]) |
| 51 | + |
| 52 | +AC_SUBST([MONGOC_RELEASED_INTERFACE_AGE], [mongoc_released_interface_age]) |
| 53 | +AC_MSG_NOTICE([libmongoc interface age $MONGOC_RELEASED_INTERFACE_AGE]) |
| 54 | + |
| 55 | +m4_define([lt_current], |
| 56 | + [m4_eval(100 * mongoc_released_minor_version + |
| 57 | + mongoc_released_micro_version - |
| 58 | + mongoc_released_interface_age)]) |
| 59 | + |
| 60 | +m4_define([lt_revision], [mongoc_released_interface_age]) |
17 | 61 |
|
18 | | -m4_define([lt_current], [m4_eval(100 * mongoc_minor_version + mongoc_micro_version - mongoc_interface_age)]) |
19 | | -m4_define([lt_revision], [mongoc_interface_age]) |
20 | | -m4_define([lt_age], [m4_eval(mongoc_binary_age - mongoc_interface_age)]) |
| 62 | +m4_define([lt_age], [m4_eval(mongoc_released_binary_age - |
| 63 | + mongoc_released_interface_age)]) |
21 | 64 |
|
22 | | -m4_define([libbson_required_version], [1.2.1]) |
| 65 | +# So far, we've synchronized libbson and mongoc versions. |
| 66 | +m4_define([libbson_required_version], [mongoc_released_version]) |
23 | 67 |
|
24 | 68 | m4_define([sasl_required_version], [2.1.6]) |
0 commit comments