This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] locale: Make the file name of the locale archive configurable
- From: Florian Weimer <fweimer at redhat dot com>
- To: libc-alpha at sourceware dot org
- Date: Tue, 04 Jun 2019 15:40:45 +0200
- Subject: [PATCH] locale: Make the file name of the locale archive configurable
This improves support for parallel installation and upgrade scenarios
involving changes to the locale archive format or the data stored in
it.
2019-06-04 Florian Weimer <fweimer@redhat.com>
* configure.ac: Handle --locale-archive-name.
(LOCALE_ARCHIVE_NAME): Define.
(locale_archive_name): Substitute.
* config.h.in (LOCALE_ARCHIVE_NAME): Undefine.
* config.make.in (locale-archive-name): Define.
* locale/loadarchive.c (archfname): Use LOCALE_ARCHIVE_NAME.
* locale/programs/locale.c (ARCHIVE_NAME): Likewise.
* locale/programs/locarchive.c (ARCHIVE_NAME): Likewise.
* manual/install.texi (Configuring and compiling): Document
--with-locale-archive-name.
* configure, INSTALL: Regenerate.
diff --git a/INSTALL b/INSTALL
index e137a71169..0244b0aa96 100644
--- a/INSTALL
+++ b/INSTALL
@@ -106,6 +106,14 @@ if 'CFLAGS' is specified it must enable optimization. For example:
particular case and potentially change debugging information and
metadata only).
+'--with-locale-archive-name=NAME'
+ Use NAME as the file name of the locale archive, and not the
+ default 'locale-archive'. Usually, the locale archive is stored in
+ the directory '/usr/lib/locale' (for both 32-bit and 64-bit
+ targets). For parallel installation of partially compatible
+ versions of the GNU C Library, this option can be used to alter the
+ name of the file used by glibc and by the 'localedef' tool.
+
'--disable-shared'
Don't build shared libraries even if it is possible. Not all
systems support shared libraries; you need ELF support and
diff --git a/config.h.in b/config.h.in
index 824dfe8d8c..7d263447ed 100644
--- a/config.h.in
+++ b/config.h.in
@@ -189,6 +189,9 @@
/* Define if the linker defines __ehdr_start. */
#undef HAVE_EHDR_START
+/* The file name of the locale archive (without the directory). */
+#undef LOCALE_ARCHIVE_NAME
+
/*
*/
diff --git a/config.make.in b/config.make.in
index 2fed3da773..a6421039eb 100644
--- a/config.make.in
+++ b/config.make.in
@@ -23,6 +23,7 @@ datarootdir = @datarootdir@
localstatedir = @libc_cv_localstatedir@
localedir = @localedir@
multidir= @libc_cv_multidir@
+locale-archive-name = @locale_archive_name@
# Should we use and build ldconfig?
use-ldconfig = @use_ldconfig@
diff --git a/configure b/configure
index c773c487b5..0d9645c389 100755
--- a/configure
+++ b/configure
@@ -687,6 +687,7 @@ hardcoded_path_in_tests
enable_timezone_tools
extra_nonshared_cflags
use_default_link
+locale_archive_name
sysheaders
ac_ct_CXX
CXXFLAGS
@@ -763,6 +764,7 @@ with_gd_lib
with_binutils
with_selinux
with_headers
+with_locale_archive_name
with_default_link
with_nonshared_cflags
enable_sanity_checks
@@ -1484,6 +1486,9 @@ Optional Packages:
--with-selinux if building with SELinux support
--with-headers=PATH location of system headers to use (for example
/usr/src/linux/include) [default=compiler default]
+ --with-locale-archive-name=NAME
+ file name of the locale archive
+ [default=locale-archive]
--with-default-link do not use explicit linker scripts
--with-nonshared-cflags=CFLAGS
build nonshared libraries with additional CFLAGS
@@ -3335,6 +3340,20 @@ fi
+# Check whether --with-locale-archive-name was given.
+if test "${with_locale_archive_name+set}" = set; then :
+ withval=$with_locale_archive_name; locale_archive_name=$withval
+else
+ locale_archive_name=locale-archive
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define LOCALE_ARCHIVE_NAME "$locale_archive_name"
+_ACEOF
+
+
+
+
# Check whether --with-default-link was given.
if test "${with_default_link+set}" = set; then :
diff --git a/configure.ac b/configure.ac
index 598ba6c4ae..1b33559103 100644
--- a/configure.ac
+++ b/configure.ac
@@ -147,6 +147,15 @@ AC_ARG_WITH([headers],
[sysheaders=''])
AC_SUBST(sysheaders)
+AC_ARG_WITH([locale-archive-name],
+ AC_HELP_STRING([--with-locale-archive-name=NAME],
+ [file name of the locale archive
+ @<:@default=locale-archive@:>@]),
+ [locale_archive_name=$withval],
+ [locale_archive_name=locale-archive])
+AC_DEFINE_UNQUOTED(LOCALE_ARCHIVE_NAME, "$locale_archive_name")
+AC_SUBST(locale_archive_name)
+
AC_SUBST(use_default_link)
AC_ARG_WITH([default-link],
AC_HELP_STRING([--with-default-link],
diff --git a/locale/loadarchive.c b/locale/loadarchive.c
index 803c1cf2a4..834f794abf 100644
--- a/locale/loadarchive.c
+++ b/locale/loadarchive.c
@@ -42,7 +42,7 @@
/* Name of the locale archive file. */
-static const char archfname[] = COMPLOCALEDIR "/locale-archive";
+static const char archfname[] = COMPLOCALEDIR "/" LOCALE_ARCHIVE_NAME;
/* Size of initial mapping window, optimal if large enough to
cover the header plus the initial locale. */
diff --git a/locale/programs/locale.c b/locale/programs/locale.c
index 6eae3175bb..be8f07b20f 100644
--- a/locale/programs/locale.c
+++ b/locale/programs/locale.c
@@ -46,7 +46,7 @@
#include "../locarchive.h"
#include <programs/xmalloc.h>
-#define ARCHIVE_NAME COMPLOCALEDIR "/locale-archive"
+#define ARCHIVE_NAME COMPLOCALEDIR "/" LOCALE_ARCHIVE_NAME
/* If set print the name of the category. */
static int show_category_name;
diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
index e6310b18be..02f44f6824 100644
--- a/locale/programs/locarchive.c
+++ b/locale/programs/locarchive.c
@@ -57,7 +57,7 @@
extern const char *output_prefix;
-#define ARCHIVE_NAME COMPLOCALEDIR "/locale-archive"
+#define ARCHIVE_NAME COMPLOCALEDIR "/" LOCALE_ARCHIVE_NAME
static const char *locnames[] =
{
diff --git a/manual/install.texi b/manual/install.texi
index 29f6b68e25..19e1f9ca16 100644
--- a/manual/install.texi
+++ b/manual/install.texi
@@ -131,6 +131,14 @@ that the objects in @file{libc_nonshared.a} are compiled with this flag
(although this will not affect the generated code in this particular
case and potentially change debugging information and metadata only).
+@item --with-locale-archive-name=@var{name}
+Use @var{name} as the file name of the locale archive, and not the
+default @file{locale-archive}. Usually, the locale archive is stored
+in the directory @file{/usr/lib/locale} (for both 32-bit and 64-bit
+targets). For parallel installation of partially compatible versions
+of @theglibc{}, this option can be used to alter the name of the file
+used by glibc and by the @command{localedef} tool.
+
@c disable static doesn't work currently
@c @item --disable-static
@c Don't build static libraries. Static libraries aren't that useful these