Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit eccead9

Browse filesBrowse files
committed
Add support for ICU 4.2
Supporting ICU 4.2 seems useful because it ships with CentOS 6. Versions before ICU 4.6 don't support pkg-config, so document an installation method without using pkg-config. In ICU 4.2, ucol_getKeywordsForLocale() sometimes returns values that will not be accepted by uloc_toLanguageTag(). Skip loading keyword variants in that version. Reported-by: Victor Wagner <vitus@wagner.pp.ru>
1 parent f85f88b commit eccead9
Copy full SHA for eccead9

File tree

Expand file treeCollapse file tree

2 files changed

+30
-3
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+30
-3
lines changed

‎doc/src/sgml/installation.sgml

Copy file name to clipboardExpand all lines: doc/src/sgml/installation.sgml
+19-3Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -774,10 +774,26 @@ su - postgres
774774
Build with support for
775775
the <productname>ICU</productname><indexterm><primary>ICU</></>
776776
library. This requires the <productname>ICU4C</productname> package
777-
as well
778-
as <productname>pkg-config</productname><indexterm><primary>pkg-config</></>
779777
to be installed. The minimum required version
780-
of <productname>ICU4C</productname> is currently 4.6.
778+
of <productname>ICU4C</productname> is currently 4.2.
779+
</para>
780+
781+
<para>
782+
By default,
783+
<productname>pkg-config</productname><indexterm><primary>pkg-config</></>
784+
will be used to find the required compilation options. This is
785+
supported for <productname>ICU4C</productname> version 4.6 and later.
786+
For older versions, or if <productname>pkg-config</productname> is
787+
not available, the variables <envar>ICU_CFLAGS</envar>
788+
and <envar>ICU_LIBS</envar> can be specified
789+
to <filename>configure</filename>, like in this example:
790+
<programlisting>
791+
./configure ... --with-icu ICU_CFLAGS='-I/some/where/include' ICU_LIBS='-L/some/where/lib -licui18n -licuuc -licudata'
792+
</programlisting>
793+
(If <productname>ICU4C</productname> is in the default search path
794+
for the compiler, then you still need to specify a nonempty string in
795+
order to avoid use of <productname>pkg-config</productname>, for
796+
example, <literal>ICU_CFLAGS=' '</literal>.)
781797
</para>
782798
</listitem>
783799
</varlistentry>

‎src/backend/commands/collationcmds.c

Copy file name to clipboardExpand all lines: src/backend/commands/collationcmds.c
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,17 @@ pg_import_system_collations(PG_FUNCTION_ARGS)
722722

723723
/*
724724
* Add keyword variants
725+
*
726+
* In ICU 4.2, ucol_getKeywordsForLocale() sometimes returns
727+
* values that will not be accepted by uloc_toLanguageTag(). Skip
728+
* loading keyword variants in that version. (Both
729+
* ucol_getKeywordValuesForLocale() and uloc_toLanguageTag() are
730+
* new in ICU 4.2, so older versions are not supported at all.)
731+
*
732+
* XXX We have no information about ICU 4.3 through 4.7, but we
733+
* know the below works with 4.8.
725734
*/
735+
#if U_ICU_VERSION_MAJOR_NUM > 4 || (U_ICU_VERSION_MAJOR_NUM == 4 && U_ICU_VERSION_MINOR_NUM > 2)
726736
status = U_ZERO_ERROR;
727737
en = ucol_getKeywordValuesForLocale("collation", name, TRUE, &status);
728738
if (U_FAILURE(status))
@@ -769,6 +779,7 @@ pg_import_system_collations(PG_FUNCTION_ARGS)
769779
(errmsg("could not get keyword values for locale \"%s\": %s",
770780
name, u_errorName(status))));
771781
uenum_close(en);
782+
#endif /* ICU >4.2 */
772783
}
773784
}
774785
#endif /* USE_ICU */

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.