summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut2008-12-11 07:34:09 +0000
committerPeter Eisentraut2008-12-11 07:34:09 +0000
commitc722e13f26c54f9cc49cd3e867fedfb316fb828b (patch)
tree24c60fc2c8f8fc6ba0393d48296552763f70f6e1
parent7c59e81de9ebed9e46b410e59d4c455715e33d55 (diff)
Append major version number and for libraries soname major version number
to the gettext domain name, to simplify parallel installations. Also, rename set_text_domain() to pg_bindtextdomain(), because that is what it does.
-rwxr-xr-xconfigure13
-rw-r--r--configure.in3
-rw-r--r--doc/src/sgml/Makefile2
-rw-r--r--src/Makefile.global.in1
-rw-r--r--src/Makefile.shlib4
-rw-r--r--src/backend/main/main.c2
-rw-r--r--src/backend/utils/init/miscinit.c2
-rw-r--r--src/bin/initdb/initdb.c2
-rw-r--r--src/bin/pg_config/pg_config.c2
-rw-r--r--src/bin/pg_controldata/pg_controldata.c2
-rw-r--r--src/bin/pg_ctl/pg_ctl.c2
-rw-r--r--src/bin/pg_dump/pg_dump.c2
-rw-r--r--src/bin/pg_dump/pg_dumpall.c2
-rw-r--r--src/bin/pg_dump/pg_restore.c2
-rw-r--r--src/bin/pg_resetxlog/pg_resetxlog.c2
-rw-r--r--src/bin/psql/startup.c2
-rw-r--r--src/bin/scripts/clusterdb.c2
-rw-r--r--src/bin/scripts/createdb.c2
-rw-r--r--src/bin/scripts/createlang.c2
-rw-r--r--src/bin/scripts/createuser.c2
-rw-r--r--src/bin/scripts/dropdb.c2
-rw-r--r--src/bin/scripts/droplang.c2
-rw-r--r--src/bin/scripts/dropuser.c2
-rw-r--r--src/bin/scripts/reindexdb.c2
-rw-r--r--src/bin/scripts/vacuumdb.c2
-rw-r--r--src/include/c.h26
-rw-r--r--src/include/miscadmin.h2
-rw-r--r--src/include/pg_config.h.in3
-rw-r--r--src/interfaces/ecpg/ecpglib/misc.c4
-rw-r--r--src/interfaces/ecpg/preproc/ecpg.c2
-rw-r--r--src/interfaces/libpq/fe-misc.c4
-rw-r--r--src/nls-global.mk5
-rw-r--r--src/pl/plperl/plperl.c4
-rw-r--r--src/pl/plpgsql/src/pl_handler.c2
-rw-r--r--src/pl/plpgsql/src/plpgsql.h2
-rw-r--r--src/pl/plpython/plpython.c4
-rw-r--r--src/pl/tcl/pltcl.c4
-rw-r--r--src/port/exec.c2
-rw-r--r--src/test/regress/pg_regress.c2
39 files changed, 88 insertions, 41 deletions
diff --git a/configure b/configure
index d4fde181c1..063a6de40e 100755
--- a/configure
+++ b/configure
@@ -656,6 +656,7 @@ build_alias
host_alias
target_alias
configure_args
+PG_MAJORVERSION
build
build_cpu
build_vendor
@@ -1910,6 +1911,13 @@ cat >>confdefs.h <<_ACEOF
#define PG_VERSION "$PACKAGE_VERSION"
_ACEOF
+PG_MAJORVERSION=`expr "$PACKAGE_VERSION" : '\([0-9][0-9]*\.[0-9][0-9]*\)'`
+
+
+cat >>confdefs.h <<_ACEOF
+#define PG_MAJORVERSION "$PG_MAJORVERSION"
+_ACEOF
+
# Make sure we can run config.sub.
$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
@@ -27183,6 +27191,7 @@ build_alias!$build_alias$ac_delim
host_alias!$host_alias$ac_delim
target_alias!$target_alias$ac_delim
configure_args!$configure_args$ac_delim
+PG_MAJORVERSION!$PG_MAJORVERSION$ac_delim
build!$build$ac_delim
build_cpu!$build_cpu$ac_delim
build_vendor!$build_vendor$ac_delim
@@ -27241,7 +27250,6 @@ EGREP!$EGREP$ac_delim
ELF_SYS!$ELF_SYS$ac_delim
LDFLAGS_SL!$LDFLAGS_SL$ac_delim
LD!$LD$ac_delim
-with_gnu_ld!$with_gnu_ld$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -27283,6 +27291,7 @@ _ACEOF
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
+with_gnu_ld!$with_gnu_ld$ac_delim
ld_R_works!$ld_R_works$ac_delim
RANLIB!$RANLIB$ac_delim
STRIP!$STRIP$ac_delim
@@ -27343,7 +27352,7 @@ vpath_build!$vpath_build$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 58; then
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 59; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
diff --git a/configure.in b/configure.in
index 0ed12b040f..427c84df4d 100644
--- a/configure.in
+++ b/configure.in
@@ -30,6 +30,9 @@ AC_PREFIX_DEFAULT(/usr/local/pgsql)
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]*\)'`]
+AC_SUBST(PG_MAJORVERSION)
+AC_DEFINE_UNQUOTED(PG_MAJORVERSION, "$PG_MAJORVERSION", [PostgreSQL major version as a string])
AC_CANONICAL_HOST
diff --git a/doc/src/sgml/Makefile b/doc/src/sgml/Makefile
index 1edcdfd3f2..f6447c8351 100644
--- a/doc/src/sgml/Makefile
+++ b/doc/src/sgml/Makefile
@@ -126,7 +126,7 @@ HTML.index:
version.sgml: $(top_builddir)/src/Makefile.global
{ \
echo "<!entity version \"$(VERSION)\">"; \
- echo "<!entity majorversion \"`expr $(VERSION) : '\([0-9][0-9]*\.[0-9][0-9]*\)'`\">"; \
+ echo "<!entity majorversion \"$(MAJORVERSION)\">"; \
} >$@
features-supported.sgml: $(top_srcdir)/src/backend/catalog/sql_feature_packages.txt $(top_srcdir)/src/backend/catalog/sql_features.txt
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 63e422f126..3202263daa 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -30,6 +30,7 @@ all:
# PostgreSQL version number
VERSION = @PACKAGE_VERSION@
+MAJORVERSION = @PG_MAJORVERSION@
# Support for VPATH builds
vpath_build = @vpath_build@
diff --git a/src/Makefile.shlib b/src/Makefile.shlib
index 9c615da290..6aeaab4ddd 100644
--- a/src/Makefile.shlib
+++ b/src/Makefile.shlib
@@ -115,6 +115,10 @@ endif
# Try to keep the sections in some kind of order, folks...
override CFLAGS += $(CFLAGS_SL)
+ifdef SO_MAJOR_VERSION
+# libraries ought to use this to refer to versioned gettext domain names
+override CPPFLAGS += -DSO_MAJOR_VERSION=$(SO_MAJOR_VERSION)
+endif
ifeq ($(PORTNAME), aix)
ifdef SO_MAJOR_VERSION
diff --git a/src/backend/main/main.c b/src/backend/main/main.c
index af7914a468..f5cff431fb 100644
--- a/src/backend/main/main.c
+++ b/src/backend/main/main.c
@@ -87,7 +87,7 @@ main(int argc, char *argv[])
* error messages to be localized.
*/
- set_pglocale_pgservice(argv[0], "postgres");
+ set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("postgres"));
#ifdef WIN32
diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c
index 596c288850..d3cbbf0890 100644
--- a/src/backend/utils/init/miscinit.c
+++ b/src/backend/utils/init/miscinit.c
@@ -1214,7 +1214,7 @@ process_local_preload_libraries(void)
}
void
-set_text_domain(const char *domain)
+pg_bindtextdomain(const char *domain)
{
#ifdef ENABLE_NLS
if (my_exec_path[0] != '\0')
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 5760b40f38..b8eda08755 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -2511,7 +2511,7 @@ main(int argc, char *argv[])
};
progname = get_progname(argv[0]);
- set_pglocale_pgservice(argv[0], "initdb");
+ set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("initdb"));
if (argc > 1)
{
diff --git a/src/bin/pg_config/pg_config.c b/src/bin/pg_config/pg_config.c
index d9807308ac..bbee1b3313 100644
--- a/src/bin/pg_config/pg_config.c
+++ b/src/bin/pg_config/pg_config.c
@@ -465,7 +465,7 @@ main(int argc, char **argv)
int j;
int ret;
- set_pglocale_pgservice(argv[0], "pg_config");
+ set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_config"));
progname = get_progname(argv[0]);
diff --git a/src/bin/pg_controldata/pg_controldata.c b/src/bin/pg_controldata/pg_controldata.c
index bdbedfd99e..4ea849d7f1 100644
--- a/src/bin/pg_controldata/pg_controldata.c
+++ b/src/bin/pg_controldata/pg_controldata.c
@@ -76,7 +76,7 @@ main(int argc, char *argv[])
const char *strftime_fmt = "%c";
const char *progname;
- set_pglocale_pgservice(argv[0], "pg_controldata");
+ set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_controldata"));
progname = get_progname(argv[0]);
diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c
index bc756959d2..a94faef728 100644
--- a/src/bin/pg_ctl/pg_ctl.c
+++ b/src/bin/pg_ctl/pg_ctl.c
@@ -1648,7 +1648,7 @@ main(int argc, char **argv)
#endif
progname = get_progname(argv[0]);
- set_pglocale_pgservice(argv[0], "pg_ctl");
+ set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_ctl"));
/*
* save argv[0] so do_start() can look for the postmaster if necessary. we
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index a62b1eafc3..8d812b9b1f 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -274,7 +274,7 @@ main(int argc, char **argv)
{NULL, 0, NULL, 0}
};
- set_pglocale_pgservice(argv[0], "pg_dump");
+ set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_dump"));
g_verbose = false;
diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c
index 8328af1911..647cc7c9bd 100644
--- a/src/bin/pg_dump/pg_dumpall.c
+++ b/src/bin/pg_dump/pg_dumpall.c
@@ -127,7 +127,7 @@ main(int argc, char *argv[])
int optindex;
- set_pglocale_pgservice(argv[0], "pg_dump");
+ set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_dump"));
progname = get_progname(argv[0]);
diff --git a/src/bin/pg_dump/pg_restore.c b/src/bin/pg_dump/pg_restore.c
index 899a8a4e4f..eb16aa9d44 100644
--- a/src/bin/pg_dump/pg_restore.c
+++ b/src/bin/pg_dump/pg_restore.c
@@ -119,7 +119,7 @@ main(int argc, char **argv)
{NULL, 0, NULL, 0}
};
- set_pglocale_pgservice(argv[0], "pg_dump");
+ set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_dump"));
opts = NewRestoreOptions();
diff --git a/src/bin/pg_resetxlog/pg_resetxlog.c b/src/bin/pg_resetxlog/pg_resetxlog.c
index f495fe8fc4..bb61d08fb3 100644
--- a/src/bin/pg_resetxlog/pg_resetxlog.c
+++ b/src/bin/pg_resetxlog/pg_resetxlog.c
@@ -96,7 +96,7 @@ main(int argc, char *argv[])
int fd;
char path[MAXPGPATH];
- set_pglocale_pgservice(argv[0], "pg_resetxlog");
+ set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_resetxlog"));
progname = get_progname(argv[0]);
diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c
index fdf65a55fc..e5b13f62c6 100644
--- a/src/bin/psql/startup.c
+++ b/src/bin/psql/startup.c
@@ -96,7 +96,7 @@ main(int argc, char *argv[])
char *password_prompt = NULL;
bool new_pass;
- set_pglocale_pgservice(argv[0], "psql");
+ set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("psql"));
if (argc > 1)
{
diff --git a/src/bin/scripts/clusterdb.c b/src/bin/scripts/clusterdb.c
index 052a961d3e..8b070a601b 100644
--- a/src/bin/scripts/clusterdb.c
+++ b/src/bin/scripts/clusterdb.c
@@ -58,7 +58,7 @@ main(int argc, char *argv[])
bool verbose = false;
progname = get_progname(argv[0]);
- set_pglocale_pgservice(argv[0], "pgscripts");
+ set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pgscripts"));
handle_help_version_opts(argc, argv, "clusterdb", help);
diff --git a/src/bin/scripts/createdb.c b/src/bin/scripts/createdb.c
index 369f87a611..e9e724a34a 100644
--- a/src/bin/scripts/createdb.c
+++ b/src/bin/scripts/createdb.c
@@ -63,7 +63,7 @@ main(int argc, char *argv[])
PGresult *result;
progname = get_progname(argv[0]);
- set_pglocale_pgservice(argv[0], "pgscripts");
+ set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pgscripts"));
handle_help_version_opts(argc, argv, "createdb", help);
diff --git a/src/bin/scripts/createlang.c b/src/bin/scripts/createlang.c
index 4ff35f01e4..c4aaab2636 100644
--- a/src/bin/scripts/createlang.c
+++ b/src/bin/scripts/createlang.c
@@ -52,7 +52,7 @@ main(int argc, char *argv[])
PGresult *result;
progname = get_progname(argv[0]);
- set_pglocale_pgservice(argv[0], "pgscripts");
+ set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pgscripts"));
handle_help_version_opts(argc, argv, "createlang", help);
diff --git a/src/bin/scripts/createuser.c b/src/bin/scripts/createuser.c
index 75cc41d06c..35e71496c4 100644
--- a/src/bin/scripts/createuser.c
+++ b/src/bin/scripts/createuser.c
@@ -81,7 +81,7 @@ main(int argc, char *argv[])
PGresult *result;
progname = get_progname(argv[0]);
- set_pglocale_pgservice(argv[0], "pgscripts");
+ set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pgscripts"));
handle_help_version_opts(argc, argv, "createuser", help);
diff --git a/src/bin/scripts/dropdb.c b/src/bin/scripts/dropdb.c
index 43c528e28e..0efda791dc 100644
--- a/src/bin/scripts/dropdb.c
+++ b/src/bin/scripts/dropdb.c
@@ -50,7 +50,7 @@ main(int argc, char *argv[])
PGresult *result;
progname = get_progname(argv[0]);
- set_pglocale_pgservice(argv[0], "pgscripts");
+ set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pgscripts"));
handle_help_version_opts(argc, argv, "dropdb", help);
diff --git a/src/bin/scripts/droplang.c b/src/bin/scripts/droplang.c
index b226609425..c8acbe2da6 100644
--- a/src/bin/scripts/droplang.c
+++ b/src/bin/scripts/droplang.c
@@ -63,7 +63,7 @@ main(int argc, char *argv[])
PGresult *result;
progname = get_progname(argv[0]);
- set_pglocale_pgservice(argv[0], "pgscripts");
+ set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pgscripts"));
handle_help_version_opts(argc, argv, "droplang", help);
diff --git a/src/bin/scripts/dropuser.c b/src/bin/scripts/dropuser.c
index f4ceb56830..94ebd04fa8 100644
--- a/src/bin/scripts/dropuser.c
+++ b/src/bin/scripts/dropuser.c
@@ -50,7 +50,7 @@ main(int argc, char *argv[])
PGresult *result;
progname = get_progname(argv[0]);
- set_pglocale_pgservice(argv[0], "pgscripts");
+ set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pgscripts"));
handle_help_version_opts(argc, argv, "dropuser", help);
diff --git a/src/bin/scripts/reindexdb.c b/src/bin/scripts/reindexdb.c
index afb06be446..d0adb1677e 100644
--- a/src/bin/scripts/reindexdb.c
+++ b/src/bin/scripts/reindexdb.c
@@ -64,7 +64,7 @@ main(int argc, char *argv[])
const char *index = NULL;
progname = get_progname(argv[0]);
- set_pglocale_pgservice(argv[0], "pgscripts");
+ set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pgscripts"));
handle_help_version_opts(argc, argv, "reindexdb", help);
diff --git a/src/bin/scripts/vacuumdb.c b/src/bin/scripts/vacuumdb.c
index 3f429d4257..7469086361 100644
--- a/src/bin/scripts/vacuumdb.c
+++ b/src/bin/scripts/vacuumdb.c
@@ -64,7 +64,7 @@ main(int argc, char *argv[])
bool verbose = false;
progname = get_progname(argv[0]);
- set_pglocale_pgservice(argv[0], "pgscripts");
+ set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pgscripts"));
handle_help_version_opts(argc, argv, "vacuumdb", help);
diff --git a/src/include/c.h b/src/include/c.h
index d2dcaa783f..cea61808f7 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -715,6 +715,32 @@ typedef NameData *Name;
#define STATUS_WAITING (2)
+/* gettext domain name mangling */
+
+/*
+ * To better support parallel installations of major PostgeSQL
+ * versions as well as parallel installations of major library soname
+ * versions, we mangle the gettext domain name by appending those
+ * version numbers. The coding rule ought to be that whereever the
+ * domain name is mentioned as a literal, it must be wrapped into
+ * PG_TEXTDOMAIN(). The macros below do not work on non-literals; but
+ * that is somewhat intentional because it avoids having to worry
+ * about multiple states of premangling and postmangling as the values
+ * are being passed around.
+ *
+ * Make sure this matches the installation rules in nls-global.mk.
+ */
+
+/* need a second indirection because we want to stringize the macro value, not the name */
+#define CppAsString2(x) CppAsString(x)
+
+#ifdef SO_MAJOR_VERSION
+# define PG_TEXTDOMAIN(domain) (domain CppAsString2(SO_MAJOR_VERSION) "-" PG_MAJORVERSION)
+#else
+# define PG_TEXTDOMAIN(domain) (domain "-" PG_MAJORVERSION)
+#endif
+
+
/* ----------------------------------------------------------------
* Section 8: system-specific hacks
*
diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h
index 86bd3988c5..12e16b84d7 100644
--- a/src/include/miscadmin.h
+++ b/src/include/miscadmin.h
@@ -343,7 +343,7 @@ extern void RecordSharedMemoryInLockFile(unsigned long id1,
extern void ValidatePgVersion(const char *path);
extern void process_shared_preload_libraries(void);
extern void process_local_preload_libraries(void);
-extern void set_text_domain(const char *domain);
+extern void pg_bindtextdomain(const char *domain);
/* in access/transam/xlog.c */
extern bool BackupInProgress(void);
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index 9f6f21bf81..5ba3ca8260 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -642,6 +642,9 @@
(--with-krb-srvnam=NAME) */
#undef PG_KRB_SRVNAM
+/* PostgreSQL major version as a string */
+#undef PG_MAJORVERSION
+
/* PostgreSQL version as a string */
#undef PG_VERSION
diff --git a/src/interfaces/ecpg/ecpglib/misc.c b/src/interfaces/ecpg/ecpglib/misc.c
index d48cb9e957..718e911439 100644
--- a/src/interfaces/ecpg/ecpglib/misc.c
+++ b/src/interfaces/ecpg/ecpglib/misc.c
@@ -474,7 +474,7 @@ ecpg_gettext(const char *msgid)
ldir = getenv("PGLOCALEDIR");
if (!ldir)
ldir = LOCALEDIR;
- bindtextdomain("ecpg", ldir);
+ bindtextdomain(PG_TEXTDOMAIN("ecpg"), ldir);
#ifdef WIN32
SetLastError(save_errno);
#else
@@ -482,7 +482,7 @@ ecpg_gettext(const char *msgid)
#endif
}
- return dgettext("ecpg", msgid);
+ return dgettext(PG_TEXTDOMAIN("ecpg"), msgid);
}
#endif /* ENABLE_NLS */
diff --git a/src/interfaces/ecpg/preproc/ecpg.c b/src/interfaces/ecpg/preproc/ecpg.c
index 48cd087b5d..c51afd265c 100644
--- a/src/interfaces/ecpg/preproc/ecpg.c
+++ b/src/interfaces/ecpg/preproc/ecpg.c
@@ -138,7 +138,7 @@ main(int argc, char *const argv[])
char my_exec_path[MAXPGPATH];
char include_path[MAXPGPATH];
- set_pglocale_pgservice(argv[0], "ecpg");
+ set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("ecpg"));
progname = get_progname(argv[0]);
diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c
index b21528f18e..00e7f0a99a 100644
--- a/src/interfaces/libpq/fe-misc.c
+++ b/src/interfaces/libpq/fe-misc.c
@@ -1166,7 +1166,7 @@ libpq_gettext(const char *msgid)
ldir = getenv("PGLOCALEDIR");
if (!ldir)
ldir = LOCALEDIR;
- bindtextdomain("libpq", ldir);
+ bindtextdomain(PG_TEXTDOMAIN("libpq"), ldir);
#ifdef WIN32
SetLastError(save_errno);
#else
@@ -1174,7 +1174,7 @@ libpq_gettext(const char *msgid)
#endif
}
- return dgettext("libpq", msgid);
+ return dgettext(PG_TEXTDOMAIN("libpq"), msgid);
}
#endif /* ENABLE_NLS */
diff --git a/src/nls-global.mk b/src/nls-global.mk
index 952aaca14e..9ca68151c6 100644
--- a/src/nls-global.mk
+++ b/src/nls-global.mk
@@ -62,10 +62,11 @@ else # not XGETTEXT
endif # not XGETTEXT
+# catalog name extentions must match behavior of PG_TEXTDOMAIN() in c.h
install-po: all-po installdirs-po
ifneq (,$(LANGUAGES))
for lang in $(LANGUAGES); do \
- $(INSTALL_DATA) po/$$lang.mo '$(DESTDIR)$(localedir)'/$$lang/LC_MESSAGES/$(CATALOG_NAME).mo || exit 1; \
+ $(INSTALL_DATA) po/$$lang.mo '$(DESTDIR)$(localedir)'/$$lang/LC_MESSAGES/$(CATALOG_NAME)$(SO_MAJOR_VERSION)-$(MAJORVERSION).mo || exit 1; \
done
endif
@@ -73,7 +74,7 @@ installdirs-po:
$(mkinstalldirs) $(foreach lang, $(LANGUAGES), '$(DESTDIR)$(localedir)'/$(lang)/LC_MESSAGES)
uninstall-po:
- rm -f $(foreach lang, $(LANGUAGES), '$(DESTDIR)$(localedir)'/$(lang)/LC_MESSAGES/$(CATALOG_NAME).mo)
+ rm -f $(foreach lang, $(LANGUAGES), '$(DESTDIR)$(localedir)'/$(lang)/LC_MESSAGES/$(CATALOG_NAME)$(SO_MAJOR_VERSION)-$(MAJORVERSION).mo)
clean-po:
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c
index 709524aca6..20bd969aea 100644
--- a/src/pl/plperl/plperl.c
+++ b/src/pl/plperl/plperl.c
@@ -32,7 +32,7 @@
/* define our text domain for translations */
#undef TEXTDOMAIN
-#define TEXTDOMAIN "plperl"
+#define TEXTDOMAIN PG_TEXTDOMAIN("plperl")
/* perl stuff */
#include "plperl.h"
@@ -190,7 +190,7 @@ _PG_init(void)
if (inited)
return;
- set_text_domain(TEXTDOMAIN);
+ pg_bindtextdomain(TEXTDOMAIN);
DefineCustomBoolVariable("plperl.use_strict",
gettext_noop("If true, will compile trusted and untrusted perl code in strict mode"),
diff --git a/src/pl/plpgsql/src/pl_handler.c b/src/pl/plpgsql/src/pl_handler.c
index 23dfb8e393..a4c71fade2 100644
--- a/src/pl/plpgsql/src/pl_handler.c
+++ b/src/pl/plpgsql/src/pl_handler.c
@@ -42,7 +42,7 @@ _PG_init(void)
if (inited)
return;
- set_text_domain(TEXTDOMAIN);
+ pg_bindtextdomain(TEXTDOMAIN);
plpgsql_HashTableInit();
RegisterXactCallback(plpgsql_xact_cb, NULL);
diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h
index 07b844019c..ad08aaa7b2 100644
--- a/src/pl/plpgsql/src/plpgsql.h
+++ b/src/pl/plpgsql/src/plpgsql.h
@@ -30,7 +30,7 @@
/* define our text domain for translations */
#undef TEXTDOMAIN
-#define TEXTDOMAIN "plpgsql"
+#define TEXTDOMAIN PG_TEXTDOMAIN("plpgsql")
/* ----------
* Compiler's namestack item types
diff --git a/src/pl/plpython/plpython.c b/src/pl/plpython/plpython.c
index 1565c41372..72ec523d59 100644
--- a/src/pl/plpython/plpython.c
+++ b/src/pl/plpython/plpython.c
@@ -66,7 +66,7 @@ typedef int Py_ssize_t;
/* define our text domain for translations */
#undef TEXTDOMAIN
-#define TEXTDOMAIN "plpython"
+#define TEXTDOMAIN PG_TEXTDOMAIN("plpython")
#include <compile.h>
#include <eval.h>
@@ -2750,7 +2750,7 @@ _PG_init(void)
if (inited)
return;
- set_text_domain(TEXTDOMAIN);
+ pg_bindtextdomain(TEXTDOMAIN);
Py_Initialize();
PLy_init_interp();
diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c
index 9807297e5c..fc586539fe 100644
--- a/src/pl/tcl/pltcl.c
+++ b/src/pl/tcl/pltcl.c
@@ -44,7 +44,7 @@
/* define our text domain for translations */
#undef TEXTDOMAIN
-#define TEXTDOMAIN "pltcl"
+#define TEXTDOMAIN PG_TEXTDOMAIN("pltcl")
#if defined(UNICODE_CONVERSION) && HAVE_TCL_VERSION(8,1)
@@ -268,7 +268,7 @@ _PG_init(void)
if (pltcl_pm_init_done)
return;
- set_text_domain(TEXTDOMAIN);
+ pg_bindtextdomain(TEXTDOMAIN);
#ifdef WIN32
/* Required on win32 to prevent error loading init.tcl */
diff --git a/src/port/exec.c b/src/port/exec.c
index 3c15f49280..cf3839ccbb 100644
--- a/src/port/exec.c
+++ b/src/port/exec.c
@@ -630,7 +630,7 @@ set_pglocale_pgservice(const char *argv0, const char *app)
* PGLOCALEDIR */
/* don't set LC_ALL in the backend */
- if (strcmp(app, "postgres") != 0)
+ if (strcmp(app, PG_TEXTDOMAIN("postgres")) != 0)
setlocale(LC_ALL, "");
if (find_my_exec(argv0, my_exec_path) < 0)
diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index 2c1181d6e1..c7dd767008 100644
--- a/src/test/regress/pg_regress.c
+++ b/src/test/regress/pg_regress.c
@@ -1894,7 +1894,7 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
};
progname = get_progname(argv[0]);
- set_pglocale_pgservice(argv[0], "pg_regress");
+ set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_regress"));
#ifndef HAVE_UNIX_SOCKETS
/* no unix domain sockets available, so change default */