From 2bcec7b8c2cfdb53bde3a22a8456ceec38dbadcf Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 24 Apr 2025 22:31:40 +0200 Subject: [PATCH] intl: Export libintl_{new,dup,free}locale from libintl.so on OpenBSD. Reported by Christian Weisgerber . * 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. --- gettext-runtime/intl/Makefile.am | 1 + gettext-runtime/intl/configure.ac | 8 ++-- gnulib-local/Makefile.am | 3 +- .../lib/getlocalename_l-unsafe.c.diff | 47 +++++++++++++++++++ 4 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 gnulib-local/lib/getlocalename_l-unsafe.c.diff diff --git a/gettext-runtime/intl/Makefile.am b/gettext-runtime/intl/Makefile.am index e81eb721f..f39c10cb8 100644 --- a/gettext-runtime/intl/Makefile.am +++ b/gettext-runtime/intl/Makefile.am @@ -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 diff --git a/gettext-runtime/intl/configure.ac b/gettext-runtime/intl/configure.ac index 0fccf1075..40b55afe1 100644 --- a/gettext-runtime/intl/configure.ac +++ b/gettext-runtime/intl/configure.ac @@ -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]) diff --git a/gnulib-local/Makefile.am b/gnulib-local/Makefile.am index 89cfc7787..c88132220 100644 --- a/gnulib-local/Makefile.am +++ b/gnulib-local/Makefile.am @@ -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 \ diff --git a/gnulib-local/lib/getlocalename_l-unsafe.c.diff b/gnulib-local/lib/getlocalename_l-unsafe.c.diff new file mode 100644 index 000000000..be3f953ab --- /dev/null +++ b/gnulib-local/lib/getlocalename_l-unsafe.c.diff @@ -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 -- 2.47.3