Skip to content

Commit

Permalink
configure.ac, config: Change supported config versions to work based …
Browse files Browse the repository at this point in the history
…on PACKAGE_VERSION

For git this means 0.0.0, but the supported versions still include hardcoded
2.4.0 / 3.0.0, which can be used.
  • Loading branch information
sirainen committed Nov 8, 2024
1 parent 14132fb commit a432da6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -264,16 +264,16 @@ AM_ICONV
# SIZE_MAX is missing without this
CXXFLAGS="$CXXFLAGS -D__STDC_LIMIT_MACROS"

# Use the first x.y.z numbers of the version.
DOVECOT_CONFIG_VERSION=$(echo "$PACKAGE_VERSION" | sed 's/^\([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/')
if test "$is_pro_build" = "yes"; then
SET_PRO_DEFINES
DOVECOT_CONFIG_VERSION=3.0.0
AC_SUBST(DOVECOT_ASSET_URL, "doc.dovecotpro.com")
AC_SUBST(DOVECOT_PRO_BUILD, 1)
else
AC_DEFINE_UNQUOTED(DOVECOT_NAME, "$PACKAGE_NAME", [Dovecot name])
AC_SUBST(DOVECOT_ASSET_URL, "doc.dovecot.org")
AC_SUBST(DOVECOT_PRO_BUILD, 0)
DOVECOT_CONFIG_VERSION=2.4.0
fi
AC_DEFINE_UNQUOTED(DOVECOT_CONFIG_VERSION, "$DOVECOT_CONFIG_VERSION", [Dovecot configuration version])
AC_SUBST(DOVECOT_CONFIG_VERSION)
Expand Down
17 changes: 14 additions & 3 deletions src/config/config-parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -1367,10 +1367,21 @@ config_parser_check_warnings(struct config_parser_context *ctx, const char *key)

static bool config_version_find(const char *version, const char **error_r)
{
const char *const supported_versions[] = {
#ifdef DOVECOT_PRO_EDITION
"3.0.0",
DOVECOT_CONFIG_VERSION,
#else
"2.4.0",
DOVECOT_CONFIG_VERSION,
#endif
NULL
};
/* FIXME: implement full version checking later */
if (strcmp(version, DOVECOT_CONFIG_VERSION) != 0) {
*error_r = t_strdup_printf("Only '%s' is supported currently",
DOVECOT_CONFIG_VERSION);
if (!str_array_find(supported_versions, version)) {
*error_r = t_strdup_printf(
"Currently supported versions are: %s",
t_strarray_join(supported_versions, " "));
return FALSE;
}
return TRUE;
Expand Down

0 comments on commit a432da6

Please sign in to comment.