summaryrefslogtreecommitdiff
path: root/src/include/c.h
diff options
context:
space:
mode:
authorPeter Eisentraut2008-12-11 07:34:09 +0000
committerPeter Eisentraut2008-12-11 07:34:09 +0000
commit218b4e8dd86016f82c3a71dec9d339240e866505 (patch)
tree1406076a9d31827ee9de1b04e16f4637d3fc186e /src/include/c.h
parent55368223cde4f19b4cd97eff7ea82b4a85a7a04c (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.
Diffstat (limited to 'src/include/c.h')
-rw-r--r--src/include/c.h28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/include/c.h b/src/include/c.h
index ca86067b9f9..4493fb91037 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -12,7 +12,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/c.h,v 1.230 2008/10/09 22:23:46 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/c.h,v 1.231 2008/12/11 07:34:08 petere Exp $
*
*-------------------------------------------------------------------------
*/
@@ -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
*