Add with-extra-version support to configure

PostgreSQL has it, now we do too!

Example: `./configure --with-extra-version=+git.20171011.a1387f4` would
currently result in: `` reporting the more useful:

	SHOW citus.version;

	         citus.version
	-------------------------------
	 7.1devel+git.20171011.a1387f4

Nice to have for packaging, one-off customer builds, etc. This stuff
is generally already in the package metadata, but it will be nice to
have it directly within a psql session.
pull/1700/head
Jason Petersen 2017-10-11 16:59:30 -06:00
parent 91ff8cd2d5
commit 339d0d6dc7
No known key found for this signature in database
GPG Key ID: 9F1D3510D110ABA9
2 changed files with 39 additions and 10 deletions

40
configure vendored
View File

@ -683,6 +683,7 @@ SHELL'
ac_subst_files=''
ac_user_opts='
enable_option_checking
with_extra_version
enable_coverage
with_libcurl
'
@ -1311,6 +1312,8 @@ Optional Features:
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-extra-version=STRING
append STRING to version
--without-libcurl do not use libcurl for anonymous statistics
collection
@ -2156,13 +2159,6 @@ fi
done
# CITUS_VERSION definition
cat >>confdefs.h <<_ACEOF
#define CITUS_VERSION "$PACKAGE_VERSION"
_ACEOF
# CITUS_MAJORVERSION definition
CITUS_MAJORVERSION=`expr "$PACKAGE_VERSION" : '\([0-9][0-9]*\.[0-9][0-9]*\)'`
@ -2171,6 +2167,36 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
# CITUS_VERSION definition
# Check whether --with-extra-version was given.
if test "${with_extra_version+set}" = set; then :
withval=$with_extra_version;
case $withval in
yes)
as_fn_error $? "argument required for --with-extra-version option" "$LINENO" 5
;;
no)
as_fn_error $? "argument required for --with-extra-version option" "$LINENO" 5
;;
*)
CITUS_VERSION="$PACKAGE_VERSION$withval"
;;
esac
else
CITUS_VERSION="$PACKAGE_VERSION"
fi
cat >>confdefs.h <<_ACEOF
#define CITUS_VERSION "$CITUS_VERSION"
_ACEOF
# CITUS_VERSION_NUM definition
# awk -F is a regex on some platforms, and not on others, so make "." a tab
CITUS_VERSION_NUM="`echo "$PACKAGE_VERSION" | sed 's/[A-Za-z].*$//' |

View File

@ -12,13 +12,16 @@ AC_COPYRIGHT([Copyright (c) 2012-2017, Citus Data, Inc.])
AC_PROG_SED
AC_PROG_AWK
# CITUS_VERSION definition
AC_DEFINE_UNQUOTED(CITUS_VERSION, "$PACKAGE_VERSION", [Citus version as a string])
# CITUS_MAJORVERSION definition
[CITUS_MAJORVERSION=`expr "$PACKAGE_VERSION" : '\([0-9][0-9]*\.[0-9][0-9]*\)'`]
AC_DEFINE_UNQUOTED(CITUS_MAJORVERSION, "$CITUS_MAJORVERSION", [Citus major version as a string])
# CITUS_VERSION definition
PGAC_ARG_REQ(with, extra-version, [STRING], [append STRING to version],
[CITUS_VERSION="$PACKAGE_VERSION$withval"],
[CITUS_VERSION="$PACKAGE_VERSION"])
AC_DEFINE_UNQUOTED(CITUS_VERSION, "$CITUS_VERSION", [Citus version as a string])
# CITUS_VERSION_NUM definition
# awk -F is a regex on some platforms, and not on others, so make "." a tab
[CITUS_VERSION_NUM="`echo "$PACKAGE_VERSION" | sed 's/[A-Za-z].*$//' |