v2-0001-Build-ICU-support-by-default.patch
text/x-patch
Filename: v2-0001-Build-ICU-support-by-default.patch
Type: text/x-patch
Part: 0
Message:
Re: Move defaults toward ICU in 16?
Patch
Format: format-patch
Series: patch v2-0001
Subject: Build ICU support by default.
| File | + | − |
|---|---|---|
| .cirrus.yml | 1 | 0 |
| configure | 17 | 29 |
| configure.ac | 6 | 2 |
| doc/src/sgml/installation.sgml | 43 | 35 |
| meson.build | 10 | 2 |
| meson_options.txt | 1 | 1 |
From b1772b12be3c47a00a3723d2937421cb5bbfe3a3 Mon Sep 17 00:00:00 2001
From: Jeff Davis <jeff@j-davis.com>
Date: Fri, 10 Feb 2023 12:08:11 -0800
Subject: [PATCH v2 1/2] Build ICU support by default.
Discussion: https://postgr.es/m/510d284759f6e943ce15096167760b2edcb2e700.camel@j-davis.com
---
.cirrus.yml | 1 +
configure | 46 ++++++++------------
configure.ac | 8 +++-
doc/src/sgml/installation.sgml | 78 +++++++++++++++++++---------------
meson.build | 12 +++++-
meson_options.txt | 2 +-
6 files changed, 78 insertions(+), 69 deletions(-)
diff --git a/.cirrus.yml b/.cirrus.yml
index 6b98980075..24302efea6 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -775,6 +775,7 @@ task:
time ./configure \
--host=x86_64-w64-mingw32 \
--enable-cassert \
+ --without-icu \
CC="ccache x86_64-w64-mingw32-gcc" \
CXX="ccache x86_64-w64-mingw32-g++"
make -s -j${BUILD_JOBS} clean
diff --git a/configure b/configure
index 5d07fd0bb9..ddb75f7f4b 100755
--- a/configure
+++ b/configure
@@ -1558,7 +1558,7 @@ Optional Packages:
set WAL block size in kB [8]
--with-CC=CMD set compiler (deprecated)
--with-llvm build with LLVM based JIT support
- --with-icu build with ICU support
+ --without-icu build without ICU support
--with-tcl build Tcl modules (PL/Tcl)
--with-tclconfig=DIR tclConfig.sh is in DIR
--with-perl build Perl modules (PL/Perl)
@@ -8401,7 +8401,9 @@ $as_echo "#define USE_ICU 1" >>confdefs.h
esac
else
- with_icu=no
+ with_icu=yes
+
+$as_echo "#define USE_ICU 1" >>confdefs.h
fi
@@ -8470,31 +8472,17 @@ fi
# Put the nasty error message in config.log where it belongs
echo "$ICU_PKG_ERRORS" >&5
- as_fn_error $? "Package requirements (icu-uc icu-i18n) were not met:
-
-$ICU_PKG_ERRORS
-
-Consider adjusting the PKG_CONFIG_PATH environment variable if you
-installed software in a non-standard prefix.
-
-Alternatively, you may set the environment variables ICU_CFLAGS
-and ICU_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details." "$LINENO" 5
+ as_fn_error $? "ICU library not found
+If you have ICU already installed, see config.log for details on the
+failure. It is possible the compiler isn't looking in the proper directory.
+Use --without-icu to disable ICU support." "$LINENO" 5
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
-is in your PATH or set the PKG_CONFIG environment variable to the full
-path to pkg-config.
-
-Alternatively, you may set the environment variables ICU_CFLAGS
-and ICU_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.
-
-To get pkg-config, see <http://pkg-config.freedesktop.org/>.
-See \`config.log' for more details" "$LINENO" 5; }
+ as_fn_error $? "ICU library not found
+If you have ICU already installed, see config.log for details on the
+failure. It is possible the compiler isn't looking in the proper directory.
+Use --without-icu to disable ICU support." "$LINENO" 5
else
ICU_CFLAGS=$pkg_cv_ICU_CFLAGS
ICU_LIBS=$pkg_cv_ICU_LIBS
@@ -15323,7 +15311,7 @@ else
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -15369,7 +15357,7 @@ else
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -15393,7 +15381,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -15438,7 +15426,7 @@ else
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -15462,7 +15450,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
diff --git a/configure.ac b/configure.ac
index e9b74ced6c..909f5dba3c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -853,13 +853,17 @@ AC_SUBST(enable_thread_safety)
# ICU
#
AC_MSG_CHECKING([whether to build with ICU support])
-PGAC_ARG_BOOL(with, icu, no, [build with ICU support],
+PGAC_ARG_BOOL(with, icu, yes, [build without ICU support],
[AC_DEFINE([USE_ICU], 1, [Define to build with ICU support. (--with-icu)])])
AC_MSG_RESULT([$with_icu])
AC_SUBST(with_icu)
if test "$with_icu" = yes; then
- PKG_CHECK_MODULES(ICU, icu-uc icu-i18n)
+ PKG_CHECK_MODULES(ICU, icu-uc icu-i18n, [],
+ [AC_MSG_ERROR([ICU library not found
+If you have ICU already installed, see config.log for details on the
+failure. It is possible the compiler isn't looking in the proper directory.
+Use --without-icu to disable ICU support.])])
fi
#
diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml
index 6619e69462..b5f88d27df 100644
--- a/doc/src/sgml/installation.sgml
+++ b/doc/src/sgml/installation.sgml
@@ -146,6 +146,35 @@ documentation. See standalone-profile.xsl for details.
<application>pg_restore</application>.
</para>
</listitem>
+
+ <listitem>
+ <para>
+ The ICU locale provider (see <xref linkend="locale-providers"/>) is used by default. If you don't want to use it then you must specify the <option>--without-icu</option> option to <filename>configure</filename>. Using this option disables support for ICU collation features (see <xref linkend="collation"/>).
+ </para>
+ <para>
+ ICU support requires the <productname>ICU4C</productname> package to be
+ installed. The minimum required version of
+ <productname>ICU4C</productname> is currently 4.2.
+ </para>
+
+ <para>
+ By default,
+ <productname>pkg-config</productname><indexterm><primary>pkg-config</primary></indexterm>
+ will be used to find the required compilation options. This is
+ supported for <productname>ICU4C</productname> version 4.6 and later.
+ For older versions, or if <productname>pkg-config</productname> is not
+ available, the variables <envar>ICU_CFLAGS</envar> and
+ <envar>ICU_LIBS</envar> can be specified to
+ <filename>configure</filename>, like in this example:
+<programlisting>
+./configure ... ICU_CFLAGS='-I/some/where/include' ICU_LIBS='-L/some/where/lib -licui18n -licuuc -licudata'
+</programlisting>
+ (If <productname>ICU4C</productname> is in the default search path
+ for the compiler, then you still need to specify nonempty strings in
+ order to avoid use of <productname>pkg-config</productname>, for
+ example, <literal>ICU_CFLAGS=' '</literal>.)
+ </para>
+ </listitem>
</itemizedlist>
</para>
@@ -926,40 +955,6 @@ build-postgresql:
</listitem>
</varlistentry>
- <varlistentry id="configure-option-with-icu">
- <term><option>--with-icu</option></term>
- <listitem>
- <para>
- Build with support for
- the <productname>ICU</productname><indexterm><primary>ICU</primary></indexterm>
- library, enabling use of ICU collation
- features<phrase condition="standalone-ignore"> (see
- <xref linkend="collation"/>)</phrase>.
- This requires the <productname>ICU4C</productname> package
- to be installed. The minimum required version
- of <productname>ICU4C</productname> is currently 4.2.
- </para>
-
- <para>
- By default,
- <productname>pkg-config</productname><indexterm><primary>pkg-config</primary></indexterm>
- will be used to find the required compilation options. This is
- supported for <productname>ICU4C</productname> version 4.6 and later.
- For older versions, or if <productname>pkg-config</productname> is
- not available, the variables <envar>ICU_CFLAGS</envar>
- and <envar>ICU_LIBS</envar> can be specified
- to <filename>configure</filename>, like in this example:
-<programlisting>
-./configure ... --with-icu ICU_CFLAGS='-I/some/where/include' ICU_LIBS='-L/some/where/lib -licui18n -licuuc -licudata'
-</programlisting>
- (If <productname>ICU4C</productname> is in the default search path
- for the compiler, then you still need to specify nonempty strings in
- order to avoid use of <productname>pkg-config</productname>, for
- example, <literal>ICU_CFLAGS=' '</literal>.)
- </para>
- </listitem>
- </varlistentry>
-
<varlistentry id="configure-with-llvm">
<term><option>--with-llvm</option></term>
<listitem>
@@ -1231,6 +1226,19 @@ build-postgresql:
<variablelist>
+ <varlistentry id="configure-option-without-icu">
+ <term><option>--without-icu</option></term>
+ <listitem>
+ <para>
+ Build without support for the
+ <productname>ICU</productname><indexterm><primary>ICU</primary></indexterm>
+ library, disabling the use of ICU collation features<phrase
+ condition="standalone-ignore"> (see <xref
+ linkend="collation"/>)</phrase>.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry id="configure-option-without-readline">
<term><option>--without-readline</option></term>
<listitem>
@@ -2419,7 +2427,7 @@ ninja install
<productname>ICU</productname><indexterm><primary>ICU</primary></indexterm>
library, enabling use of ICU collation features<phrase
condition="standalone-ignore"> (see <xref
- linkend="collation"/>)</phrase>. Defaults to auto and requires the
+ linkend="collation"/>)</phrase>. Defaults to enabled and requires the
<productname>ICU4C</productname> package to be installed. The minimum
required version of <productname>ICU4C</productname> is currently 4.2.
</para>
diff --git a/meson.build b/meson.build
index e379a252a5..9cd7491fda 100644
--- a/meson.build
+++ b/meson.build
@@ -721,8 +721,16 @@ endif
icuopt = get_option('icu')
if not icuopt.disabled()
- icu = dependency('icu-uc', required: icuopt.enabled())
- icu_i18n = dependency('icu-i18n', required: icuopt.enabled())
+ icu = dependency('icu-uc', required: false)
+ icu_i18n = dependency('icu-i18n', required: false)
+
+ icu_found = icu.found() and icu_i18n.found()
+ if icuopt.enabled() and not icu_found
+ error('''ICU library not found
+If you have ICU already installed, see meson-log/meson-log.txt for details on the
+failure. It is possible the compiler isn't looking in the proper directory.
+Use -Dicu=disabled to disable ICU support.''')
+ endif
if icu.found()
cdata.set('USE_ICU', 1)
diff --git a/meson_options.txt b/meson_options.txt
index 9d3ef4aa20..fbd4e69356 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -82,7 +82,7 @@ option('dtrace', type : 'feature', value: 'disabled',
option('gssapi', type : 'feature', value: 'auto',
description: 'GSSAPI support')
-option('icu', type : 'feature', value: 'auto',
+option('icu', type : 'feature', value: 'enabled',
description: 'ICU support')
option('ldap', type : 'feature', value: 'auto',
--
2.34.1