Commit 46328916 authored by Peter Eisentraut's avatar Peter Eisentraut

configure: Allow adding a custom string to PG_VERSION

This can be used to mark custom built binaries with an extra version
string such as a git describe identifier or distribution package release
version.

From: Oskari Saarenmaa <os@ohmu.fi>
parent ccca6f56
...@@ -804,6 +804,7 @@ SHELL' ...@@ -804,6 +804,7 @@ SHELL'
ac_subst_files='' ac_subst_files=''
ac_user_opts=' ac_user_opts='
enable_option_checking enable_option_checking
with_extra_version
with_template with_template
with_includes with_includes
with_libraries with_libraries
...@@ -1507,6 +1508,8 @@ Optional Features: ...@@ -1507,6 +1508,8 @@ Optional Features:
Optional Packages: Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-extra-version=STRING
append STRING to version
--with-template=NAME override operating system template --with-template=NAME override operating system template
--with-includes=DIRS look for additional header files in DIRS --with-includes=DIRS look for additional header files in DIRS
--with-libraries=DIRS look for additional libraries in DIRS --with-libraries=DIRS look for additional libraries in DIRS
...@@ -2047,16 +2050,44 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. ...@@ -2047,16 +2050,44 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
configure_args=$ac_configure_args configure_args=$ac_configure_args
PG_MAJORVERSION=`expr "$PACKAGE_VERSION" : '\([0-9][0-9]*\.[0-9][0-9]*\)'`
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
#define PG_VERSION "$PACKAGE_VERSION" #define PG_MAJORVERSION "$PG_MAJORVERSION"
_ACEOF _ACEOF
PG_MAJORVERSION=`expr "$PACKAGE_VERSION" : '\([0-9][0-9]*\.[0-9][0-9]*\)'`
# Check whether --with-extra-version was given.
if test "${with_extra_version+set}" = set; then
withval=$with_extra_version;
case $withval in
yes)
{ { $as_echo "$as_me:$LINENO: error: argument required for --with-extra-version option" >&5
$as_echo "$as_me: error: argument required for --with-extra-version option" >&2;}
{ (exit 1); exit 1; }; }
;;
no)
{ { $as_echo "$as_me:$LINENO: error: argument required for --with-extra-version option" >&5
$as_echo "$as_me: error: argument required for --with-extra-version option" >&2;}
{ (exit 1); exit 1; }; }
;;
*)
PG_VERSION="$PACKAGE_VERSION$withval"
;;
esac
else
PG_VERSION="$PACKAGE_VERSION"
fi
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
#define PG_MAJORVERSION "$PG_MAJORVERSION" #define PG_VERSION "$PG_VERSION"
_ACEOF _ACEOF
...@@ -30284,7 +30315,7 @@ fi ...@@ -30284,7 +30315,7 @@ fi
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
#define PG_VERSION_STR "PostgreSQL $PACKAGE_VERSION on $host, compiled by $cc_string, `expr $ac_cv_sizeof_void_p \* 8`-bit" #define PG_VERSION_STR "PostgreSQL $PG_VERSION on $host, compiled by $cc_string, `expr $ac_cv_sizeof_void_p \* 8`-bit"
_ACEOF _ACEOF
......
...@@ -29,11 +29,15 @@ AC_CONFIG_AUX_DIR(config) ...@@ -29,11 +29,15 @@ AC_CONFIG_AUX_DIR(config)
AC_PREFIX_DEFAULT(/usr/local/pgsql) AC_PREFIX_DEFAULT(/usr/local/pgsql)
AC_SUBST(configure_args, [$ac_configure_args]) AC_SUBST(configure_args, [$ac_configure_args])
AC_DEFINE_UNQUOTED(PG_VERSION, "$PACKAGE_VERSION", [PostgreSQL version as a string])
[PG_MAJORVERSION=`expr "$PACKAGE_VERSION" : '\([0-9][0-9]*\.[0-9][0-9]*\)'`] [PG_MAJORVERSION=`expr "$PACKAGE_VERSION" : '\([0-9][0-9]*\.[0-9][0-9]*\)'`]
AC_SUBST(PG_MAJORVERSION) AC_SUBST(PG_MAJORVERSION)
AC_DEFINE_UNQUOTED(PG_MAJORVERSION, "$PG_MAJORVERSION", [PostgreSQL major version as a string]) AC_DEFINE_UNQUOTED(PG_MAJORVERSION, "$PG_MAJORVERSION", [PostgreSQL major version as a string])
PGAC_ARG_REQ(with, extra-version, [STRING], [append STRING to version],
[PG_VERSION="$PACKAGE_VERSION$withval"],
[PG_VERSION="$PACKAGE_VERSION"])
AC_DEFINE_UNQUOTED(PG_VERSION, "$PG_VERSION", [PostgreSQL version as a string])
AC_CANONICAL_HOST AC_CANONICAL_HOST
template= template=
...@@ -1914,7 +1918,7 @@ else ...@@ -1914,7 +1918,7 @@ else
fi fi
AC_DEFINE_UNQUOTED(PG_VERSION_STR, AC_DEFINE_UNQUOTED(PG_VERSION_STR,
["PostgreSQL $PACKAGE_VERSION on $host, compiled by $cc_string, `expr $ac_cv_sizeof_void_p \* 8`-bit"], ["PostgreSQL $PG_VERSION on $host, compiled by $cc_string, `expr $ac_cv_sizeof_void_p \* 8`-bit"],
[A string containing the version number, platform, and C compiler]) [A string containing the version number, platform, and C compiler])
# Supply a numeric version string for use by 3rd party add-ons # Supply a numeric version string for use by 3rd party add-ons
......
...@@ -628,6 +628,19 @@ su - postgres ...@@ -628,6 +628,19 @@ su - postgres
<para> <para>
<variablelist> <variablelist>
<varlistentry>
<term><option>--with-extra-version=<replaceable>STRING</></option></term>
<listitem>
<para>
Append <replaceable>STRING</> to the PostgreSQL version number. You
can use this, for example, to mark binaries built from unreleased Git
snapshots or containing custom patches with an extra version string
such as a <command>git describe</command> identifier or a
distribution package release number.
</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><option>--with-includes=<replaceable>DIRECTORIES</></option></term> <term><option>--with-includes=<replaceable>DIRECTORIES</></option></term>
<listitem> <listitem>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment