From 9b00885d0fd0a07c7057647f45032428a45a8db8 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 5 Jul 2015 12:01:01 -0400 Subject: [PATCH] Make numeric form of PG version number readily available in Makefiles. Expose PG_VERSION_NUM (e.g., "90600") as a Make variable; but for consistency with the other Make variables holding similar info, call the variable just VERSION_NUM not PG_VERSION_NUM. There was some discussion of making this value available as a pg_config value as well. However, that would entail substantially more work than this two-line patch. Given that there was not exactly universal consensus that we need this at all, let's just do a minimal amount of work for now. Back-patch of commit a5d489ccb7e613c7ca3be6141092b8c1d2c13fa7, so that this variable is actually useful for its intended purpose sometime before 2020. Michael Paquier, reviewed by Pavel Stehule --- configure | 2 ++ configure.in | 1 + src/Makefile.global.in | 1 + 3 files changed, 4 insertions(+) diff --git a/configure b/configure index 749d5ade445..8e66f37f872 100755 --- a/configure +++ b/configure @@ -642,6 +642,7 @@ ac_includes_default="\ ac_subst_vars='LTLIBOBJS vpath_build +PG_VERSION_NUM OSX XSLTPROC COLLATEINDEX @@ -30046,6 +30047,7 @@ _ACEOF + # prepare build tree if outside source tree # Note 1: test -ef might not exist, but it's more reliable than `pwd`. # Note 2: /bin/pwd might be better than shell's built-in at getting diff --git a/configure.in b/configure.in index c4a477ead98..8bf6bb85ec4 100644 --- a/configure.in +++ b/configure.in @@ -1932,6 +1932,7 @@ AC_DEFINE_UNQUOTED(PG_VERSION_STR, tr '.' ' ' | $AWK '{printf "%d%02d%02d", $1, $2, (NF >= 3) ? $3 : 0}'`"] AC_DEFINE_UNQUOTED(PG_VERSION_NUM, $PG_VERSION_NUM, [PostgreSQL version as a number]) +AC_SUBST(PG_VERSION_NUM) # prepare build tree if outside source tree diff --git a/src/Makefile.global.in b/src/Makefile.global.in index 9830b17830e..337bdb0b281 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -34,6 +34,7 @@ all: # PostgreSQL version number VERSION = @PACKAGE_VERSION@ MAJORVERSION = @PG_MAJORVERSION@ +VERSION_NUM = @PG_VERSION_NUM@ # Support for VPATH builds vpath_build = @vpath_build@