intl: Export libintl_{new,dup,free}locale from libintl.so on OpenBSD.

Reported by Christian Weisgerber <naddy@mips.inka.de>.

* gnulib-local/lib/getlocalename_l-unsafe.c.diff: New file.
* gnulib-local/Makefile.am (EXTRA_DIST): Add it.
* gettext-runtime/intl/configure.ac (rpl_newlocale, rpl_duplocale,
rpl_freelocale): Redirect to symbols prefixed with 'libintl_', not '_libintl_'.
* gettext-runtime/intl/Makefile.am (BUILT_SOURCES): Add libgnuintl.h.
This commit is contained in:
Bruno Haible 2025-04-24 22:31:40 +02:00
parent 2b3739bdfe
commit 2bcec7b8c2
4 changed files with 55 additions and 4 deletions

View File

@ -240,6 +240,7 @@ libgnuintl.h: $(srcdir)/libgnuintl.in.h $(srcdir)/export.h
| sed -e 's,@''HAVE_VISIBILITY''@,@HAVE_VISIBILITY@,g' \
| sed -e 's,@''WOE32DLL''@,@WOE32DLL@,g' \
> libgnuintl.h
BUILT_SOURCES += libgnuintl.h
MOSTLYCLEANFILES += libgnuintl.h
libintl.h: $(srcdir)/libgnuintl.in.h

View File

@ -306,9 +306,6 @@ AH_VERBATIM([znoexport], [
#define gl_locale_name_environ _libintl_locale_name_environ
#define gl_locale_name_default _libintl_locale_name_default
#define gl_locale_name_unsafe _libintl_locale_name_unsafe
#define rpl_newlocale _libintl_newlocale
#define rpl_duplocale _libintl_duplocale
#define rpl_freelocale _libintl_freelocale
/* Symbols defined by gnulib module 'lock'. */
#if USE_ISOC_THREADS || USE_ISOC_AND_POSIX_THREADS
#define glthread_lock_init _libintl_lock_init
@ -455,6 +452,11 @@ if false; then
AC_DEFINE([rpl_vfprintf], [_libintl_vfprintf], [Hidden symbol.])
fi
dnl These symbols must not be hidden; they are exported via libgnuintl.in.h.
AC_DEFINE([rpl_newlocale], [libintl_newlocale], [Exported symbol.])
AC_DEFINE([rpl_duplocale], [libintl_duplocale], [Exported symbol.])
AC_DEFINE([rpl_freelocale], [libintl_freelocale], [Exported symbol.])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([gnulib-lib/Makefile])

View File

@ -1,5 +1,5 @@
## Makefile for the gnulib-local directory of GNU gettext
## Copyright (C) 2006-2024 Free Software Foundation, Inc.
## Copyright (C) 2006-2025 Free Software Foundation, Inc.
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@ -30,6 +30,7 @@ lib/error.in.h.diff \
lib/error-progname.c \
lib/error-progname.h \
lib/exitfail.h.diff \
lib/getlocalename_l-unsafe.c.diff \
lib/getopt-core.h.diff \
lib/gettext.h \
lib/gl_array_list.h.diff \

View File

@ -0,0 +1,47 @@
diff --git a/lib/getlocalename_l-unsafe.c b/lib/getlocalename_l-unsafe.c
index cb7ae5e5ea..87031ea365 100644
--- a/lib/getlocalename_l-unsafe.c
+++ b/lib/getlocalename_l-unsafe.c
@@ -52,6 +52,12 @@
#if LOCALENAME_ENHANCE_LOCALE_FUNCS
+# if IN_LIBINTL
+# define BUILDING_LIBINTL 1
+/* Get LIBINTL_SHLIB_EXPORTED. */
+# include "libgnuintl.h"
+# endif
+
# include "flexmember.h"
# include "glthread/lock.h"
# include "thread-optim.h"
@@ -127,6 +133,9 @@ get_locale_t_name (int category, locale_t locale)
# endif
/* newlocale() override. */
+# if IN_LIBINTL
+extern LIBINTL_SHLIB_EXPORTED locale_t newlocale (int, const char *, locale_t);
+# endif
locale_t
newlocale (int category_mask, const char *name, locale_t base)
#undef newlocale
@@ -331,6 +340,9 @@ newlocale (int category_mask, const char *name, locale_t base)
}
/* duplocale() override. */
+# if IN_LIBINTL
+extern LIBINTL_SHLIB_EXPORTED locale_t duplocale (locale_t);
+# endif
locale_t
duplocale (locale_t locale)
#undef duplocale
@@ -426,6 +438,9 @@ duplocale (locale_t locale)
}
/* freelocale() override. */
+# if IN_LIBINTL
+extern LIBINTL_SHLIB_EXPORTED void freelocale (locale_t);
+# endif
void
freelocale (locale_t locale)
#undef freelocale