From 5f87f11b18ea83615c342c832caace49bf7e3897 Mon Sep 17 00:00:00 2001 From: Jacob Champion Date: Mon, 21 Apr 2025 13:43:08 -0700 Subject: [PATCH v9 1/2] Add minor-version counterpart to (PG_)MAJORVERSION An upcoming commit will name a library, libpq-oauth, using the major and minor versions. Make the minor version accessible from the Makefiles and as a string constant in the code. --- configure | 7 +++++++ configure.ac | 2 ++ meson.build | 1 + src/Makefile.global.in | 1 + src/include/pg_config.h.in | 3 +++ src/makefiles/meson.build | 1 + 6 files changed, 15 insertions(+) diff --git a/configure b/configure index 0936010718d..3d783793dfa 100755 --- a/configure +++ b/configure @@ -792,6 +792,7 @@ build_os build_vendor build_cpu build +PG_MINORVERSION PG_MAJORVERSION target_alias host_alias @@ -2877,6 +2878,12 @@ cat >>confdefs.h <<_ACEOF _ACEOF + +cat >>confdefs.h <<_ACEOF +#define PG_MINORVERSION "$PG_MINORVERSION" +_ACEOF + + cat >>confdefs.h <<_ACEOF #define PG_MINORVERSION_NUM $PG_MINORVERSION _ACEOF diff --git a/configure.ac b/configure.ac index 2a78cddd825..1cb3a0ff042 100644 --- a/configure.ac +++ b/configure.ac @@ -35,6 +35,8 @@ test -n "$PG_MINORVERSION" || PG_MINORVERSION=0 AC_SUBST(PG_MAJORVERSION) AC_DEFINE_UNQUOTED(PG_MAJORVERSION, "$PG_MAJORVERSION", [PostgreSQL major version as a string]) AC_DEFINE_UNQUOTED(PG_MAJORVERSION_NUM, $PG_MAJORVERSION, [PostgreSQL major version number]) +AC_SUBST(PG_MINORVERSION) +AC_DEFINE_UNQUOTED(PG_MINORVERSION, "$PG_MINORVERSION", [PostgreSQL minor version as a string]) AC_DEFINE_UNQUOTED(PG_MINORVERSION_NUM, $PG_MINORVERSION, [PostgreSQL minor version number]) PGAC_ARG_REQ(with, extra-version, [STRING], [append STRING to version], diff --git a/meson.build b/meson.build index a1516e54529..18423a7c13e 100644 --- a/meson.build +++ b/meson.build @@ -148,6 +148,7 @@ pg_version += get_option('extra_version') cdata.set_quoted('PG_VERSION', pg_version) cdata.set_quoted('PG_MAJORVERSION', pg_version_major.to_string()) cdata.set('PG_MAJORVERSION_NUM', pg_version_major) +cdata.set_quoted('PG_MINORVERSION', pg_version_minor.to_string()) cdata.set('PG_MINORVERSION_NUM', pg_version_minor) cdata.set('PG_VERSION_NUM', pg_version_num) # PG_VERSION_STR is built later, it depends on compiler test results diff --git a/src/Makefile.global.in b/src/Makefile.global.in index 6722fbdf365..54b4a07712e 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -40,6 +40,7 @@ maintainer-clean: distclean # PostgreSQL version number VERSION = @PACKAGE_VERSION@ MAJORVERSION = @PG_MAJORVERSION@ +MINORVERSION = @PG_MINORVERSION@ VERSION_NUM = @PG_VERSION_NUM@ PACKAGE_URL = @PACKAGE_URL@ diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index c3cc9fa856d..4fe37d228c5 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -602,6 +602,9 @@ /* PostgreSQL major version number */ #undef PG_MAJORVERSION_NUM +/* PostgreSQL minor version as a string */ +#undef PG_MINORVERSION + /* PostgreSQL minor version number */ #undef PG_MINORVERSION_NUM diff --git a/src/makefiles/meson.build b/src/makefiles/meson.build index 55da678ec27..e3adb5d8dc4 100644 --- a/src/makefiles/meson.build +++ b/src/makefiles/meson.build @@ -36,6 +36,7 @@ pgxs_kv = { 'PACKAGE_URL': pg_url, 'PACKAGE_VERSION': pg_version, 'PG_MAJORVERSION': pg_version_major, + 'PG_MINORVERSION': pg_version_minor, 'PG_VERSION_NUM': pg_version_num, 'configure_input': 'meson', -- 2.34.1